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

test: Separate Detox build from test execution #7897

Merged
merged 31 commits into from
Dec 12, 2023

Conversation

vinistevam
Copy link
Contributor

@vinistevam vinistevam commented Nov 21, 2023

Description

This PR aims to split the detox build and test execution in different steps on Bitrise.
It was necessary to split the commands for ios test:e2e:ios:bitrise:build / test:e2e:ios:bitrise:run and android test:e2e:android:bitrise:build / test:e2e:android:bitrise:run.
To reuse node_modules, yarn.lock and build outputs it was introduced save-cache because it supports key-based caching in addition to save-gradle-cache.

The previous android/ios_e2e_test was split accordingly into android/ios_e2e_build where the dependencies and build are prepared and those outputs saved into the cache, and android/ios_e2e_test is where those caches are restored, the test is executed and saves the reports or screenshots in case of failure.

Benefits

Limitations

  • Currently, it is necessary to wait for the completion of the first stage before initiating the next one.

Related issues

Fixes: https://github.com/MetaMask/mobile-planning/issues/1311

Manual testing steps

  1. Go to Bitrise and run pr_smoke_e2e_pipeline

SMOKE
Pipeline without cache: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/0a971976-089b-4530-a10e-fe86ae1af1eb
Pipeline when build is cached: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/bb021668-0473-4461-bc98-f6b71f53cd33

RECRESSION
Pipeline without cache: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/5a5d101a-bfa8-4931-88d2-bf7f0b3a11f0

Pipeline: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/0a971976-089b-4530-a10e-fe86ae1af1eb

Screenshots/Recordings

After

stateDiagram-v2
    direction LR
    [*] --> code_setup_dev
    state Build {
        direction LR
        code_setup_dev --> setup
        setup --> prep_environment
        prep_environment --> code_setup
        code_setup --> android_e2e_build
    }
     android_e2e_build --> [*]
stateDiagram-v2
    direction LR
    [*] --> setup
    state Test {
        direction LR
        setup --> prep_environment
        prep_environment --> e2e_setup
        e2e_setup --> android_e2e_test
    }
    android_e2e_test --> [*]

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've clearly explained what problem this PR is solving and how it is solved.
  • I've linked related issues
  • I've included manual testing steps
  • I've included screenshots/recordings if applicable
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
  • I’ve properly set the pull request status:
    • In case it's not yet "ready for review", I've set it to "draft".
    • In case it's "ready for review", I've changed it from "draft" to "non-draft".

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@vinistevam vinistevam changed the title WIP WIP: Test: Separate Detox build from test execution Nov 22, 2023
@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Nov 22, 2023
Copy link

socket-security bot commented Nov 22, 2023

👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

@codecov-commenter
Copy link

codecov-commenter commented Nov 22, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (813a800) 37.92% compared to head (9ace27b) 37.92%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7897   +/-   ##
=======================================
  Coverage   37.92%   37.92%           
=======================================
  Files        1140     1140           
  Lines       29196    29196           
  Branches     2746     2746           
=======================================
  Hits        11074    11074           
  Misses      17478    17478           
  Partials      644      644           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

E2E test started on Bitrise: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/bb021668-0473-4461-bc98-f6b71f53cd33
You can also kick off another Bitrise E2E smoke test by removing and re-applying the (Run Smoke E2E) label

bitrise.yml Outdated Show resolved Hide resolved
bitrise.yml Show resolved Hide resolved
bitrise.yml Show resolved Hide resolved
bitrise.yml Show resolved Hide resolved
bitrise.yml Show resolved Hide resolved
Copy link
Member

@Andepande Andepande left a comment

Choose a reason for hiding this comment

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

LGTM I was able to branch off and understand the implementation better.

bitrise.yml Show resolved Hide resolved
bitrise.yml Show resolved Hide resolved
Copy link
Contributor

@NicolasMassart NicolasMassart left a comment

Choose a reason for hiding this comment

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

Great job on the build-test split and smart caching! I added questions but just curious me, not required for approval.

bitrise.yml Show resolved Hide resolved
bitrise.yml Show resolved Hide resolved
Copy link

sonarcloud bot commented Dec 12, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@vinistevam vinistevam merged commit 8c27134 into main Dec 12, 2023
49 checks passed
@vinistevam vinistevam deleted the e2e-split-detox-build-and-test branch December 12, 2023 12:30
@github-actions github-actions bot locked and limited conversation to collaborators Dec 12, 2023
@metamaskbot metamaskbot added the release-7.15.0 Issue or pull request that will be included in release 7.15.0 label Dec 12, 2023
@vinistevam vinistevam added the No QA Needed/E2E Only Apply this label when your PR does not need any QA effort. label Dec 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
No QA Needed/E2E Only Apply this label when your PR does not need any QA effort. release-7.15.0 Issue or pull request that will be included in release 7.15.0 team-confirmations-system DEPRECATED: please use "team-confirmations" label instead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants