Skip to content

Commit 22bd132

Browse files
committed
Add -u shorthand option for updating baseline screenshots and snapshots
1 parent 56f0c9b commit 22bd132

File tree

5 files changed

+21
-6
lines changed

5 files changed

+21
-6
lines changed

packages/kbn-test/src/functional_test_runner/cli.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ export function runFtrCli() {
6060
include: toArray(flags['include-tag'] as string | string[]),
6161
exclude: toArray(flags['exclude-tag'] as string | string[]),
6262
},
63-
updateBaselines: flags.updateBaselines,
64-
updateSnapshots: flags.updateSnapshots,
63+
updateBaselines: flags.updateBaselines || flags.u,
64+
updateSnapshots: flags.updateSnapshots || flags.u,
6565
}
6666
);
6767

@@ -132,9 +132,10 @@ export function runFtrCli() {
132132
'invert',
133133
'test-stats',
134134
'updateBaselines',
135+
'updateSnapshots',
136+
'u',
135137
'throttle',
136138
'headless',
137-
'updateSnapshots',
138139
],
139140
default: {
140141
config: 'test/functional/config.js',
@@ -151,6 +152,7 @@ export function runFtrCli() {
151152
--test-stats print the number of tests (included and excluded) to STDERR
152153
--updateBaselines replace baseline screenshots with whatever is generated from the test
153154
--updateSnapshots replace inline and file snapshots with whatever is generated from the test
155+
-u replace both baseline screenshots and snapshots
154156
--kibana-install-dir directory where the Kibana install being tested resides
155157
--throttle enable network throttling in Chrome browser
156158
--headless run browser in headless mode

packages/kbn-test/src/functional_tests/cli/run_tests/__snapshots__/args.test.js.snap

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/kbn-test/src/functional_tests/cli/run_tests/__snapshots__/cli.test.js.snap

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/kbn-test/src/functional_tests/cli/run_tests/args.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ const options = {
4747
desc: 'Replace baseline screenshots with whatever is generated from the test.',
4848
},
4949
updateSnapshots: {
50-
desc: 'replace inline and file snapshots with whatever is generated from the test.',
50+
desc: 'Replace inline and file snapshots with whatever is generated from the test.',
51+
},
52+
u: {
53+
desc: 'Replace both baseline screenshots and snapshots',
5154
},
5255
include: {
5356
arg: '<file>',

packages/kbn-test/src/functional_tests/cli/run_tests/cli.test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,14 @@ describe('run tests CLI', () => {
133133
expect(exitMock).not.toHaveBeenCalledWith();
134134
});
135135

136+
it('accepts boolean value for -u', async () => {
137+
global.process.argv.push('-u');
138+
139+
await runTestsCli(['foo']);
140+
141+
expect(exitMock).not.toHaveBeenCalledWith();
142+
});
143+
136144
it('accepts source value for esFrom', async () => {
137145
global.process.argv.push('--esFrom', 'source');
138146

0 commit comments

Comments
 (0)