implement proper reports #559
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
| name: "End-to-end test" | |
| on: [push] | |
| # workflow_dispatch: | |
| # inputs: | |
| # build_number: | |
| # description: 'Build number e.g v0.4.21 build-692' | |
| # required: true | |
| # default: 'v0.4.21 build-692' | |
| # repository_dispatch: | |
| # types: [trigger-test] | |
| # Auto cancels previous running CI jobs in this PR on each new commit | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.client_payload.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| start-test: | |
| runs-on: ubuntu-latest | |
| name: "Start Test" | |
| steps: | |
| - name: Enable KVM | |
| run: | | |
| echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
| sudo udevadm control --reload-rules | |
| sudo udevadm trigger --name-match=kvm | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| # setup nodejs | |
| - name: Install Node.js | |
| uses: actions/setup-node@v2 | |
| with: | |
| node-version: '22' | |
| - name: Format APK directory name | |
| run: | | |
| directory_name=$(echo "${{ github.event.client_payload.build_number || github.event.inputs.build_number }}" | sed 's/ /_/g') | |
| echo "DIRECTORY_NAME=$directory_name" >> "$GITHUB_ENV" | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v5.1.0 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| aws-region: ${{ secrets.AWS_REGION }} | |
| - name: Download file from S3 | |
| env: | |
| DIRECTORY_NAME: ${{ env.DIRECTORY_NAME }} | |
| run: | | |
| aws s3 cp s3://dock-wallet/app-truvera-distribution/v1.7.0_build-904/dock-wallet.apk ./app/truvera-wallet.apk | |
| - name: Install Dependencies | |
| run: | | |
| npm install --force | |
| yarn global add appium | |
| appium driver install uiautomator2 | |
| - name: Run E2E Tests | |
| uses: ReactiveCircus/android-emulator-runner@v2 | |
| with: | |
| api-level: 30 | |
| arch: x86_64 | |
| profile: pixel_7_pro | |
| script: | | |
| appium &>/dev/null & | |
| sleep 5 | |
| adb install -g ./app/truvera-wallet.apk | |
| adb shell pm grant com.truvera.app android.permission.WRITE_EXTERNAL_STORAGE | |
| npm run test | |
| - name: Upload Test Reports | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-reports | |
| path: test-reports/ | |
| retention-days: 30 | |
| - name: Upload Screenshots | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: screenshots | |
| path: test-reports/screenshots/ | |
| retention-days: 30 | |
| - name: Publish Test Results | |
| if: always() | |
| uses: EnricoMi/publish-unit-test-result-action@v2 | |
| with: | |
| files: test-reports/junit/results.xml | |
| check_name: E2E Test Results | |
| comment_title: E2E Test Results | |
| - name: Generate Test Summary | |
| if: always() | |
| run: | | |
| echo "## E2E Test Results Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| if [ -f "test-reports/mochawesome/report.json" ]; then | |
| TOTAL=$(jq '.stats.tests' test-reports/mochawesome/report.json) | |
| PASSES=$(jq '.stats.passes' test-reports/mochawesome/report.json) | |
| FAILURES=$(jq '.stats.failures' test-reports/mochawesome/report.json) | |
| PENDING=$(jq '.stats.pending' test-reports/mochawesome/report.json) | |
| DURATION=$(jq '.stats.duration' test-reports/mochawesome/report.json) | |
| echo "📊 **Test Statistics**" >> $GITHUB_STEP_SUMMARY | |
| echo "- Total Tests: $TOTAL" >> $GITHUB_STEP_SUMMARY | |
| echo "- ✅ Passed: $PASSES" >> $GITHUB_STEP_SUMMARY | |
| echo "- ❌ Failed: $FAILURES" >> $GITHUB_STEP_SUMMARY | |
| echo "- ⏭️ Pending: $PENDING" >> $GITHUB_STEP_SUMMARY | |
| echo "- ⏱️ Duration: ${DURATION}ms" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| # List failed tests if any | |
| if [ "$FAILURES" -gt 0 ]; then | |
| echo "### ❌ Failed Tests" >> $GITHUB_STEP_SUMMARY | |
| jq -r '.results[].suites[].tests[] | select(.fail == true) | "- " + .fullTitle' test-reports/mochawesome/report.json >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| else | |
| echo "⚠️ No test report found" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| echo "📸 **Screenshots**" >> $GITHUB_STEP_SUMMARY | |
| echo "Screenshots are available in the artifacts section above." >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "📄 **Full HTML Report**" >> $GITHUB_STEP_SUMMARY | |
| echo "Download the test-reports artifact to view the detailed HTML report." >> $GITHUB_STEP_SUMMARY | |
| # - name: Parse Test Report | |
| # if: always() | |
| # run: | | |
| # chmod +x ./scripts/ParseReports.sh ./scripts/BuildNumber.sh | |
| # ./scripts/ParseReports.sh | |
| # ./scripts/BuildNumber.sh | |
| - name: Send slack notification | |
| if: always() | |
| uses: edge/simple-slack-notify@master | |
| env: | |
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
| BUILD_NUMBER: ${{ github.event.client_payload.build_number || github.event.inputs.build_number}} | |
| with: | |
| channel: '#wallet-bot' | |
| status: ${{ job.status }} | |
| success_text: 'Smoke Tests completed successfully' | |
| failure_text: 'Smoke Tests failed' | |
| cancelled_text: 'Smoke Tests cancelled' | |
| fields: | | |
| [ | |
| { "title": "Action URL", "value": "${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}"}, | |
| { "title": "Build Number", "value":"v1.7.0_build-904"}, | |
| { "title": "Failed Tests", "value":"${env.ALL_FAILED_TESTS}"} | |
| ] |