Skip to content

Commit

Permalink
Add retry steps in case automated screenshots
Browse files Browse the repository at this point in the history
  • Loading branch information
lcawl committed Sep 24, 2024
1 parent 88e041d commit 73117d1
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { FtrProviderContext } from '../../../../../ftr_provider_context';
import { navigateToCasesApp } from '../../../../../../shared/lib/cases';

export default function ({ getPageObject, getPageObjects, getService }: FtrProviderContext) {
const pageObjects = getPageObjects(['header']);
const retry = getService('retry');
const svlCases = getService('svlCases');
const svlCommonScreenshots = getService('svlCommonScreenshots');
const svlCommonPage = getPageObject('svlCommonPage');
Expand All @@ -27,7 +29,13 @@ export default function ({ getPageObject, getPageObjects, getService }: FtrProvi

it('case settings screenshots', async () => {
await navigateToCasesApp(getPageObject, getService, owner);
await retry.waitFor('configure-case-button exist', async () => {
return await testSubjects.exists('configure-case-button');
});
await testSubjects.click('configure-case-button');
await retry.waitFor('add-custom-field exist', async () => {
return await testSubjects.exists('add-custom-field');
});
await testSubjects.click('add-custom-field');
await svlCommonScreenshots.takeScreenshot(
'observability-cases-custom-fields',
Expand All @@ -36,25 +44,43 @@ export default function ({ getPageObject, getPageObjects, getService }: FtrProvi
700
);
await testSubjects.setValue('custom-field-label-input', 'my-field');
await retry.waitFor('common-flyout-save exist', async () => {
return await testSubjects.exists('common-flyout-save');
});
await testSubjects.click('common-flyout-save');
await svlCommonScreenshots.takeScreenshot(
'observability-cases-settings',
screenshotDirectories
);
await retry.waitFor('add-template exist', async () => {
return await testSubjects.exists('add-template');
});
await testSubjects.click('add-template');
await svlCommonScreenshots.takeScreenshot(
'observability-cases-templates',
screenshotDirectories,
1400,
1000
);
await retry.waitFor('common-flyout-cancel exist', async () => {
return await testSubjects.exists('common-flyout-cancel');
});
await testSubjects.click('common-flyout-cancel');
await retry.waitFor('dropdown-connectors exist', async () => {
return await testSubjects.exists('dropdown-connectors');
});
await testSubjects.click('dropdown-connectors');
await retry.waitFor('dropdown-connector-add-connector exist', async () => {
return await testSubjects.exists('dropdown-connector-add-connector');
});
await testSubjects.click('dropdown-connector-add-connector');
await svlCommonScreenshots.takeScreenshot(
'observability-cases-add-connector',
screenshotDirectories
);
await retry.waitFor('euiFlyoutCloseButton exist', async () => {
return await testSubjects.exists('euiFlyoutCloseButton');
});
await testSubjects.click('euiFlyoutCloseButton');
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import { navigateToCasesApp } from '../../../../../../shared/lib/cases';

export default function ({ getPageObject, getPageObjects, getService }: FtrProviderContext) {
const pageObjects = getPageObjects(['common', 'header', 'svlCommonPage', 'svlCommonNavigation']);
const retry = getService('retry');
const svlCases = getService('svlCases');
const svlCommonScreenshots = getService('svlCommonScreenshots');
const screenshotDirectories = ['response_ops_docs', 'security_cases'];
const testSubjects = getService('testSubjects');
const owner = SECURITY_SOLUTION_OWNER;

// FLAKY: https://github.com/elastic/kibana/issues/188997
describe.skip('security case settings', function () {
describe('security case settings', function () {
after(async () => {
await svlCases.api.deleteAllCaseItems();
});
Expand All @@ -29,29 +29,56 @@ export default function ({ getPageObject, getPageObjects, getService }: FtrProvi

it('case settings screenshot', async () => {
await navigateToCasesApp(getPageObject, getService, owner);
await retry.waitFor('configure-case-button exist', async () => {
return await testSubjects.exists('configure-case-button');
});
await testSubjects.click('configure-case-button');
await pageObjects.header.waitUntilLoadingHasFinished();
await retry.waitFor('add-custom-field exist', async () => {
return await testSubjects.exists('add-custom-field');
});
await testSubjects.click('add-custom-field');
await svlCommonScreenshots.takeScreenshot(
'security-cases-custom-fields',
screenshotDirectories,
1400,
700
);
await retry.waitFor('custom-field-label-input exist', async () => {
return await testSubjects.exists('custom-field-label-input');
});
await testSubjects.setValue('custom-field-label-input', 'my-field');
await retry.waitFor('common-flyout-save exist', async () => {
return await testSubjects.exists('common-flyout-save');
});
await testSubjects.click('common-flyout-save');
await svlCommonScreenshots.takeScreenshot('security-cases-settings', screenshotDirectories);
await retry.waitFor('add-template to exist', async () => {
return await testSubjects.exists('add-template');
});
await testSubjects.click('add-template');
await svlCommonScreenshots.takeScreenshot(
'security-cases-templates',
screenshotDirectories,
1400,
1000
);
await retry.waitFor('common-flyout-cancel to exist', async () => {
return await testSubjects.exists('common-flyout-cancel');
});
await testSubjects.click('common-flyout-cancel');
await retry.waitFor('dropdown-connectors to exist', async () => {
return await testSubjects.exists('dropdown-connectors');
});
await testSubjects.click('dropdown-connectors');
await retry.waitFor('dropdown-connector-add-connector to exist', async () => {
return await testSubjects.exists('dropdown-connector-add-connector');
});
await testSubjects.click('dropdown-connector-add-connector');
await svlCommonScreenshots.takeScreenshot('security-cases-connectors', screenshotDirectories);
await retry.waitFor('euiFlyoutCloseButton exist', async () => {
return await testSubjects.exists('euiFlyoutCloseButton');
});
await testSubjects.click('euiFlyoutCloseButton');
});
});
Expand Down

0 comments on commit 73117d1

Please sign in to comment.