Skip to content

Commit

Permalink
add retry to handle loading indicator timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
js-jankisalvi committed Aug 11, 2023
1 parent e5393ab commit 521b5f1
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/

import { expect } from 'expect';
import { v4 as uuidv4 } from 'uuid';
import { ConnectorTypes } from '@kbn/cases-plugin/common/types/domain';
import { FtrProviderContext } from '../../../ftr_provider_context';
import { createCase } from './helper/api';
Expand All @@ -19,15 +18,13 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {
const testSubjects = getService('testSubjects');
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const dashboardAddPanel = getService('dashboardAddPanel');
const cases = getService('cases');
const find = getService('find');
const supertest = getService('supertest');
const retry = getService('retry');

describe('persistable attachment', () => {
describe('lens visualization', () => {
const myDashboardName = `My-dashboard-${uuidv4()}`;

before(async () => {
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional');
await kibanaServer.importExport.load(
Expand All @@ -40,9 +37,13 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {

await dashboard.clickNewDashboard();

await dashboardAddPanel.clickCreateNewLink();
await retry.try(async () => {
await testSubjects.click('dashboardAddNewPanelButton');
});

await lens.goToTimeRange();
await retry.try(async () => {
await lens.goToTimeRange();
});

await lens.configureDimension({
dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension',
Expand All @@ -64,7 +65,6 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {

await lens.saveAndReturn();
await dashboard.waitForRenderComplete();
await dashboard.saveDashboard(myDashboardName);
});

after(async () => {
Expand All @@ -83,10 +83,11 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {
await testSubjects.click('embeddablePanelMore-mainMenu');
await testSubjects.click('embeddablePanelAction-embeddable_addToNewCase');

await cases.create.createCase({
title: caseTitle,
description: 'test description',
});
await testSubjects.existOrFail('create-case-flyout');

await testSubjects.setValue('input', caseTitle);

await testSubjects.setValue('euiMarkdownEditorTextArea', 'test description');

// verify that solution picker is not visible
await testSubjects.missingOrFail('caseOwnerSelector');
Expand All @@ -97,6 +98,11 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {

await testSubjects.click('toaster-content-case-view-link');

if (await testSubjects.exists('appLeaveConfirmModal')) {
await testSubjects.exists('confirmModalConfirmButton');
await testSubjects.click('confirmModalConfirmButton');
}

const title = await find.byCssSelector('[data-test-subj="editable-title-header-value"]');
expect(await title.getVisibleText()).toEqual(caseTitle);

Expand Down Expand Up @@ -137,6 +143,11 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {
await cases.common.expectToasterToContain(`${theCaseTitle} has been updated`);
await testSubjects.click('toaster-content-case-view-link');

if (await testSubjects.exists('appLeaveConfirmModal')) {
await testSubjects.exists('confirmModalConfirmButton');
await testSubjects.click('confirmModalConfirmButton');
}

const title = await find.byCssSelector('[data-test-subj="editable-title-header-value"]');
expect(await title.getVisibleText()).toEqual(theCaseTitle);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {
const lens = getPageObject('lens');
const svlSearchNavigation = getService('svlSearchNavigation');
const svlCommonNavigation = getPageObject('svlCommonNavigation');
const dashboardAddPanel = getService('dashboardAddPanel');
const retry = getService('retry');

describe('persistable attachment', () => {
describe('lens visualization', () => {
Expand All @@ -31,9 +31,13 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {

await dashboard.clickNewDashboard();

await dashboardAddPanel.clickCreateNewLink();
await retry.try(async () => {
await testSubjects.click('dashboardAddNewPanelButton');
});

await lens.goToTimeRange();
await retry.try(async () => {
await lens.goToTimeRange();
});

await lens.configureDimension({
dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/

import { expect } from 'expect';
import { v4 as uuidv4 } from 'uuid';
import { ConnectorTypes } from '@kbn/cases-plugin/common/types/domain';
import { FtrProviderContext } from '../../../../ftr_provider_context';
import { createCase } from './helper/api';
Expand All @@ -18,16 +17,13 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {
const testSubjects = getService('testSubjects');
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const dashboardAddPanel = getService('dashboardAddPanel');
const cases = getService('cases');
const find = getService('find');
const listingTable = getService('listingTable');
const supertest = getService('supertest');
const retry = getService('retry');

describe('persistable attachment', () => {
describe('lens visualization', () => {
const myDashboardName = `My-dashboard-${uuidv4()}`;

before(async () => {
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional');
await kibanaServer.importExport.load(
Expand All @@ -40,9 +36,13 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {

await dashboard.clickNewDashboard();

await dashboardAddPanel.clickCreateNewLink();
await retry.try(async () => {
await testSubjects.click('dashboardAddNewPanelButton');
});

await lens.goToTimeRange();
await retry.try(async () => {
await lens.goToTimeRange();
});

await lens.configureDimension({
dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension',
Expand All @@ -65,7 +65,6 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {
await lens.saveAndReturn();

await dashboard.waitForRenderComplete();
await dashboard.saveDashboard(myDashboardName);
});

after(async () => {
Expand Down Expand Up @@ -100,6 +99,11 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {

await testSubjects.click('toaster-content-case-view-link');

if (await testSubjects.exists('appLeaveConfirmModal')) {
await testSubjects.exists('confirmModalConfirmButton');
await testSubjects.click('confirmModalConfirmButton');
}

const title = await find.byCssSelector('[data-test-subj="editable-title-header-value"]');
expect(await title.getVisibleText()).toEqual(caseTitle);

Expand Down Expand Up @@ -128,8 +132,9 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {

await testSubjects.click('solutionSideNavItemLink-dashboards');

await listingTable.searchForItemWithName(myDashboardName);
await listingTable.clickItemLink('dashboard', myDashboardName);
if (await testSubjects.exists('edit-unsaved-New-Dashboard')) {
await testSubjects.click('edit-unsaved-New-Dashboard');
}

await testSubjects.click('embeddablePanelToggleMenuIcon');
await testSubjects.click('embeddablePanelMore-mainMenu');
Expand All @@ -143,6 +148,11 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {
await cases.common.expectToasterToContain(`${theCaseTitle} has been updated`);
await testSubjects.click('toaster-content-case-view-link');

if (await testSubjects.exists('appLeaveConfirmModal')) {
await testSubjects.exists('confirmModalConfirmButton');
await testSubjects.click('confirmModalConfirmButton');
}

const title = await find.byCssSelector('[data-test-subj="editable-title-header-value"]');
expect(await title.getVisibleText()).toEqual(theCaseTitle);

Expand Down

0 comments on commit 521b5f1

Please sign in to comment.