Skip to content

Commit

Permalink
test: lw-12373 add e2e support for Firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
ljagiela committed Feb 28, 2025
1 parent 916b788 commit 33a0600
Show file tree
Hide file tree
Showing 45 changed files with 557 additions and 191 deletions.
81 changes: 81 additions & 0 deletions .github/actions/test/reports/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: process-smoke-reports

inputs:
BROWSER:
description: 'browser'
required: true
type: string
default: chrome
SMOKE_TESTS_RESULT:
required: true
type: string
GH_TOKEN:
description: 'Github token'
required: true
E2E_AWS_ACCESS_KEY_ID:
required: true
E2E_AWS_SECRET_ACCESS_KEY:
required: true
E2E_REPORTS_USER:
required: true
E2E_REPORTS_PASSWORD:
required: true
E2E_REPORTS_URL:
required: true
runs:
using: 'composite'

steps:
- name: Download all smoke tests artifacts
uses: actions/download-artifact@v4
with:
path: .
pattern: 'runner-artifacts-*'
merge-multiple: true

- name: Create allure properties
shell: bash
if: always()
working-directory: ./reports/allure/results
run: |
echo "
branch=${{ github.ref_name }}
browser= ${{ inputs.BROWSER }}
tags= '@Smoke'
platform=Linux
" > environment.properties
- name: Publish allure report to S3
uses: andrcuns/[email protected]
if: always()
env:
GITHUB_AUTH_TOKEN: ${{ inputs.GH_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ inputs.E2E_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ inputs.E2E_AWS_SECRET_ACCESS_KEY }}
with:
storageType: s3
resultsGlob: './reports/allure/results'
bucket: lace-e2e-test-results
prefix: 'smoke/linux/${{ inputs.BROWSER }}/${{ github.run_number }}'
copyLatest: true
ignoreMissingResults: true
updatePr: comment
baseUrl: 'https://${{ inputs.E2E_REPORTS_USER }}:${{ inputs.E2E_REPORTS_PASSWORD }}@${{ inputs.E2E_REPORTS_URL }}'

- name: Publish artifacts (logs, reports, screenshots)
uses: actions/upload-artifact@v4
if: always()
with:
name: test-artifacts
path: |
./packages/e2e-tests/screenshots
./packages/e2e-tests/logs
./packages/e2e-tests/reports
retention-days: 5

- run: |
if [[ "${{ inputs.SMOKE_TESTS_RESULT }}" == "success" ]]; then
exit 0
else
exit 1
fi
60 changes: 60 additions & 0 deletions .github/actions/test/smoke/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: run-smoke-e2e

inputs:
BROWSER:
description: 'browser'
required: true
type: string
default: 'chrome'
BATCH:
description: 'Tests batch'
required: true
type: number
WALLET_PASSWORD:
description: 'Test wallet password'
required: true
GH_TOKEN:
description: 'Github token'
required: true
TEST_DAPP_URL:
description: 'Test DApp Url'
required: true

runs:
using: 'composite'

steps:
- name: Setup Node.js and install dependencies
uses: ./.github/actions/install
with:
WALLET_PASSWORD: ${{ inputs.WALLET_PASSWORD }}
GITHUB_TOKEN: ${{ inputs.GH_TOKEN }}

- name: Download Lace build artifact
uses: actions/download-artifact@v4
with:
name: '${{ env.BUILD_ARTIFACT_NAME }}-${{ inputs.BROWSER }}'
path: ./apps/browser-extension-wallet/dist

- name: Setup Firefox Developer Edition
id: setup-firefox
uses: browser-actions/setup-firefox@v1
with:
firefox-version: 'latest-devedition'
if: inputs.BROWSER == 'firefox'

- name: Verify Firefox Installation
if: inputs.BROWSER == 'firefox'
shell: bash
run: |
echo Installed firefox versions: ${{ steps.setup-firefox.outputs.firefox-version }}
${{ steps.setup-firefox.outputs.firefox-path }} --version
- name: Execute E2E tests for ${{ inputs.BROWSER }}
uses: ./.github/actions/test/e2e
with:
BATCH: ${{ inputs.BATCH }}
SMOKE_ONLY: true
TEST_DAPP_URL: ${{ inputs.TEST_DAPP_URL }}
WALLET_PASSWORD: ${{ inputs.WALLET_PASSWORD }}
SERVICE_WORKER_LOGS: true
163 changes: 90 additions & 73 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ jobs:
SENTRY_PROJECT: ${{ startsWith(github.ref, 'refs/heads/release') && vars.SENTRY_PROJECT || ''}}
SENTRY_ENVIRONMENT: 'production'
DAPP_RADAR_API_KEY: ${{ startsWith(github.ref, 'refs/heads/release') && secrets.DAPP_RADAR_API_KEY || '' }}

build:
name: Build Lace
runs-on: ubuntu-22.04
Expand All @@ -239,9 +239,33 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Build Lace artifact
- name: Build Lace chrome artifact
uses: ./.github/shared/build
with:
BROWSER_TARGET: 'chromium'
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
LACE_EXTENSION_KEY: ${{ secrets.MANIFEST_PUBLIC_KEY }}
BLOCKFROST_PROJECT_ID_MAINNET: ${{ secrets.BLOCKFROST_PROJECT_ID_MAINNET }}
BLOCKFROST_PROJECT_ID_PREPROD: ${{ secrets.BLOCKFROST_PROJECT_ID_PREPROD }}
BLOCKFROST_PROJECT_ID_PREVIEW: ${{ secrets.BLOCKFROST_PROJECT_ID_PREVIEW }}
BLOCKFROST_PROJECT_ID_SANCHONET: ${{ secrets.BLOCKFROST_PROJECT_ID_SANCHONET }}
SENTRY_AUTH_TOKEN: ${{ startsWith(github.ref, 'refs/heads/release') && secrets.SENTRY_AUTH_TOKEN || '' }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
SENTRY_ORG: ${{ startsWith(github.ref, 'refs/heads/release') && vars.SENTRY_ORG || '' }}
SENTRY_PROJECT: ${{ startsWith(github.ref, 'refs/heads/release') && vars.SENTRY_PROJECT || ''}}
SENTRY_ENVIRONMENT: 'smoke-tests'
WALLET_POLLING_INTERVAL_IN_SEC: 5

- name: Upload chrome artifact
uses: actions/upload-artifact@v4
with:
name: '${{ env.BUILD_ARTIFACT_NAME }}-chrome'
path: ./apps/browser-extension-wallet/dist

- name: Build Lace firefox artifact
uses: ./.github/shared/build
with:
BROWSER_TARGET: 'firefox'
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
LACE_EXTENSION_KEY: ${{ secrets.MANIFEST_PUBLIC_KEY }}
BLOCKFROST_PROJECT_ID_MAINNET: ${{ secrets.BLOCKFROST_PROJECT_ID_MAINNET }}
Expand All @@ -255,104 +279,97 @@ jobs:
SENTRY_ENVIRONMENT: 'smoke-tests'
WALLET_POLLING_INTERVAL_IN_SEC: 5

- name: Upload build artifact
- name: Upload firefox artifact
uses: actions/upload-artifact@v4
with:
name: '${{ env.BUILD_ARTIFACT_NAME }}'
name: '${{ env.BUILD_ARTIFACT_NAME }}-firefox'
path: ./apps/browser-extension-wallet/dist

smokeTests:
name: Smoke e2e tests
smokeTests-chrome:
name: Smoke e2e tests - Chrome
runs-on: ubuntu-22.04
needs: build
strategy:
fail-fast: false
matrix:
batch: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js and install dependencies
uses: ./.github/actions/install
- name: Execute E2E tests - Chrome
uses: ./.github/actions/test/smoke
with:
BROWSER: "chrome"
BATCH: ${{ matrix.batch }}
TEST_DAPP_URL: ${{ secrets.TEST_DAPP_URL }}
WALLET_PASSWORD: ${{ secrets.WALLET_PASSWORD_TESTNET }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}

- name: Download Lace build artifact
uses: actions/download-artifact@v4
with:
name: '${{ env.BUILD_ARTIFACT_NAME }}'
path: ./apps/browser-extension-wallet/dist
processReports-chrome:
name: Process smoke e2e test reports - Chrome
runs-on: ubuntu-22.04
needs: smokeTests-chrome
if: always()
steps:
- name: Checkout repository
- uses: actions/checkout@v4

- name: Run reports processing - Chrome
uses: ./.github/actions/test/reports
with:
BROWSER: 'chrome'
SMOKE_TESTS_RESULT: ${{ needs.smokeTests-chrome.result }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
E2E_AWS_ACCESS_KEY_ID: ${{ secrets.E2E_AWS_ACCESS_KEY_ID }}
E2E_AWS_SECRET_ACCESS_KEY: ${{ secrets.E2E_AWS_SECRET_ACCESS_KEY }}
E2E_REPORTS_USER: ${{ secrets.E2E_REPORTS_USER }}
E2E_REPORTS_PASSWORD: ${{ secrets.E2E_REPORTS_PASSWORD }}
E2E_REPORTS_URL: ${{ secrets.E2E_REPORTS_URL }}

smokeTests-firefox:
name: Smoke e2e tests - Firefox
runs-on: ubuntu-22.04
needs: smokeTests-chrome
strategy:
fail-fast: false
matrix:
batch: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 ]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Execute E2E tests
uses: ./.github/actions/test/e2e
- name: Execute E2E tests - Firefox
uses: ./.github/actions/test/smoke
with:
BROWSER: 'firefox'
BATCH: ${{ matrix.batch }}
SMOKE_ONLY: true
TEST_DAPP_URL: ${{ secrets.TEST_DAPP_URL }}
WALLET_PASSWORD: ${{ secrets.WALLET_PASSWORD_TESTNET }}
SERVICE_WORKER_LOGS: true
GH_TOKEN: ${{ secrets.GH_TOKEN }}

processReports:
name: Process smoke e2e test reports
processReports-firefox:
name: Process smoke e2e test reports - Firefox
runs-on: ubuntu-22.04
needs: smokeTests
needs: smokeTests-firefox
if: always()
steps:
- name: Download all smoke tests artifacts
uses: actions/download-artifact@v4
with:
path: .
pattern: 'runner-artifacts-*'
merge-multiple: true
- name: Checkout repository
uses: actions/checkout@v4

- name: Create allure properties
shell: bash
if: always()
working-directory: ./reports/allure/results
run: |
echo "
branch=${{ github.ref_name }}
browser= 'Chrome'
tags= '@Smoke'
platform=Linux
" > environment.properties
- name: Publish allure report to S3
uses: andrcuns/[email protected]
if: always()
env:
GITHUB_AUTH_TOKEN: ${{ secrets.GH_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.E2E_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.E2E_AWS_SECRET_ACCESS_KEY }}
with:
storageType: s3
resultsGlob: './reports/allure/results'
bucket: lace-e2e-test-results
prefix: 'smoke/linux/chrome/${{ github.run_number }}'
copyLatest: true
ignoreMissingResults: true
updatePr: comment
baseUrl: 'https://${{ secrets.E2E_REPORTS_USER }}:${{ secrets.E2E_REPORTS_PASSWORD }}@${{ secrets.E2E_REPORTS_URL }}'

- name: Publish artifacts (logs, reports, screenshots)
uses: actions/upload-artifact@v4
if: always()
with:
name: test-artifacts
path: |
./packages/e2e-tests/screenshots
./packages/e2e-tests/logs
./packages/e2e-tests/reports
retention-days: 5

- run: |
if [[ ${{ needs.smokeTests.result }} == "success" ]]; then
exit 0
else
exit 1
fi
- name: Run reports processing - Firefox
uses: ./.github/actions/test/reports
with:
BROWSER: 'firefox'
SMOKE_TESTS_RESULT: ${{ needs.smokeTests-firefox.result }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
E2E_AWS_ACCESS_KEY_ID: ${{ secrets.E2E_AWS_ACCESS_KEY_ID }}
E2E_AWS_SECRET_ACCESS_KEY: ${{ secrets.E2E_AWS_SECRET_ACCESS_KEY }}
E2E_REPORTS_USER: ${{ secrets.E2E_REPORTS_USER }}
E2E_REPORTS_PASSWORD: ${{ secrets.E2E_REPORTS_PASSWORD }}
E2E_REPORTS_URL: ${{ secrets.E2E_REPORTS_URL }}

if-core-changed:
name: When core changed
Expand Down
9 changes: 8 additions & 1 deletion packages/e2e-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ UI-mapped gherkin tests for the Lace browser extension
with [selenium-standalone](https://github.com/webdriverio/selenium-standalone/blob/main/docs/java-versions.md)
- On macOS, you can install it easily with homebrew: `brew install openjdk`
- gpg
- Firefox Developer Edition (for running tests on Firefox)

## Running tests locally

Expand All @@ -32,6 +33,7 @@ UI-mapped gherkin tests for the Lace browser extension
- Run tests (from the `packages/e2e-tests` directory)
- `yarn test:local:chrome`
- `yarn test:local:edge`
- `yarn test:local:firefox`

## Selective gherkin scenario runs by tag matching

Expand All @@ -43,11 +45,15 @@ UI-mapped gherkin tests for the Lace browser extension

- chrome
- edge
- firefox
- does not support network interception or console log collection, so some tests/features are disabled (using the @SkipFirefox tag)
- works only with Firefox Developer Edition, as the regular version does not allow the use of extensions
- does not support device emulation, so popup mode is simulated by simply resizing the window, which is not an ideal method of simulation

## Supported params

- `STANDALONE_DRIVER=true|false` default = false (optional)
- true = use already running chromedriver on port 4444
- true = use already running chromedriver/geckodriver on port 4444
- false = use webdriver manager
- `ENV=(mainnet|preprod|preview)`default = preprod (optional)
- determines default network used for tests
Expand All @@ -58,6 +64,7 @@ UI-mapped gherkin tests for the Lace browser extension
- url for test DApp (only for DApp Connector tests)
- `SERVICE_WORKER_LOGS=true|false` default=false (optional)
- enables service worker logs collection
- not supported for Firefox

## Run single feature file with params

Expand Down
Loading

0 comments on commit 33a0600

Please sign in to comment.