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

UI Tests: Find in Page #2443

Merged
merged 41 commits into from
Mar 22, 2024
Merged

UI Tests: Find in Page #2443

merged 41 commits into from
Mar 22, 2024

Conversation

Halle
Copy link
Contributor

@Halle Halle commented Mar 18, 2024

Task/Issue URL: https://app.asana.com/0/1199230911884351/1205717021705364/f
Tech Design URL:
CC:

Description: Adds a series of UI tests for Find in Page

Steps to test this PR:

  1. Open the scheme UI Tests
  2. Navigate to the test pane
  3. Run UI Tests

Halle added 25 commits March 14, 2024 16:07
@github-actions github-actions bot added the bot: not in app board Added by automation for pull requests with tasks not added to macOS App Board Asana project label Mar 18, 2024
Copy link
Contributor

github-actions bot commented Mar 18, 2024

Warnings
⚠️ PR has more than 500 lines of code changing. Consider splitting into smaller PRs if possible.

Generated by 🚫 dangerJS against 059aa9a

Copy link
Contributor Author

@Halle Halle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explanation of changes outside of test case.

@Halle Halle requested a review from ayoy March 18, 2024 10:55
Copy link
Contributor Author

@Halle Halle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An explanation of how we are checking for find highlighting without highlight marker accessibility data from the system find component, and how we are checking that the "find next" highlight is highlighting a difference occurrence in the text.

UITests/FindInPageTests.swift Outdated Show resolved Hide resolved
UITests/FindInPageTests.swift Outdated Show resolved Hide resolved
@github-actions github-actions bot removed the bot: not in app board Added by automation for pull requests with tasks not added to macOS App Board Asana project label Mar 18, 2024
@ayoy ayoy self-assigned this Mar 22, 2024
Copy link
Collaborator

@ayoy ayoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great to me @Halle!

"Couldn't find \"Find in Page\" statusField in a reasonable timeframe."
)
let statusFieldTextContent = try XCTUnwrap(statusField.value as? String)
XCTAssertEqual(statusFieldTextContent, "1 of 4") // Note: this is not a localized test element, and it should have a localization strategy.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you have any recommendation for that? Is it possible that we import app localizations here? That would probably be tricky if at all possible. My thinking was that we could force the app to run in English and limit to testing English language.

Copy link
Contributor Author

@Halle Halle Mar 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is definitely tricky. As a general thing, I try to have as few as possible pass states that depend on an English phrase, because it flags up an area where we can predict that UX changes and improvements will change it in the future (which equals future UI test maintenance). That's one reason I try to avoid using English sample text or accessibility identifiers that are English phrases about the element, because it lets checks like this stand out so we can easily see them where they are part of a test.

But in this case, I thought this UI element was the good indicator from the outside of the app of whether occurrence counting and finding next were doing the right thing.

Localization was slightly imprecise, because what I really want is to make the test more robust over time by using the default language NSLocalizedString and its tokenization to construct this comparison the same way that the string is constructed in English, so that the test keeps working when the string changes. For these tests its good to know as little about the app as we can get away with, but it might be a good compromise to add UserText.swift to the target so that we can use its values in order to do more robust tests of textual UI.

(Edit: but I do think pinning the tests to English for now is a good idea!)

UITests/FindInPageTests.swift Outdated Show resolved Hide resolved
@Halle Halle merged commit 2e1c81b into main Mar 22, 2024
17 checks passed
@Halle Halle deleted the halle/find-in-page-tests branch March 22, 2024 15:05
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

Successfully merging this pull request may close these issues.

2 participants