refactor(e2e-suite): move from suite-desctop-core to suite

This commit is contained in:
Martin Vere Cihlar
2025-11-28 20:40:15 -04:00
committed by Martin Vere Cihlar
parent fbd746576a
commit 887e06b58d
284 changed files with 122 additions and 152 deletions

View File

@@ -85,7 +85,7 @@ runs:
run: |
echo "::group::Install PW Dependencies"
echo "Silently installing Playwright dependencies"
yarn workspaces focus @trezor/suite-desktop-core ${{ inputs.workspace-dependencies }} > /dev/null
yarn workspaces focus @trezor/suite ${{ inputs.workspace-dependencies }} > /dev/null
if [[ "${{ inputs.project }}" == "web" ]]; then
npx playwright install --with-deps > /dev/null
fi
@@ -132,7 +132,7 @@ runs:
docker compose up -d ${{ inputs.containers }}
echo "Starting Playwright project ${{ inputs.project }} for test group ${{ inputs.test-group }}"
yarn workspace @trezor/suite-desktop-core test:orchestrated:e2e:${{ inputs.project }} \
yarn workspace @trezor/suite test:orchestrated:e2e:${{ inputs.project }} \
--pwc-cancel-after-failures ${{ inputs.fail-fast }} \
--forbid-only \
$REPORTER_OPT \

View File

@@ -50,7 +50,7 @@ jobs:
shell: bash
run: |
echo "Installing Playwright dependencies"
yarn workspaces focus @trezor/suite-desktop-core
yarn workspaces focus @trezor/suite
# Playwright runtime may indirectly import the built config, and that would crash if message-system is not built
yarn message-system-sign-config
@@ -63,4 +63,4 @@ jobs:
RELEASE_BUILD: ${{ env.release_build }}
run: |
echo "Starting Playwright Reporter for manual regression suite"
yarn workspace @trezor/suite-desktop-core github:report:manual ${{ inputs.testFilter }}
yarn workspace @trezor/suite github:report:manual ${{ inputs.testFilter }}

View File

@@ -1,9 +1,4 @@
{
"ignore-patterns": ["libDev", "lib"],
"ignores": [
"node-loader",
"@playwright/browser-chromium",
"@playwright/browser-firefox",
"@playwright/browser-webkit"
]
"ignores": ["node-loader"]
}

View File

@@ -1,8 +1,4 @@
import {
eslint,
globalNoExtraneousDependenciesDevDependencies,
playwrightEslint,
} from '@trezor/eslint';
import { eslint, globalNoExtraneousDependenciesDevDependencies } from '@trezor/eslint';
export default [
...eslint,
@@ -21,15 +17,4 @@ export default [
],
},
},
{
ignores: ['**/playwright-report/', '**/test-results/'],
},
{
files: ['**/scripts/**'],
rules: {
'no-console': 'off',
'import/no-default-export': 'off',
},
},
playwrightEslint,
];

View File

@@ -10,37 +10,23 @@
"depcheck": "yarn g:depcheck",
"build:core": "yarn g:rimraf dist && TS_NODE_PROJECT=\"tsconfig.json\" yarn webpack --config ./webpack/core.webpack.config.ts",
"type-check": "yarn g:tsc --build tsconfig.json && yarn g:tsc --build scripts/tsconfig.json",
"test:unit": "yarn g:jest",
"test:e2e:desktop": "yarn xvfb-maybe -- playwright test --config=./e2e/playwright.config.ts --project=desktop",
"test:e2e:web": "yarn xvfb-maybe -- playwright test --config=./e2e/playwright.config.ts --project=web",
"test:e2e:update-snapshots": "yarn xvfb-maybe -- playwright test --config=./e2e/playwright.config.ts --grep @snapshot --update-snapshots",
"test:orchestrated:e2e:desktop": "NODE_OPTIONS='--no-warnings=DEP0040' yarn xvfb-maybe -- pwc-p --config=./e2e/playwright.config.ts --project=desktop",
"test:orchestrated:e2e:web": "NODE_OPTIONS='--no-warnings=DEP0040' yarn xvfb-maybe -- pwc-p --config=./e2e/playwright.config.ts --project=web",
"github:report:manual": "NODE_OPTIONS='--no-warnings=DEP0040' yarn xvfb-maybe -- playwright test --config=./e2e/playwright.config.ts --project=manual --reporter=./e2e/support/reporters/gitHubReporter.ts",
"github:create:project": "tsx ./e2e/support/reporters/scriptCreateProject.ts",
"git:bisect": "./e2e/bisect-commits.sh"
"test:unit": "yarn g:jest"
},
"dependencies": {
"@sentry/electron": "^7.2.0",
"@suite-common/message-system": "workspace:*",
"@suite-common/sentry": "workspace:*",
"@suite-common/suite-constants": "workspace:^",
"@suite-common/suite-types": "workspace:*",
"@suite-common/suite-utils": "workspace:*",
"@suite-common/wallet-config": "workspace:*",
"@trezor/coinjoin": "workspace:*",
"@trezor/connect": "workspace:*",
"@trezor/connect-web": "workspace:*",
"@trezor/env-utils": "workspace:*",
"@trezor/eslint": "workspace:*",
"@trezor/ipc-proxy": "workspace:*",
"@trezor/node-utils": "workspace:*",
"@trezor/request-manager": "workspace:*",
"@trezor/suite": "workspace:*",
"@trezor/suite-desktop-api": "workspace:*",
"@trezor/suite-desktop-native": "workspace:*",
"@trezor/theme": "workspace:*",
"@trezor/transport": "workspace:*",
"@trezor/transport-bluetooth": "workspace:*",
"@trezor/transport-bridge": "workspace:*",
"@trezor/urls": "workspace:*",
@@ -54,37 +40,16 @@
"ws": "^8.18.0"
},
"devDependencies": {
"@currents/playwright": "^1.17.0",
"@electron/fuses": "^2.0.0",
"@electron/notarize": "3.1.0",
"@playwright/browser-chromium": "^1.55.0",
"@playwright/browser-firefox": "^1.55.0",
"@playwright/browser-webkit": "^1.55.0",
"@playwright/test": "^1.55.0",
"@sentry/webpack-plugin": "^4.6.0",
"@suite-common/feedback": "workspace:*",
"@suite-common/trading": "workspace:*",
"@suite-common/wallet-utils": "workspace:*",
"@trezor/blockchain-link-types": "workspace:^",
"@trezor/e2e-utils": "workspace:*",
"@trezor/protobuf": "workspace:*",
"@trezor/suite-analytics": "workspace:*",
"@trezor/trezor-user-env-link": "workspace:*",
"@trezor/type-utils": "workspace:*",
"@types/electron-localshortcut": "^3.1.3",
"@types/lodash": "^4.17.16",
"@types/ws": "^8.5.13",
"dotenv": "^16.4.7",
"electron": "39.0.0",
"electron-devtools-installer": "^4.0.0",
"fs-extra": "^11.3.1",
"glob": "^11.0.3",
"jest-diff": "^29.7.0",
"lodash": "^4.17.21",
"react-intl": "^7.1.14",
"terser-webpack-plugin": "^5.3.14",
"tsx": "^4.20.3",
"webpack": "5.102.1",
"xvfb-maybe": "^0.2.1"
"webpack": "5.102.1"
}
}

View File

@@ -18,6 +18,7 @@ const notarizeAfterSignHook = context => {
const appName = context.packager.appInfo.productFilename;
const appPath = `${appOutDir}/${appName}.app`;
// eslint-disable-next-line no-console
console.log(`notarizing ${appPath} ...`);
return notarize({
@@ -28,4 +29,5 @@ const notarizeAfterSignHook = context => {
});
};
// eslint-disable-next-line import/no-default-export
export default notarizeAfterSignHook;

View File

@@ -23,6 +23,7 @@ const afterPackHookSetElectronFuses = async context => {
So we only set the appropriate fuses for Windows
*/
if (electronPlatformName !== 'win32') {
// eslint-disable-next-line no-console
console.log('Skipping electron fuses ');
return;
@@ -33,6 +34,7 @@ const afterPackHookSetElectronFuses = async context => {
const binaryFilename = `${appName}${ext}`;
const binaryPath = path.join(appOutDir, binaryFilename);
// eslint-disable-next-line no-console
console.log(`Setting electron fuses on ${binaryPath}`);
await flipFuses(binaryPath, {
@@ -41,7 +43,9 @@ const afterPackHookSetElectronFuses = async context => {
[FuseV1Options.OnlyLoadAppFromAsar]: true,
});
// eslint-disable-next-line no-console
console.log('Successfully set electron fuses');
};
// eslint-disable-next-line import/no-default-export
export default afterPackHookSetElectronFuses;

View File

@@ -10,6 +10,7 @@ import { execSync } from 'node:child_process';
const signWindows = async configuration => {
// Check if IS_CODESIGN_BUILD is set and true
if (!process.env.IS_CODESIGN_BUILD || process.env.IS_CODESIGN_BUILD.toLowerCase() !== 'true') {
// eslint-disable-next-line no-console
console.log('This is DEV build, not signing');
return;
@@ -28,4 +29,5 @@ const signWindows = async configuration => {
);
};
// eslint-disable-next-line import/no-default-export
export default signWindows;

View File

@@ -3,49 +3,27 @@
"compilerOptions": { "outDir": "libDev" },
"include": ["src", "e2e", "**/*.json"],
"references": [
{
"path": "../../suite-common/message-system"
},
{ "path": "../../suite-common/sentry" },
{
"path": "../../suite-common/suite-constants"
},
{
"path": "../../suite-common/suite-types"
},
{
"path": "../../suite-common/suite-utils"
},
{
"path": "../../suite-common/wallet-config"
},
{ "path": "../coinjoin" },
{ "path": "../connect" },
{ "path": "../connect-web" },
{ "path": "../env-utils" },
{ "path": "../eslint" },
{ "path": "../ipc-proxy" },
{ "path": "../node-utils" },
{ "path": "../request-manager" },
{ "path": "../suite" },
{ "path": "../suite-desktop-api" },
{ "path": "../suite-desktop-native" },
{ "path": "../theme" },
{ "path": "../transport" },
{ "path": "../transport-bluetooth" },
{ "path": "../transport-bridge" },
{ "path": "../urls" },
{ "path": "../utils" },
{ "path": "../../suite-common/feedback" },
{ "path": "../../suite-common/trading" },
{
"path": "../../suite-common/wallet-utils"
},
{ "path": "../blockchain-link-types" },
{ "path": "../e2e-utils" },
{ "path": "../protobuf" },
{ "path": "../suite-analytics" },
{ "path": "../trezor-user-env-link" },
{ "path": "../type-utils" }
]
}

View File

@@ -5,6 +5,10 @@
"src",
"stylelint-config-standard",
"postcss-styled-syntax",
"typescript-styled-plugin"
"typescript-styled-plugin",
"node-loader",
"@playwright/browser-chromium",
"@playwright/browser-firefox",
"@playwright/browser-webkit"
]
}

View File

@@ -43,7 +43,7 @@ if [ "\$TARGET" = "desktop" ]; then
yarn workspace @trezor/suite-desktop build:app
set +e
yarn workspace @trezor/suite-desktop-core test:e2e:desktop "\$TEST_FILE"
yarn workspace @trezor/suite test:e2e:desktop "\$TEST_FILE"
RESULT=\$?
set -e
@@ -55,7 +55,7 @@ elif [ "\$TARGET" = "web" ]; then
wait_for_web_server || { kill "\$SERVER_PID" || true; exit 125; }
set +e
yarn workspace @trezor/suite-desktop-core test:e2e:web "\$TEST_FILE"
yarn workspace @trezor/suite test:e2e:web "\$TEST_FILE"
RESULT=\$?
set -e

View File

@@ -67,5 +67,4 @@ const config: PlaywrightTestConfig = defineConfig<CurrentsFixtures, CurrentsWork
snapshotPathTemplate: 'snapshots/{projectName}/{testFilePath}/{arg}{ext}',
});
// eslint-disable-next-line import/no-default-export
export default config;

View File

@@ -1,11 +1,11 @@
import { Page } from '@playwright/test';
import { urlSearchParams } from '@trezor/suite/src/utils/suite/metadata';
import { SuiteAnalyticsEvent } from '@trezor/suite-analytics';
import { step } from './common';
import { expect } from './testExtends/customMatchers';
import { EventPayload, Requests } from './types';
import { expect } from '../support/fixtures';
import { urlSearchParams } from '../../src/utils/suite/metadata';
export class AnalyticsFixture {
private page: Page;

View File

@@ -1,8 +1,8 @@
import { Page } from '@playwright/test';
import { DropboxMock, GoogleMock } from '@trezor/e2e-utils';
import { encrypt } from '@trezor/suite/src/utils/suite/metadata';
import { encrypt } from '../../../src/utils/suite/metadata';
import { step } from '../common';
export enum MetadataProvider {

Some files were not shown because too many files have changed in this diff Show More