Repository: pass-culture/pass-culture-app-native
Pull request #7804: (PC-35008) chore(e2e): add label-triggered E2E tests for iOS and Android
Author: login: arenault-pass
Created: 2025-03-06T14:52:03Z | Merged: 2025-03-13T16:44:16Z

Link to JIRA ticket: https://passculture.atlassian.net/browse/PC-35008

## Flakiness

If I had to re-run tests in the CI due to flakiness, I add the incident [on Notion][2]

## Checklist

I have:

- [ ] Made sure my feature is working on web.
- [ ] Made sure my feature is working on mobile (depending on relevance : real or virtual devices)
- [ ] Written **unit tests** native (and web when implementation is different) for my feature.
- [ ] Added a **screenshot** for UI tickets or deleted the screenshot section if no UI change
- [ ] If my PR is a bugfix, I add the link of the "résolution de problème sur le bug" [on Notion][1]
- [ ] I am aware of all the best practices and respected them.




Diff:
diff --git a/.github/workflows/dev_on_pull_request_run_e2e.yml b/.github/workflows/dev_on_pull_request_run_e2e.yml
new file mode 100644
index 000000000000..e74a34934a1a
--- /dev/null
+++ b/.github/workflows/dev_on_pull_request_run_e2e.yml
@@ -0,0 +1,75 @@
+name: '[on_pr] Run E2E tests from given branch when labeled'
+
+on:
+  pull_request:
+    types: [labeled]
+
+permissions:
+  contents: read
+  id-token: write
+  pull-requests: write
+
+jobs:
+  notify_test_launch:
+    if: |
+      github.event.label.name == 'e2e iOS' ||
+      github.event.label.name == 'e2e Android' ||
+      github.event.label.name == 'e2e'
+    runs-on: ubuntu-latest
+    steps:
+      - name: Comment PR
+        uses: actions/github-script@v7
+        with:
+          script: |
+            const label = context.payload.label.name;
+            let platform = label.includes('iOS') ? 'iOS' : label.includes('Android') ? 'Android' : 'iOS et Android';
+            let dashboardLinks = '';
+
+            if (label === 'e2e' || label.includes('iOS')) {
+              dashboardLinks += '- [Dashboard iOS](https://app.maestro.dev/project/proj_01javz1ncreqb9dcshv3y4da44/maestro-tests/app/app_01jk8x3ck0e6dansmsrx4g1h6z)\n';
+            }
+            if (label === 'e2e' || label.includes('Android')) {
+              dashboardLinks += '- [Dashboard Android](https://app.maestro.dev/project/proj_01javz1ncreqb9dcshv3y4da44/maestro-tests/app/app_01jawmdb0kfyk9tpg40habrw36)\n';
+            }
+
+            github.rest.issues.createComment({
+              issue_number: context.issue.number,
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              body: `🚀 Les tests E2E ${platform} ont été lancés !
+
+              Les résultats seront disponibles :
+              - Dans le canal Slack #equipe-e2e-jeunes
+              ${dashboardLinks}
+              Bonne journée ! 🌟`
+            })
+
+  e2e-tests-ios:
+    if: |
+      github.event.label.name == 'e2e iOS' ||
+      github.event.label.name == 'e2e'
+    needs: notify_test_launch
+    concurrency:
+      group: e2e-ios-${{ github.head_ref }}
+      cancel-in-progress: false
+    uses: ./.github/workflows/dev_on_workflow_call_e2e_ios.yml
+    with:
+      upload_name_prefix: '[PR]'
+    secrets:
+      GCP_EHP_SERVICE_ACCOUNT: ${{ secrets.GCP_EHP_SERVICE_ACCOUNT }}
+      GCP_EHP_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.GCP_EHP_WORKLOAD_IDENTITY_PROVIDER }}
+
+  e2e-tests-android:
+    if: |
+      github.event.label.name == 'e2e Android' ||
+      github.event.label.name == 'e2e'
+    needs: notify_test_launch
+    concurrency:
+      group: e2e-android-${{ github.head_ref }}
+      cancel-in-progress: false
+    uses: ./.github/workflows/dev_on_workflow_call_e2e_android.yml
+    with:
+      upload_name_prefix: '[PR]'
+    secrets:
+      GCP_EHP_SERVICE_ACCOUNT: ${{ secrets.GCP_EHP_SERVICE_ACCOUNT }}
+      GCP_EHP_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.GCP_EHP_WORKLOAD_IDENTITY_PROVIDER }}
diff --git a/.github/workflows/dev_on_workflow_call_e2e_android.yml b/.github/workflows/dev_on_workflow_call_e2e_android.yml
index 1ae70666d260..3be0c0a869d8 100644
--- a/.github/workflows/dev_on_workflow_call_e2e_android.yml
+++ b/.github/workflows/dev_on_workflow_call_e2e_android.yml
@@ -2,6 +2,12 @@ name: '0 [on_workflow] Dev on workflow call e2e android'
 
 on:
   workflow_call:
+    inputs:
+      upload_name_prefix:
+        description: 'Prefix to add to the upload name'
+        required: false
+        type: string
+        default: '[MES]'
     secrets:
       GCP_EHP_SERVICE_ACCOUNT:
         required: true
@@ -92,7 +98,7 @@ jobs:
           if [[ "${{ github.event_name }}" == "schedule" ]]; then
             CUSTOM_NAME="[Nightly][Android] Release du ${DATE} au soir (${COMMIT_HASH})"
           else
-            CUSTOM_NAME="[MES][Android] Staging du ${DATE} (${COMMIT_HASH})"
+            CUSTOM_NAME="${{ inputs.upload_name_prefix }}[Android] Staging du ${DATE} (${COMMIT_HASH})"
           fi
           echo "CUSTOM_NAME=$CUSTOM_NAME" >> $GITHUB_OUTPUT
 
diff --git a/.github/workflows/dev_on_workflow_call_e2e_ios.yml b/.github/workflows/dev_on_workflow_call_e2e_ios.yml
index 4aa54442b50c..0ac06401c94f 100644
--- a/.github/workflows/dev_on_workflow_call_e2e_ios.yml
+++ b/.github/workflows/dev_on_workflow_call_e2e_ios.yml
@@ -2,6 +2,12 @@ name: '0 [on_workflow] Dev on workflow call e2e iOS'
 
 on:
   workflow_call:
+    inputs:
+      upload_name_prefix:
+        description: 'Prefix to add to the upload name'
+        required: false
+        type: string
+        default: '[MES]'
     secrets:
       GCP_EHP_SERVICE_ACCOUNT:
         required: true
@@ -102,7 +108,7 @@ jobs:
           if [[ "${{ github.event_name }}" == "schedule" ]]; then
             CUSTOM_NAME="[Nightly][iOS] Release du ${DATE} au soir (${COMMIT_HASH})"
           else
-            CUSTOM_NAME="[MES][iOS] Staging du ${DATE} (${COMMIT_HASH})"
+            CUSTOM_NAME="${{ inputs.upload_name_prefix }}[iOS] Staging du ${DATE} (${COMMIT_HASH})"
           fi
           echo "CUSTOM_NAME=$CUSTOM_NAME" >> $GITHUB_OUTPUT
       - name: Upload and run ios tests with Robin


Reviews:
user: login: bebstein-pass
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-06T16:45:15Z
user: login: arenault-pass
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-12T13:57:17Z
user: login: bebstein-pass
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-03-13T15:48:25Z

Review comments:
diff_hunk: @@ -0,0 +1,60 @@
+name: '[on_pr] Run E2E tests from given branch when labeled'
+
+on:
+  pull_request:
+    types: [labeled]
+
+permissions:
+  contents: read
+  id-token: write
+  pull-requests: write
+
+jobs:
+  notify_test_launch:
+    if: |
+      github.event.label.name == 'e2e iOS' ||
+      github.event.label.name == 'e2e Android'
+    runs-on: ubuntu-latest
+    steps:
+      - name: Comment PR
+        uses: actions/github-script@v7
+        with:
+          script: |
+            const label = context.payload.label.name;
+            const platform = label.includes('iOS') ? 'iOS' : 'Android';
+            const dashboardLink = platform === 'iOS' 
+              ? 'https://app.maestro.dev/project/proj_01javz1ncreqb9dcshv3y4da44/maestro-tests/app/app_01jk8x3ck0e6dansmsrx4g1h6z'
+              : 'https://app.maestro.dev/project/proj_01javz1ncreqb9dcshv3y4da44/maestro-tests/app/app_01jawmdb0kfyk9tpg40habrw36';
+
+            github.rest.issues.createComment({
+              issue_number: context.issue.number,
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              body: `🚀 Les tests E2E ${platform} ont été lancés !
+
+              Les résultats seront disponibles :
+              - Dans le canal Slack #equipe-e2e-jeunes
+              - Sur le [dashboard Maestro Cloud](${dashboardLink})
+              
+              Bonne journée ! 🌟`
+            })
+
+  e2e-tests-ios:
+    if: github.event.label.name == 'e2e iOS'
+    needs: notify_test_launch
+    uses: ./.github/workflows/dev_on_workflow_call_e2e_ios.yml
+    with:
+      upload_name_prefix: '[e2e iOS]-[${{ github.head_ref }}]'
+    secrets:
+      GCP_EHP_SERVICE_ACCOUNT: ${{ secrets.GCP_EHP_SERVICE_ACCOUNT }}
+      GCP_EHP_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.GCP_EHP_WORKLOAD_IDENTITY_PROVIDER }}
path: .github/workflows/dev_on_pull_request_run_e2e.yml
user: login: bebstein-pass
body: je ne comprends pas où seront cherché les secrets
created_at: 2025-03-06T16:44:32Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,60 @@
+name: '[on_pr] Run E2E tests from given branch when labeled'
+
+on:
+  pull_request:
+    types: [labeled]
+
+permissions:
+  contents: read
+  id-token: write
+  pull-requests: write
+
+jobs:
+  notify_test_launch:
+    if: |
+      github.event.label.name == 'e2e iOS' ||
+      github.event.label.name == 'e2e Android'
+    runs-on: ubuntu-latest
+    steps:
+      - name: Comment PR
+        uses: actions/github-script@v7
+        with:
+          script: |
+            const label = context.payload.label.name;
+            const platform = label.includes('iOS') ? 'iOS' : 'Android';
+            const dashboardLink = platform === 'iOS' 
+              ? 'https://app.maestro.dev/project/proj_01javz1ncreqb9dcshv3y4da44/maestro-tests/app/app_01jk8x3ck0e6dansmsrx4g1h6z'
+              : 'https://app.maestro.dev/project/proj_01javz1ncreqb9dcshv3y4da44/maestro-tests/app/app_01jawmdb0kfyk9tpg40habrw36';
+
+            github.rest.issues.createComment({
+              issue_number: context.issue.number,
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              body: `🚀 Les tests E2E ${platform} ont été lancés !
+
+              Les résultats seront disponibles :
+              - Dans le canal Slack #equipe-e2e-jeunes
+              - Sur le [dashboard Maestro Cloud](${dashboardLink})
+              
+              Bonne journée ! 🌟`
+            })
+
+  e2e-tests-ios:
+    if: github.event.label.name == 'e2e iOS'
+    needs: notify_test_launch
+    uses: ./.github/workflows/dev_on_workflow_call_e2e_ios.yml
+    with:
+      upload_name_prefix: '[e2e iOS]-[${{ github.head_ref }}]'
+    secrets:
+      GCP_EHP_SERVICE_ACCOUNT: ${{ secrets.GCP_EHP_SERVICE_ACCOUNT }}
+      GCP_EHP_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.GCP_EHP_WORKLOAD_IDENTITY_PROVIDER }}
path: .github/workflows/dev_on_pull_request_run_e2e.yml
user: login: arenault-pass
body: Ils sont cherché dans le workflow principal `dev_on_workflow_call_e2e_ios.yml` et son homologue Android.
C'est une exigence de GitHub Actions : même si les secrets sont définis dans les workflows appelés, nous devons explicitement les passer lors de l'appel puisqu'ils sont marqués comme `required: true`.
created_at: 2025-03-12T13:57:17Z
author_association: CONTRIBUTOR

PR comments:
user: login: github-actions[bot]
created_at: 2025-03-06T15:08:40Z
body: 🚀 Les tests E2E iOS ont été lancés !

  Les résultats seront disponibles :
  - Dans le canal Slack #equipe-e2e-jeunes
  - Sur le [dashboard Maestro Cloud](https://app.maestro.dev/project/proj_01javz1ncreqb9dcshv3y4da44/maestro-tests/app/app_01jk8x3ck0e6dansmsrx4g1h6z)
  
  Bonne journée ! 🌟
author_association: CONTRIBUTOR
user: login: github-actions[bot]
created_at: 2025-03-07T13:11:00Z
body: 🚀 Les tests E2E Android ont été lancés !

  Les résultats seront disponibles :
  - Dans le canal Slack #equipe-e2e-jeunes
  - Sur le [dashboard Maestro Cloud](https://app.maestro.dev/project/proj_01javz1ncreqb9dcshv3y4da44/maestro-tests/app/app_01jawmdb0kfyk9tpg40habrw36)
  
  Bonne journée ! 🌟
author_association: CONTRIBUTOR
user: login: github-actions[bot]
created_at: 2025-03-07T13:24:50Z
body: 🚀 Les tests E2E iOS ont été lancés !

  Les résultats seront disponibles :
  - Dans le canal Slack #equipe-e2e-jeunes
  - Sur le [dashboard Maestro Cloud](https://app.maestro.dev/project/proj_01javz1ncreqb9dcshv3y4da44/maestro-tests/app/app_01jk8x3ck0e6dansmsrx4g1h6z)
  
  Bonne journée ! 🌟
author_association: CONTRIBUTOR
user: login: arenault-pass
created_at: 2025-03-12T14:33:34Z
body: J'ai l'impression qu'on a une MVP pas trop mal pour l'instant
Ca vous branche qu'on test ça sur les semaines a venir ?
+ je vais en aussi parler Mercredi prochain proposer aux devs de commencer à l'utiliser sur les PR de bugs
@lbeneston-pass @bebstein-pass
author_association: CONTRIBUTOR
user: login: sonarqubecloud[bot]
created_at: 2025-03-12T14:54:23Z
body: ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=pass-culture_pass-culture-app-native-proxy&pullRequest=7804) **Quality Gate passed**  
Issues  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 New issues](https://sonarcloud.io/project/issues?id=pass-culture_pass-culture-app-native-proxy&pullRequest=7804&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=pass-culture_pass-culture-app-native-proxy&pullRequest=7804&issueStatuses=ACCEPTED)

Measures  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=pass-culture_pass-culture-app-native-proxy&pullRequest=7804&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=pass-culture_pass-culture-app-native-proxy&pullRequest=7804&metric=new_coverage&view=list)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=pass-culture_pass-culture-app-native-proxy&pullRequest=7804&metric=new_duplicated_lines_density&view=list)  
  
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=pass-culture_pass-culture-app-native-proxy&pullRequest=7804)


author_association: NONE
user: login: sonarqubecloud[bot]
created_at: 2025-03-12T15:00:43Z
body: ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=pass-culture_pass-culture-app-native&pullRequest=7804) **Quality Gate passed**  
Issues  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 New issues](https://sonarcloud.io/project/issues?id=pass-culture_pass-culture-app-native&pullRequest=7804&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=pass-culture_pass-culture-app-native&pullRequest=7804&issueStatuses=ACCEPTED)

Measures  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=pass-culture_pass-culture-app-native&pullRequest=7804&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=pass-culture_pass-culture-app-native&pullRequest=7804&metric=new_coverage&view=list)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=pass-culture_pass-culture-app-native&pullRequest=7804&metric=new_duplicated_lines_density&view=list)  
  
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=pass-culture_pass-culture-app-native&pullRequest=7804)


author_association: NONE