[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',
},
},
{
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}'],
plugins: ['react-perf'],

View file

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

View file

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

View file

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

View file

@ -25,7 +25,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await a11y.testAppSnapshot();
});
describe('data views', async () => {
describe('data views', () => {
before(async () => {
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional');
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('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 () => {

View file

@ -8,7 +8,6 @@
import _ from 'lodash';
import expect from '@kbn/expect';
import { asyncForEach } from '@kbn/std';
import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
@ -17,6 +16,24 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['common', 'console', 'header']);
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() {
this.tags('includeFirefox');
before(async () => {
@ -365,47 +382,27 @@ GET _search
});
});
describe('with conditional templates', async () => {
const CONDITIONAL_TEMPLATES = [
{
type: 'fs',
template: `"location": "path"`,
},
{
type: 'url',
template: `"url": ""`,
},
{ type: 's3', template: `"bucket": ""` },
{
type: 'azure',
template: `"path": ""`,
},
];
describe('with conditional templates', () => {
beforeEach(async () => {
await PageObjects.console.clearTextArea();
await PageObjects.console.enterRequest('\n POST _snapshot/test_repo');
await PageObjects.console.pressEnter();
});
await asyncForEach(CONDITIONAL_TEMPLATES, async ({ type, template }) => {
it('should insert different templates depending on the value of type', async () => {
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');
it('should insert fs template', async () => {
await runTemplateTest('fs', `"location": "path"`);
});
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}`);
});
});
it('should insert url template', async () => {
await runTemplateTest('url', `"url": ""`);
});
it('should insert s3 template', async () => {
await runTemplateTest('s3', `"bucket": ""`);
});
it('should insert azure template', async () => {
await runTemplateTest('azure', `"path": ""`);
});
});
});

View file

@ -7,7 +7,6 @@
*/
import expect from '@kbn/expect';
import { asyncForEach } from '@kbn/std';
import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
@ -15,6 +14,18 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const retry = getService('retry');
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
describe.skip('console app', function testComments() {
this.tags('includeFirefox');
@ -27,130 +38,193 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});
});
describe('with comments', async () => {
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 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(
[
describe('with comments', () => {
describe('with single line comments', () => {
it('should allow in request url, using //', async () => {
await runTest(
{
url: '\n// GET _search',
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": {}',
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',
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": {}',
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 "//": {}',
},
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": "//"',
},
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 "#": {}',
},
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": "#"',
},
],
async () => {
expect(await PageObjects.console.hasInvalidSyntax()).to.be(false);
expect(await PageObjects.console.hasErrorMarker()).to.be(false);
}
);
async () => {
expect(await PageObjects.console.hasInvalidSyntax()).to.be(false);
expect(await PageObjects.console.hasErrorMarker()).to.be(false);
}
);
});
});
describe('with multiline comments', async () => {
await runTests(
[
describe('with multiline comments', () => {
it('should allow in request url, using /* */', async () => {
await runTest(
{
url: '\n /* \nGET _search \n*/',
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": {} */',
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 */',
},
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": "*/"',
},
],
async () => {
expect(await PageObjects.console.hasInvalidSyntax()).to.be(false);
expect(await PageObjects.console.hasErrorMarker()).to.be(false);
}
);
async () => {
expect(await PageObjects.console.hasInvalidSyntax()).to.be(false);
expect(await PageObjects.console.hasErrorMarker()).to.be(false);
}
);
});
});
describe('with invalid syntax in request body', async () => {
await runTests(
[
describe('with invalid syntax in request body', () => {
it('should highlight invalid syntax', async () => {
await runTest(
{
description: 'should highlight invalid syntax',
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 () => {
await runTests(
[
describe('with invalid request', () => {
it('with invalid character should display error marker', async () => {
await runTest(
{
description: 'with invalid character should display error marker',
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 {}',
},
],
async () => {
expect(await PageObjects.console.hasErrorMarker()).to.be(true);
}
);
async () => {
expect(await PageObjects.console.hasErrorMarker()).to.be(true);
}
);
});
});
});
});

View file

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

View file

@ -137,14 +137,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
before('reset dashboard', async () => {
const currentUrl = await browser.getCurrentUrl();
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 PageObjects.dashboard.saveDashboard(dashboardName + '2');
});
before('expand panel to "full screen"', async () => {
await dashboardPanelActions.clickExpandPanelToggle();
});

View file

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

View file

@ -39,6 +39,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
after(async () => {
await kibanaServer.savedObjects.cleanStandardList();
await PageObjects.common.unsetTime();
});
it('highlighting on filtering works', async function () {
@ -85,9 +86,5 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
'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();
};
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', () => {
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 () => {
await kibanaServer.savedObjects.cleanStandardList();
await kibanaServer.importExport.load(
@ -117,8 +111,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.common.unsetTime();
});
describe('snapshot share', async () => {
describe('test local state', async () => {
describe('snapshot share', () => {
describe('test local state', () => {
it('should not have "panels" state when not in unsaved changes state', async () => {
await testSubjects.missingOrFail('dashboardUnsavedChangesBadge');
expect(await getSharedUrl('snapshot')).to.not.contain('panels');
@ -144,8 +138,24 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});
});
describe('test filter state', async () => {
await testFilterState('snapshot');
describe('test filter state', () => {
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 () => {
@ -155,9 +165,25 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});
});
describe('saved object share', async () => {
describe('test filter state', async () => {
await testFilterState('savedObject');
describe('saved object share', () => {
describe('test filter state', () => {
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);
});
describe('compare controls snapshot', async () => {
describe('compare controls snapshot', () => {
const waitForPageReady = async () => {
await PageObjects.header.waitUntilLoadingHasFinished();
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.expectUnsavedChangesBadge();
pieChart.expectEmptyPieChart();
await pieChart.expectEmptyPieChart();
});
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]);
});
describe('Hierarchical chaining off', async () => {
describe('Hierarchical chaining off', () => {
before(async () => {
await dashboardControls.updateChainingSystem('NONE');
});

View file

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

View file

@ -105,13 +105,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
expect(await dashboardControls.optionsListGetCardinalityValue()).to.be('4');
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]);
expect(await dashboardControls.optionsListGetCardinalityValue()).to.be('5');
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 () => {
@ -120,13 +120,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await dashboardControls.optionsListPopoverSelectOption('Kibana Airlines');
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]);
expect(await dashboardControls.optionsListGetCardinalityValue()).to.be('5');
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');
expect(
@ -154,13 +154,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
expect(await dashboardControls.optionsListGetCardinalityValue()).to.be('4');
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]);
expect(await dashboardControls.optionsListGetCardinalityValue()).to.be('0');
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 () => {
@ -169,13 +169,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await dashboardControls.optionsListPopoverSelectOption('Kibana Airlines');
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]);
expect(await dashboardControls.optionsListGetCardinalityValue()).to.be('0');
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');
expect(

View file

@ -29,7 +29,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const DASHBOARD_NAME = 'Test Range Slider Control';
describe('Range Slider Control', async () => {
describe('Range Slider Control', () => {
before(async () => {
await security.testUser.setRoles([
'kibana_admin',
@ -74,7 +74,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
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 () => {
await dashboardControls.createControl({
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 () => {
const firstId = (await dashboardControls.getAllControlIds())[0];
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 () => {
await queryBar.setQuery('AvgTicketPrice <= 300 error');
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;
before(async () => {
@ -66,7 +66,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await security.testUser.restoreDefaults();
});
describe('Replace options list', async () => {
describe('Replace options list', () => {
beforeEach(async () => {
await dashboardControls.clearAllControls();
await dashboardControls.createControl({
@ -98,7 +98,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});
});
describe('Replace range slider', async () => {
describe('Replace range slider', () => {
beforeEach(async () => {
await dashboardControls.clearAllControls();
await dashboardControls.createControl({

View file

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

View file

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

View file

@ -30,7 +30,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
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 () => {
expect(await dashboardControls.optionsListEditorGetCurrentDataView(true)).to.eql(
'logstash-*'

View file

@ -66,7 +66,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await dashboard.clickQuickSave();
});
describe('Applies query settings to controls', async () => {
describe('Applies query settings to controls', () => {
it('Malformed query throws an error', async () => {
await queryBar.setQuery('animal.keyword : "dog" error');
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();
});
describe('dashboard filters', async () => {
describe('dashboard filters', () => {
before(async () => {
await filterBar.addFilter({
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 () => {
await queryBar.setQuery('');
await queryBar.submitQuery();
@ -259,8 +259,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await dashboard.clearUnsavedChanges();
});
describe('discarding changes', async () => {
describe('changes can be discarded', async () => {
describe('discarding changes', () => {
describe('changes can be discarded', () => {
let selections = '';
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_VALUES = {
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 addDocument = async (index: string, document: string) => {

View file

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

View file

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

View file

@ -38,7 +38,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
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 () => {
await PageObjects.common.navigateToApp('discover');
await dataViews.createFromSearchBar({
@ -91,7 +91,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});
});
describe('bfetch disabled', async () => {
describe('bfetch disabled', () => {
before(async () => {
await kibanaServer.uiSettings.update({ 'bfetch:disable': true });
});

View file

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

View file

@ -74,7 +74,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.timePicker.setDefaultAbsoluteRange();
});
describe('classic table in window 900x700', async function () {
describe('classic table in window 900x700', function () {
before(async () => {
await browser.setWindowSize(900, 700);
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 () => {
await browser.setWindowSize(600, 700);
await PageObjects.common.navigateToApp('discover');
@ -112,7 +112,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});
});
describe('legacy', async function () {
describe('legacy', function () {
before(async () => {
await PageObjects.common.navigateToApp('discover');
await PageObjects.discover.waitUntilSearchingHasFinished();
@ -146,7 +146,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
expect(skipButtonText === activeElementText).to.be(true);
});
describe('expand a document row', async function () {
describe('expand a document row', function () {
const rowToInspect = 1;
beforeEach(async function () {
// 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 expectedFieldLength: Record<string, number> = {
phpmemory: 1,

View file

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

View file

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

View file

@ -38,7 +38,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
enableESQL: true,
};
describe('discover esql view', async function () {
describe('discover esql view', function () {
before(async () => {
await kibanaServer.savedObjects.cleanStandardList();
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 esArchiver.unload('test/functional/fixtures/es_archiver/date_nanos_mixed');
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 () {
@ -53,9 +54,5 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const rowData4 = await PageObjects.discover.getDocTableIndex(isLegacy ? 7 : 4);
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 indexPatterns = getService('indexPatterns');
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>;
before(async function () {
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>;
before(async function () {
teardown = await setup({ storeStateInSessionStorage: true });

View file

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

View file

@ -36,7 +36,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
describe('listing', () => {
before(async () => {
PageObjects.home.openSampleDataAccordion();
await PageObjects.home.openSampleDataAccordion();
});
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() {
before(async () => {
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(
'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.clickKibanaIndexPatterns();
await PageObjects.settings.removeLogstashIndexPatternIfExist();
await kibanaServer.uiSettings.replace({ 'dateFormat:tz': 'UTC' });
await browser.refresh();
});
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);
});
});
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('remote cluster only', async () => {
describe('remote cluster only', () => {
beforeEach(async function () {
await kibanaServer.uiSettings.replace({});
await PageObjects.settings.navigateTo();
@ -47,7 +47,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await kibanaServer.savedObjects.cleanStandardList();
});
});
describe('remote and local clusters', async () => {
describe('remote and local clusters', () => {
before(async () => {
await es.transport.request({
path: '/blogs/_doc',

View file

@ -13,7 +13,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['settings', 'common', 'header']);
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 () => {
await PageObjects.settings.navigateTo();
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 () => {
await PageObjects.common.navigateToApp('discover', {
hash: `/doc/${indexPatternId}/${indexTitle}?id=${testDocumentId}`,

View file

@ -57,7 +57,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.settings.createIndexPattern('alias2*', 'date');
});
describe('discover verify hits', async () => {
describe('discover verify hits', () => {
before(async () => {
const from = 'Nov 12, 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() {
await kibanaServer.importExport.unload('test/functional/fixtures/kbn_archiver/discover');
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 () => {
const from = 'Sep 17, 2015 @ 06: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']]);
});
describe('data table with date histogram', async () => {
describe('data table with date histogram', () => {
before(async () => {
await PageObjects.visualize.navigateToNewAggBasedVisualization();
await PageObjects.visualize.clickDataTable();

View file

@ -18,20 +18,20 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const testSubjects = getService('testSubjects');
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() {
before(async () => {
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 () {
await inspector.expectIsEnabled();

View file

@ -143,7 +143,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
color: '#00FF00',
});
retry.try(async () => {
await retry.try(async () => {
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 () {
pieChart.expectPieSliceCount(10, isNewChartsLibraryEnabled);
await pieChart.expectPieSliceCount(10, isNewChartsLibraryEnabled);
});
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/';
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 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() {
before(async () => {
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([
'kibana_admin',
'long_window_logstash',
'test_logstash_reader',
]);
await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings();
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 () {
const expectedLabels = [
'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 () {
const axisId = 'ValueAxis-1';
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/long_window_logstash');
});
before(async () => {
await kibanaServer.uiSettings.update({
'histogram:maxBars': 100,
});

View file

@ -553,7 +553,7 @@ export class ConsolePageObject extends FtrService {
await this.retry.try(async () => {
const firstInnerHtml = await line.getAttribute('innerHTML');
// 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');
const secondInnerHtml = await line.getAttribute('innerHTML');
// 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() {
this.retry.try(async () => {
await this.retry.try(async () => {
const url = await this.browser.getCurrentUrl();
expect(url.indexOf('_a')).to.be(-1);
});
@ -453,7 +453,7 @@ export class DashboardPageObject extends FtrService {
const edit = editMode ? `?_a=(viewMode:edit)` : '';
dashboardLocation = `/view/${id}${edit}`;
}
this.common.navigateToActualUrl('dashboard', dashboardLocation, args);
await this.common.navigateToActualUrl('dashboard', dashboardLocation, args);
}
public async gotoDashboardListingURL({

View file

@ -638,7 +638,7 @@ export class DashboardPageControls extends FtrService {
selectedType?: string;
}) {
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}`);
expect(await controlTypeItem.isEnabled()).to.be(true);
if (type === selectedType) {

View file

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

View file

@ -68,7 +68,7 @@ export class VisualBuilderPageObject extends FtrService {
private async toggleYesNoSwitch(testSubj: string, value: boolean) {
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();
}
@ -577,7 +577,7 @@ export class VisualBuilderPageObject extends FtrService {
if (useKibanaIndices === false) {
const el = await this.testSubjects.find(metricsIndexPatternInput);
el.focus();
await el.focus();
await el.clearValue();
if (value) {
await el.type(value, { charByChar: true });

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -22,6 +22,7 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide
const browser = getService('browser');
const find = getService('find');
const supertest = getService('supertest');
const log = getService('log');
const PageObjects = getPageObjects(['common']);
describe('Telemetry service', () => {
@ -30,7 +31,8 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide
return browser.executeAsync<boolean>((cb) => {
(window as unknown as Record<string, () => Promise<boolean>>)
._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) => {
(window as unknown as Record<string, () => Promise<boolean>>)
._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`);
};
describe('Index Lifecycle Management Accessibility', async () => {
describe('Index Lifecycle Management Accessibility', () => {
before(async () => {
await esClient.snapshot.createRepository({
name: REPO_NAME,

View file

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

View file

@ -25,13 +25,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await a11y.testAppSnapshot();
});
describe('index management', async () => {
describe('indices', async () => {
describe('index management', () => {
describe('indices', () => {
it('empty state', async () => {
await PageObjects.settings.clickIndexManagement();
await a11y.testAppSnapshot();
});
describe('indices with data', async () => {
describe('indices with data', () => {
before(async () => {
await esArchiver.loadIfNeeded(
'test/functional/fixtures/es_archiver/logstash_functional'
@ -48,7 +48,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await a11y.testAppSnapshot();
});
describe('index details', async () => {
describe('index details', () => {
it('index details - overview', async () => {
await PageObjects.settings.clickIndexManagement();
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
describe('Create Space B and Verify', async () => {
describe('Create Space B and Verify', () => {
it('a11y test for delete space button', async () => {
await PageObjects.spaceSelector.clickCreateSpace();
await PageObjects.spaceSelector.clickEnterSpaceName();

View file

@ -156,7 +156,7 @@ export default function ({ getService }: FtrProviderContext) {
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.setJobId(dfaOutlierJobId);
await a11y.testAppSnapshot();
@ -203,7 +203,7 @@ export default function ({ getService }: FtrProviderContext) {
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.setJobId(dfaRegressionJobId);
await a11y.testAppSnapshot();
@ -252,7 +252,7 @@ export default function ({ getService }: FtrProviderContext) {
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.setJobId(dfaClassificationJobId);
await a11y.testAppSnapshot();

View file

@ -21,12 +21,12 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const retry = getService('retry');
// github.com/elastic/kibana/issues/153599
describe.skip('cross cluster replication - a11y tests', async () => {
describe.skip('cross cluster replication - a11y tests', () => {
before(async () => {
await PageObjects.common.navigateToApp('crossClusterReplication');
});
describe('follower index tab', async () => {
describe('follower index tab', () => {
const remoteName = `testremote${Date.now().toString()}`;
const testIndex = `testindex${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 () => {
await a11y.testAppSnapshot();
});
describe('follower index tab', async () => {
describe('follower index form', async () => {
describe('follower index tab', () => {
describe('follower index form', () => {
before(async () => {
await PageObjects.common.navigateToApp('remoteClusters');
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 index form', async () => {
describe('auto-follower patterns', () => {
describe('auto follower index form', () => {
before(async () => {
await PageObjects.crossClusterReplication.clickAutoFollowerTab();
});

View file

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

View file

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

View file

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

View file

@ -55,7 +55,7 @@ export default function ({ getService }: FtrProviderContext) {
});
after(async () => {
objectRemover.removeAll();
await objectRemover.removeAll();
await deleteDataView({
supertest,
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();
afterEach(async () => {
asyncForEach(backfillIds, async ({ id, spaceId }: { id: string; spaceId: string }) => {
await asyncForEach(backfillIds, async ({ id, spaceId }: { id: string; spaceId: string }) => {
await supertest
.delete(`${getUrlPrefix(spaceId)}/internal/alerting/rules/backfill/${id}`)
.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();
afterEach(async () => {
asyncForEach(backfillIds, async ({ id, spaceId }: { id: string; spaceId: string }) => {
await asyncForEach(backfillIds, async ({ id, spaceId }: { id: string; spaceId: string }) => {
await supertest
.delete(`${getUrlPrefix(spaceId)}/internal/alerting/rules/backfill/${id}`)
.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();
afterEach(async () => {
asyncForEach(backfillIds, async ({ id, spaceId }: { id: string; spaceId: string }) => {
await asyncForEach(backfillIds, async ({ id, spaceId }: { id: string; spaceId: string }) => {
await supertest
.delete(`${getUrlPrefix(spaceId)}/internal/alerting/rules/backfill/${id}`)
.set('kbn-xsrf', 'foo');

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -39,7 +39,7 @@ export default function createAlertsAsDataFlappingTest({ getService }: FtrProvid
query: { match_all: {} },
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

View file

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

View file

@ -111,7 +111,7 @@ export default function featureControlsTests({ getService }: FtrProviderContext)
expectResponse(regularSettingResult);
const telemetryResult = await saveTelemetrySetting(username, password);
expectTelemetryResponse(telemetryResult, true);
await expectTelemetryResponse(telemetryResult, true);
} finally {
await security.role.delete(roleName);
await security.user.delete(username);
@ -143,7 +143,7 @@ export default function featureControlsTests({ getService }: FtrProviderContext)
expect403(regularSettingResult);
const telemetryResult = await saveTelemetrySetting(username, password);
expectTelemetryResponse(telemetryResult, false);
await expectTelemetryResponse(telemetryResult, false);
} finally {
await security.role.delete(roleName);
await security.user.delete(username);
@ -217,7 +217,7 @@ export default function featureControlsTests({ getService }: FtrProviderContext)
expectResponse(regularSettingResult);
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 () => {
@ -225,7 +225,7 @@ export default function featureControlsTests({ getService }: FtrProviderContext)
expect403(regularSettingResult);
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 () => {
@ -233,7 +233,7 @@ export default function featureControlsTests({ getService }: FtrProviderContext)
expect403(regularSettingResult);
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
await new Promise((resolve) =>
setTimeout(() => {
req.abort();
void req.abort(); // Explicitly ignore any potential promise
resolve(null);
}, 2000)
);

View file

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

View file

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

View file

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

View file

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

View file

@ -55,7 +55,7 @@ export function UsageAPIProvider({ getService }: FtrProviderContext) {
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana');
if (opts?.authHeader) {
request.set(opts.authHeader);
void request.set(opts.authHeader);
}
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');
for (const field of fields) {
formDataRequest.field(field[0], field[1]);
void formDataRequest.field(field[0], field[1]);
}
res = await formDataRequest;

View file

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

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