[FTR] enable recommended mocha + no-floating-promises ESLint rules (#190690)

## Summary

This PR enforces ESLint rules in FTR tests, in particular:
- `no-floating-promises` rule to catch unawaited Promises in
tests/services/page objects

_Why is it important?_
- Keep correct test execution order: cleanup code may run before the
async operation is completed, leading to unexpected behavior in
subsequent tests
- Accurate test results: If a test completes before an async operation
(e.g., API request) has finished, Mocha might report the test as passed
or failed based on incomplete context.
```
198:11  error  Promises must be awaited, end with a call to .catch, end with a call to .then
with a rejection handler or be explicitly marked as ignored with the `void` operator 
@typescript-eslint/no-floating-promises
```
<img width="716" alt="Screenshot 2024-08-20 at 14 04 43"
src="https://github.com/user-attachments/assets/9afffe4c-4b51-4790-964c-c44a76baed1e">

- recommended rules from
[eslint-mocha-plugin](https://www.npmjs.com/package/eslint-plugin-mocha)
including:
-
[no-async-describe](https://github.com/lo1tuma/eslint-plugin-mocha/blob/main/docs/rules/no-async-describe.md)
-
[no-identical-title.md](https://github.com/lo1tuma/eslint-plugin-mocha/blob/main/docs/rules/no-identical-title.md)
-
[no-sibling-hooks.md](https://github.com/lo1tuma/eslint-plugin-mocha/blob/main/docs/rules/no-sibling-hooks.md)
and others

Note for reviewers: some tests were skipped due to failures after
missing `await` was added. Most likely is a "false positive" case when
test is finished before async operation is actually completed. Please
work on fixing and re-enabling it

---------

Co-authored-by: Tiago Costa <tiago.costa@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Dzmitry Lemechko 2024-08-23 18:54:36 +02:00 committed by GitHub
parent e2c234fcbf
commit fa69337c94
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
220 changed files with 947 additions and 856 deletions

View file

@ -1365,6 +1365,25 @@ module.exports = {
'react/jsx-fragments': 'error', 'react/jsx-fragments': 'error',
}, },
}, },
{
files: [
'test/{accessibility,*functional*,*api_integration*}/apps/**/*.{js,ts}',
'x-pack/test/{accessibility,*functional*,*api_integration*}/apps/**/*.{js,ts}',
'x-pack/test_serverless/{functional,api_integration}/test_suites/**/*.{js,ts}',
],
extends: ['plugin:mocha/recommended'],
plugins: ['mocha'],
env: {
mocha: true,
},
rules: {
'mocha/no-mocha-arrows': 'off',
'mocha/no-exports': 'off',
'mocha/no-setup-in-describe': 'off',
'mocha/no-nested-tests': 'off',
'mocha/no-skipped-tests': 'off',
},
},
{ {
files: ['x-pack/plugins/lists/public/**/!(*.test).{js,mjs,ts,tsx}'], files: ['x-pack/plugins/lists/public/**/!(*.test).{js,mjs,ts,tsx}'],
plugins: ['react-perf'], plugins: ['react-perf'],

View file

@ -159,7 +159,7 @@ describe('ApplicationService', () => {
await act(async () => { await act(async () => {
await navigateToApp('app1'); await navigateToApp('app1');
update(); await update();
}); });
expect(currentAppIds).toEqual(['app1']); expect(currentAppIds).toEqual(['app1']);
@ -195,15 +195,15 @@ describe('ApplicationService', () => {
await act(async () => { await act(async () => {
await navigateToApp('app1'); await navigateToApp('app1');
update(); await update();
}); });
await act(async () => { await act(async () => {
await navigateToApp('app2', { path: '/nested' }); await navigateToApp('app2', { path: '/nested' });
update(); await update();
}); });
await act(async () => { await act(async () => {
await navigateToApp('app2', { path: '/another-path' }); await navigateToApp('app2', { path: '/another-path' });
update(); await update();
}); });
expect(locations).toEqual(['/', '/app/app1', '/app/app2/nested', '/app/app2/another-path']); expect(locations).toEqual(['/', '/app/app1', '/app/app2/nested', '/app/app2/another-path']);
@ -625,9 +625,14 @@ describe('ApplicationService', () => {
title: 'App1', title: 'App1',
mount: async ({ setHeaderActionMenu }: AppMountParameters) => { mount: async ({ setHeaderActionMenu }: AppMountParameters) => {
setHeaderActionMenu(mounter1); setHeaderActionMenu(mounter1);
promise.then(() => { promise
setHeaderActionMenu(mounter2); .then(() => {
}); setHeaderActionMenu(mounter2);
})
.catch((error) => {
// eslint-disable-next-line no-console
console.error('Error:', error);
});
return () => undefined; return () => undefined;
}, },
}); });
@ -663,9 +668,14 @@ describe('ApplicationService', () => {
title: 'App1', title: 'App1',
mount: async ({ setHeaderActionMenu }: AppMountParameters) => { mount: async ({ setHeaderActionMenu }: AppMountParameters) => {
setHeaderActionMenu(mounter1); setHeaderActionMenu(mounter1);
promise.then(() => { promise
setHeaderActionMenu(undefined); .then(() => {
}); setHeaderActionMenu(undefined);
})
.catch((error) => {
// eslint-disable-next-line no-console
console.error('Error:', error);
});
return () => undefined; return () => undefined;
}, },
}); });

View file

@ -26,7 +26,7 @@ module.exports = {
}, },
overrides: [ overrides: [
{ {
files: ['server/**/*'], files: ['server/**/*', '*functional*/**/*', '*api_integration*/**/*'],
rules: { rules: {
// Let's focus on server-side errors first to avoid server crashes. // Let's focus on server-side errors first to avoid server crashes.
// We'll tackle /public eventually. // We'll tackle /public eventually.

View file

@ -20,7 +20,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const dashboardName = 'Dashboard Listing A11y'; const dashboardName = 'Dashboard Listing A11y';
const clonedDashboardName = 'Dashboard Listing A11y (1)'; const clonedDashboardName = 'Dashboard Listing A11y (1)';
it('dashboard', async () => { it('navitate to dashboard app', async () => {
await PageObjects.common.navigateToApp('dashboard'); await PageObjects.common.navigateToApp('dashboard');
await a11y.testAppSnapshot(); await a11y.testAppSnapshot();
}); });
@ -61,7 +61,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await a11y.testAppSnapshot(); await a11y.testAppSnapshot();
}); });
it('Open Edit mode', async () => { it('Open Edit mode again', async () => {
await PageObjects.dashboard.switchToEditMode(); await PageObjects.dashboard.switchToEditMode();
await a11y.testAppSnapshot(); await a11y.testAppSnapshot();
}); });
@ -86,7 +86,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await a11y.testAppSnapshot(); await a11y.testAppSnapshot();
}); });
it('Open add panel', async () => { it('Open add panel again', async () => {
await dashboardAddPanel.clickOpenAddPanel(); await dashboardAddPanel.clickOpenAddPanel();
await a11y.testAppSnapshot(); await a11y.testAppSnapshot();
}); });

View file

@ -25,7 +25,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await a11y.testAppSnapshot(); await a11y.testAppSnapshot();
}); });
describe('data views', async () => { describe('data views', () => {
before(async () => { before(async () => {
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional'); await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional');
await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover'); await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover');

View file

@ -58,7 +58,7 @@ export default function ({ getService }: FtrProviderContext) {
expect(response.get('vary')).to.equal('accept-encoding, user-hash'); expect(response.get('vary')).to.equal('accept-encoding, user-hash');
expect(response.get('etag')).to.not.be.empty(); expect(response.get('etag')).to.not.be.empty();
kibanaServer.uiSettings.replace({ 'data_views:cache_max_age': 5 }); await kibanaServer.uiSettings.replace({ 'data_views:cache_max_age': 5 });
}); });
it('returns 304 on matching etag', async () => { it('returns 304 on matching etag', async () => {

View file

@ -8,7 +8,6 @@
import _ from 'lodash'; import _ from 'lodash';
import expect from '@kbn/expect'; import expect from '@kbn/expect';
import { asyncForEach } from '@kbn/std';
import { FtrProviderContext } from '../../../ftr_provider_context'; import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) { export default function ({ getService, getPageObjects }: FtrProviderContext) {
@ -17,6 +16,24 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['common', 'console', 'header']); const PageObjects = getPageObjects(['common', 'console', 'header']);
const find = getService('find'); const find = getService('find');
async function runTemplateTest(type: string, template: string) {
await PageObjects.console.enterText(`{\n\t"type": "${type}"`);
await PageObjects.console.pressEnter();
await PageObjects.console.sleepForDebouncePeriod();
// Prompt autocomplete for 'settings'
await PageObjects.console.promptAutocomplete('s');
await retry.waitFor('autocomplete to be visible', () =>
PageObjects.console.isAutocompleteVisible()
);
await PageObjects.console.pressEnter();
await retry.try(async () => {
const request = await PageObjects.console.getRequest();
log.debug(request);
expect(request).to.contain(`${template}`);
});
}
describe('console autocomplete feature', function describeIndexTests() { describe('console autocomplete feature', function describeIndexTests() {
this.tags('includeFirefox'); this.tags('includeFirefox');
before(async () => { before(async () => {
@ -365,47 +382,27 @@ GET _search
}); });
}); });
describe('with conditional templates', async () => { describe('with conditional templates', () => {
const CONDITIONAL_TEMPLATES = [
{
type: 'fs',
template: `"location": "path"`,
},
{
type: 'url',
template: `"url": ""`,
},
{ type: 's3', template: `"bucket": ""` },
{
type: 'azure',
template: `"path": ""`,
},
];
beforeEach(async () => { beforeEach(async () => {
await PageObjects.console.clearTextArea(); await PageObjects.console.clearTextArea();
await PageObjects.console.enterRequest('\n POST _snapshot/test_repo'); await PageObjects.console.enterRequest('\n POST _snapshot/test_repo');
await PageObjects.console.pressEnter(); await PageObjects.console.pressEnter();
}); });
await asyncForEach(CONDITIONAL_TEMPLATES, async ({ type, template }) => { it('should insert fs template', async () => {
it('should insert different templates depending on the value of type', async () => { await runTemplateTest('fs', `"location": "path"`);
await PageObjects.console.enterText(`{\n\t"type": "${type}"`); });
await PageObjects.console.pressEnter();
await PageObjects.console.sleepForDebouncePeriod();
// Prompt autocomplete for 'settings'
await PageObjects.console.promptAutocomplete('s');
await retry.waitFor('autocomplete to be visible', () => it('should insert url template', async () => {
PageObjects.console.isAutocompleteVisible() await runTemplateTest('url', `"url": ""`);
); });
await PageObjects.console.pressEnter();
await retry.try(async () => { it('should insert s3 template', async () => {
const request = await PageObjects.console.getRequest(); await runTemplateTest('s3', `"bucket": ""`);
log.debug(request); });
expect(request).to.contain(`${template}`);
}); it('should insert azure template', async () => {
}); await runTemplateTest('azure', `"path": ""`);
}); });
}); });
}); });

View file

@ -7,7 +7,6 @@
*/ */
import expect from '@kbn/expect'; import expect from '@kbn/expect';
import { asyncForEach } from '@kbn/std';
import { FtrProviderContext } from '../../../ftr_provider_context'; import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) { export default function ({ getService, getPageObjects }: FtrProviderContext) {
@ -15,6 +14,18 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const retry = getService('retry'); const retry = getService('retry');
const PageObjects = getPageObjects(['common', 'console', 'header']); const PageObjects = getPageObjects(['common', 'console', 'header']);
const enterRequest = async (url: string, body: string) => {
await PageObjects.console.clearTextArea();
await PageObjects.console.enterRequest(url);
await PageObjects.console.pressEnter();
await PageObjects.console.enterText(body);
};
async function runTest(input: { url?: string; body: string }, fn: () => Promise<void>) {
await enterRequest(input.url ?? '\nGET search', input.body);
await fn();
}
// Failing: See https://github.com/elastic/kibana/issues/138160 // Failing: See https://github.com/elastic/kibana/issues/138160
describe.skip('console app', function testComments() { describe.skip('console app', function testComments() {
this.tags('includeFirefox'); this.tags('includeFirefox');
@ -27,130 +38,193 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
}); });
}); });
describe('with comments', async () => { describe('with comments', () => {
const enterRequest = async (url: string, body: string) => { describe('with single line comments', () => {
await PageObjects.console.clearTextArea(); it('should allow in request url, using //', async () => {
await PageObjects.console.enterRequest(url); await runTest(
await PageObjects.console.pressEnter();
await PageObjects.console.enterText(body);
};
async function runTests(
tests: Array<{ description: string; url?: string; body: string }>,
fn: () => Promise<void>
) {
await asyncForEach(tests, async ({ description, url, body }) => {
it(description, async () => {
await enterRequest(url ?? '\nGET search', body);
await fn();
});
});
}
describe('with single line comments', async () => {
await runTests(
[
{ {
url: '\n// GET _search', url: '\n// GET _search',
body: '', body: '',
description: 'should allow in request url, using //',
}, },
async () => {
expect(await PageObjects.console.hasInvalidSyntax()).to.be(false);
expect(await PageObjects.console.hasErrorMarker()).to.be(false);
}
);
});
it('should allow in request body, using //', async () => {
await runTest(
{ {
body: '{\n\t\t"query": {\n\t\t\t// "match_all": {}', body: '{\n\t\t"query": {\n\t\t\t// "match_all": {}',
description: 'should allow in request body, using //',
}, },
async () => {
expect(await PageObjects.console.hasInvalidSyntax()).to.be(false);
expect(await PageObjects.console.hasErrorMarker()).to.be(false);
}
);
});
it('should allow in request url, using #', async () => {
await runTest(
{ {
url: '\n # GET _search', url: '\n # GET _search',
body: '', body: '',
description: 'should allow in request url, using #',
}, },
async () => {
expect(await PageObjects.console.hasInvalidSyntax()).to.be(false);
expect(await PageObjects.console.hasErrorMarker()).to.be(false);
}
);
});
it('should allow in request body, using #', async () => {
await runTest(
{ {
body: '{\n\t\t"query": {\n\t\t\t# "match_all": {}', body: '{\n\t\t"query": {\n\t\t\t# "match_all": {}',
description: 'should allow in request body, using #',
}, },
async () => {
expect(await PageObjects.console.hasInvalidSyntax()).to.be(false);
expect(await PageObjects.console.hasErrorMarker()).to.be(false);
}
);
});
it('should accept as field names, using //', async () => {
await runTest(
{ {
description: 'should accept as field names, using //',
body: '{\n "//": {}', body: '{\n "//": {}',
}, },
async () => {
expect(await PageObjects.console.hasInvalidSyntax()).to.be(false);
expect(await PageObjects.console.hasErrorMarker()).to.be(false);
}
);
});
it('should accept as field values, using //', async () => {
await runTest(
{ {
description: 'should accept as field values, using //',
body: '{\n "f": "//"', body: '{\n "f": "//"',
}, },
async () => {
expect(await PageObjects.console.hasInvalidSyntax()).to.be(false);
expect(await PageObjects.console.hasErrorMarker()).to.be(false);
}
);
});
it('should accept as field names, using #', async () => {
await runTest(
{ {
description: 'should accept as field names, using #',
body: '{\n "#": {}', body: '{\n "#": {}',
}, },
async () => {
expect(await PageObjects.console.hasInvalidSyntax()).to.be(false);
expect(await PageObjects.console.hasErrorMarker()).to.be(false);
}
);
});
it('should accept as field values, using #', async () => {
await runTest(
{ {
description: 'should accept as field values, using #',
body: '{\n "f": "#"', body: '{\n "f": "#"',
}, },
], async () => {
async () => { expect(await PageObjects.console.hasInvalidSyntax()).to.be(false);
expect(await PageObjects.console.hasInvalidSyntax()).to.be(false); expect(await PageObjects.console.hasErrorMarker()).to.be(false);
expect(await PageObjects.console.hasErrorMarker()).to.be(false); }
} );
); });
}); });
describe('with multiline comments', async () => { describe('with multiline comments', () => {
await runTests( it('should allow in request url, using /* */', async () => {
[ await runTest(
{ {
url: '\n /* \nGET _search \n*/', url: '\n /* \nGET _search \n*/',
body: '', body: '',
description: 'should allow in request url, using /* */',
}, },
async () => {
expect(await PageObjects.console.hasInvalidSyntax()).to.be(false);
expect(await PageObjects.console.hasErrorMarker()).to.be(false);
}
);
});
it('should allow in request body, using /* */', async () => {
await runTest(
{ {
body: '{\n\t\t"query": {\n\t\t\t/* "match_all": {} */', body: '{\n\t\t"query": {\n\t\t\t/* "match_all": {} */',
description: 'should allow in request body, using /* */',
}, },
async () => {
expect(await PageObjects.console.hasInvalidSyntax()).to.be(false);
expect(await PageObjects.console.hasErrorMarker()).to.be(false);
}
);
});
it('should accept as field names, using /*', async () => {
await runTest(
{ {
description: 'should accept as field names, using /*',
body: '{\n "/*": {} \n\t\t /* "f": 1 */', body: '{\n "/*": {} \n\t\t /* "f": 1 */',
}, },
async () => {
expect(await PageObjects.console.hasInvalidSyntax()).to.be(false);
expect(await PageObjects.console.hasErrorMarker()).to.be(false);
}
);
});
it('should accept as field values, using */', async () => {
await runTest(
{ {
description: 'should accept as field values, using */',
body: '{\n /* "f": 1 */ \n"f": "*/"', body: '{\n /* "f": 1 */ \n"f": "*/"',
}, },
], async () => {
async () => { expect(await PageObjects.console.hasInvalidSyntax()).to.be(false);
expect(await PageObjects.console.hasInvalidSyntax()).to.be(false); expect(await PageObjects.console.hasErrorMarker()).to.be(false);
expect(await PageObjects.console.hasErrorMarker()).to.be(false); }
} );
); });
}); });
describe('with invalid syntax in request body', async () => { describe('with invalid syntax in request body', () => {
await runTests( it('should highlight invalid syntax', async () => {
[ await runTest(
{ {
description: 'should highlight invalid syntax',
body: '{\n "query": \'\'', // E.g. using single quotes body: '{\n "query": \'\'', // E.g. using single quotes
}, },
], async () => {
expect(await PageObjects.console.hasInvalidSyntax()).to.be(true);
async () => { }
expect(await PageObjects.console.hasInvalidSyntax()).to.be(true); );
} });
);
}); });
describe('with invalid request', async () => { describe('with invalid request', () => {
await runTests( it('with invalid character should display error marker', async () => {
[ await runTest(
{ {
description: 'with invalid character should display error marker',
body: '{\n $ "query": {}', body: '{\n $ "query": {}',
}, },
async () => {
expect(await PageObjects.console.hasErrorMarker()).to.be(true);
}
);
});
it('with missing field name', async () => {
await runTest(
{ {
description: 'with missing field name',
body: '{\n "query": {},\n {}', body: '{\n "query": {},\n {}',
}, },
], async () => {
async () => { expect(await PageObjects.console.hasErrorMarker()).to.be(true);
expect(await PageObjects.console.hasErrorMarker()).to.be(true); }
} );
); });
}); });
}); });
}); });

View file

@ -8,7 +8,6 @@
import _ from 'lodash'; import _ from 'lodash';
import expect from '@kbn/expect'; import expect from '@kbn/expect';
import { asyncForEach } from '@kbn/std';
import { FtrProviderContext } from '../../../ftr_provider_context'; import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) { export default function ({ getService, getPageObjects }: FtrProviderContext) {
@ -17,6 +16,23 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['common', 'console', 'header']); const PageObjects = getPageObjects(['common', 'console', 'header']);
const find = getService('find'); const find = getService('find');
async function runTemplateTest(type: string, template: string) {
await PageObjects.console.monaco.enterText(`{\n\t"type": "${type}",\n`);
await PageObjects.console.sleepForDebouncePeriod();
// Prompt autocomplete for 'settings'
await PageObjects.console.monaco.promptAutocomplete('s');
await retry.waitFor('autocomplete to be visible', () =>
PageObjects.console.monaco.isAutocompleteVisible()
);
await PageObjects.console.monaco.pressEnter();
await retry.try(async () => {
const request = await PageObjects.console.monaco.getEditorText();
log.debug(request);
expect(request).to.contain(`${template}`);
});
}
describe('console autocomplete feature', function describeIndexTests() { describe('console autocomplete feature', function describeIndexTests() {
this.tags('includeFirefox'); this.tags('includeFirefox');
before(async () => { before(async () => {
@ -315,45 +331,26 @@ GET _search
}); });
}); });
describe('with conditional templates', async () => { describe('with conditional templates', () => {
const CONDITIONAL_TEMPLATES = [
{
type: 'fs',
template: `"location": "path"`,
},
{
type: 'url',
template: `"url": ""`,
},
{ type: 's3', template: `"bucket": ""` },
{
type: 'azure',
template: `"path": ""`,
},
];
beforeEach(async () => { beforeEach(async () => {
await PageObjects.console.monaco.clearEditorText(); await PageObjects.console.monaco.clearEditorText();
await PageObjects.console.monaco.enterText('POST _snapshot/test_repo\n'); await PageObjects.console.monaco.enterText('POST _snapshot/test_repo\n');
}); });
await asyncForEach(CONDITIONAL_TEMPLATES, async ({ type, template }) => { it('should insert fs template', async () => {
it('should insert different templates depending on the value of type', async () => { await runTemplateTest('fs', `"location": "path"`);
await PageObjects.console.monaco.enterText(`{\n\t"type": "${type}",\n`); });
await PageObjects.console.sleepForDebouncePeriod();
// Prompt autocomplete for 'settings'
await PageObjects.console.monaco.promptAutocomplete('s');
await retry.waitFor('autocomplete to be visible', () => it('should insert url template', async () => {
PageObjects.console.monaco.isAutocompleteVisible() await runTemplateTest('url', `"url": ""`);
); });
await PageObjects.console.monaco.pressEnter();
await retry.try(async () => { it('should insert s3 template', async () => {
const request = await PageObjects.console.monaco.getEditorText(); await runTemplateTest('s3', `"bucket": ""`);
log.debug(request); });
expect(request).to.contain(`${template}`);
}); it('should insert azure template', async () => {
}); await runTemplateTest('azure', `"path": ""`);
}); });
}); });

View file

@ -23,7 +23,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.console.closeHelpIfExists(); await PageObjects.console.closeHelpIfExists();
}); });
describe('with comments', async () => { describe('with comments', () => {
const enterRequest = async (url: string, body: string) => { const enterRequest = async (url: string, body: string) => {
await PageObjects.console.monaco.clearEditorText(); await PageObjects.console.monaco.clearEditorText();
await PageObjects.console.monaco.enterText(`${url}\n${body}`); await PageObjects.console.monaco.enterText(`${url}\n${body}`);
@ -41,6 +41,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
}); });
} }
// eslint-disable-next-line mocha/no-async-describe
describe('with single line comments', async () => { describe('with single line comments', async () => {
await runTests( await runTests(
[ [
@ -85,6 +86,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
); );
}); });
// eslint-disable-next-line mocha/no-async-describe
describe('with multiline comments', async () => { describe('with multiline comments', async () => {
await runTests( await runTests(
[ [
@ -112,6 +114,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
); );
}); });
// eslint-disable-next-line mocha/no-async-describe
describe('with invalid syntax in request body', async () => { describe('with invalid syntax in request body', async () => {
await runTests( await runTests(
[ [
@ -127,6 +130,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
); );
}); });
// eslint-disable-next-line mocha/no-async-describe
describe('with invalid request', async () => { describe('with invalid request', async () => {
await runTests( await runTests(
[ [

View file

@ -137,14 +137,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
before('reset dashboard', async () => { before('reset dashboard', async () => {
const currentUrl = await browser.getCurrentUrl(); const currentUrl = await browser.getCurrentUrl();
await browser.get(currentUrl.toString(), false); await browser.get(currentUrl.toString(), false);
});
before('and add one panel and save to put dashboard in "view" mode', async () => {
await dashboardAddPanel.addVisualization(PIE_CHART_VIS_NAME); await dashboardAddPanel.addVisualization(PIE_CHART_VIS_NAME);
await PageObjects.dashboard.saveDashboard(dashboardName + '2'); await PageObjects.dashboard.saveDashboard(dashboardName + '2');
});
before('expand panel to "full screen"', async () => {
await dashboardPanelActions.clickExpandPanelToggle(); await dashboardPanelActions.clickExpandPanelToggle();
}); });

View file

@ -93,7 +93,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.visualize.saveVisualizationExpectSuccess('legacy url markdown'); await PageObjects.visualize.saveVisualizationExpectSuccess('legacy url markdown');
(await find.byLinkText('abc')).click(); await (await find.byLinkText('abc')).click();
await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.timePicker.setDefaultDataRange(); await PageObjects.timePicker.setDefaultDataRange();
@ -115,7 +115,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.dashboard.navigateToApp(); await PageObjects.dashboard.navigateToApp();
await PageObjects.dashboard.clickNewDashboard(); await PageObjects.dashboard.clickNewDashboard();
await dashboardAddPanel.addVisualization('legacy url markdown'); await dashboardAddPanel.addVisualization('legacy url markdown');
(await find.byLinkText('abc')).click(); await (await find.byLinkText('abc')).click();
await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.header.waitUntilLoadingHasFinished();
await elasticChart.setNewChartUiDebugFlag(true); await elasticChart.setNewChartUiDebugFlag(true);
await PageObjects.timePicker.setDefaultDataRange(); await PageObjects.timePicker.setDefaultDataRange();

View file

@ -39,6 +39,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
after(async () => { after(async () => {
await kibanaServer.savedObjects.cleanStandardList(); await kibanaServer.savedObjects.cleanStandardList();
await PageObjects.common.unsetTime();
}); });
it('highlighting on filtering works', async function () { it('highlighting on filtering works', async function () {
@ -85,9 +86,5 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
'Rendering Test: saved search' 'Rendering Test: saved search'
); );
}); });
after(async () => {
await PageObjects.common.unsetTime();
});
}); });
} }

View file

@ -52,48 +52,42 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
return await PageObjects.share.getSharedUrl(); return await PageObjects.share.getSharedUrl();
}; };
const unpinnedFilterIsOnlyWhenDashboardIsUnsaved = async (mode: TestingModes) => {
await filterBar.addFilter({ field: 'geo.src', operation: 'is', value: 'AE' });
await PageObjects.dashboard.waitForRenderComplete();
const sharedUrl = await getSharedUrl(mode);
const { globalState, appState } = getStateFromUrl(sharedUrl);
expect(globalState).to.not.contain('filters');
if (mode === 'snapshot') {
expect(appState).to.contain('filters');
} else {
expect(sharedUrl).to.not.contain('appState');
}
};
const unpinnedFilterIsRemoved = async (mode: TestingModes) => {
await PageObjects.dashboard.clickQuickSave();
await PageObjects.dashboard.waitForRenderComplete();
const sharedUrl = await getSharedUrl(mode);
expect(sharedUrl).to.not.contain('appState');
};
const pinnedFilterIsWhenDashboardInGlobalState = async (mode: TestingModes) => {
await filterBar.toggleFilterPinned('geo.src');
await PageObjects.dashboard.clickQuickSave();
await PageObjects.dashboard.waitForRenderComplete();
const sharedUrl = await getSharedUrl(mode);
const { globalState, appState } = getStateFromUrl(sharedUrl);
expect(globalState).to.contain('filters');
if (mode === 'snapshot') {
expect(appState).to.not.contain('filters');
}
};
describe('share dashboard', () => { describe('share dashboard', () => {
const testFilterState = async (mode: TestingModes) => {
it('should not have "filters" state in either app or global state when no filters', async () => {
expect(await getSharedUrl(mode)).to.not.contain('filters');
});
it('unpinned filter should show up only in app state when dashboard is unsaved', async () => {
await filterBar.addFilter({ field: 'geo.src', operation: 'is', value: 'AE' });
await PageObjects.dashboard.waitForRenderComplete();
const sharedUrl = await getSharedUrl(mode);
const { globalState, appState } = getStateFromUrl(sharedUrl);
expect(globalState).to.not.contain('filters');
if (mode === 'snapshot') {
expect(appState).to.contain('filters');
} else {
expect(sharedUrl).to.not.contain('appState');
}
});
it('unpinned filters should be removed from app state when dashboard is saved', async () => {
await PageObjects.dashboard.clickQuickSave();
await PageObjects.dashboard.waitForRenderComplete();
const sharedUrl = await getSharedUrl(mode);
expect(sharedUrl).to.not.contain('appState');
});
it('pinned filter should show up only in global state', async () => {
await filterBar.toggleFilterPinned('geo.src');
await PageObjects.dashboard.clickQuickSave();
await PageObjects.dashboard.waitForRenderComplete();
const sharedUrl = await getSharedUrl(mode);
const { globalState, appState } = getStateFromUrl(sharedUrl);
expect(globalState).to.contain('filters');
if (mode === 'snapshot') {
expect(appState).to.not.contain('filters');
}
});
};
before(async () => { before(async () => {
await kibanaServer.savedObjects.cleanStandardList(); await kibanaServer.savedObjects.cleanStandardList();
await kibanaServer.importExport.load( await kibanaServer.importExport.load(
@ -117,8 +111,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.common.unsetTime(); await PageObjects.common.unsetTime();
}); });
describe('snapshot share', async () => { describe('snapshot share', () => {
describe('test local state', async () => { describe('test local state', () => {
it('should not have "panels" state when not in unsaved changes state', async () => { it('should not have "panels" state when not in unsaved changes state', async () => {
await testSubjects.missingOrFail('dashboardUnsavedChangesBadge'); await testSubjects.missingOrFail('dashboardUnsavedChangesBadge');
expect(await getSharedUrl('snapshot')).to.not.contain('panels'); expect(await getSharedUrl('snapshot')).to.not.contain('panels');
@ -144,8 +138,24 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
}); });
}); });
describe('test filter state', async () => { describe('test filter state', () => {
await testFilterState('snapshot'); const mode = 'snapshot';
it('should not have "filters" state in either app or global state when no filters', async () => {
expect(await getSharedUrl(mode)).to.not.contain('filters');
});
it('unpinned filter should show up only in app state when dashboard is unsaved', async () => {
await unpinnedFilterIsOnlyWhenDashboardIsUnsaved(mode);
});
it('unpinned filters should be removed from app state when dashboard is saved', async () => {
await unpinnedFilterIsRemoved(mode);
});
it('pinned filter should show up only in global state', async () => {
await pinnedFilterIsWhenDashboardInGlobalState(mode);
});
}); });
after(async () => { after(async () => {
@ -155,9 +165,25 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
}); });
}); });
describe('saved object share', async () => { describe('saved object share', () => {
describe('test filter state', async () => { describe('test filter state', () => {
await testFilterState('savedObject'); const mode = 'savedObject';
it('should not have "filters" state in either app or global state when no filters', async () => {
expect(await getSharedUrl(mode)).to.not.contain('filters');
});
it('unpinned filter should show up only in app state when dashboard is unsaved', async () => {
await unpinnedFilterIsOnlyWhenDashboardIsUnsaved(mode);
});
it('unpinned filters should be removed from app state when dashboard is saved', async () => {
await unpinnedFilterIsRemoved(mode);
});
it('pinned filter should show up only in global state', async () => {
await pinnedFilterIsWhenDashboardInGlobalState(mode);
});
}); });
}); });
}); });

View file

@ -96,7 +96,7 @@ export default function ({
expect(percentDifference).to.be.lessThan(0.029); expect(percentDifference).to.be.lessThan(0.029);
}); });
describe('compare controls snapshot', async () => { describe('compare controls snapshot', () => {
const waitForPageReady = async () => { const waitForPageReady = async () => {
await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.header.waitUntilLoadingHasFinished();
await retry.waitFor('page ready for screenshot', async () => { await retry.waitFor('page ready for screenshot', async () => {

View file

@ -215,7 +215,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await dashboard.waitForRenderComplete(); await dashboard.waitForRenderComplete();
await dashboard.expectUnsavedChangesBadge(); await dashboard.expectUnsavedChangesBadge();
pieChart.expectEmptyPieChart(); await pieChart.expectEmptyPieChart();
}); });
it('hitting dashboard resets selections + unapplies timeslice', async () => { it('hitting dashboard resets selections + unapplies timeslice', async () => {

View file

@ -239,7 +239,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await dashboardControls.optionsListEnsurePopoverIsClosed(controlIds[2]); await dashboardControls.optionsListEnsurePopoverIsClosed(controlIds[2]);
}); });
describe('Hierarchical chaining off', async () => { describe('Hierarchical chaining off', () => {
before(async () => { before(async () => {
await dashboardControls.updateChainingSystem('NONE'); await dashboardControls.updateChainingSystem('NONE');
}); });

View file

@ -25,7 +25,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await dashboard.switchToEditMode(); await dashboard.switchToEditMode();
}); });
describe('filtering settings', async () => { describe('filtering settings', () => {
const firstOptionsListId = 'bcb81550-0843-44ea-9020-6c1ebf3228ac'; const firstOptionsListId = 'bcb81550-0843-44ea-9020-6c1ebf3228ac';
let beforeCount: number; let beforeCount: number;
@ -55,7 +55,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
beforeRange = await getRange(); beforeRange = await getRange();
}); });
describe('do not apply global filters', async () => { describe('do not apply global filters', () => {
it('- filter pills', async () => { it('- filter pills', async () => {
await filterBar.addFilter({ field: 'animal.keyword', operation: 'is', value: 'cat' }); await filterBar.addFilter({ field: 'animal.keyword', operation: 'is', value: 'cat' });
await dashboardControls.optionsListOpenPopover(firstOptionsListId); await dashboardControls.optionsListOpenPopover(firstOptionsListId);
@ -105,7 +105,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
}); });
}); });
describe('control group settings flyout closes', async () => { describe('control group settings flyout closes', () => {
it('when navigating away from dashboard', async () => { it('when navigating away from dashboard', async () => {
await dashboard.switchToEditMode(); await dashboard.switchToEditMode();
await dashboardControls.openControlGroupSettingsFlyout(); await dashboardControls.openControlGroupSettingsFlyout();

View file

@ -105,13 +105,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
expect(await dashboardControls.optionsListGetCardinalityValue()).to.be('4'); expect(await dashboardControls.optionsListGetCardinalityValue()).to.be('4');
await dashboardControls.optionsListEnsurePopoverIsClosed(controlIds[0]); await dashboardControls.optionsListEnsurePopoverIsClosed(controlIds[0]);
dashboardControls.validateRange('placeholder', controlIds[1], '100', '1200'); await dashboardControls.validateRange('placeholder', controlIds[1], '100', '1200');
await dashboardControls.optionsListOpenPopover(controlIds[2]); await dashboardControls.optionsListOpenPopover(controlIds[2]);
expect(await dashboardControls.optionsListGetCardinalityValue()).to.be('5'); expect(await dashboardControls.optionsListGetCardinalityValue()).to.be('5');
await dashboardControls.optionsListEnsurePopoverIsClosed(controlIds[2]); await dashboardControls.optionsListEnsurePopoverIsClosed(controlIds[2]);
dashboardControls.validateRange('placeholder', controlIds[3], '0', '19979'); await dashboardControls.validateRange('placeholder', controlIds[3], '0', '19979');
}); });
it('ignores controls on other controls and panels using a data view without the control field by default', async () => { it('ignores controls on other controls and panels using a data view without the control field by default', async () => {
@ -120,13 +120,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await dashboardControls.optionsListPopoverSelectOption('Kibana Airlines'); await dashboardControls.optionsListPopoverSelectOption('Kibana Airlines');
await dashboardControls.optionsListEnsurePopoverIsClosed(controlIds[0]); await dashboardControls.optionsListEnsurePopoverIsClosed(controlIds[0]);
dashboardControls.validateRange('placeholder', controlIds[1], '100', '1196'); await dashboardControls.validateRange('placeholder', controlIds[1], '100', '1196');
await dashboardControls.optionsListOpenPopover(controlIds[2]); await dashboardControls.optionsListOpenPopover(controlIds[2]);
expect(await dashboardControls.optionsListGetCardinalityValue()).to.be('5'); expect(await dashboardControls.optionsListGetCardinalityValue()).to.be('5');
await dashboardControls.optionsListEnsurePopoverIsClosed(controlIds[2]); await dashboardControls.optionsListEnsurePopoverIsClosed(controlIds[2]);
dashboardControls.validateRange('placeholder', controlIds[3], '0', '19979'); await dashboardControls.validateRange('placeholder', controlIds[3], '0', '19979');
const logstashSavedSearchPanel = await testSubjects.find('embeddedSavedSearchDocTable'); const logstashSavedSearchPanel = await testSubjects.find('embeddedSavedSearchDocTable');
expect( expect(
@ -154,13 +154,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
expect(await dashboardControls.optionsListGetCardinalityValue()).to.be('4'); expect(await dashboardControls.optionsListGetCardinalityValue()).to.be('4');
await dashboardControls.optionsListEnsurePopoverIsClosed(controlIds[0]); await dashboardControls.optionsListEnsurePopoverIsClosed(controlIds[0]);
dashboardControls.validateRange('placeholder', controlIds[1], '100', '1200'); await dashboardControls.validateRange('placeholder', controlIds[1], '100', '1200');
await dashboardControls.optionsListOpenPopover(controlIds[2]); await dashboardControls.optionsListOpenPopover(controlIds[2]);
expect(await dashboardControls.optionsListGetCardinalityValue()).to.be('0'); expect(await dashboardControls.optionsListGetCardinalityValue()).to.be('0');
await dashboardControls.optionsListEnsurePopoverIsClosed(controlIds[2]); await dashboardControls.optionsListEnsurePopoverIsClosed(controlIds[2]);
dashboardControls.validateRange('placeholder', controlIds[3], '0', '0'); await dashboardControls.validateRange('placeholder', controlIds[3], '0', '0');
}); });
it('applies global filters on controls using a data view without the filter field', async () => { it('applies global filters on controls using a data view without the filter field', async () => {
@ -169,13 +169,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await dashboardControls.optionsListPopoverSelectOption('Kibana Airlines'); await dashboardControls.optionsListPopoverSelectOption('Kibana Airlines');
await dashboardControls.optionsListEnsurePopoverIsClosed(controlIds[0]); await dashboardControls.optionsListEnsurePopoverIsClosed(controlIds[0]);
dashboardControls.validateRange('placeholder', controlIds[1], '100', '1196'); await dashboardControls.validateRange('placeholder', controlIds[1], '100', '1196');
await dashboardControls.optionsListOpenPopover(controlIds[2]); await dashboardControls.optionsListOpenPopover(controlIds[2]);
expect(await dashboardControls.optionsListGetCardinalityValue()).to.be('0'); expect(await dashboardControls.optionsListGetCardinalityValue()).to.be('0');
await dashboardControls.optionsListEnsurePopoverIsClosed(controlIds[2]); await dashboardControls.optionsListEnsurePopoverIsClosed(controlIds[2]);
dashboardControls.validateRange('placeholder', controlIds[3], '0', '0'); await dashboardControls.validateRange('placeholder', controlIds[3], '0', '0');
const logstashSavedSearchPanel = await testSubjects.find('embeddedSavedSearchDocTable'); const logstashSavedSearchPanel = await testSubjects.find('embeddedSavedSearchDocTable');
expect( expect(

View file

@ -29,7 +29,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const DASHBOARD_NAME = 'Test Range Slider Control'; const DASHBOARD_NAME = 'Test Range Slider Control';
describe('Range Slider Control', async () => { describe('Range Slider Control', () => {
before(async () => { before(async () => {
await security.testUser.setRoles([ await security.testUser.setRoles([
'kibana_admin', 'kibana_admin',
@ -74,7 +74,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await security.testUser.restoreDefaults(); await security.testUser.restoreDefaults();
}); });
describe('create and edit', async () => { describe('create and edit', () => {
it('can create a new range slider control from a blank state', async () => { it('can create a new range slider control from a blank state', async () => {
await dashboardControls.createControl({ await dashboardControls.createControl({
controlType: RANGE_SLIDER_CONTROL, controlType: RANGE_SLIDER_CONTROL,
@ -257,7 +257,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
}); });
}); });
describe('validation', async () => { describe('validation', () => {
it('displays error message when upper bound selection is less than lower bound selection', async () => { it('displays error message when upper bound selection is less than lower bound selection', async () => {
const firstId = (await dashboardControls.getAllControlIds())[0]; const firstId = (await dashboardControls.getAllControlIds())[0];
await dashboardControls.rangeSliderSetLowerBound(firstId, '500'); await dashboardControls.rangeSliderSetLowerBound(firstId, '500');
@ -279,7 +279,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
}); });
}); });
describe('interaction', async () => { describe('interaction', () => {
it('Malformed query throws an error', async () => { it('Malformed query throws an error', async () => {
await queryBar.setQuery('AvgTicketPrice <= 300 error'); await queryBar.setQuery('AvgTicketPrice <= 300 error');
await queryBar.submitQuery(); await queryBar.submitQuery();

View file

@ -47,7 +47,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
}); });
}; };
describe('Replacing controls', async () => { describe('Replacing controls', () => {
let controlId: string; let controlId: string;
before(async () => { before(async () => {
@ -66,7 +66,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await security.testUser.restoreDefaults(); await security.testUser.restoreDefaults();
}); });
describe('Replace options list', async () => { describe('Replace options list', () => {
beforeEach(async () => { beforeEach(async () => {
await dashboardControls.clearAllControls(); await dashboardControls.clearAllControls();
await dashboardControls.createControl({ await dashboardControls.createControl({
@ -98,7 +98,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
}); });
}); });
describe('Replace range slider', async () => { describe('Replace range slider', () => {
beforeEach(async () => { beforeEach(async () => {
await dashboardControls.clearAllControls(); await dashboardControls.clearAllControls();
await dashboardControls.createControl({ await dashboardControls.createControl({

View file

@ -24,7 +24,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
'dashboard', 'dashboard',
]); ]);
describe('Time Slider Control', async () => { describe('Time Slider Control', () => {
before(async () => { before(async () => {
await security.testUser.setRoles([ await security.testUser.setRoles([
'kibana_admin', 'kibana_admin',
@ -52,7 +52,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await security.testUser.restoreDefaults(); await security.testUser.restoreDefaults();
}); });
describe('create, edit, and delete', async () => { describe('create, edit, and delete', () => {
before(async () => { before(async () => {
await dashboard.navigateToApp(); await dashboard.navigateToApp();
await dashboard.preserveCrossAppState(); await dashboard.preserveCrossAppState();
@ -130,8 +130,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
}); });
}); });
describe('panel interactions', async () => { describe('panel interactions', () => {
describe('saved search', async () => { describe('saved search', () => {
before(async () => { before(async () => {
await dashboard.navigateToApp(); await dashboard.navigateToApp();
await dashboard.loadSavedDashboard('timeslider and saved search'); await dashboard.loadSavedDashboard('timeslider and saved search');

View file

@ -47,7 +47,7 @@ export default function ({ loadTestFile, getService, getPageObjects }: FtrProvid
await kibanaServer.savedObjects.cleanStandardList(); await kibanaServer.savedObjects.cleanStandardList();
}; };
describe('Options list control', async () => { describe('Options list control', () => {
before(setup); before(setup);
after(teardown); after(teardown);

View file

@ -30,7 +30,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await dashboard.clickQuickSave(); await dashboard.clickQuickSave();
}); });
describe('Options List Control Editor selects relevant data views', async () => { describe('Options List Control Editor selects relevant data views', () => {
it('selects the default data view when the dashboard is blank', async () => { it('selects the default data view when the dashboard is blank', async () => {
expect(await dashboardControls.optionsListEditorGetCurrentDataView(true)).to.eql( expect(await dashboardControls.optionsListEditorGetCurrentDataView(true)).to.eql(
'logstash-*' 'logstash-*'

View file

@ -66,7 +66,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await dashboard.clickQuickSave(); await dashboard.clickQuickSave();
}); });
describe('Applies query settings to controls', async () => { describe('Applies query settings to controls', () => {
it('Malformed query throws an error', async () => { it('Malformed query throws an error', async () => {
await queryBar.setQuery('animal.keyword : "dog" error'); await queryBar.setQuery('animal.keyword : "dog" error');
await queryBar.submitQuery(); // quicker than clicking the submit button, but hides the time picker await queryBar.submitQuery(); // quicker than clicking the submit button, but hides the time picker
@ -111,7 +111,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await timePicker.setDefaultDataRange(); await timePicker.setDefaultDataRange();
}); });
describe('dashboard filters', async () => { describe('dashboard filters', () => {
before(async () => { before(async () => {
await filterBar.addFilter({ await filterBar.addFilter({
field: 'sound.keyword', field: 'sound.keyword',
@ -167,7 +167,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
}); });
}); });
describe('Selections made in control apply to dashboard', async () => { describe('Selections made in control apply to dashboard', () => {
it('Shows available options in options list', async () => { it('Shows available options in options list', async () => {
await queryBar.setQuery(''); await queryBar.setQuery('');
await queryBar.submitQuery(); await queryBar.submitQuery();
@ -259,8 +259,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await dashboard.clearUnsavedChanges(); await dashboard.clearUnsavedChanges();
}); });
describe('discarding changes', async () => { describe('discarding changes', () => {
describe('changes can be discarded', async () => { describe('changes can be discarded', () => {
let selections = ''; let selections = '';
beforeEach(async () => { beforeEach(async () => {
@ -292,7 +292,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
}); });
}); });
describe('Test data view runtime field', async () => { describe('Test data view runtime field', () => {
const FIELD_NAME = 'testRuntimeField'; const FIELD_NAME = 'testRuntimeField';
const FIELD_VALUES = { const FIELD_VALUES = {
G: G:
@ -360,7 +360,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
}); });
}); });
describe('Test exists query', async () => { describe('Test exists query', () => {
const newDocuments: Array<{ index: string; id: string }> = []; const newDocuments: Array<{ index: string; id: string }> = [];
const addDocument = async (index: string, document: string) => { const addDocument = async (index: string, document: string) => {

View file

@ -55,7 +55,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await dashboard.clickQuickSave(); await dashboard.clickQuickSave();
}); });
describe('Options List dashboard validation', async () => { describe('Options List dashboard validation', () => {
before(async () => { before(async () => {
await dashboardControls.optionsListOpenPopover(controlId); await dashboardControls.optionsListOpenPopover(controlId);
await dashboardControls.optionsListPopoverSelectOption('meow'); await dashboardControls.optionsListPopoverSelectOption('meow');
@ -116,7 +116,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
}); });
}); });
describe('Options List dashboard no validation', async () => { describe('Options List dashboard no validation', () => {
before(async () => { before(async () => {
await dashboardControls.optionsListOpenPopover(controlId); await dashboardControls.optionsListOpenPopover(controlId);
await dashboardControls.optionsListPopoverSelectOption('meow'); await dashboardControls.optionsListPopoverSelectOption('meow');

View file

@ -38,7 +38,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const LINKS_PANEL_NAME = 'Some links'; const LINKS_PANEL_NAME = 'Some links';
describe('links panel create and edit', () => { describe('links panel create and edit', () => {
describe('creation', async () => { describe('creation', () => {
before(async () => { before(async () => {
await dashboard.navigateToApp(); await dashboard.navigateToApp();
await dashboard.preserveCrossAppState(); await dashboard.preserveCrossAppState();
@ -95,7 +95,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await dashboardLinks.clickPanelEditorCloseButton(); await dashboardLinks.clickPanelEditorCloseButton();
}); });
describe('by-value links panel', async () => { describe('by-value links panel', () => {
it('can create a new by-value links panel', async () => { it('can create a new by-value links panel', async () => {
await dashboardAddPanel.clickEditorMenuButton(); await dashboardAddPanel.clickEditorMenuButton();
await dashboardAddPanel.clickAddNewPanelFromUIActionLink('Links'); await dashboardAddPanel.clickAddNewPanelFromUIActionLink('Links');

View file

@ -38,7 +38,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await kibanaServer.uiSettings.unset('search:timeout'); await kibanaServer.uiSettings.unset('search:timeout');
}); });
describe('bfetch enabled', async () => { describe('bfetch enabled', () => {
it('timeout on single shard shows warning and results with bfetch enabled', async () => { it('timeout on single shard shows warning and results with bfetch enabled', async () => {
await PageObjects.common.navigateToApp('discover'); await PageObjects.common.navigateToApp('discover');
await dataViews.createFromSearchBar({ await dataViews.createFromSearchBar({
@ -91,7 +91,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
}); });
}); });
describe('bfetch disabled', async () => { describe('bfetch disabled', () => {
before(async () => { before(async () => {
await kibanaServer.uiSettings.update({ 'bfetch:disable': true }); await kibanaServer.uiSettings.update({ 'bfetch:disable': true });
}); });

View file

@ -35,11 +35,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await kibanaServer.uiSettings.replace({}); await kibanaServer.uiSettings.replace({});
}); });
beforeEach(async function () {
await PageObjects.common.navigateToApp('discover');
await PageObjects.discover.waitForDocTableLoadingComplete();
});
beforeEach(async function () { beforeEach(async function () {
await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings(); await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings();
await PageObjects.common.navigateToApp('discover'); await PageObjects.common.navigateToApp('discover');

View file

@ -74,7 +74,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.timePicker.setDefaultAbsoluteRange(); await PageObjects.timePicker.setDefaultAbsoluteRange();
}); });
describe('classic table in window 900x700', async function () { describe('classic table in window 900x700', function () {
before(async () => { before(async () => {
await browser.setWindowSize(900, 700); await browser.setWindowSize(900, 700);
await PageObjects.common.navigateToApp('discover'); await PageObjects.common.navigateToApp('discover');
@ -93,7 +93,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
}); });
}); });
describe('classic table in window 600x700', async function () { describe('classic table in window 600x700', function () {
before(async () => { before(async () => {
await browser.setWindowSize(600, 700); await browser.setWindowSize(600, 700);
await PageObjects.common.navigateToApp('discover'); await PageObjects.common.navigateToApp('discover');
@ -112,7 +112,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
}); });
}); });
describe('legacy', async function () { describe('legacy', function () {
before(async () => { before(async () => {
await PageObjects.common.navigateToApp('discover'); await PageObjects.common.navigateToApp('discover');
await PageObjects.discover.waitUntilSearchingHasFinished(); await PageObjects.discover.waitUntilSearchingHasFinished();
@ -146,7 +146,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
expect(skipButtonText === activeElementText).to.be(true); expect(skipButtonText === activeElementText).to.be(true);
}); });
describe('expand a document row', async function () { describe('expand a document row', function () {
const rowToInspect = 1; const rowToInspect = 1;
beforeEach(async function () { beforeEach(async function () {
// close the toggle if open // close the toggle if open
@ -228,7 +228,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
}); });
}); });
describe('add and remove columns', async function () { describe('add and remove columns', function () {
const extraColumns = ['phpmemory', 'ip']; const extraColumns = ['phpmemory', 'ip'];
const expectedFieldLength: Record<string, number> = { const expectedFieldLength: Record<string, number> = {
phpmemory: 1, phpmemory: 1,

View file

@ -30,7 +30,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
'doc_table:legacy': true, 'doc_table:legacy': true,
}; };
describe('discover esql grid with legacy setting', async function () { describe('discover esql grid with legacy setting', function () {
before(async () => { before(async () => {
await security.testUser.setRoles(['kibana_admin', 'test_logstash_reader']); await security.testUser.setRoles(['kibana_admin', 'test_logstash_reader']);
await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover'); await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover');

View file

@ -36,7 +36,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
defaultIndex: 'logstash-*', defaultIndex: 'logstash-*',
}; };
describe('discover esql columns', async function () { describe('discover esql columns', function () {
before(async () => { before(async () => {
await kibanaServer.savedObjects.cleanStandardList(); await kibanaServer.savedObjects.cleanStandardList();
await security.testUser.setRoles(['kibana_admin', 'test_logstash_reader']); await security.testUser.setRoles(['kibana_admin', 'test_logstash_reader']);

View file

@ -38,7 +38,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
enableESQL: true, enableESQL: true,
}; };
describe('discover esql view', async function () { describe('discover esql view', function () {
before(async () => { before(async () => {
await kibanaServer.savedObjects.cleanStandardList(); await kibanaServer.savedObjects.cleanStandardList();
await security.testUser.setRoles(['kibana_admin', 'test_logstash_reader']); await security.testUser.setRoles(['kibana_admin', 'test_logstash_reader']);

View file

@ -40,6 +40,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await security.testUser.restoreDefaults(); await security.testUser.restoreDefaults();
await esArchiver.unload('test/functional/fixtures/es_archiver/date_nanos_mixed'); await esArchiver.unload('test/functional/fixtures/es_archiver/date_nanos_mixed');
await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] }); await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] });
await PageObjects.common.unsetTime();
}); });
it('shows a list of records of indices with date & date_nanos fields in the right order', async function () { it('shows a list of records of indices with date & date_nanos fields in the right order', async function () {
@ -53,9 +54,5 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const rowData4 = await PageObjects.discover.getDocTableIndex(isLegacy ? 7 : 4); const rowData4 = await PageObjects.discover.getDocTableIndex(isLegacy ? 7 : 4);
expect(rowData4).to.contain('Jan 1, 2019 @ 12:10:30.123000000'); expect(rowData4).to.contain('Jan 1, 2019 @ 12:10:30.123000000');
}); });
after(async () => {
await PageObjects.common.unsetTime();
});
}); });
} }

View file

@ -69,7 +69,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
}); });
}); });
describe('version fields', async () => { describe('version fields', () => {
const es = getService('es'); const es = getService('es');
const indexPatterns = getService('indexPatterns'); const indexPatterns = getService('indexPatterns');
const indexTitle = 'version-test'; const indexTitle = 'version-test';

View file

@ -50,7 +50,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
}; };
} }
describe('shared links with state in query', async () => { describe('shared links with state in query', () => {
let teardown: () => Promise<void>; let teardown: () => Promise<void>;
before(async function () { before(async function () {
teardown = await setup({ storeStateInSessionStorage: false }); teardown = await setup({ storeStateInSessionStorage: false });
@ -94,7 +94,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
}); });
}); });
describe('shared links with state in sessionStorage', async () => { describe('shared links with state in sessionStorage', () => {
let teardown: () => Promise<void>; let teardown: () => Promise<void>;
before(async function () { before(async function () {
teardown = await setup({ storeStateInSessionStorage: true }); teardown = await setup({ storeStateInSessionStorage: true });

View file

@ -53,7 +53,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
after(async () => { after(async () => {
await security.testUser.restoreDefaults(); await security.testUser.restoreDefaults();
kibanaServer.savedObjects.cleanStandardList(); await kibanaServer.savedObjects.cleanStandardList();
await kibanaServer.uiSettings.replace({}); await kibanaServer.uiSettings.replace({});
}); });

View file

@ -36,7 +36,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
describe('listing', () => { describe('listing', () => {
before(async () => { before(async () => {
PageObjects.home.openSampleDataAccordion(); await PageObjects.home.openSampleDataAccordion();
}); });
it('should display registered flights sample data sets', async () => { it('should display registered flights sample data sets', async () => {

View file

@ -19,7 +19,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
describe('overview page - no data', function describeIndexTests() { describe('overview page - no data', function describeIndexTests() {
before(async () => { before(async () => {
await esArchiver.unload('test/functional/fixtures/es_archiver/logstash_functional'); await esArchiver.unload('test/functional/fixtures/es_archiver/logstash_functional');
kibanaServer.savedObjects.clean({ types: ['index-pattern'] }); await kibanaServer.savedObjects.clean({ types: ['index-pattern'] });
await kibanaServer.importExport.unload( await kibanaServer.importExport.unload(
'test/functional/fixtures/kbn_archiver/kibana_sample_data_flights_index_pattern' 'test/functional/fixtures/kbn_archiver/kibana_sample_data_flights_index_pattern'
); );

View file

@ -26,6 +26,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.settings.navigateTo(); await PageObjects.settings.navigateTo();
await PageObjects.settings.clickKibanaIndexPatterns(); await PageObjects.settings.clickKibanaIndexPatterns();
await PageObjects.settings.removeLogstashIndexPatternIfExist(); await PageObjects.settings.removeLogstashIndexPatternIfExist();
await kibanaServer.uiSettings.replace({ 'dateFormat:tz': 'UTC' });
await browser.refresh();
}); });
it('should allow setting advanced settings', async function () { it('should allow setting advanced settings', async function () {
@ -95,10 +97,5 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
expect(globalState.length).to.be.greaterThan(20); expect(globalState.length).to.be.greaterThan(20);
}); });
}); });
after(async function () {
await kibanaServer.uiSettings.replace({ 'dateFormat:tz': 'UTC' });
await browser.refresh();
});
}); });
} }

View file

@ -22,7 +22,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
}); });
describe('index pattern wizard ccs', () => { describe('index pattern wizard ccs', () => {
describe('remote cluster only', async () => { describe('remote cluster only', () => {
beforeEach(async function () { beforeEach(async function () {
await kibanaServer.uiSettings.replace({}); await kibanaServer.uiSettings.replace({});
await PageObjects.settings.navigateTo(); await PageObjects.settings.navigateTo();
@ -47,7 +47,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await kibanaServer.savedObjects.cleanStandardList(); await kibanaServer.savedObjects.cleanStandardList();
}); });
}); });
describe('remote and local clusters', async () => { describe('remote and local clusters', () => {
before(async () => { before(async () => {
await es.transport.request({ await es.transport.request({
path: '/blogs/_doc', path: '/blogs/_doc',

View file

@ -13,7 +13,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['settings', 'common', 'header']); const PageObjects = getPageObjects(['settings', 'common', 'header']);
const testSubjects = getService('testSubjects'); const testSubjects = getService('testSubjects');
describe('Data view field caps cache advanced setting', async function () { describe('Data view field caps cache advanced setting', function () {
before(async () => { before(async () => {
await PageObjects.settings.navigateTo(); await PageObjects.settings.navigateTo();
await PageObjects.settings.clickKibanaSettings(); await PageObjects.settings.clickKibanaSettings();

View file

@ -555,7 +555,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
}); });
}); });
describe('check formats', async () => { describe('check formats', () => {
before(async () => { before(async () => {
await PageObjects.common.navigateToApp('discover', { await PageObjects.common.navigateToApp('discover', {
hash: `/doc/${indexPatternId}/${indexTitle}?id=${testDocumentId}`, hash: `/doc/${indexPatternId}/${indexTitle}?id=${testDocumentId}`,

View file

@ -57,7 +57,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.settings.createIndexPattern('alias2*', 'date'); await PageObjects.settings.createIndexPattern('alias2*', 'date');
}); });
describe('discover verify hits', async () => { describe('discover verify hits', () => {
before(async () => { before(async () => {
const from = 'Nov 12, 2016 @ 05:00:00.000'; const from = 'Nov 12, 2016 @ 05:00:00.000';
const to = 'Nov 19, 2016 @ 05:00:00.000'; const to = 'Nov 19, 2016 @ 05:00:00.000';

View file

@ -56,6 +56,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
after(async function afterAll() { after(async function afterAll() {
await kibanaServer.importExport.unload('test/functional/fixtures/kbn_archiver/discover'); await kibanaServer.importExport.unload('test/functional/fixtures/kbn_archiver/discover');
await kibanaServer.uiSettings.replace({}); await kibanaServer.uiSettings.replace({});
await PageObjects.common.unsetTime();
}); });
/** /**
@ -145,7 +146,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
}); });
}); });
describe('discover scripted field', async () => { describe('discover scripted field', () => {
before(async () => { before(async () => {
const from = 'Sep 17, 2015 @ 06:31:44.000'; const from = 'Sep 17, 2015 @ 06:31:44.000';
const to = 'Sep 18, 2015 @ 18:31:44.000'; const to = 'Sep 18, 2015 @ 18:31:44.000';
@ -515,9 +516,5 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
}); });
}); });
}); });
after(async () => {
await PageObjects.common.unsetTime();
});
}); });
} }

View file

@ -103,7 +103,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
expect(data).to.be.eql([['14,004', '1,412.6']]); expect(data).to.be.eql([['14,004', '1,412.6']]);
}); });
describe('data table with date histogram', async () => { describe('data table with date histogram', () => {
before(async () => { before(async () => {
await PageObjects.visualize.navigateToNewAggBasedVisualization(); await PageObjects.visualize.navigateToNewAggBasedVisualization();
await PageObjects.visualize.clickDataTable(); await PageObjects.visualize.clickDataTable();

View file

@ -18,20 +18,20 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const testSubjects = getService('testSubjects'); const testSubjects = getService('testSubjects');
const PageObjects = getPageObjects(['visualize', 'visEditor', 'visChart', 'timePicker']); const PageObjects = getPageObjects(['visualize', 'visEditor', 'visChart', 'timePicker']);
async function initGaugeVis() {
log.debug('navigateToApp visualize');
await PageObjects.visualize.navigateToNewAggBasedVisualization();
log.debug('clickGauge');
await PageObjects.visualize.clickGauge();
await PageObjects.visualize.clickNewSearch();
await PageObjects.timePicker.setDefaultAbsoluteRange();
}
describe('gauge chart', function indexPatternCreation() { describe('gauge chart', function indexPatternCreation() {
before(async () => { before(async () => {
await PageObjects.visualize.initTests(); await PageObjects.visualize.initTests();
await initGaugeVis();
}); });
async function initGaugeVis() {
log.debug('navigateToApp visualize');
await PageObjects.visualize.navigateToNewAggBasedVisualization();
log.debug('clickGauge');
await PageObjects.visualize.clickGauge();
await PageObjects.visualize.clickNewSearch();
await PageObjects.timePicker.setDefaultAbsoluteRange();
}
before(initGaugeVis);
it('should have inspector enabled', async function () { it('should have inspector enabled', async function () {
await inspector.expectIsEnabled(); await inspector.expectIsEnabled();

View file

@ -143,7 +143,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
color: '#00FF00', color: '#00FF00',
}); });
retry.try(async () => { await retry.try(async () => {
expect(await PageObjects.annotationEditor.getAnnotationCount()).to.be(2); expect(await PageObjects.annotationEditor.getAnnotationCount()).to.be(2);
}); });
}); });

View file

@ -69,7 +69,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
}); });
it('should show 10 slices in pie chart', async function () { it('should show 10 slices in pie chart', async function () {
pieChart.expectPieSliceCount(10, isNewChartsLibraryEnabled); await pieChart.expectPieSliceCount(10, isNewChartsLibraryEnabled);
}); });
it('should show correct data', async function () { it('should show correct data', async function () {

View file

@ -195,7 +195,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
}); });
}); });
it('should display drilldown urls', async () => { it('should display drilldown urls after field formatting is applied', async () => {
const baseURL = 'http://elastic.co/foo/'; const baseURL = 'http://elastic.co/foo/';
await visualBuilder.clickPanelOptions('table'); await visualBuilder.clickPanelOptions('table');

View file

@ -30,38 +30,36 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const vizName = 'Visualization AreaChart Name Test - Charts library'; const vizName = 'Visualization AreaChart Name Test - Charts library';
const initAreaChart = async () => {
log.debug('navigateToApp visualize');
await PageObjects.visualize.navigateToNewAggBasedVisualization();
log.debug('clickAreaChart');
await PageObjects.visualize.clickAreaChart();
log.debug('clickNewSearch');
await PageObjects.visualize.clickNewSearch();
log.debug('Click X-axis');
await PageObjects.visEditor.clickBucket('X-axis');
log.debug('Click Date Histogram');
await PageObjects.visEditor.selectAggregation('Date Histogram');
log.debug('Check field value');
const fieldValues = await PageObjects.visEditor.getField();
log.debug('fieldValue = ' + fieldValues);
expect(fieldValues[0]).to.be('@timestamp');
const intervalValue = await PageObjects.visEditor.getInterval();
log.debug('intervalValue = ' + intervalValue);
expect(intervalValue[0]).to.be('Auto');
await PageObjects.visEditor.clickGo(true);
};
describe('area charts', function indexPatternCreation() { describe('area charts', function indexPatternCreation() {
before(async () => { before(async () => {
await PageObjects.visualize.initTests(); await PageObjects.visualize.initTests();
await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings();
});
const initAreaChart = async () => {
log.debug('navigateToApp visualize');
await PageObjects.visualize.navigateToNewAggBasedVisualization();
log.debug('clickAreaChart');
await PageObjects.visualize.clickAreaChart();
log.debug('clickNewSearch');
await PageObjects.visualize.clickNewSearch();
log.debug('Click X-axis');
await PageObjects.visEditor.clickBucket('X-axis');
log.debug('Click Date Histogram');
await PageObjects.visEditor.selectAggregation('Date Histogram');
log.debug('Check field value');
const fieldValues = await PageObjects.visEditor.getField();
log.debug('fieldValue = ' + fieldValues);
expect(fieldValues[0]).to.be('@timestamp');
const intervalValue = await PageObjects.visEditor.getInterval();
log.debug('intervalValue = ' + intervalValue);
expect(intervalValue[0]).to.be('Auto');
await PageObjects.visEditor.clickGo(true);
};
before(async function () {
await security.testUser.setRoles([ await security.testUser.setRoles([
'kibana_admin', 'kibana_admin',
'long_window_logstash', 'long_window_logstash',
'test_logstash_reader', 'test_logstash_reader',
]); ]);
await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings();
await initAreaChart(); await initAreaChart();
}); });

View file

@ -230,7 +230,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
}); });
}); });
describe('timezones', async function () { describe('timezones', function () {
it('should show round labels in default timezone', async function () { it('should show round labels in default timezone', async function () {
const expectedLabels = [ const expectedLabels = [
'2015-09-20 00:00', '2015-09-20 00:00',

View file

@ -281,7 +281,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
}); });
}); });
describe('vertical bar in percent mode', async () => { describe('vertical bar in percent mode', () => {
it('should show ticks with percentage values', async function () { it('should show ticks with percentage values', async function () {
const axisId = 'ValueAxis-1'; const axisId = 'ValueAxis-1';
await PageObjects.visEditor.clickMetricsAndAxes(); await PageObjects.visEditor.clickMetricsAndAxes();

View file

@ -23,9 +23,6 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) {
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional'); await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional');
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/long_window_logstash'); await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/long_window_logstash');
});
before(async () => {
await kibanaServer.uiSettings.update({ await kibanaServer.uiSettings.update({
'histogram:maxBars': 100, 'histogram:maxBars': 100,
}); });

View file

@ -553,7 +553,7 @@ export class ConsolePageObject extends FtrService {
await this.retry.try(async () => { await this.retry.try(async () => {
const firstInnerHtml = await line.getAttribute('innerHTML'); const firstInnerHtml = await line.getAttribute('innerHTML');
// The line number is not updated immediately after the click, so we need to wait for it. // The line number is not updated immediately after the click, so we need to wait for it.
this.common.sleep(500); await this.common.sleep(500);
line = await editor.findByCssSelector('.ace_active-line'); line = await editor.findByCssSelector('.ace_active-line');
const secondInnerHtml = await line.getAttribute('innerHTML'); const secondInnerHtml = await line.getAttribute('innerHTML');
// The line number will change as the user types, but we want to wait until it's stable. // The line number will change as the user types, but we want to wait until it's stable.

View file

@ -85,7 +85,7 @@ export class DashboardPageObject extends FtrService {
} }
public async expectAppStateRemovedFromURL() { public async expectAppStateRemovedFromURL() {
this.retry.try(async () => { await this.retry.try(async () => {
const url = await this.browser.getCurrentUrl(); const url = await this.browser.getCurrentUrl();
expect(url.indexOf('_a')).to.be(-1); expect(url.indexOf('_a')).to.be(-1);
}); });
@ -453,7 +453,7 @@ export class DashboardPageObject extends FtrService {
const edit = editMode ? `?_a=(viewMode:edit)` : ''; const edit = editMode ? `?_a=(viewMode:edit)` : '';
dashboardLocation = `/view/${id}${edit}`; dashboardLocation = `/view/${id}${edit}`;
} }
this.common.navigateToActualUrl('dashboard', dashboardLocation, args); await this.common.navigateToActualUrl('dashboard', dashboardLocation, args);
} }
public async gotoDashboardListingURL({ public async gotoDashboardListingURL({

View file

@ -638,7 +638,7 @@ export class DashboardPageControls extends FtrService {
selectedType?: string; selectedType?: string;
}) { }) {
this.log.debug(`Verifying that control types match what is expected for the selected field`); this.log.debug(`Verifying that control types match what is expected for the selected field`);
asyncForEach(supportedTypes, async (type) => { await asyncForEach(supportedTypes, async (type) => {
const controlTypeItem = await this.testSubjects.find(`create__${type}`); const controlTypeItem = await this.testSubjects.find(`create__${type}`);
expect(await controlTypeItem.isEnabled()).to.be(true); expect(await controlTypeItem.isEnabled()).to.be(true);
if (type === selectedType) { if (type === selectedType) {

View file

@ -413,7 +413,7 @@ export class DiscoverPageObject extends FtrService {
// add the focus to the button to make it appear // add the focus to the button to make it appear
const skipButton = await this.testSubjects.find('discoverSkipTableButton'); const skipButton = await this.testSubjects.find('discoverSkipTableButton');
// force focus on it, to make it interactable // force focus on it, to make it interactable
skipButton.focus(); await skipButton.focus();
// now click it! // now click it!
return skipButton.click(); return skipButton.click();
} }
@ -521,8 +521,8 @@ export class DiscoverPageObject extends FtrService {
return await this.testSubjects.exists('discoverNoResultsTimefilter'); return await this.testSubjects.exists('discoverNoResultsTimefilter');
} }
public showsErrorCallout() { public async showsErrorCallout() {
this.retry.try(async () => { await this.retry.try(async () => {
await this.testSubjects.existOrFail('discoverErrorCalloutTitle'); await this.testSubjects.existOrFail('discoverErrorCalloutTitle');
}); });
} }

View file

@ -68,7 +68,7 @@ export class VisualBuilderPageObject extends FtrService {
private async toggleYesNoSwitch(testSubj: string, value: boolean) { private async toggleYesNoSwitch(testSubj: string, value: boolean) {
const option = await this.testSubjects.find(`${testSubj}-${value ? 'yes' : 'no'}`); const option = await this.testSubjects.find(`${testSubj}-${value ? 'yes' : 'no'}`);
(await option.findByCssSelector('label')).click(); await (await option.findByCssSelector('label')).click();
await this.header.waitUntilLoadingHasFinished(); await this.header.waitUntilLoadingHasFinished();
} }
@ -577,7 +577,7 @@ export class VisualBuilderPageObject extends FtrService {
if (useKibanaIndices === false) { if (useKibanaIndices === false) {
const el = await this.testSubjects.find(metricsIndexPatternInput); const el = await this.testSubjects.find(metricsIndexPatternInput);
el.focus(); await el.focus();
await el.clearValue(); await el.clearValue();
if (value) { if (value) {
await el.type(value, { charByChar: true }); await el.type(value, { charByChar: true });

View file

@ -287,7 +287,7 @@ export class VisualizeChartPageObject extends FtrService {
const legendItemColor = await chart.findByCssSelector( const legendItemColor = await chart.findByCssSelector(
`[data-ech-series-name="${name}"] .echLegendItem__color` `[data-ech-series-name="${name}"] .echLegendItem__color`
); );
legendItemColor.click(); await legendItemColor.click();
await this.waitForVisualizationRenderingStabilized(); await this.waitForVisualizationRenderingStabilized();
// arbitrary color chosen, any available would do // arbitrary color chosen, any available would do
@ -307,7 +307,7 @@ export class VisualizeChartPageObject extends FtrService {
const legendItemColor = await chart.findByCssSelector( const legendItemColor = await chart.findByCssSelector(
`[data-ech-series-name="${name}"] .echLegendItem__color` `[data-ech-series-name="${name}"] .echLegendItem__color`
); );
legendItemColor.click(); await legendItemColor.click();
} else { } else {
// This click has been flaky in opening the legend, hence the this.retry. See // This click has been flaky in opening the legend, hence the this.retry. See
// https://github.com/elastic/kibana/issues/17468 // https://github.com/elastic/kibana/issues/17468
@ -333,7 +333,7 @@ export class VisualizeChartPageObject extends FtrService {
cell cell
); );
await this.common.sleep(2000); await this.common.sleep(2000);
filterBtn.click(); await filterBtn.click();
}); });
} }

View file

@ -280,7 +280,7 @@ export class VisualizeEditorPageObject extends FtrService {
public async setCustomLabel(label: string, index: number | string = 1) { public async setCustomLabel(label: string, index: number | string = 1) {
const customLabel = await this.testSubjects.find(`visEditorStringInput${index}customLabel`); const customLabel = await this.testSubjects.find(`visEditorStringInput${index}customLabel`);
customLabel.type(label); await customLabel.type(label);
} }
public async selectYAxisAggregation(agg: string, field: string, label: string, index = 1) { public async selectYAxisAggregation(agg: string, field: string, label: string, index = 1) {

View file

@ -284,11 +284,11 @@ export class DashboardExpectService extends FtrService {
} }
async savedSearchRowsExist() { async savedSearchRowsExist() {
this.testSubjects.existOrFail('docTableExpandToggleColumn'); await this.testSubjects.existOrFail('docTableExpandToggleColumn');
} }
async savedSearchRowsMissing() { async savedSearchRowsMissing() {
this.testSubjects.missingOrFail('docTableExpandToggleColumn'); await this.testSubjects.missingOrFail('docTableExpandToggleColumn');
} }
async dataTableRowCount(expectedCount: number) { async dataTableRowCount(expectedCount: number) {

View file

@ -69,7 +69,7 @@ export function DashboardDrilldownPanelActionsProvider({ getService }: FtrProvid
async clickActionByText(text: string) { async clickActionByText(text: string) {
log.debug(`clickActionByText: "${text}"`); log.debug(`clickActionByText: "${text}"`);
(await this.getActionWebElementByText(text)).click(); await (await this.getActionWebElementByText(text)).click();
} }
async getActionHrefByText(text: string) { async getActionHrefByText(text: string) {
@ -80,7 +80,7 @@ export function DashboardDrilldownPanelActionsProvider({ getService }: FtrProvid
async openHrefByText(text: string) { async openHrefByText(text: string) {
log.debug(`openHref: "${text}"`); log.debug(`openHref: "${text}"`);
(await this.getActionWebElementByText(text)).openHref(); await (await this.getActionWebElementByText(text)).openHref();
} }
async getActionWebElementByText(text: string): Promise<WebElementWrapper> { async getActionWebElementByText(text: string): Promise<WebElementWrapper> {

View file

@ -53,14 +53,14 @@ export class ListingTableService extends FtrService {
*/ */
public async setSearchFilterValue(value: string) { public async setSearchFilterValue(value: string) {
const searchFilter = await this.getSearchFilter(); const searchFilter = await this.getSearchFilter();
searchFilter.type(value); await searchFilter.type(value);
} }
/** /**
* Clears search input on landing page * Clears search input on landing page
*/ */
public async clearSearchFilter() { public async clearSearchFilter() {
this.testSubjects.click('clearSearchButton'); await this.testSubjects.click('clearSearchButton');
} }
private async getAllItemsNamesOnCurrentPage(): Promise<string[]> { private async getAllItemsNamesOnCurrentPage(): Promise<string[]> {

View file

@ -23,12 +23,12 @@ export default function ({ getService }: PluginFunctionalProviderContext) {
request.write(body[i++]); request.write(body[i++]);
} else { } else {
clearInterval(intervalId); clearInterval(intervalId);
request.end((err, res) => { void request.end((err, res) => {
resolve(res); resolve(res);
}); });
} }
}, interval); }, interval);
request.on('error', (err) => { void request.on('error', (err) => {
clearInterval(intervalId); clearInterval(intervalId);
reject(err); reject(err);
}); });

View file

@ -22,6 +22,7 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide
const browser = getService('browser'); const browser = getService('browser');
const find = getService('find'); const find = getService('find');
const supertest = getService('supertest'); const supertest = getService('supertest');
const log = getService('log');
const PageObjects = getPageObjects(['common']); const PageObjects = getPageObjects(['common']);
describe('Telemetry service', () => { describe('Telemetry service', () => {
@ -30,7 +31,8 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide
return browser.executeAsync<boolean>((cb) => { return browser.executeAsync<boolean>((cb) => {
(window as unknown as Record<string, () => Promise<boolean>>) (window as unknown as Record<string, () => Promise<boolean>>)
._checkCanSendTelemetry() ._checkCanSendTelemetry()
.then(cb); .then(cb)
.catch((err) => log.error(err));
}); });
}; };
@ -39,7 +41,8 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide
await browser.executeAsync<void>((cb) => { await browser.executeAsync<void>((cb) => {
(window as unknown as Record<string, () => Promise<boolean>>) (window as unknown as Record<string, () => Promise<boolean>>)
._resetTelemetry() ._resetTelemetry()
.then(() => cb()); .then(() => cb())
.catch((err) => log.error(err));
}); });
}); });

View file

@ -63,7 +63,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
throw new Error(`Could not find ${policyName} in policy table`); throw new Error(`Could not find ${policyName} in policy table`);
}; };
describe('Index Lifecycle Management Accessibility', async () => { describe('Index Lifecycle Management Accessibility', () => {
before(async () => { before(async () => {
await esClient.snapshot.createRepository({ await esClient.snapshot.createRepository({
name: REPO_NAME, name: REPO_NAME,

View file

@ -14,7 +14,7 @@ export default function ({ getService, getPageObjects }: any) {
const log = getService('log'); const log = getService('log');
const a11y = getService('a11y'); /* this is the wrapping service around axe */ const a11y = getService('a11y'); /* this is the wrapping service around axe */
describe('Ingest Pipelines Accessibility', async () => { describe('Ingest Pipelines Accessibility', () => {
before(async () => { before(async () => {
await putSamplePipeline(esClient); await putSamplePipeline(esClient);
await common.navigateToApp('ingestPipelines'); await common.navigateToApp('ingestPipelines');

View file

@ -25,13 +25,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await a11y.testAppSnapshot(); await a11y.testAppSnapshot();
}); });
describe('index management', async () => { describe('index management', () => {
describe('indices', async () => { describe('indices', () => {
it('empty state', async () => { it('empty state', async () => {
await PageObjects.settings.clickIndexManagement(); await PageObjects.settings.clickIndexManagement();
await a11y.testAppSnapshot(); await a11y.testAppSnapshot();
}); });
describe('indices with data', async () => { describe('indices with data', () => {
before(async () => { before(async () => {
await esArchiver.loadIfNeeded( await esArchiver.loadIfNeeded(
'test/functional/fixtures/es_archiver/logstash_functional' 'test/functional/fixtures/es_archiver/logstash_functional'
@ -48,7 +48,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await a11y.testAppSnapshot(); await a11y.testAppSnapshot();
}); });
describe('index details', async () => { describe('index details', () => {
it('index details - overview', async () => { it('index details - overview', async () => {
await PageObjects.settings.clickIndexManagement(); await PageObjects.settings.clickIndexManagement();
await PageObjects.indexManagement.clickIndexAt(0); await PageObjects.indexManagement.clickIndexAt(0);

View file

@ -85,7 +85,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
}); });
// creating space b and making it the current space so space selector page gets displayed when space b gets deleted // creating space b and making it the current space so space selector page gets displayed when space b gets deleted
describe('Create Space B and Verify', async () => { describe('Create Space B and Verify', () => {
it('a11y test for delete space button', async () => { it('a11y test for delete space button', async () => {
await PageObjects.spaceSelector.clickCreateSpace(); await PageObjects.spaceSelector.clickCreateSpace();
await PageObjects.spaceSelector.clickEnterSpaceName(); await PageObjects.spaceSelector.clickEnterSpaceName();

View file

@ -156,7 +156,7 @@ export default function ({ getService }: FtrProviderContext) {
await a11y.testAppSnapshot(); await a11y.testAppSnapshot();
}); });
it('data frame analytics create job additional options step for outlier job', async () => { it('data frame analytics create job additional details step for outlier job', async () => {
await ml.dataFrameAnalyticsCreation.continueToDetailsStep(); await ml.dataFrameAnalyticsCreation.continueToDetailsStep();
await ml.dataFrameAnalyticsCreation.setJobId(dfaOutlierJobId); await ml.dataFrameAnalyticsCreation.setJobId(dfaOutlierJobId);
await a11y.testAppSnapshot(); await a11y.testAppSnapshot();
@ -203,7 +203,7 @@ export default function ({ getService }: FtrProviderContext) {
await a11y.testAppSnapshot(); await a11y.testAppSnapshot();
}); });
it('data frame analytics create job additional options step for regression job', async () => { it('data frame analytics create job additional details step for regression job', async () => {
await ml.dataFrameAnalyticsCreation.continueToDetailsStep(); await ml.dataFrameAnalyticsCreation.continueToDetailsStep();
await ml.dataFrameAnalyticsCreation.setJobId(dfaRegressionJobId); await ml.dataFrameAnalyticsCreation.setJobId(dfaRegressionJobId);
await a11y.testAppSnapshot(); await a11y.testAppSnapshot();
@ -252,7 +252,7 @@ export default function ({ getService }: FtrProviderContext) {
await a11y.testAppSnapshot(); await a11y.testAppSnapshot();
}); });
it('data frame analytics create job additional options step for classification job', async () => { it('data frame analytics create job additional details step for classification job', async () => {
await ml.dataFrameAnalyticsCreation.continueToDetailsStep(); await ml.dataFrameAnalyticsCreation.continueToDetailsStep();
await ml.dataFrameAnalyticsCreation.setJobId(dfaClassificationJobId); await ml.dataFrameAnalyticsCreation.setJobId(dfaClassificationJobId);
await a11y.testAppSnapshot(); await a11y.testAppSnapshot();

View file

@ -21,12 +21,12 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const retry = getService('retry'); const retry = getService('retry');
// github.com/elastic/kibana/issues/153599 // github.com/elastic/kibana/issues/153599
describe.skip('cross cluster replication - a11y tests', async () => { describe.skip('cross cluster replication - a11y tests', () => {
before(async () => { before(async () => {
await PageObjects.common.navigateToApp('crossClusterReplication'); await PageObjects.common.navigateToApp('crossClusterReplication');
}); });
describe('follower index tab', async () => { describe('follower index tab', () => {
const remoteName = `testremote${Date.now().toString()}`; const remoteName = `testremote${Date.now().toString()}`;
const testIndex = `testindex${Date.now().toString()}`; const testIndex = `testindex${Date.now().toString()}`;
const testFollower = `follower${Date.now().toString()}`; const testFollower = `follower${Date.now().toString()}`;
@ -35,8 +35,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('empty follower index table', async () => { it('empty follower index table', async () => {
await a11y.testAppSnapshot(); await a11y.testAppSnapshot();
}); });
describe('follower index tab', async () => { describe('follower index tab', () => {
describe('follower index form', async () => { describe('follower index form', () => {
before(async () => { before(async () => {
await PageObjects.common.navigateToApp('remoteClusters'); await PageObjects.common.navigateToApp('remoteClusters');
await PageObjects.remoteClusters.createNewRemoteCluster(remoteName, 'localhost:9300'); await PageObjects.remoteClusters.createNewRemoteCluster(remoteName, 'localhost:9300');
@ -68,8 +68,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
}); });
}); });
}); });
describe('auto-follower patterns', async () => { describe('auto-follower patterns', () => {
describe('auto follower index form', async () => { describe('auto follower index form', () => {
before(async () => { before(async () => {
await PageObjects.crossClusterReplication.clickAutoFollowerTab(); await PageObjects.crossClusterReplication.clickAutoFollowerTab();
}); });

View file

@ -23,7 +23,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.common.navigateToApp('observability'); await PageObjects.common.navigateToApp('observability');
}); });
describe('Overview', async () => { describe('Overview', () => {
before(async () => { before(async () => {
await observability.overview.common.openAlertsSectionAndWaitToAppear(); await observability.overview.common.openAlertsSectionAndWaitToAppear();
await a11y.testAppSnapshot(); await a11y.testAppSnapshot();

View file

@ -29,7 +29,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await a11y.testAppSnapshot(); await a11y.testAppSnapshot();
}); });
describe('create a rollup job wizard', async () => { describe('create a rollup job wizard', () => {
it('step 1 - logistics', async () => { it('step 1 - logistics', async () => {
await testSubjects.click('createRollupJobButton'); await testSubjects.click('createRollupJobButton');
await PageObjects.rollup.verifyStepIsActive(1); await PageObjects.rollup.verifyStepIsActive(1);

View file

@ -31,7 +31,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.settings.clickSnapshotRestore(); await PageObjects.settings.clickSnapshotRestore();
}); });
describe('empty state', async () => { describe('empty state', () => {
it('empty snapshots table', async () => { it('empty snapshots table', async () => {
await a11y.testAppSnapshot(); await a11y.testAppSnapshot();
}); });
@ -52,7 +52,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
}); });
}); });
describe('table views with data', async () => { describe('table views with data', () => {
const testRepoName = 'testrepo'; const testRepoName = 'testrepo';
const snapshotName = `testsnapshot${Date.now().toString()}`; const snapshotName = `testsnapshot${Date.now().toString()}`;
before(async () => { before(async () => {
@ -80,7 +80,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
}); });
}); });
describe('create policy wizard', async () => { describe('create policy wizard', () => {
const testRepoName = 'policyrepo'; const testRepoName = 'policyrepo';
before(async () => { before(async () => {
await createRepo(testRepoName); await createRepo(testRepoName);

View file

@ -55,7 +55,7 @@ export default function ({ getService }: FtrProviderContext) {
}); });
after(async () => { after(async () => {
objectRemover.removeAll(); await objectRemover.removeAll();
await deleteDataView({ await deleteDataView({
supertest, supertest,
id: DATA_VIEW_ID, id: DATA_VIEW_ID,

View file

@ -31,7 +31,7 @@ export default function deleteBackfillTests({ getService }: FtrProviderContext)
const end = moment().utc().startOf('day').subtract(1, 'day').toISOString(); const end = moment().utc().startOf('day').subtract(1, 'day').toISOString();
afterEach(async () => { afterEach(async () => {
asyncForEach(backfillIds, async ({ id, spaceId }: { id: string; spaceId: string }) => { await asyncForEach(backfillIds, async ({ id, spaceId }: { id: string; spaceId: string }) => {
await supertest await supertest
.delete(`${getUrlPrefix(spaceId)}/internal/alerting/rules/backfill/${id}`) .delete(`${getUrlPrefix(spaceId)}/internal/alerting/rules/backfill/${id}`)
.set('kbn-xsrf', 'foo'); .set('kbn-xsrf', 'foo');

View file

@ -26,7 +26,7 @@ export default function findBackfillTests({ getService }: FtrProviderContext) {
const end2 = moment().utc().startOf('day').subtract(10, 'day').toISOString(); const end2 = moment().utc().startOf('day').subtract(10, 'day').toISOString();
afterEach(async () => { afterEach(async () => {
asyncForEach(backfillIds, async ({ id, spaceId }: { id: string; spaceId: string }) => { await asyncForEach(backfillIds, async ({ id, spaceId }: { id: string; spaceId: string }) => {
await supertest await supertest
.delete(`${getUrlPrefix(spaceId)}/internal/alerting/rules/backfill/${id}`) .delete(`${getUrlPrefix(spaceId)}/internal/alerting/rules/backfill/${id}`)
.set('kbn-xsrf', 'foo'); .set('kbn-xsrf', 'foo');

View file

@ -25,7 +25,7 @@ export default function getBackfillTests({ getService }: FtrProviderContext) {
const end2 = moment().utc().startOf('day').subtract(3, 'day').toISOString(); const end2 = moment().utc().startOf('day').subtract(3, 'day').toISOString();
afterEach(async () => { afterEach(async () => {
asyncForEach(backfillIds, async ({ id, spaceId }: { id: string; spaceId: string }) => { await asyncForEach(backfillIds, async ({ id, spaceId }: { id: string; spaceId: string }) => {
await supertest await supertest
.delete(`${getUrlPrefix(spaceId)}/internal/alerting/rules/backfill/${id}`) .delete(`${getUrlPrefix(spaceId)}/internal/alerting/rules/backfill/${id}`)
.set('kbn-xsrf', 'foo'); .set('kbn-xsrf', 'foo');

View file

@ -33,7 +33,7 @@ export default function scheduleBackfillTests({ getService }: FtrProviderContext
const objectRemover = new ObjectRemover(supertest); const objectRemover = new ObjectRemover(supertest);
afterEach(async () => { afterEach(async () => {
asyncForEach(backfillIds, async ({ id, spaceId }: { id: string; spaceId: string }) => { await asyncForEach(backfillIds, async ({ id, spaceId }: { id: string; spaceId: string }) => {
await supertest await supertest
.delete(`${getUrlPrefix(spaceId)}/internal/alerting/rules/backfill/${id}`) .delete(`${getUrlPrefix(spaceId)}/internal/alerting/rules/backfill/${id}`)
.set('kbn-xsrf', 'foo'); .set('kbn-xsrf', 'foo');

View file

@ -41,7 +41,7 @@ export default function bulkUntrackTests({ getService }: FtrProviderContext) {
}, },
conflicts: 'proceed', conflicts: 'proceed',
}); });
objectRemover.removeAll(); await objectRemover.removeAll();
}); });
for (const scenario of UserAtSpaceScenarios) { for (const scenario of UserAtSpaceScenarios) {

View file

@ -32,7 +32,7 @@ export default function bulkUntrackByQueryTests({ getService }: FtrProviderConte
}, },
conflicts: 'proceed', conflicts: 'proceed',
}); });
objectRemover.removeAll(); await objectRemover.removeAll();
}); });
for (const scenario of UserAtSpaceScenarios) { for (const scenario of UserAtSpaceScenarios) {

View file

@ -54,8 +54,8 @@ export default function bedrockTest({ getService }: FtrProviderContext) {
}; };
describe('Bedrock', () => { describe('Bedrock', () => {
after(() => { after(async () => {
objectRemover.removeAll(); await objectRemover.removeAll();
}); });
describe('action creation', () => { describe('action creation', () => {
const simulator = new BedrockSimulator({ const simulator = new BedrockSimulator({

View file

@ -48,8 +48,8 @@ export default function genAiTest({ getService }: FtrProviderContext) {
}; };
describe('OpenAI', () => { describe('OpenAI', () => {
after(() => { after(async () => {
objectRemover.removeAll(); await objectRemover.removeAll();
}); });
describe('action creation', () => { describe('action creation', () => {
const simulator = new OpenAISimulator({ const simulator = new OpenAISimulator({

View file

@ -22,7 +22,7 @@ export default function emailNotificationTest({ getService }: FtrProviderContext
describe('email using html', () => { describe('email using html', () => {
afterEach(async () => { afterEach(async () => {
objectRemover.removeAll(); await objectRemover.removeAll();
}); });
it('succeeds as notification', async () => { it('succeeds as notification', async () => {

View file

@ -21,9 +21,9 @@ export default function indexTest({ getService }: FtrProviderContext) {
const esDeleteAllIndices = getService('esDeleteAllIndices'); const esDeleteAllIndices = getService('esDeleteAllIndices');
describe('index connector', () => { describe('index connector', () => {
beforeEach(() => { beforeEach(async () => {
esDeleteAllIndices(ES_TEST_INDEX_NAME); await esDeleteAllIndices(ES_TEST_INDEX_NAME);
esDeleteAllIndices(ES_TEST_DATASTREAM_INDEX_NAME); await esDeleteAllIndices(ES_TEST_DATASTREAM_INDEX_NAME);
}); });
after(async () => { after(async () => {

View file

@ -44,9 +44,9 @@ export default function preconfiguredAlertHistoryConnectorTests({
} }
const objectRemover = new ObjectRemover(supertest); const objectRemover = new ObjectRemover(supertest);
beforeEach(() => { beforeEach(async () => {
esDeleteAllIndices(AlertHistoryDefaultIndexName); await esDeleteAllIndices(AlertHistoryDefaultIndexName);
esDeleteAllIndices(ALERT_HISTORY_OVERRIDE_INDEX); await esDeleteAllIndices(ALERT_HISTORY_OVERRIDE_INDEX);
}); });
after(() => objectRemover.removeAll()); after(() => objectRemover.removeAll());

View file

@ -62,7 +62,7 @@ export default function createAlertsAsDataInstallResourcesTest({ getService }: F
describe('alerts as data', () => { describe('alerts as data', () => {
afterEach(async () => { afterEach(async () => {
objectRemover.removeAll(); await objectRemover.removeAll();
await es.deleteByQuery({ await es.deleteByQuery({
index: alertsAsDataIndex, index: alertsAsDataIndex,
query: { match_all: {} }, query: { match_all: {} },

View file

@ -81,7 +81,7 @@ export default function createAlertsAsDataAlertDelayInstallResourcesTest({
}); });
}); });
afterEach(async () => { afterEach(async () => {
objectRemover.removeAll(); await objectRemover.removeAll();
await es.deleteByQuery({ await es.deleteByQuery({
index: [alertsAsDataIndex, alwaysFiringAlertsAsDataIndex], index: [alertsAsDataIndex, alwaysFiringAlertsAsDataIndex],
query: { match_all: {} }, query: { match_all: {} },

View file

@ -39,7 +39,7 @@ export default function createAlertsAsDataFlappingTest({ getService }: FtrProvid
query: { match_all: {} }, query: { match_all: {} },
conflicts: 'proceed', conflicts: 'proceed',
}); });
objectRemover.removeAll(); await objectRemover.removeAll();
}); });
// These are the same tests from x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/event_log.ts // These are the same tests from x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/event_log.ts

View file

@ -19,8 +19,8 @@ export interface RoleCredentials {
cookieHeader: { Cookie: string }; cookieHeader: { Cookie: string };
} }
export const deleteIndex = (es: Client, indexToBeDeleted: string[]) => { export const deleteIndex = async (es: Client, indexToBeDeleted: string[]) => {
Promise.all([ return Promise.all([
...indexToBeDeleted.map((indexes) => ...indexToBeDeleted.map((indexes) =>
es.deleteByQuery({ es.deleteByQuery({
index: indexes, index: indexes,

View file

@ -111,7 +111,7 @@ export default function featureControlsTests({ getService }: FtrProviderContext)
expectResponse(regularSettingResult); expectResponse(regularSettingResult);
const telemetryResult = await saveTelemetrySetting(username, password); const telemetryResult = await saveTelemetrySetting(username, password);
expectTelemetryResponse(telemetryResult, true); await expectTelemetryResponse(telemetryResult, true);
} finally { } finally {
await security.role.delete(roleName); await security.role.delete(roleName);
await security.user.delete(username); await security.user.delete(username);
@ -143,7 +143,7 @@ export default function featureControlsTests({ getService }: FtrProviderContext)
expect403(regularSettingResult); expect403(regularSettingResult);
const telemetryResult = await saveTelemetrySetting(username, password); const telemetryResult = await saveTelemetrySetting(username, password);
expectTelemetryResponse(telemetryResult, false); await expectTelemetryResponse(telemetryResult, false);
} finally { } finally {
await security.role.delete(roleName); await security.role.delete(roleName);
await security.user.delete(username); await security.user.delete(username);
@ -217,7 +217,7 @@ export default function featureControlsTests({ getService }: FtrProviderContext)
expectResponse(regularSettingResult); expectResponse(regularSettingResult);
const telemetryResult = await saveTelemetrySetting(username, password, space1Id); const telemetryResult = await saveTelemetrySetting(username, password, space1Id);
expectTelemetryResponse(telemetryResult, true); await expectTelemetryResponse(telemetryResult, true);
}); });
it(`user_1 can only save telemetry in space_2`, async () => { it(`user_1 can only save telemetry in space_2`, async () => {
@ -225,7 +225,7 @@ export default function featureControlsTests({ getService }: FtrProviderContext)
expect403(regularSettingResult); expect403(regularSettingResult);
const telemetryResult = await saveTelemetrySetting(username, password, space2Id); const telemetryResult = await saveTelemetrySetting(username, password, space2Id);
expectTelemetryResponse(telemetryResult, true); await expectTelemetryResponse(telemetryResult, true);
}); });
it(`user_1 can't save either settings or telemetry in space_3`, async () => { it(`user_1 can't save either settings or telemetry in space_3`, async () => {
@ -233,7 +233,7 @@ export default function featureControlsTests({ getService }: FtrProviderContext)
expect403(regularSettingResult); expect403(regularSettingResult);
const telemetryResult = await saveTelemetrySetting(username, password, space3Id); const telemetryResult = await saveTelemetrySetting(username, password, space3Id);
expectTelemetryResponse(telemetryResult, false); await expectTelemetryResponse(telemetryResult, false);
}); });
}); });
}); });

View file

@ -224,7 +224,7 @@ export default function ({ getService }: FtrProviderContext) {
// This should be swallowed and not kill the Kibana server // This should be swallowed and not kill the Kibana server
await new Promise((resolve) => await new Promise((resolve) =>
setTimeout(() => { setTimeout(() => {
req.abort(); void req.abort(); // Explicitly ignore any potential promise
resolve(null); resolve(null);
}, 2000) }, 2000)
); );

View file

@ -31,7 +31,7 @@ export default function ({ getService }: FtrProviderContext) {
before(async () => { before(async () => {
await slo.deleteAllSLOs(); await slo.deleteAllSLOs();
await sloEsClient.deleteTestSourceData(); await sloEsClient.deleteTestSourceData();
loadTestData(getService); await loadTestData(getService);
}); });
beforeEach(() => { beforeEach(() => {

View file

@ -248,7 +248,7 @@ export default function ({ getService }: FtrProviderContext) {
}, },
}) })
.expect(200); .expect(200);
kibanaServer.savedObjects.create({ await kibanaServer.savedObjects.create({
id: syntheticsApiKeyID, id: syntheticsApiKeyID,
type: syntheticsApiKeyObjectType, type: syntheticsApiKeyObjectType,
overwrite: true, overwrite: true,

View file

@ -47,7 +47,7 @@ export default function ({ getService }: FtrProviderContext) {
const cnvb = now.subtract(23, 'weeks').toISOString(); const cnvb = now.subtract(23, 'weeks').toISOString();
const monitorId = 'monitor1'; const monitorId = 'monitor1';
before(async () => { before(async () => {
makeChecksWithStatus( await makeChecksWithStatus(
esService, esService,
monitorId, monitorId,
3, 3,
@ -77,8 +77,8 @@ export default function ({ getService }: FtrProviderContext) {
(d: any) => d (d: any) => d
); );
}); });
after('unload test docs', () => { after('unload test docs', async () => {
esArchiver.unload('x-pack/test/functional/es_archives/uptime/blank'); await esArchiver.unload('x-pack/test/functional/es_archives/uptime/blank');
}); });
it('retrieves expected cert data', async () => { it('retrieves expected cert data', async () => {

View file

@ -51,18 +51,18 @@ export class SupertestWithRoleScope {
throw new Error('The instance has already been destroyed.'); throw new Error('The instance has already been destroyed.');
} }
// set role-based API key by default // set role-based API key by default
agent.set(this.roleAuthc.apiKeyHeader); void agent.set(this.roleAuthc.apiKeyHeader);
if (withInternalHeaders) { if (withInternalHeaders) {
agent.set(this.samlAuth.getInternalRequestHeader()); void agent.set(this.samlAuth.getInternalRequestHeader());
} }
if (withCommonHeaders) { if (withCommonHeaders) {
agent.set(this.samlAuth.getCommonRequestHeader()); void agent.set(this.samlAuth.getCommonRequestHeader());
} }
if (withCustomHeaders) { if (withCustomHeaders) {
agent.set(withCustomHeaders); void agent.set(withCustomHeaders);
} }
return agent; return agent;

View file

@ -55,7 +55,7 @@ export function UsageAPIProvider({ getService }: FtrProviderContext) {
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana');
if (opts?.authHeader) { if (opts?.authHeader) {
request.set(opts.authHeader); void request.set(opts.authHeader);
} }
const { body } = await request.send({ refreshCache: true, ...payload }).expect(200); const { body } = await request.send({ refreshCache: true, ...payload }).expect(200);

View file

@ -51,7 +51,7 @@ export function createApmApiClient(st: supertest.Agent) {
.set('Content-type', 'multipart/form-data'); .set('Content-type', 'multipart/form-data');
for (const field of fields) { for (const field of fields) {
formDataRequest.field(field[0], field[1]); void formDataRequest.field(field[0], field[1]);
} }
res = await formDataRequest; res = await formDataRequest;

View file

@ -33,7 +33,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
after(async () => { after(async () => {
await deleteAllServiceGroups(apmApiClient); await deleteAllServiceGroups(apmApiClient);
apmSynthtraceEsClient.clean(); await apmSynthtraceEsClient.clean();
}); });
before(async () => { before(async () => {

Some files were not shown because too many files have changed in this diff Show more