Skip to content

Commit

Permalink
Search Sessions: Improve Flaky Functional Test (#89370)
Browse files Browse the repository at this point in the history
* Search Sessions: Unskip Flaky Functional Test

* typo

* keep skip for now

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
tsullivan and kibanamachine authored Feb 2, 2021
1 parent 5f64e67 commit 10e1f1c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import { FtrProviderContext } from '../ftr_provider_context';

export function SearchSessionsPageProvider({ getService, getPageObjects }: FtrProviderContext) {
const log = getService('log');
const find = getService('find');
const testSubjects = getService('testSubjects');
const PageObjects = getPageObjects(['common']);
Expand All @@ -21,7 +22,7 @@ export function SearchSessionsPageProvider({ getService, getPageObjects }: FtrPr
},

async getList() {
const table = await find.byCssSelector('table');
const table = await testSubjects.find('searchSessionsMgmtTable');
const allRows = await table.findAllByTestSubject('searchSessionsRow');

return Promise.all(
Expand All @@ -37,15 +38,18 @@ export function SearchSessionsPageProvider({ getService, getPageObjects }: FtrPr
expires: $.findTestSubject('sessionManagementExpiresCol').text(),
app: $.findTestSubject('sessionManagementAppIcon').attr('data-test-app-id'),
view: async () => {
log.debug('management ui: view the session');
await viewCell.click();
},
reload: async () => {
log.debug('management ui: reload the status');
await actionsCell.click();
await find.clickByCssSelector(
'[data-test-subj="sessionManagementPopoverAction-reload"]'
);
},
cancel: async () => {
log.debug('management ui: cancel the session');
await actionsCell.click();
await find.clickByCssSelector(
'[data-test-subj="sessionManagementPopoverAction-cancel"]'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,27 @@ export function SearchSessionsProvider({ getService }: FtrProviderContext) {
}

public async viewSearchSessions() {
log.debug('viewSearchSessions');
await this.ensurePopoverOpened();
await testSubjects.click('searchSessionIndicatorviewSearchSessionsLink');
}

public async save() {
log.debug('save the search session');
await this.ensurePopoverOpened();
await testSubjects.click('searchSessionIndicatorSaveBtn');
await this.ensurePopoverClosed();
}

public async cancel() {
log.debug('cancel the search session');
await this.ensurePopoverOpened();
await testSubjects.click('searchSessionIndicatorCancelBtn');
await this.ensurePopoverClosed();
}

public async refresh() {
log.debug('refresh the status');
await this.ensurePopoverOpened();
await testSubjects.click('searchSessionIndicatorRefreshBtn');
await this.ensurePopoverClosed();
Expand All @@ -85,15 +89,20 @@ export function SearchSessionsProvider({ getService }: FtrProviderContext) {
}

private async ensurePopoverOpened() {
log.debug('ensurePopoverOpened');
const isAlreadyOpen = await testSubjects.exists(SEARCH_SESSIONS_POPOVER_CONTENT_TEST_SUBJ);
if (isAlreadyOpen) return;
if (isAlreadyOpen) {
log.debug('Popover is already open');
return;
}
return retry.waitFor(`searchSessions popover opened`, async () => {
await testSubjects.click(SEARCH_SESSION_INDICATOR_TEST_SUBJ);
return await testSubjects.exists(SEARCH_SESSIONS_POPOVER_CONTENT_TEST_SUBJ);
});
}

private async ensurePopoverClosed() {
log.debug('ensurePopoverClosed');
const isAlreadyClosed = !(await testSubjects.exists(
SEARCH_SESSIONS_POPOVER_CONTENT_TEST_SUBJ
));
Expand All @@ -110,7 +119,7 @@ export function SearchSessionsProvider({ getService }: FtrProviderContext) {
* Alternatively, a test can navigate to `Management > Search Sessions` and use the UI to delete any created tests.
*/
public async deleteAllSearchSessions() {
log.debug('Deleting created searcg sessions');
log.debug('Deleting created search sessions');
// ignores 409 errs and keeps retrying
await retry.tryForTime(10000, async () => {
const { body } = await supertest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { FtrProviderContext } from '../../../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const testSubjects = getService('testSubjects');
const retry = getService('retry');
const PageObjects = getPageObjects([
'common',
'header',
Expand All @@ -18,20 +19,25 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
]);
const searchSessions = getService('searchSessions');
const esArchiver = getService('esArchiver');
const retry = getService('retry');
const log = getService('log');

// FLAKY: https://github.com/elastic/kibana/issues/89069
describe.skip('Search search sessions Management UI', () => {
describe.skip('Search sessions Management UI', () => {
describe('New search sessions', () => {
before(async () => {
await PageObjects.common.navigateToApp('dashboard');
log.debug('wait for dashboard landing page');
retry.tryForTime(10000, async () => {
testSubjects.existOrFail('dashboardLandingPage');
});
});

after(async () => {
await searchSessions.deleteAllSearchSessions();
});

it('Saves a session and verifies it in the Management app', async () => {
log.debug('loading the "Not Delayed" dashboard');
await PageObjects.dashboard.loadSavedDashboard('Not Delayed');
await PageObjects.dashboard.waitForRenderComplete();
await searchSessions.expectState('completed');
Expand All @@ -47,6 +53,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});

// find there is only one item in the table which is the newly saved session
log.debug('find the newly saved session');
const searchSessionList = await PageObjects.searchSessionsManagement.getList();
expect(searchSessionList.length).to.be(1);
expect(searchSessionList[0].expires).not.to.eql('--');
Expand All @@ -63,6 +70,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await searchSessions.expectState('restored');
});

// NOTE: this test depends on the previous one passing
it('Reloads as new session from management', async () => {
await PageObjects.searchSessionsManagement.goTo();

Expand Down

0 comments on commit 10e1f1c

Please sign in to comment.