Skip to content

Commit

Permalink
[ftr/cli] add headless option, fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
dmlemeshko committed Dec 10, 2019
1 parent 475dad8 commit 1c26fdc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
21 changes: 10 additions & 11 deletions packages/kbn-test/src/functional_test_runner/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,13 @@ export function runFtrCli() {
}
);

process.env.TEST_THROTTLE_NETWORK = flags.throttle as string;
if (flags.throttle) {
process.env.TEST_THROTTLE_NETWORK = '1';
}

if (flags.headless) {
process.env.TEST_BROWSER_HEADLESS = '1';
}

let teardownRun = false;
const teardown = async (err?: Error) => {
Expand Down Expand Up @@ -98,16 +104,8 @@ export function runFtrCli() {
},
{
flags: {
string: [
'config',
'grep',
'exclude',
'include-tag',
'exclude-tag',
'kibana-install-dir',
'throttle',
],
boolean: ['bail', 'invert', 'test-stats', 'updateBaselines'],
string: ['config', 'grep', 'exclude', 'include-tag', 'exclude-tag', 'kibana-install-dir'],
boolean: ['bail', 'invert', 'test-stats', 'updateBaselines', 'throttle', 'headless'],
default: {
config: 'test/functional/config.js',
debug: true,
Expand All @@ -124,6 +122,7 @@ export function runFtrCli() {
--updateBaselines replace baseline screenshots with whatever is generated from the test
--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
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,15 @@ describe('run tests CLI', () => {

await runTestsCli(['foo']);

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

it('accepts headless option', async () => {
global.process.argv.push('--headless');

await runTestsCli(['foo']);

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

it('accepts extra server options', async () => {
Expand Down

0 comments on commit 1c26fdc

Please sign in to comment.