feat: migrate mobile learn test to playwright (#54686)

Co-authored-by: Naomi <nhcarrigan@gmail.com>
This commit is contained in:
Niraj Nandish
2024-05-08 02:19:36 +05:30
committed by GitHub
parent 1ac5e2d713
commit bd1e5b5403
6 changed files with 127 additions and 63 deletions

View File

@@ -29,16 +29,15 @@ jobs:
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: ${{ matrix.node-version }}
# cypress-io/github-action caches the store, so we should not cache it
# here.
cache: pnpm
- name: Setup Flutter 3.13.x
- name: Setup Flutter 3.19.x
uses: subosito/flutter-action@2783a3f08e1baf891508463f8c6653c258246225 # v2
with:
flutter-version: '3.13.x'
flutter-version: '3.19.x'
channel: 'stable'
cache: true
cache-key: flutter-3.13.x
cache-key: flutter-3.19.x
cache-path: ${{ runner.tool_cache }}/flutter
- name: Set freeCodeCamp Environment Variables
@@ -58,30 +57,18 @@ jobs:
flutter pub get
flutter test test/widget_test.dart
# This is a workaround for the fact that Cypress does not support
# running in a sub-directory.
#
# In our cypress config, we default to the cypress/e2e/default directory.
# We need to change this to cypress/e2e/ for the specific tests we are running
# in this workflow.
#
- name: Adjust the Cypress Config
run: |
sed -i 's#cypress/e2e/default/#cypress/e2e/#g' cypress.config.js
- name: Install playwright dependencies
run: npx playwright install --with-deps
- name: Install serve
run: npm install -g serve
- name: Cypress run
uses: cypress-io/github-action@v6
- name: Run playwright tests
run: npx playwright test --config=playwright-mobile.config.ts
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
record: ${{ env.CYPRESS_RECORD_KEY != 0 }}
start: npx serve --no-request-logging
wait-on: http://localhost:3000
wait-on-timeout: 1200
config: retries=1,screenshotOnRunFailure=false,video=false,baseUrl=http://localhost:3000/mobile/mobile-app/generated-tests/
browser: chrome
spec: cypress/e2e/mobile-learn/test-challenges.js
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
name: playwright-report-mobile
path: playwright/reporter
retention-days: 30