Giter VIP home page Giter VIP logo

Comments (10)

stephencelis avatar stephencelis commented on June 9, 2024 1

Ah. I think it’s kind of correct to fail in this case. Any way to modify your code to avoid the loading for the test? Or to load a valid HTML string instead?

from swift-snapshot-testing.

stephencelis avatar stephencelis commented on June 9, 2024

Ah, good point, embedded web views shouldn’t time out if possible. Will look into this soon! Thanks for so thoroughly testing things 🙌

from swift-snapshot-testing.

kaqu avatar kaqu commented on June 9, 2024

Applications I am covering now with snapshot tests (fortunately) have a lot of weird things 😅

from swift-snapshot-testing.

stephencelis avatar stephencelis commented on June 9, 2024

@kaqu I can't seem to reproduce this failure. WKWebView snapshots should only time out if the web view thinks that it isLoading. As long as the web view is not actively loading content, it should render a blank screen. Any chance you can produce a failing test case for us?

from swift-snapshot-testing.

kaqu avatar kaqu commented on June 9, 2024

Ok, I will try to reproduce it outside or find if there is some other case here.

from swift-snapshot-testing.

kaqu avatar kaqu commented on June 9, 2024

This makes timeout:

func testWebView() {
        class VC: UIViewController {
            override func loadView() {
                let browser: WKWebView = .init()
                view = browser
                browser.load(URLRequest(url: URL(string: "url")!))
            }
        }
        let vc = VC()
        vc.view.frame = .init(x: 0, y: 0, width: 200, height: 200)
        assertSnapshot(matching: vc, as: .image)
    }

It turns out that it was loading url, but it was kind of invalid.

from swift-snapshot-testing.

kaqu avatar kaqu commented on June 9, 2024

I am wondering if loading other valid URL like base64 data which is accepted by browsers will behave similarly.

from swift-snapshot-testing.

stephencelis avatar stephencelis commented on June 9, 2024

(Up for other suggestions, too! We just want to wait for loading web pages to load.)

from swift-snapshot-testing.

kaqu avatar kaqu commented on June 9, 2024

Thanks for help though, sorry for incomplete debug 🙂 I agree that timeout in that case is good (loading base64 data seems to work correctly)

from swift-snapshot-testing.

stephencelis avatar stephencelis commented on June 9, 2024

Going to close this issue and track the improvement here #136.

from swift-snapshot-testing.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.