-
Notifications
You must be signed in to change notification settings - Fork 26
Enable manual execution of E2E tests on branches via workflow_dispatch #1656
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
Draft
Copilot
wants to merge
8
commits into
main
Choose a base branch
from
copilot/fix-09ebd978-bbd0-4c56-983d-b3e9ca6dda0f
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
4f32abc
Enable manual E2E test execution on branches via workflow_dispatch
Copilot 134a8c2
Fix markdown formatting error in README.md
Copilot a45e0f2
Temporary: Add test trigger for E2E workflow validation
Copilot 7d1a129
Fix GitHub Actions workflow syntax error with matrix context
Copilot 1a47969
Fix remaining matrix context syntax error in manual job conditions
Copilot 3ab92ba
Add explicit permissions block to E2E workflow for security
Copilot 385d42f
Update .github/workflows/e2e-tests.yaml
ManAnRuck fc921e6
Update .github/workflows/e2e-tests.yaml
ManAnRuck File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,41 +3,171 @@ name: 🧪 E2E Tests | |
| on: | ||
| push: | ||
| branches: [main] | ||
| workflow_dispatch: | ||
| inputs: | ||
| test_type: | ||
| description: 'Type of E2E test to run' | ||
| required: true | ||
| default: 'smoke' | ||
| type: choice | ||
| options: | ||
| - smoke | ||
| - verification | ||
| - all | ||
| platform: | ||
| description: 'Platform to test on' | ||
| required: true | ||
| default: 'ios' | ||
| type: choice | ||
| options: | ||
| - ios | ||
| - android | ||
| - both | ||
|
|
||
| # Set default permissions to read-only | ||
| permissions: | ||
| contents: read | ||
|
|
||
| env: | ||
| APP_VARIANT: internal | ||
| CI: true | ||
|
|
||
| jobs: | ||
| e2e-test: | ||
| name: Run ${{ matrix.test }} on ${{ matrix.platform }} | ||
| # Job for automatic push triggers (only iOS smoke test) | ||
| e2e-test-auto: | ||
| name: Run smoke on ios (auto) | ||
| runs-on: macos-latest | ||
| if: github.event_name == 'push' | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: "22" | ||
|
|
||
| - name: Cache Yarn dependencies | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: node_modules | ||
| key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-yarn- | ||
|
|
||
| - name: Install dependencies | ||
| run: yarn | ||
|
|
||
| - name: Install Maestro | ||
| run: | | ||
| curl -Ls "https://get.maestro.mobile.dev" | bash | ||
| export PATH="$PATH":"$HOME/.maestro/bin" | ||
|
|
||
| - name: Decrypt GPG secure files | ||
| run: | | ||
| brew install [email protected] | ||
| echo ${{ secrets.SUPER_SECRET_PASSWORD }} | gpg1 --no-tty --passphrase-fd 0 google-services.json.gpg | ||
|
|
||
| - name: Build Expo app prebuild | ||
| run: yarn expo prebuild --platform ios | ||
|
|
||
| - name: Cache iOS build | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ios/build | ||
| ~/Library/Developer/Xcode/DerivedData | ||
| key: ${{ runner.os }}-ios-build-${{ hashFiles('ios/**/*.pbxproj', 'ios/Podfile.lock', 'src/**/*.tsx', 'src/**/*.ts') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-ios-build- | ||
|
|
||
| - name: Setup iOS Simulator | ||
| run: | | ||
| DEVICE_ID=$(xcrun xctrace list devices | grep -m 1 "iPhone" | awk '{print $NF}' | tr -d '()') | ||
| xcrun simctl boot $DEVICE_ID || true | ||
|
|
||
| - name: Build iOS App | ||
| run: | | ||
| xcodebuild -workspace DEMOCRACYInternal.xcworkspace -scheme DEMOCRACYInternal -configuration Release -sdk iphonesimulator -derivedDataPath build | xcbeautify | ||
| working-directory: ${{ github.workspace }}/ios | ||
|
|
||
| - name: Install iOS App | ||
| run: | | ||
| DEVICE_ID=$(xcrun xctrace list devices | grep -m 1 "iPhone" | awk '{print $NF}' | tr -d '()') | ||
| xcrun simctl install $DEVICE_ID ios/build/Build/Products/Release-iphonesimulator/DEMOCRACYInternal.app | ||
ManAnRuck marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| - name: Launch iOS App | ||
| run: | | ||
| DEVICE_ID=$(xcrun xctrace list devices | grep -m 1 "iPhone" | awk '{print $NF}' | tr -d '()') | ||
| xcrun simctl launch $DEVICE_ID de.democracy-deutschland.clientapp.internal | ||
|
|
||
| - name: Wait for App to be ready | ||
| run: sleep 30 | ||
|
|
||
| - name: Run Maestro Tests | ||
| run: | | ||
| export PATH="$PATH":"$HOME/.maestro/bin" | ||
| yarn test:e2e:smoke | ||
|
|
||
| - name: Upload Test Results | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: maestro-smoke-ios-auto | ||
| path: | | ||
| .maestro/test-results | ||
| .maestro/logs | ||
|
|
||
| # Job for manual workflow dispatch triggers | ||
| e2e-test-manual: | ||
github-advanced-security[bot] marked this conversation as resolved.
Fixed
Show fixed
Hide fixed
|
||
| name: Run ${{ matrix.test }} on ${{ matrix.platform }} (manual) | ||
| strategy: | ||
| matrix: | ||
| include: | ||
| # iOS tests | ||
| - platform: ios | ||
| os: macos-latest | ||
| test: smoke | ||
| - platform: ios | ||
| os: macos-latest | ||
| test: verification | ||
|
|
||
| # Android tests (commented out due to current setup issues) | ||
| # - platform: android | ||
| # os: macos-latest | ||
| # test: smoke | ||
| # - platform: android | ||
| # os: macos-latest | ||
| # test: verification | ||
| - platform: ios | ||
| os: macos-latest | ||
| test: smoke | ||
| # - platform: ios | ||
| # os: macos-latest | ||
| # test: verification | ||
| runs-on: ${{ matrix.os }} | ||
| if: github.event_name == 'workflow_dispatch' | ||
|
|
||
| steps: | ||
| - name: Check if this test should run | ||
| id: should_run | ||
| run: | | ||
| should_run="false" | ||
| if [[ "${{ inputs.test_type }}" == "all" || "${{ inputs.test_type }}" == "${{ matrix.test }}" ]]; then | ||
| if [[ "${{ inputs.platform }}" == "both" || "${{ inputs.platform }}" == "${{ matrix.platform }}" ]]; then | ||
| should_run="true" | ||
| fi | ||
| fi | ||
| echo "should_run=$should_run" >> $GITHUB_OUTPUT | ||
| echo "Test: ${{ matrix.test }}, Platform: ${{ matrix.platform }}, Should run: $should_run" | ||
|
|
||
| - name: Checkout repository | ||
| if: steps.should_run.outputs.should_run == 'true' | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Node.js | ||
| if: steps.should_run.outputs.should_run == 'true' | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: "22" | ||
|
|
||
| - name: Cache Yarn dependencies | ||
| if: steps.should_run.outputs.should_run == 'true' | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: node_modules | ||
|
|
@@ -46,24 +176,28 @@ jobs: | |
| ${{ runner.os }}-yarn- | ||
|
|
||
| - name: Install dependencies | ||
| if: steps.should_run.outputs.should_run == 'true' | ||
| run: yarn | ||
|
|
||
| - name: Install Maestro | ||
| if: steps.should_run.outputs.should_run == 'true' | ||
| run: | | ||
| curl -Ls "https://get.maestro.mobile.dev" | bash | ||
| export PATH="$PATH":"$HOME/.maestro/bin" | ||
|
|
||
| - name: Decrypt GPG secure files | ||
| if: steps.should_run.outputs.should_run == 'true' | ||
| run: | | ||
| brew install [email protected] | ||
| echo ${{ secrets.SUPER_SECRET_PASSWORD }} | gpg1 --no-tty --passphrase-fd 0 google-services.json.gpg | ||
|
|
||
| - name: Build Expo app prebuild | ||
| if: steps.should_run.outputs.should_run == 'true' | ||
| run: yarn expo prebuild --platform ${{ matrix.platform }} | ||
|
|
||
| - name: Cache iOS build | ||
| if: steps.should_run.outputs.should_run == 'true' && matrix.platform == 'ios' | ||
| uses: actions/cache@v4 | ||
| if: matrix.platform == 'ios' | ||
| with: | ||
| path: | | ||
| ios/build | ||
|
|
@@ -73,53 +207,55 @@ jobs: | |
| ${{ runner.os }}-ios-build- | ||
|
|
||
| - name: Setup iOS Simulator | ||
| if: matrix.platform == 'ios' | ||
| if: steps.should_run.outputs.should_run == 'true' && matrix.platform == 'ios' | ||
| run: | | ||
| DEVICE_ID=$(xcrun xctrace list devices | grep -m 1 "iPhone" | awk '{print $NF}' | tr -d '()') | ||
| xcrun simctl boot $DEVICE_ID || true | ||
|
|
||
| # - name: Setup Android Emulator | ||
| # if: matrix.platform == 'android' | ||
| # if: steps.should_run.outputs.should_run == 'true' && matrix.platform == 'android' | ||
| # uses: reactivecircus/android-emulator-runner@v2 | ||
| # with: | ||
| # api-level: 31 | ||
| # script: echo "Emulator started" | ||
|
|
||
| - name: Build iOS App | ||
| if: matrix.platform == 'ios' | ||
| if: steps.should_run.outputs.should_run == 'true' && matrix.platform == 'ios' | ||
| run: | | ||
| xcodebuild -workspace DEMOCRACYInternal.xcworkspace -scheme DEMOCRACYInternal -configuration Release -sdk iphonesimulator -derivedDataPath build | xcbeautify | ||
| working-directory: ${{ github.workspace }}/ios | ||
|
|
||
| # - name: Install iOS App | ||
| # if: matrix.platform == 'ios' | ||
| # run: | | ||
| # DEVICE_ID=$(xcrun xctrace list devices | grep -m 1 "iPhone" | awk '{print $NF}' | tr -d '()') | ||
| # xcrun simctl install $DEVICE_ID ios/build/Build/Products/Release-iphonesimulator/DEMOCRACYInternal.app | ||
| - name: Install iOS App | ||
| if: steps.should_run.outputs.should_run == 'true' && matrix.platform == 'ios' | ||
| run: | | ||
| DEVICE_ID=$(xcrun xctrace list devices | grep -m 1 "iPhone" | awk '{print $NF}' | tr -d '()') | ||
| xcrun simctl install $DEVICE_ID ios/build/Build/Products/Release-iphonesimulator/DEMOCRACYInternal.app | ||
|
|
||
| # - name: Launch iOS App | ||
| # if: matrix.platform == 'ios' | ||
| # run: | | ||
| # DEVICE_ID=$(xcrun xctrace list devices | grep -m 1 "iPhone" | awk '{print $NF}' | tr -d '()') | ||
| # xcrun simctl launch $DEVICE_ID de.democracy-deutschland.clientapp.internal | ||
| - name: Launch iOS App | ||
| if: steps.should_run.outputs.should_run == 'true' && matrix.platform == 'ios' | ||
| run: | | ||
| DEVICE_ID=$(xcrun xctrace list devices | grep -m 1 "iPhone" | awk '{print $NF}' | tr -d '()') | ||
| xcrun simctl launch $DEVICE_ID de.democracy-deutschland.clientapp.internal | ||
|
|
||
| # - name: Build and Run Android App | ||
| # if: matrix.platform == 'android' | ||
| # if: steps.should_run.outputs.should_run == 'true' && matrix.platform == 'android' | ||
| # run: yarn android | ||
|
|
||
| # - name: Wait for App to be ready | ||
| # run: sleep 30 | ||
| - name: Wait for App to be ready | ||
| if: steps.should_run.outputs.should_run == 'true' | ||
| run: sleep 30 | ||
|
|
||
| # - name: Run Maestro Tests | ||
| # run: | | ||
| # export PATH="$PATH":"$HOME/.maestro/bin" | ||
| # yarn test:e2e:${{ matrix.test }} | ||
| - name: Run Maestro Tests | ||
| if: steps.should_run.outputs.should_run == 'true' | ||
| run: | | ||
| export PATH="$PATH":"$HOME/.maestro/bin" | ||
| yarn test:e2e:${{ matrix.test }} | ||
|
|
||
| # - name: Upload Test Results | ||
| # if: always() | ||
| # uses: actions/upload-artifact@v4 | ||
| # with: | ||
| # name: maestro-${{ matrix.test }}-${{ matrix.platform }} | ||
| # path: | | ||
| # .maestro/test-results | ||
| # .maestro/logs | ||
| - name: Upload Test Results | ||
| if: always() && steps.should_run.outputs.should_run == 'true' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: maestro-${{ matrix.test }}-${{ matrix.platform }} | ||
| path: | | ||
| .maestro/test-results | ||
| .maestro/logs | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -80,14 +80,23 @@ We pin `[email protected]`, `[email protected]`, and `[email protected]` to avoid | |
|
|
||
| The project uses Maestro for end-to-end testing. See [Testing Documentation](./docs/TESTING.md) for more information. | ||
|
|
||
| Run tests with: | ||
| Run tests locally with: | ||
|
|
||
| ```bash | ||
| yarn test:e2e # Run all E2E tests | ||
| yarn test:e2e:smoke # Run smoke tests only | ||
| yarn test:e2e:verification # Run verification flow tests only | ||
| ``` | ||
|
|
||
| ### Manual E2E Testing on GitHub Actions | ||
|
|
||
| E2E tests can be manually triggered on any branch through GitHub Actions: | ||
| 1. Go to **Actions** → **🧪 E2E Tests** workflow | ||
| 2. Click **Run workflow** and select test type and platform | ||
| 3. Tests will run on the selected branch | ||
|
|
||
| This is useful for testing feature branches before merging. | ||
|
|
||
| ## Deployment | ||
|
|
||
| This project uses fastlane for both iOS and Android deployments. | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.