diff --git a/packages/connect/e2e/README.md b/packages/connect/e2e/README.md index 203cd548d828..aebdcb797912 100644 --- a/packages/connect/e2e/README.md +++ b/packages/connect/e2e/README.md @@ -17,6 +17,16 @@ you may use the following params: -i ``` +## karma test + +Browser console is not visible in the terminal. Use KARMA_SINGLE_RUN env variable and debug test at http://localhost:8099/debug.html in your favorite browser. + +For local changes to take effect build connect-iframe or connect-web depending where they were made and restart test. + +``` +TESTS_PATTERN="init" KARMA_SINGLE_RUN=false yarn workspace @trezor/connect test:e2e:web +``` + ## Transactions cache Bitcoin-like coins `signTransaction` method require additional data about transactions referenced from used inputs. diff --git a/packages/connect/e2e/__fixtures__/stellarSignTransaction.ts b/packages/connect/e2e/__fixtures__/stellarSignTransaction.ts index 5c3d5b986ef6..22818af2705a 100644 --- a/packages/connect/e2e/__fixtures__/stellarSignTransaction.ts +++ b/packages/connect/e2e/__fixtures__/stellarSignTransaction.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/prefer-ts-expect-error */ // @ts-ignore import commonFixtures from '../../../../submodules/trezor-common/tests/fixtures/stellar/sign_tx.json'; -import { Messages } from '@trezor/transport/src'; +import * as Messages from '@trezor/protobuf/src/messages'; // operations are in protobuf format (snake_case) diff --git a/packages/connect/e2e/karma.config.js b/packages/connect/e2e/karma.config.js index 6d36cd7d7abc..eba6f9ccf197 100644 --- a/packages/connect/e2e/karma.config.js +++ b/packages/connect/e2e/karma.config.js @@ -2,32 +2,25 @@ const path = require('path'); const webpack = require('webpack'); module.exports = config => { + const singleRun = process.env.KARMA_SINGLE_RUN === 'false' ? false : true; + config.set({ basePath: path.resolve(__dirname, '../..'), // NOTE: "[monorepo-root]/packages", to have access to other packages hostname: 'localhost', port: 8099, autoWatch: false, - // to debug locally set single run to false and go to http://localhost:8099/debug.html - // for local changes to take effect build connect-iframe and connect-web - singleRun: true, + singleRun, client: { captureConsole: true, clearContext: true, useIframe: false, runInParent: true, - mocha: { - bail: true, - }, // uncomment to disable random ordering of tests jasmine: { random: false, }, }, - browserConsoleLogOptions: { - terminal: true, - level: '', - }, browsers: [ // 'Chrome', 'ChromeHeadlessNoSandbox', @@ -74,7 +67,7 @@ module.exports = config => { }, ...(process.env.TESTS_PATTERN || '*') .split(' ') - .map(pattern => path.resolve(__dirname, `./tests/**/${pattern.trim()}.test.ts`)), + .map(pattern => path.resolve(__dirname, `./tests/**/${pattern.trim()}*.ts`)), ], webpackMiddleware: { diff --git a/packages/connect/e2e/karma.plugin.js b/packages/connect/e2e/karma.plugin.js index 08d786818ba3..44caeafe4dd6 100644 --- a/packages/connect/e2e/karma.plugin.js +++ b/packages/connect/e2e/karma.plugin.js @@ -11,25 +11,26 @@ function CustomReporter(rootConfig, logger) { log.info('Running @trezor/connect tests...'); log.info('FW:', process.env.TESTS_FIRMWARE); log.info('Methods:', process.env.TESTS_INCLUDED_METHODS || 'All'); - }, - - onSpecStart: (_browser, spec) => { - log.warn('onSpecStart', spec); + log.info('Pattern:', process.env.TESTS_PATTERN || '*'); }, onSpecComplete: (_browser, spec) => { - log.info(spec.success ? '✓' : '✖', spec.fullName); - if (!spec.success) { - log.info(spec); + if (spec.skipped) { + log.warn('○ skipped', spec.fullName); + } else if (spec.success) { + log.info('✓', spec.fullName); + } else { + log.error('✖', spec.fullName); + log.error(spec); } }, onRunComplete: () => { - log.warn('onRunComplete'); + log.info('onRunComplete'); }, onExit: done => { - log.warn('onExit'); + log.info('onExit'); done(); }, }; diff --git a/packages/connect/e2e/karma.setup.js b/packages/connect/e2e/karma.setup.js index 666eedd92dcd..73851c17b470 100644 --- a/packages/connect/e2e/karma.setup.js +++ b/packages/connect/e2e/karma.setup.js @@ -59,6 +59,8 @@ jasmine.getEnv().beforeAll(() => { }); }); +it.skip = xit; +it.only = fit; // expect is missing "any" matcher expect.any = jasmine.any;