Comments (10)
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.
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.
Applications I am covering now with snapshot tests (fortunately) have a lot of weird things 😅
from swift-snapshot-testing.
@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.
Ok, I will try to reproduce it outside or find if there is some other case here.
from swift-snapshot-testing.
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.
I am wondering if loading other valid URL like base64 data which is accepted by browsers will behave similarly.
from swift-snapshot-testing.
(Up for other suggestions, too! We just want to wait for loading web pages to load.)
from swift-snapshot-testing.
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.
Going to close this issue and track the improvement here #136.
from swift-snapshot-testing.
Related Issues (20)
- Timeout Error During Snapshot Testing with WKWebView
- Snapshots tests fail when Json returns in different order, HOT 1
- macCatalyst: Snapshots generated differ a lot between local computer and a MacStadium M1 mac mini HOT 1
- Run success on local and xcode on CI Runner but test failed when using fastlane run_tests HOT 5
- Text-based snapshots break across platforms due to line ending differences HOT 2
- Undefined symbols Linker command failed with exit code 1. HOT 1
- Snapshot adds imported module's name that fails match with reference shapshot
- Deadlock in inline snapshot testing HOT 4
- What's the way to use `assertSnapshot` in async test? HOT 3
- How to snapshot on special iOS version? HOT 1
- Optimizing Image Handling in Swift Snapshot Testing
- Snapshot of table view with combine receiver happens too late HOT 1
- swift-syntax 510.0.0 update not possible HOT 1
- How to generate iPhone 15 Snapshots with Xcode 15, as view.swift doesn't contain those dimensions HOT 1
- I get "Process completed with exit code 65" when I use "assertSnapshot(of: vc, as: .image)" function on GitHub Actions.
- `diffTool` have a Swift 6 warning on Xcode 15.3 with Strict Concurrency Checking set to Complete
- Privacy manifest for AppStore releases HOT 1
- "The file “...” couldn’t be opened because you don’t have permission to view it" after switching branch
- Privacy manifest file / Privacy Rules HOT 1
- Blank diff snapshot
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swift-snapshot-testing.