Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WKWebView.takeSnapshot failing to generate an image on Xcode 14 RC #625

Closed
marcosgriselli opened this issue Sep 2, 2022 · 4 comments
Closed

Comments

@marcosgriselli
Copy link

marcosgriselli commented Sep 2, 2022

Describe the bug
All WKWebView tests that require generating an image are crashing while force unwrapping an optional image on the takSnapshot completion handler.

To Reproduce
Run the iOS tests on the swift-snapshot-testing repo's main branch with Xcode 14 RC.

Expected behavior
Tests to pass

Screenshots

image

Environment

  • swift-snapshot-testing version: latest main
  • Xcode 14 RC
  • Swift 5.7
  • OS: 12.5.1

More information

Console output logs "Invalid connection identifier" which makes me wonder if Xcode is expecting network capabilities to launch this.

Test Case '-[SnapshotTestingTests.SnapshotTestingTests testWebView]' started.
2022-09-02 16:45:53.832110-0700 xctest[26474:1131098] [ProcessSuspension] endowmentsForHandle: Process with PID 26474 is not running
2022-09-02 16:45:53.874338-0700 xctest[26474:1131098] [Process] 0x160064100 - [PID=0] WebProcessProxy::didFinishLaunching: Invalid connection identifier (web process failed to launch)
2022-09-02 16:45:53.874399-0700 xctest[26474:1131098] [Process] 0x160064100 - [PID=0] WebProcessProxy::processDidTerminateOrFailedToLaunch: reason=Crash
2022-09-02 16:45:53.874518-0700 xctest[26474:1131098] [Process] 0x13300ce18 - [pageProxyID=6, webPageID=7, PID=0] WebPageProxy::processDidTerminate: (pid 0), reason=Crash
@marcosgriselli marcosgriselli changed the title WKWebView iOS test crashing on Xcode 14 beta 6 WKWebView.takeSnapshot failing to generate an image on Xcode 14 beta 6 Sep 6, 2022
@barrault01
Copy link

Still happening with Xcode 14 RC.

@marcosgriselli marcosgriselli changed the title WKWebView.takeSnapshot failing to generate an image on Xcode 14 beta 6 WKWebView.takeSnapshot failing to generate an image on Xcode 14 RC Sep 12, 2022
barrault01 added a commit to barrault01/swift-snapshot-testing that referenced this issue Sep 15, 2022
@teameh
Copy link
Contributor

teameh commented Dec 20, 2022

Still happening with Xcode 14.0.1. But only on iOS 16, iOS 15 is working fine.

A crash inside WKWebView occurs that seems to make the wkWebView.takeSnapshot(...) method to return an error instead of an image.

xctest[42043:34329227] [Process] 0x110064100 - [PID=0] WebProcessProxy::didFinishLaunching: Invalid connection identifier (web process failed to launch)
xctest[42043:34329227] [Process] 0x110064100 - [PID=0] WebProcessProxy::processDidTerminateOrFailedToLaunch: reason=Crash
xctest[42043:34329227] [Process] 0x13a82da18 - [pageProxyID=6, webPageID=7, PID=0] WebPageProxy::processDidTerminate: (pid 0), reason=Crash
xctest[42043:34329227] [Loading] 0x13a82da18 - [pageProxyID=6, webPageID=7, PID=0] WebPageProxy::dispatchProcessDidTerminate: reason=Crash
xctest[42043:34329227] [Loading] 0x13a82da18 - [pageProxyID=6, webPageID=7, PID=0] WebPageProxy::dispatchProcessDidTerminate: Not eagerly reloading the view because it is not currently visible

I don't think this is caused by SnapshotTesting. Just using the takeSnapshot method without SnapshotTesting also fails. Weird that I can't find any other blog posts or issues about this.

Seems related to these:
https://developer.apple.com/forums/thread/716354
https://developer.apple.com/forums/thread/712899
https://developer.apple.com/forums/thread/712349
https://developer.apple.com/forums/thread/713581
https://stackoverflow.com/questions/67067390

However, most of those are related to injecting javascript

teameh pushed a commit to teameh/swift-snapshot-testing that referenced this issue Dec 23, 2022
@teameh
Copy link
Contributor

teameh commented Jan 3, 2023

@barrault01 I've opened a PR with your commit because it does improve things a little bit.

teameh pushed a commit to teameh/swift-snapshot-testing that referenced this issue Feb 23, 2023
thedavidharris pushed a commit to thedavidharris/swift-snapshot-testing that referenced this issue Mar 9, 2023
teameh added a commit to teameh/swift-snapshot-testing that referenced this issue Dec 15, 2023
teameh added a commit to teameh/swift-snapshot-testing that referenced this issue Dec 15, 2023
teameh added a commit to teameh/swift-snapshot-testing that referenced this issue Dec 15, 2023
teameh added a commit to teameh/swift-snapshot-testing that referenced this issue Dec 15, 2023
stephencelis pushed a commit that referenced this issue Jan 8, 2024
Muhieddine-El-Kaissi pushed a commit to thumbtack/swift-snapshot-testing that referenced this issue Aug 8, 2024
@mbrandonw
Copy link
Member

I believe #692 fixed this, so closing for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants