From 4fe865a6bcf4d5969b15e5e95b93b16882fa0439 Mon Sep 17 00:00:00 2001 From: Nelito Junior Date: Fri, 6 Dec 2024 20:09:50 -0300 Subject: [PATCH] chore(e2e): Added support for the 'chrome-dev' channel in Playwright FE-803 (#1677) ~~Add~~ Replace `chromium` with `chrome-beta` tests as a way to catch breaking changes early on. I would have chosen the `dev` channel as it gives us 9 to 12 weeks to catch those changes, as the `beta` channel would only give 4 to 6 weeks and the `Canary` version is too unstable, but `dev` is not available on playwright at the moment. Decided to replace to the beta version instead of running on both as to not increase the test time. If it runs on beta we can be safe that it runs on stable. --- .../actions/e2e-tests-contracts/action.yaml | 11 ++-- .github/workflows/pr-tests-e2e-contracts.yml | 57 +++++++++++++++++-- .../e2e-contract-tests/playwright.config.ts | 14 ++++- 3 files changed, 71 insertions(+), 11 deletions(-) diff --git a/.github/actions/e2e-tests-contracts/action.yaml b/.github/actions/e2e-tests-contracts/action.yaml index fac2f0fa32..08e5bb4dfe 100644 --- a/.github/actions/e2e-tests-contracts/action.yaml +++ b/.github/actions/e2e-tests-contracts/action.yaml @@ -10,6 +10,9 @@ inputs: genesisSecret: description: Secret of genesis to fund the master wallet required: false + browser: + description: Browser to run tests on (chromium or chrome-beta) + required: true runs: using: 'composite' @@ -26,13 +29,13 @@ runs: NODE_ENV: test # E2E tests running with Playwright - - name: Install Playwright Browsers + - name: Install Playwright Browsers (${{ inputs.browser }}) shell: bash - run: npx playwright install --with-deps chromium + run: npx playwright install --with-deps ${{ inputs.browser }} - name: Run E2E Contract Tests shell: bash - run: xvfb-run --auto-servernum -- pnpm test:e2e:contracts + run: xvfb-run --auto-servernum -- pnpm test:e2e:contracts --project=${{ inputs.browser }} env: PORT: 5173 VITE_FUEL_PROVIDER_URL: ${{ inputs.providerUrl }} @@ -42,7 +45,7 @@ runs: - uses: actions/upload-artifact@v4 if: always() with: - name: playwright-report + name: playwright-report-${{ inputs.browser }} path: | packages/app/playwright-report/ packages/app/playwright-html/ diff --git a/.github/workflows/pr-tests-e2e-contracts.yml b/.github/workflows/pr-tests-e2e-contracts.yml index 3a47c31a50..02bdf73c85 100644 --- a/.github/workflows/pr-tests-e2e-contracts.yml +++ b/.github/workflows/pr-tests-e2e-contracts.yml @@ -11,11 +11,11 @@ concurrency: jobs: tests-e2e-contracts: - name: Test + name: Test (Chrome Stable) runs-on: buildjet-8vcpu-ubuntu-2204 timeout-minutes: 10 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: FuelLabs/github-actions/setups/node@master with: node-version: 20.11.0 @@ -41,16 +41,65 @@ jobs: run: pnpm deploy:contracts working-directory: ./packages/e2e-contract-tests - - name: Run E2E Contract Tests - Local + - name: Run E2E Contract Tests uses: ./.github/actions/e2e-tests-contracts with: providerUrl: "http://localhost:4000/v1/graphql" masterMnemonic: ${{ secrets.VITE_MASTER_WALLET_MNEMONIC }} genesisSecret: "0xa449b1ffee0e2205fa924c6740cc48b3b473aa28587df6dab12abc245d1f5298" + browser: 'chromium' - uses: actions/upload-artifact@v4 if: always() with: name: playwright-e2e-contract-tests-report path: packages/e2e-contract-tests/playwright-results - retention-days: 30 \ No newline at end of file + retention-days: 30 + + tests-e2e-contracts-beta: + name: Test (Chrome Beta) + runs-on: buildjet-8vcpu-ubuntu-2204 + timeout-minutes: 10 + continue-on-error: true + steps: + - uses: actions/checkout@v4 + - uses: FuelLabs/github-actions/setups/node@master + with: + node-version: 20.11.0 + pnpm-version: 9.5.0 + + - uses: FuelLabs/github-actions/setups/docker@master + with: + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - uses: ./.github/actions/setup-rust + + - name: Run PNPM install + id: pnpm-cache + run: + pnpm recursive install --frozen-lockfile + + - name: Start Test Node + run: pnpm node:up + + - name: Generate .env app + run: cp packages/app/.env.example packages/app/.env + + - name: Build & Deploy Contracts + run: pnpm deploy:contracts + working-directory: ./packages/e2e-contract-tests + - uses: ./.github/actions/e2e-tests-contracts + with: + providerUrl: "http://localhost:4000/v1/graphql" + masterMnemonic: ${{ secrets.VITE_MASTER_WALLET_MNEMONIC }} + genesisSecret: "0xa449b1ffee0e2205fa924c6740cc48b3b473aa28587df6dab12abc245d1f5298" + browser: 'chrome-beta' + + - uses: actions/upload-artifact@v4 + if: always() + with: + name: playwright-e2e-contract-tests-report-beta + path: packages/e2e-contract-tests/playwright-results + retention-days: 30 + + \ No newline at end of file diff --git a/packages/e2e-contract-tests/playwright.config.ts b/packages/e2e-contract-tests/playwright.config.ts index 9c12aa2a6a..c0dc1c24cf 100644 --- a/packages/e2e-contract-tests/playwright.config.ts +++ b/packages/e2e-contract-tests/playwright.config.ts @@ -10,8 +10,7 @@ const IS_CI = process.env.CI; const config: PlaywrightTestConfig = defineConfig({ testDir: './playwright', outputDir: './playwright-results/', - retries: 1, - maxFailures: IS_CI ? 1 : undefined, + retries: IS_CI ? 1 : 0, workers: 1, timeout: 60_000, reporter: [['html', { printSteps: true }]], @@ -30,7 +29,16 @@ const config: PlaywrightTestConfig = defineConfig({ projects: [ { name: 'chromium', - use: { ...devices['Desktop Chrome'] }, + use: { + ...devices['Desktop Chromium'], + }, + }, + { + name: 'chrome-beta', + use: { + channel: 'chrome-beta', + ...devices['Desktop Chrome'], + }, }, ], });