Skip to content

Commit

Permalink
[8.12] [Index Management] Fix index templates flaky tests (#172949) (#…
Browse files Browse the repository at this point in the history
…173479)

Closes #172831
Closes #172832

# Backport

This will backport the following commits from `main` to `8.12`:
- [[Index Management] Fix index templates flaky tests
(#172949)](#172949)

<!--- Backport version: 8.9.8 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Ignacio
Rivas","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-12-13T11:24:25Z","message":"[Index
Management] Fix index templates flaky tests
(#172949)","sha":"a3b4c0a2ce9e90a802ebc2851b5484f3c005a750","branchLabelMapping":{"^v8.13.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Index
Management","Team:Deployment
Management","release_note:skip","backport:skip","v8.13.0"],"number":172949,"url":"https://github.com/elastic/kibana/pull/172949","mergeCommit":{"message":"[Index
Management] Fix index templates flaky tests
(#172949)","sha":"a3b4c0a2ce9e90a802ebc2851b5484f3c005a750"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.13.0","labelRegex":"^v8.13.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/172949","number":172949,"mergeCommit":{"message":"[Index
Management] Fix index templates flaky tests
(#172949)","sha":"a3b4c0a2ce9e90a802ebc2851b5484f3c005a750"}}]}]
BACKPORT-->
  • Loading branch information
sabarasaba authored Dec 18, 2023
1 parent 6212a62 commit ef55d8c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export function FormWizard<T extends object = { [key: string]: any }, S extends
? 'complete'
: 'incomplete') as EuiStepStatus,
disabled: getIsStepDisabled(index),
'data-test-subj': `formWizardStep-${index}`,
onClick: () => navigateToStep(index),
};
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,14 @@ import type { WebElementWrapper } from '../../../../../../../test/functional/ser
export default ({ getPageObjects, getService }: FtrProviderContext) => {
const pageObjects = getPageObjects(['svlCommonPage', 'common', 'indexManagement', 'header']);
const browser = getService('browser');
const security = getService('security');
const testSubjects = getService('testSubjects');
const es = getService('es');
const retry = getService('retry');

const TEST_TEMPLATE = 'a_test_template';

describe('Index Templates', function () {
before(async () => {
await security.testUser.setRoles(['index_management_user']);
// Navigate to the index management page
await pageObjects.svlCommonPage.login();
});

Expand Down Expand Up @@ -53,7 +51,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
});

after(async () => {
await es.indices.deleteIndexTemplate({ name: TEST_TEMPLATE });
await es.indices.deleteIndexTemplate({ name: TEST_TEMPLATE }, { ignore: [404] });
});

it('Displays the test template in the list of templates', async () => {
Expand All @@ -77,25 +75,25 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
});

describe('Create index template', () => {
const TEST_TEMPLATE_NAME = `test_template_${Math.random()}`;

after(async () => {
await es.indices.deleteIndexTemplate({ name: TEST_TEMPLATE });
await es.indices.deleteIndexTemplate({ name: TEST_TEMPLATE_NAME }, { ignore: [404] });
});

it('Creates index template', async () => {
await testSubjects.click('createTemplateButton');

await testSubjects.setValue('nameField', TEST_TEMPLATE);
await testSubjects.setValue('nameField', TEST_TEMPLATE_NAME);
await testSubjects.setValue('indexPatternsField', 'test*');

// Finish wizard flow
await testSubjects.click('nextButton');
await testSubjects.click('nextButton');
await testSubjects.click('nextButton');
await testSubjects.click('nextButton');
await testSubjects.click('nextButton');
// Click form summary step and then the submit button
await testSubjects.click('formWizardStep-5');
await testSubjects.click('nextButton');

expect(await testSubjects.getVisibleText('title')).to.contain(TEST_TEMPLATE);
await retry.try(async () => {
expect(await testSubjects.getVisibleText('stepTitle')).to.contain(TEST_TEMPLATE_NAME);
});
});
});
});
Expand Down

0 comments on commit ef55d8c

Please sign in to comment.