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
[snapshot] Fix compatibility with macOS #19864
base: master
Are you sure you want to change the base?
Conversation
This is still in progress. Will get round to it very soon. |
@ptrkstr Hey! I love this PR and just wanted to see if there was anything that you needed help with 😊 |
Hey @joshdholtz thanks for reaching out! I think it should be good to go for review. Maybe one additional change could be that it doesn't require a user to add 'concurrent_simulators(false)' to their snapfile and instead that's ignored if it's snapshotting for mac? |
Hey @joshdholtz, bumping this 😌 |
77d6d8f
to
70a5e39
Compare
Shouldn't we get this merged in, @joshdholtz ? |
Checklist
bundle exec rspec
from the root directory to see all new and existing tests passbundle exec rubocop -a
to ensure the code style is validMotivation and Context
Why is this change required? What problem does it solve?
SnapshotHelper.swift
because it contained symbols not available on macOS. This PR solves that problem by ensuring that macOS only sees symbols available to it.XCUIScreenshotProviding
object should be screenshotted. This is useful when taking screenshots for macOS and you'd prefer to screenshot the window and not the screen. This does not break backwards compatibility.For conversations around Snapshot on macOS, please see:
latest_simulator_version_for_device
#18663Description
screenshotProvider: XCUIScreenshotProviding = XCUIScreen.main
toopen class func snapshot(_ name: String, timeWaitingForIdle timeout: TimeInterval = 20)
.if os(OSX)
condition of the above mentioned function, removed call ofapp.typeKey(XCUIKeyboardKeySecondaryFn, modifierFlags: [])
and added screenshot saving functionality.class func fixLandscapeOrientation(image: UIImage) -> UIImage
with#if os(iOS) || os(watchOS) || os(tvOS)
asUIImage
isn't available on macOS.URL(fileURLWithPath: "/Users/\(NSUserName())")
screenshot.mac?
to check againstApple MacBook
instead ofMacBook
.self.top_space_above_device = offset['titleHeight'] # needed for centering the title
fromput_device_into_background
astitleHeight
isn't available for Mac.@config
fromfetch_config
.Testing Steps
concurrent_simulators(false)
to the snapfile based off the suggestion here: Snapshot with Catalyst fails atlatest_simulator_version_for_device
#18663 (comment).