-
-
Notifications
You must be signed in to change notification settings - Fork 259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert suite settings (coins, custom-firmware) + refactors desktop pipeline #15869
Changes from all commits
613c1bc
40420f4
868b52e
2ce744c
32054b9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,12 +107,14 @@ jobs: | |
# CONTAINERS: "trezor-user-env-unix" | ||
- TEST_GROUP: "@group=wallet" | ||
CONTAINERS: "trezor-user-env-unix bitcoin-regtest" | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{github.event.after}} | ||
fetch-depth: 2 | ||
|
||
- name: Setup node | ||
uses: actions/setup-node@v4 | ||
with: | ||
|
@@ -124,16 +126,6 @@ jobs: | |
run: | | ||
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT | ||
|
||
- name: Extract commit message | ||
id: extract_commit_message | ||
run: | | ||
if [ "${{ github.event_name }}" == "pull_request" ]; then | ||
git fetch origin +refs/pull/${{ github.event.pull_request.number }}/merge: --depth=1 | ||
echo "message=$(git log --no-merges -1 --pretty=format:"%s")" >> $GITHUB_OUTPUT | ||
else | ||
echo "message=$(git log --no-merges -1 --pretty=format:"%s")" >> $GITHUB_OUTPUT | ||
fi | ||
|
||
- name: Install dependencies and pull docker images | ||
env: | ||
COMPOSE_FILE: ./docker/docker-compose.suite-ci-pw.yml | ||
|
@@ -144,21 +136,18 @@ jobs: | |
npx playwright install --with-deps chromium | ||
docker compose pull ${{ matrix.CONTAINERS }} | ||
|
||
- name: Run Playwright e2e tests | ||
- name: Run Playwright e2e web tests | ||
env: | ||
COMPOSE_FILE: ./docker/docker-compose.suite-ci-pw.yml | ||
BASE_URL: https://dev.suite.sldev.cz/suite-web/${{ steps.extract_branch.outputs.branch }}/web/ | ||
## Keep retries enabled once stabilized | ||
ALLOW_RETRY: true | ||
TEST_GROUP: ${{ matrix.TEST_GROUP }} | ||
GITHUB_ACTION: true | ||
CURRENTS_PROJECT_ID: Og0NOQ | ||
CURRENTS_RECORD_KEY: ${{ secrets.CURRENTS_RECORD_KEY }} | ||
CURRENTS_CI_BUILD_ID: pr-run-${{github.run_id}} | ||
run: | | ||
docker compose up -d ${{ matrix.CONTAINERS }} | ||
echo "Starting Playwright Web test group ${TEST_GROUP}" | ||
yarn workspace @trezor/suite-desktop-core test:e2e:web --grep=${TEST_GROUP} | ||
echo "Starting Playwright Web test group ${{ matrix.TEST_GROUP }}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unify how vars are passed to bash and adds safety net --forbid-only. Playwright docs: Whether to disallow test.only. Useful on CI. |
||
yarn workspace @trezor/suite-desktop-core test:e2e:web --forbid-only --grep=${{ matrix.TEST_GROUP }} | ||
|
||
- name: Extract Trezor-user-env logs | ||
if: ${{ ! cancelled() }} | ||
|
@@ -176,6 +165,12 @@ jobs: | |
trezor-user-env-debugging.log | ||
tenv-emulator-bridge-debugging.log | ||
trezor-user-env-version.txt | ||
retention-days: 30 | ||
|
||
- name: Docker compose down | ||
env: | ||
COMPOSE_FILE: ./docker/docker-compose.suite-ci-pw.yml | ||
run: docker compose down | ||
|
||
- name: Upload Playwright report | ||
if: ${{ ! cancelled() }} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,14 +5,16 @@ export enum PlaywrightProjects { | |
Web = 'web', | ||
Desktop = 'desktop', | ||
} | ||
const timeoutCIRun = 1000 * 60; | ||
const timeoutLocalRun = 1000 * 30; | ||
|
||
const config: PlaywrightTestConfig = { | ||
projects: [ | ||
{ | ||
name: PlaywrightProjects.Web, | ||
use: { | ||
browserName: 'chromium', | ||
baseURL: process.env.BASE_URL || 'http://localhost:8000', | ||
baseURL: process.env.BASE_URL || 'http://localhost:8000/', | ||
}, | ||
grepInvert: /@desktopOnly/, | ||
}, | ||
|
@@ -34,7 +36,7 @@ const config: PlaywrightTestConfig = { | |
reporter: process.env.GITHUB_ACTION | ||
? [['list'], ['@currents/playwright'], ['html', { open: 'never' }]] | ||
: [['list'], ['html', { open: 'never' }]], | ||
timeout: 1000 * 60 * 5, | ||
timeout: process.env.GITHUB_ACTION ? timeoutCIRun : timeoutLocalRun, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We want locally tests to fail fast during troubleshooting. |
||
outputDir: path.join(__dirname, 'test-results'), | ||
}; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
/* eslint-disable no-console */ | ||
|
||
import { _electron as electron } from '@playwright/test'; | ||
import { _electron as electron, TestInfo } from '@playwright/test'; | ||
import path from 'path'; | ||
import fse from 'fs-extra'; | ||
|
||
import { TrezorUserEnvLink } from '@trezor/trezor-user-env-link'; | ||
|
||
import { PlaywrightProjects } from '../playwright.config'; | ||
|
||
// specific version of legacy bridge is requested & expected | ||
export const LEGACY_BRIDGE_VERSION = '2.0.33'; | ||
const disableHashCheckArgument = '--state.suite.settings.isFirmwareHashCheckDisabled=true'; | ||
|
@@ -100,3 +102,14 @@ export const launchSuite = async (params: LaunchSuiteParams = {}) => { | |
|
||
return { electronApp, window }; | ||
}; | ||
|
||
export const getApiUrl = (webBaseUrl: string | undefined, testInfo: TestInfo) => { | ||
const electronApiURL = 'file:///'; | ||
const apiURL = | ||
testInfo.project.name === PlaywrightProjects.Desktop ? electronApiURL : webBaseUrl; | ||
if (!apiURL) { | ||
throw new Error('apiURL is not defined'); | ||
} | ||
|
||
return apiURL; | ||
}; | ||
Comment on lines
+106
to
+115
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. might need update once i see first ci run |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Locator, expect as baseExpect } from '@playwright/test'; | ||
|
||
export const expect = baseExpect.extend({ | ||
async toBeEnabledCoin(locator: Locator) { | ||
const isActive = await locator.getAttribute('data-active'); | ||
|
||
return { | ||
pass: isActive === 'true', | ||
message: () => | ||
isActive === null | ||
? `expected ${locator} to have attribute 'data-active', but it does not have this attribute at all` | ||
: `expected ${locator} to have attribute 'data-active' set to 'true', but got '${isActive}'`, | ||
}; | ||
}, | ||
async toBeDisabledCoin(locator: Locator) { | ||
const isActive = await locator.getAttribute('data-active'); | ||
|
||
return { | ||
pass: isActive === 'false', | ||
message: () => | ||
isActive === null | ||
? `expected ${locator} to have attribute 'data-active', but it does not have this attribute at all` | ||
: `expected ${locator} to have attribute 'data-active' set to 'false', but got '${isActive}'`, | ||
}; | ||
}, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our web pipeline uses different checkout:
Any preferences?