Skip to content

Commit

Permalink
Add -u shorthand option for updating baseline screenshots and snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
dgieselaar committed Nov 11, 2020
1 parent 56f0c9b commit 22bd132
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 6 deletions.
8 changes: 5 additions & 3 deletions packages/kbn-test/src/functional_test_runner/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ export function runFtrCli() {
include: toArray(flags['include-tag'] as string | string[]),
exclude: toArray(flags['exclude-tag'] as string | string[]),
},
updateBaselines: flags.updateBaselines,
updateSnapshots: flags.updateSnapshots,
updateBaselines: flags.updateBaselines || flags.u,
updateSnapshots: flags.updateSnapshots || flags.u,
}
);

Expand Down Expand Up @@ -132,9 +132,10 @@ export function runFtrCli() {
'invert',
'test-stats',
'updateBaselines',
'updateSnapshots',
'u',
'throttle',
'headless',
'updateSnapshots',
],
default: {
config: 'test/functional/config.js',
Expand All @@ -151,6 +152,7 @@ export function runFtrCli() {
--test-stats print the number of tests (included and excluded) to STDERR
--updateBaselines replace baseline screenshots with whatever is generated from the test
--updateSnapshots replace inline and file snapshots with whatever is generated from the test
-u replace both baseline screenshots and snapshots
--kibana-install-dir directory where the Kibana install being tested resides
--throttle enable network throttling in Chrome browser
--headless run browser in headless mode
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion packages/kbn-test/src/functional_tests/cli/run_tests/args.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ const options = {
desc: 'Replace baseline screenshots with whatever is generated from the test.',
},
updateSnapshots: {
desc: 'replace inline and file snapshots with whatever is generated from the test.',
desc: 'Replace inline and file snapshots with whatever is generated from the test.',
},
u: {
desc: 'Replace both baseline screenshots and snapshots',
},
include: {
arg: '<file>',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ describe('run tests CLI', () => {
expect(exitMock).not.toHaveBeenCalledWith();
});

it('accepts boolean value for -u', async () => {
global.process.argv.push('-u');

await runTestsCli(['foo']);

expect(exitMock).not.toHaveBeenCalledWith();
});

it('accepts source value for esFrom', async () => {
global.process.argv.push('--esFrom', 'source');

Expand Down

0 comments on commit 22bd132

Please sign in to comment.