Skip to content

chore: add UI tests for switching accounts - WPB-24968#4657

Open
samwyndham wants to merge 9 commits intodevelopfrom
chore/ui-tests-switch-accounts-WPB-24968
Open

chore: add UI tests for switching accounts - WPB-24968#4657
samwyndham wants to merge 9 commits intodevelopfrom
chore/ui-tests-switch-accounts-WPB-24968

Conversation

@samwyndham
Copy link
Copy Markdown
Contributor

@samwyndham samwyndham commented Apr 29, 2026

TaskWPB-24968 [iOS] Automation - TC-8941 - As a user, I am able to switch between accounts.

Issue

This PR:

  • Introduces a UI test that covers switching accounts - https://app.testiny.io/IOS/testcases/tc/8941. The success of account switching is done by looking at the contents of the conversations list as this is something I have seen breaking in practice.

Additionally it does some refactoring to fix issues I experienced working with multiple backends above:

  1. Deleted BackendContext.current as I found this shared mutable state lead to issues keeping UserHelpers in sync with the current value of BackendContext.current. Instead this value is now passed through as needed.
  2. Introduced some static methods for creating, tracking, and cleaning up UserHelper. This means that deletion of created accounts only needs to happen in once place and it will clean up accounts created for all backends. UserHelper() is now UserHelper.default and UserHelper(backend: .anta) is now UserHelper.instance(backend: .anta).
  3. Deleted userHelper instance variable from WireUITestCase. Use UserHelper.default instead.
SwitchAccount.mov

Testing

Run UI tests


Checklist

  • Title contains a reference JIRA issue number like [WPB-XXX].
  • Description is filled and free of optional paragraphs.
  • Adds/updates automated tests.

}

override func tearDown() async throws {
await app.terminate()
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This ensures the app is killed before deleting the created users remotely which could lead to a crash in the app.

@samwyndham samwyndham requested review from David-Henner, findms and jullianm and removed request for jullianm April 29, 2026 12:55
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
4.5% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 29, 2026

Test Results

1 881 tests   1 854 ✅  2m 18s ⏱️
  301 suites     27 💤
    1 files        0 ❌

Results for commit c889615.

Summary: workflow run #25110194241
Allure report (download zip): html-report-29589-chore_ui-tests-switch-accounts-WPB-24968

}

@MainActor
func testSwitchingAccounts_TC_8941() async throws {
Copy link
Copy Markdown
Contributor

@findms findms May 1, 2026

Choose a reason for hiding this comment

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

Does it make sense to move this test in MultiBackendSupportTests where multi backend account getting added?

Copy link
Copy Markdown
Contributor

@findms findms left a comment

Choose a reason for hiding this comment

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

lgtm. Left a comment to move this test to different Test file..

Copy link
Copy Markdown
Contributor

@David-Henner David-Henner left a comment

Choose a reason for hiding this comment

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

nice work! 🚀

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.

3 participants