Skip to content

chore: setup ui automator for appium replacement (WPB-8645)#4011

Merged
yamilmedina merged 7 commits intodevelopfrom
chore/setupui-automator
May 6, 2025
Merged

chore: setup ui automator for appium replacement (WPB-8645)#4011
yamilmedina merged 7 commits intodevelopfrom
chore/setupui-automator

Conversation

@yamilmedina
Copy link
Contributor

@yamilmedina yamilmedina commented May 5, 2025

EpicWPB-8645 [Android] Infrastructure code and developer experience


PR Submission Checklist for internal contributors

  • The PR Title

    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  • The PR Description

    • is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

Appium is set to be replaced, so this adds the config projects to run UIAutomator tests for QA start playing with the tool.

Next steps left for other PRs, when QA migration is almost set to complete:

  • Users managers handling
  • Scripts to install, and run on CI and locally for QA using the CLI.

Issues

Appium is set to be replaced.

Causes (Optional)

Guideline from QA to get the tests closer to the code.

Solutions

After syncing with @CinnamonNinja and @emmaoke-w we agreed to move to UIAutomator as it is a 1:1 replacement for the framework

Testing

Test Coverage (Optional)

  • I have added automated test to this contribution

How to Test

  • Make sure you have a devDebug apk installed in the emulator.
  • Run the tests in Android studio for LoginTest under :tests:testsCore

Attachments

Screen.Recording.2025-05-05.at.16.54.48.mov

PR Post Submission Checklist for internal contributors (Optional)

  • Wire's Github Workflow has automatically linked the PR to a JIRA issue

PR Post Merge Checklist for internal contributors

  • If any soft of configuration variable was introduced by this PR, it has been added to the relevant documents and the CI jobs have been updated.

References
  1. https://sparkbox.com/foundry/semantic_commit_messages
  2. https://github.com/wireapp/.github#usage
  3. E.g. feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764.

@yamilmedina yamilmedina requested review from a team, CinnamonNinja, Garzas, MohamadJaara, emmaoke-w, ohassine, saleniuk, sbakhtiarov and typfel and removed request for a team and sbakhtiarov May 5, 2025 14:57
@pull-request-size pull-request-size bot added size/M and removed size/L labels May 5, 2025
@yamilmedina yamilmedina changed the title chore: setup ui automator for appium replacement (WPB-8545) chore: setup ui automator for appium replacement (WPB-8645) May 5, 2025
@pull-request-size pull-request-size bot added size/L and removed size/M labels May 6, 2025
@AndroidBob
Copy link
Collaborator

AndroidBob commented May 6, 2025

New ADR(s) in this PR 📚:

6. Simplified enterprise login

Date: 2025-01-23

Status

Accepted

Context

Starting (potentially) from Android 4.12.x the app will support the new enterprise login flows, this means in practice that the app needs to support both flows current/old.

The current flow (old)

Customers configure their setup manually in their backend.
The user experience for this makes the user selects manually which flow they must use by going to the correct screens, i.e. going to the tab and select login with SSO code, or login with email, or use a deeplink to load the on premise configuration, and then select the correct flow.

The new flow

Customers, via team settings and Back-office tools, will be able to load this config to facilitate the decision of which flow the user must use. This will make the app, in conjunction with the backend, decide for the user which path/flow they must use to login by just having one input field, “email or SSO code”.
The adoption won’t be automatically via deprecation, hence the need to support both flows for some time. To clarify a bit how this looks in practice for the code we have, how this will be implemented, a high level look of the two flows living together, the following diagram can be used.

Decision

We will keep both flows, the current as-is and the new one, being the app able to decide which one to use based on the configuration received from the backend.

%%{
  init: {
    'theme': 'neutral'
  }
}%%

flowchart LR
    z((App loads</br> BE/API context)) --> di
    di{BE supports </br>API >= 8 ?}:::someclass -- Yes --> a1
    di -- No</br>OR Authenticated Proxy --> b1
    classDef someclass fill:#f96
    subgraph new_flow
      a0@{ shape: braces, label: "These flows are selected by the app and the BE" }
      a1[StartLoginScreen </br>'Enter email or SSO code'] -- looks like SSO code --> a2[Go to SSO flow path 6-7] 
      a1 -- Looks like an email? --> a3[BE replies which path to go 1-4]
    end
    subgraph current_flow
      b0@{ shape: braces, label: "These flows are selected manually by the user" }
      b1[WelcomeScreen] --> b2[LoginEmailScreen]
      b1 --> b3[LoginWithSSOCodeScreen]
    end
Loading

Consequences

  • The code base will have some duplication for some time, but this will be removed when the old flow is deprecated.
  • To select the correct flow, the app will need to load the BE context, based on the API version, and then decide which flow to use.
  • The navigation, entry point will need to be dynamic, based on the flow selected.

7. Introducing UIAutomator for integrated testing

Date: 2025-05-06

Status

Accepted

Context

QA wants to migrate from Appium to a new framework to run tests and being closed to the source code that we are testing.
The tests nowadays are running on an emulator with an apk. After meeting the QA we evaluated options, Espresso and UIAutomator.

Decision

UIAutomator seems to be the best option for us, as it is a framework that is already in the Android SDK and it is more flexible than Espresso, this last one is more limited to the app under test because of mocks and stubs.
We will create a new module(s) for testing purposes, and we will use the UIAutomator framework to run the tests, common logic can be extracted and shared between tests modules in case we want to parallelize the tests in the future.

Consequences

The new structure of the project will be as follows:

wire-android
├── app
│   ├── ...
├── core
│   ├── ...
├── features
│   ├── ...
├── tests
│   ├── ...
│   ├── testsCore
│   ├── testsSupport
└── build.gradle.kts

@yamilmedina yamilmedina enabled auto-merge May 6, 2025 12:48
@sonarqubecloud
Copy link

sonarqubecloud bot commented May 6, 2025

@codecov
Copy link

codecov bot commented May 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 46.02%. Comparing base (fcb37fb) to head (9bbccf7).
Report is 3 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4011      +/-   ##
===========================================
- Coverage    46.04%   46.02%   -0.03%     
===========================================
  Files          519      519              
  Lines        18081    18092      +11     
  Branches      3037     3042       +5     
===========================================
  Hits          8326     8326              
- Misses        8891     8902      +11     
  Partials       864      864              

see 4 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fcb37fb...9bbccf7. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@yamilmedina yamilmedina added this pull request to the merge queue May 6, 2025
Merged via the queue into develop with commit f533b19 May 6, 2025
13 of 14 checks passed
@yamilmedina yamilmedina deleted the chore/setupui-automator branch May 6, 2025 13:16
@github-actions
Copy link
Contributor

github-actions bot commented May 6, 2025

Built wire-android-staging-compat-pr-4011.apk is available for download

@github-actions
Copy link
Contributor

github-actions bot commented May 6, 2025

Built wire-android-dev-debug-pr-4011.apk is available for download

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants