-
Notifications
You must be signed in to change notification settings - Fork 4
iOS media handling changes #42
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
base: main
Are you sure you want to change the base?
Conversation
Miki-Session
commented
May 9, 2025
- Simulators are erased before booting
- Media sending functions generally push first and expect the file to be present
- This completes the changes brought in by Android 1.23.0 changes #40
run/types/DeviceWrapper.ts
Outdated
// Checking Sent status on both platforms | ||
await this.waitForTextElementToBePresent({ | ||
...new OutgoingMessageStatusSent(this).build(), | ||
maxWait: 50000, |
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.
50s?
run/test/specs/utils/open_app.ts
Outdated
// Simulators are cleared on start of a test run to minimize device bloat | ||
// This has to be done before starting them because you can't erase booted simulators | ||
// If a simulator is already running this fails silently | ||
await runScriptAndLog(`xcrun simctl erase ${udid}`); |
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.
for many tests/simulators do we need to erase the data? Just wondering if there is a better way to do this, more reliably.
As in, we always push the file/media from the first device for each tests that need it, right?
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.
As discussed, I think this may need to be removed. The enormous time bloat is far outweighing the problem of having a flaky locator for media.
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'm working on a different approach that could allow us to not rely on any set dates for accessibility IDs (which was the whole point of this refactor)
If that works out (🤞🏻) we might get away with having a simple cronjob on the CI that periodically wipes all iOS simulators, just to minimize device bloat.
run/test/specs/utils/open_app.ts
Outdated
// Simulators are cleared on start of a test run to minimize device bloat | ||
// This has to be done before starting them because you can't erase booted simulators | ||
// If a simulator is already running this fails silently | ||
await runScriptAndLog(`xcrun simctl erase ${udid}`); |
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.
As discussed, I think this may need to be removed. The enormous time bloat is far outweighing the problem of having a flaky locator for media.
await runScriptAndLog(`xcrun simctl openurl ${this.udid} ${pdfURL}`, true); | ||
// Safari is open but now the file must be downloaded | ||
await this.clickOnElementAll(new SafariShareButton(this)); | ||
await this.clickOnElementAll(new IOSSaveToFiles(this)); | ||
await this.clickOnElementAll(new IOSSaveButton(this)); | ||
// If for some weird reason the file is already present (but not found in the file picker) |
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.
Ran this test about 10 times (Send document 1:1 @ios
) and it only passed twice. This function needs tweaking
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.
Ran the test 10x on my end from a cold boot and the only time it failed, it failed way before the attachment sending part. I suspect Safari has a different flow on 17.5 and 17.2 (and 18.x probably) - gonna have another look
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.
Note to self: this works consistently on my 17.2 and 17.5 simulators but not 18.x
run/types/DeviceWrapper.ts
Outdated
await this.clickOnElementAll(new UserSettings(this)); | ||
// Click on Profile picture | ||
await this.clickOnElementAll(new UserSettings(this)); | ||
await this.clickOnElementAll(new ChangeProfilePictureButton(this)); | ||
if (this.isIOS()) { | ||
// Push file first | ||
await this.pushMediaToDevice(profilePicture, forcedDate); |
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.
This test failed every time I ran it, need to revisit this
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.
Change profile picture
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.
Would be good to know where this fails on your end because I'm getting 100% pass rate with 10 repeats on my end. I'll run them on 17.2 and 18.x to be safe.
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.
looks like the locator is am
and AM
depending on locale
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.
The new image matching approach completely eliminates this problem
} | ||
await alice1.onIOS().clickOnByAccessibilityID('Photo, 25 March, 11:09 am', 1000); | ||
await matchAndTapImage( | ||
alice1.onIOS(), |
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.
what is this onIOS for?
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.
also, should we move this function to the DeviceWrapper class directly?
@@ -20,6 +20,7 @@ | |||
"devDependencies": { | |||
"@appium/execute-driver-plugin": "^3.0.1", | |||
"@appium/images-plugin": "^3.0.17", | |||
"@appium/opencv": "^3.0.9", |
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.
we cannot do the same with the image matching that playwright offers?
I guess not because
- this will not just look for a buffer that looks like another one,
- but will actually try to find in a buffer, a part that looks like another one. Is that it?
const center = { | ||
x: rect.x + Math.floor(rect.width / 2), | ||
y: rect.y + Math.floor(rect.height / 2), | ||
confidence: score, |
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.
the confidence field can be removed, right?