mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
Add flag to update E2E snapshots (#20514)
The E2E test scripts now have a flag for updating E2E test snapshots. The flag has been documented as well. This makes it easier to update snapshots and raises visbility of this feature.
This commit is contained in:
parent
861c30de29
commit
6c50587878
@ -97,6 +97,8 @@ Single e2e tests can be run with `yarn test:e2e:single test/e2e/tests/TEST_NAME.
|
|||||||
--leave-running Leaves the browser running after a test fails, along with
|
--leave-running Leaves the browser running after a test fails, along with
|
||||||
anything else that the test used (ganache, the test dapp,
|
anything else that the test used (ganache, the test dapp,
|
||||||
etc.) [boolean] [default: false]
|
etc.) [boolean] [default: false]
|
||||||
|
--update-snapshot Update E2E test snapshots
|
||||||
|
[alias: -u] [boolean] [default: false]
|
||||||
```
|
```
|
||||||
|
|
||||||
For example, to run the `account-details` tests using Chrome, with debug logging and with the browser set to remain open upon failure, you would use:
|
For example, to run the `account-details` tests using Chrome, with debug logging and with the browser set to remain open upon failure, you would use:
|
||||||
|
@ -74,12 +74,27 @@ async function main() {
|
|||||||
description:
|
description:
|
||||||
'Set how many times the test should be retried upon failure.',
|
'Set how many times the test should be retried upon failure.',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
|
})
|
||||||
|
.option('update-snapshot', {
|
||||||
|
alias: 'u',
|
||||||
|
default: false,
|
||||||
|
description: 'Update E2E snapshots',
|
||||||
|
type: 'boolean',
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.strict()
|
.strict()
|
||||||
.help('help');
|
.help('help');
|
||||||
|
|
||||||
const { browser, debug, retries, snaps, mv3, rpc, buildType } = argv;
|
const {
|
||||||
|
browser,
|
||||||
|
debug,
|
||||||
|
retries,
|
||||||
|
snaps,
|
||||||
|
mv3,
|
||||||
|
rpc,
|
||||||
|
buildType,
|
||||||
|
updateSnapshot,
|
||||||
|
} = argv;
|
||||||
|
|
||||||
let testPaths;
|
let testPaths;
|
||||||
|
|
||||||
@ -130,6 +145,9 @@ async function main() {
|
|||||||
if (debug) {
|
if (debug) {
|
||||||
args.push('--debug');
|
args.push('--debug');
|
||||||
}
|
}
|
||||||
|
if (updateSnapshot) {
|
||||||
|
args.push('--update-snapshot');
|
||||||
|
}
|
||||||
|
|
||||||
// For running E2Es in parallel in CI
|
// For running E2Es in parallel in CI
|
||||||
const currentChunkIndex = process.env.CIRCLE_NODE_INDEX ?? 0;
|
const currentChunkIndex = process.env.CIRCLE_NODE_INDEX ?? 0;
|
||||||
|
@ -42,6 +42,12 @@ async function main() {
|
|||||||
'Leaves the browser running after a test fails, along with anything else that the test used (ganache, the test dapp, etc.)',
|
'Leaves the browser running after a test fails, along with anything else that the test used (ganache, the test dapp, etc.)',
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
})
|
})
|
||||||
|
.option('update-snapshot', {
|
||||||
|
alias: 'u',
|
||||||
|
default: false,
|
||||||
|
description: 'Update E2E snapshots',
|
||||||
|
type: 'boolean',
|
||||||
|
})
|
||||||
.positional('e2e-test-path', {
|
.positional('e2e-test-path', {
|
||||||
describe: 'The path for the E2E test to run.',
|
describe: 'The path for the E2E test to run.',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
@ -58,6 +64,7 @@ async function main() {
|
|||||||
retries,
|
retries,
|
||||||
retryUntilFailure,
|
retryUntilFailure,
|
||||||
leaveRunning,
|
leaveRunning,
|
||||||
|
updateSnapshot,
|
||||||
} = argv;
|
} = argv;
|
||||||
|
|
||||||
if (!browser) {
|
if (!browser) {
|
||||||
@ -103,6 +110,10 @@ async function main() {
|
|||||||
exit = '--no-exit';
|
exit = '--no-exit';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (updateSnapshot) {
|
||||||
|
process.env.UPDATE_SNAPSHOTS = 'true';
|
||||||
|
}
|
||||||
|
|
||||||
const configFile = path.join(__dirname, '.mocharc.js');
|
const configFile = path.join(__dirname, '.mocharc.js');
|
||||||
const extraArgs = process.env.E2E_ARGS?.split(' ') || [];
|
const extraArgs = process.env.E2E_ARGS?.split(' ') || [];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user