-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add UI tests of image optimization setting #22095
Conversation
📲 You can test the changes from this Pull Request in WordPress Alpha by scanning the QR code below to install the corresponding build.
|
📲 You can test the changes from this Pull Request in Jetpack Alpha by scanning the QR code below to install the corresponding build.
|
We don't strictly need to expect the back button being present. In fact, on iPad, there's no back button in that screen.
@@ -27,7 +27,7 @@ public extension XCTestCase { | |||
|
|||
appToRemove.firstMatch.press(forDuration: 1) | |||
waitAndTap(Apps.springboard.buttons["Remove App"]) | |||
waitAndTap(Apps.springboard.alerts.buttons["Delete App"]) | |||
waitForExistenceAndTap(Apps.springboard.alerts.buttons["Delete App"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that the Delete app
button wasn't tapped when running the UI tests locally. For this reason, I decided to change this action to explicitly wait for the element's existence.
Nice @fluiddot! Thanks for going the extra mile to add these. |
Just leaving a note that I'm looking into a PR — will leave some feedback today a bit later. Thank you for adding the tests! 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for adding the UI tests, and extending the Screens to support "App Settings" screen ⭐
I executed the tests locally for iPhone with no issues 👍 , and left two minor naming / formatting comments, they're not blocking.
P.S. One thing to discuss (@jostnes and @tiagomar 👋): since we try to have mainly critical flows automated, should we consider splitting the tests schemes to Smoke
and Full
, to keep the execution time under 30 minutes for Smoke
? With Xcode 15 incoming, this might become problematic if we keep on running all tests on every push.
WordPress/UITestsFoundation/Screens/Editor/BlockEditorScreen.swift
Outdated
Show resolved
Hide resolved
WordPress/UITestsFoundation/Screens/Editor/BlockEditorScreen.swift
Outdated
Show resolved
Hide resolved
@MainActor | ||
override func setUpWithError() throws { | ||
try super.setUpWithError() | ||
setUpTestSuite(removeBeforeLaunching: true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At first, I was confused why this file uses removeBeforeLaunching
, but then I realized that this is to ensure that Image Optimization prompt is shown for both testImageOptimizationIsTurnedOnEditor
and testImageOptimizationIsTurnedOffEditor
, and that tests in this file are independent/isolated.
We might need to keep this in mind, though, if we add more tests into this file: for other tests deleting the app might not be necessary, but it takes quite a lot of time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At first, I was confused why this file uses
removeBeforeLaunching
, but then I realized that this is to ensure that Image Optimization prompt is shown for bothtestImageOptimizationIsTurnedOnEditor
andtestImageOptimizationIsTurnedOffEditor
, and that tests in this file are independent/isolated.
Yeah, I should have added a note here explaining why it's necessary to remove it before launching. I'll add an inline comment as a follow-up.
We might need to keep this in mind, though, if we add more tests into this file: for other tests deleting the app might not be necessary, but it takes quite a lot of time.
I agree. This approach is specific to the tests I added. In the future, it's likely to be unnecessary for other tests related to the App Settings screen. I wonder if there's an option to enable removeBeforeLaunching
at the test level. If not, we can consider renaming the test file to OptimizeImagesSettingTests
to convey that the file should only include test cases related to that logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if there's an option to enable
removeBeforeLaunching
at the test level
Maybe not the nicest way, but this should do the trick (not tested):
let testsRequiringAppDeletion = [
"testImageOptimizationEnabledByDefault",
"testImageOptimizationIsTurnedOnEditor",
"testImageOptimizationIsTurnedOffEditor"
]
let removeBeforeLaunch = testsRequiringAppDeletion.contains(where: { testName in self.name.contains(testName)})
try super.setUpWithError()
setUpTestSuite(removeBeforeLaunching: removeBeforeLaunch)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried your approach and it worked nice, thanks for sharing it. I haven't found another approach to use a different setup depending on the test case, so I think we can apply this workaround. Applied in 00e4d46.
This PR is a follow-up of #21981 and adds UI tests of the new App Setting to optimize images when uploading.
To test:
N/A
Regression Notes
Potential unintended areas of impact
N/A
What I did to test those areas of impact (or what existing automated tests I relied on)
N/A
What automated tests I added (or what prevented me from doing so)
N/A
PR submission checklist:
RELEASE-NOTES.txt
if necessary.UI Changes testing checklist: