firefox-ios icon indicating copy to clipboard operation
firefox-ios copied to clipboard

Refactor FXIOS-22527 - UI Tests Added waitAndTap() for better maintenance

Open hemche opened this issue 1 year ago • 7 comments

:scroll: Tickets

Jira ticket Github issue

:bulb: Description

This issue is regarding the UITests at https://github.com/mozilla-mobile/firefox-ios/tree/main/firefox-ios/firefox-ios-tests/Tests Currently, we are using the below code whenever we need to wait for an element's existence and then tap on it.

mozWaitForElementToExist(app.buttons["XXX"])
app.buttons["XXX"].tap()

There are many places where we are using the above two lines. It would be beneficial in terms of maintenance to have a function like waitAndTap() within the XCUIElement. So that in the future if we need to improve the wait method or change it due to syntax changes from Apple XCUITest side, it will be a change at one place instead of changing it in each and every test.

Updated al the tests wherever wait and then tap was being used. Ran all the smoke XCUI tests locally and they passed. 1 failing test in smoke suite is not related to the change i did.

Screenshot 2024-10-13 at 10 41 47 PM Screenshot 2024-10-13 at 9 59 02 PM Screenshot 2024-10-13 at 10 16 47 PM Screenshot 2024-10-13 at 10 30 45 PM

┆Issue is synchronized with this Jira Task

:pencil: Checklist

You have to check all boxes before merging

  • [x] Filled in the above information (tickets numbers and description of your work)
  • [x] Updated the PR name to follow our PR naming guidelines
  • [x] Wrote unit tests and/or ensured the tests suite is passing
  • [ ] When working on UI, I checked and implemented accessibility (minimum Dynamic Text and VoiceOver)
  • [ ] If needed, I updated documentation / comments for complex code and public methods
  • [ ] If needed, added a backport comment (example @Mergifyio backport release/v120)

hemche avatar Oct 14 '24 02:10 hemche

@hemche There are swiftlint errors in this PR, please check them here: https://github.com/mozilla-mobile/firefox-ios/runs/31488235539

isabelrios avatar Oct 14 '24 11:10 isabelrios

@hemche There are swiftlint errors in this PR, please check them here: https://github.com/mozilla-mobile/firefox-ios/runs/31488235539

@isabelrios Thanks for the catch. Will update my linter settings for future PRs. Should be fixed in 5ee6d08

hemche avatar Oct 14 '24 14:10 hemche

Messages
:book: Edited 35 files
:book: Created 0 files

Generated by :no_entry_sign: Danger Swift against 107729ff30eb1e1f7dac6fd7ecc49fb9541f83ef

mobiletest-ci-bot avatar Oct 15 '24 14:10 mobiletest-ci-bot

This 1 failing test is not part of my refactoring. This test is passing locally when i run. So, let me know if there is something else i need to fix before this PR can be reviewed. Ofcourse whenever you have time. No rush. @isabelrios @jjSDET https://github.com/mozilla-mobile/firefox-ios/pull/22528/checks?check_run_id=31561753904

hemche avatar Oct 17 '24 01:10 hemche

This pull request has conflicts when rebasing. Could you fix it @hemche? 🙏

mergify[bot] avatar Oct 17 '24 13:10 mergify[bot]

This pull request has conflicts when rebasing. Could you fix it @hemche? 🙏

Rebase conflicts resolved in cfc400b

hemche avatar Oct 17 '24 19:10 hemche

Smoke tests look good: https://app.bitrise.io/app/6c06d3a40422d10f/pipelines/e12a5a6f-d309-4a7b-9fb9-a10d82445c93

L10n tests also look good. I would approve 👍🏼 this PR.

clarmso avatar Oct 18 '24 03:10 clarmso