From 32f2fb7d2335fd621c2cb8f581cce3393d38b5b8 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Ortiz karliatto Date: Mon, 15 Apr 2024 08:31:17 +0200 Subject: [PATCH] wip --- .../workflows/connect-dev-release-test.yml | 11 +++++++++ .../template-connect-popup-test-params.yml | 23 ++++++++++++++++--- .../e2e/tests/mv2-webextension.test.ts} | 2 ++ .../e2e/playwright.config.ts | 13 ----------- 4 files changed, 33 insertions(+), 16 deletions(-) rename packages/{connect-webextension/e2e/webextension.test.ts => connect-popup/e2e/tests/mv2-webextension.test.ts} (99%) delete mode 100644 packages/connect-webextension/e2e/playwright.config.ts diff --git a/.github/workflows/connect-dev-release-test.yml b/.github/workflows/connect-dev-release-test.yml index 4cf4ee115048..d90dda09d69d 100644 --- a/.github/workflows/connect-dev-release-test.yml +++ b/.github/workflows/connect-dev-release-test.yml @@ -22,6 +22,8 @@ on: - "packages/transport/**" - "packages/utxo-lib/**" - "packages/utils/**" + - "packages/connect-examples/webextension-mv2/**" + - "packages/connect-examples/webextension-mv3/**" - "submodules/trezor-common/**" - "yarn.lock" - ".github/workflows/connect-dev-release-test.yml" @@ -116,3 +118,12 @@ jobs: with: test-name: unchained.test DEV_SERVER_HOSTNAME: dev.suite.sldev.cz + + webextension-examples: + needs: [build-deploy] + uses: ./.github/workflows/template-connect-popup-test-params.yml + with: + test-name: mv2-webextension.test + DEV_SERVER_HOSTNAME: dev.suite.sldev.cz + run-webextension: true + run-web: false diff --git a/.github/workflows/template-connect-popup-test-params.yml b/.github/workflows/template-connect-popup-test-params.yml index 2f9041ed18f7..8f05d8857602 100644 --- a/.github/workflows/template-connect-popup-test-params.yml +++ b/.github/workflows/template-connect-popup-test-params.yml @@ -15,15 +15,23 @@ on: description: "Flag to indicate whether to run the webextension job" type: "boolean" required: false + default: false + run-web: + description: "Flag to indicate whether to run the web job" + type: "boolean" + required: false + default: true build-overview: description: "Flag to indicate whether to build connect-popup-overview.html" type: "boolean" required: false + default: false jobs: web: name: web runs-on: ubuntu-latest + if: ${{ inputs.run-web }} steps: - uses: actions/checkout@v4 with: @@ -67,7 +75,7 @@ jobs: if: failure() uses: actions/upload-artifact@v4 with: - name: test-artifacts-${{ inputs.test-name }}-${{ github.run_attempt }} + name: web-test-artifacts-${{ inputs.test-name }}-${{ github.run_attempt }}-${{ github.run_id }} path: | packages/connect-popup/test-results @@ -92,14 +100,23 @@ jobs: run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT id: extract_branch - - name: Build webextension + - name: Install dependencies run: | yarn install --immutable yarn build:libs + + - name: Build webextension + run: | yarn workspace @trezor/connect-webextension build yarn workspace @trezor/connect-iframe build:core-module yarn workspace @trezor/connect-explorer build:webextension + - name: Build example webextension + run: | + yarn workspace @trezor/connect-web build:webextension + yarn workspace @trezor/connect-web build:inline + node packages/connect-examples/update-webextensions.js + - name: Make Docker Script Executable run: chmod +x ./docker/docker-connect-popup-ci.sh @@ -116,7 +133,7 @@ jobs: if: failure() uses: actions/upload-artifact@v4 with: - name: test-artifacts-${{ inputs.test-name }}-${{ github.run_attempt }} + name: webextension-test-artifacts-${{ inputs.test-name }}-${{ github.run_attempt }}-${{ github.run_id }} path: | packages/connect-popup/test-results diff --git a/packages/connect-webextension/e2e/webextension.test.ts b/packages/connect-popup/e2e/tests/mv2-webextension.test.ts similarity index 99% rename from packages/connect-webextension/e2e/webextension.test.ts rename to packages/connect-popup/e2e/tests/mv2-webextension.test.ts index 530b787661de..b6415889cbea 100644 --- a/packages/connect-webextension/e2e/webextension.test.ts +++ b/packages/connect-popup/e2e/tests/mv2-webextension.test.ts @@ -38,6 +38,7 @@ test('Basic web extension MV2', async () => { __dirname, '..', '..', + '..', 'connect-examples', 'webextension-mv2', 'build', @@ -134,6 +135,7 @@ test('Basic web extension MV3', async () => { __dirname, '..', '..', + '..', 'connect-examples', 'webextension-mv3', 'build', diff --git a/packages/connect-webextension/e2e/playwright.config.ts b/packages/connect-webextension/e2e/playwright.config.ts deleted file mode 100644 index e7f43c82bb5b..000000000000 --- a/packages/connect-webextension/e2e/playwright.config.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { PlaywrightTestConfig } from '@playwright/test'; - -export const config: PlaywrightTestConfig = { - testDir: 'e2e', - retries: 0, - workers: 1, // to disable parallelism between test files - timeout: 30 * 1000, - use: { - headless: process.env.HEADLESS === 'true', - ignoreHTTPSErrors: true, - trace: 'retain-on-failure', - }, -};