Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ export const ComponentTable: FunctionComponent<Props> = ({
<EuiButton
fill
iconType="plusInCircle"
data-test-subj="createPipelineButton"
key="createPipelineButton"
data-test-subj="createComponentTemplateButton"
key="createComponentTemplateButton"
{...reactRouterNavigate(history, '/create_component_template')}
>
{i18n.translate('xpack.idxMgmt.componentTemplatesList.table.createButtonLabel', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,23 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {

await log.debug('Navigating to the enrich policies tab');
await security.testUser.setRoles(['index_management_user']);
await pageObjects.common.navigateToApp('indexManagement');
// Navigate to the enrich policies tab
await pageObjects.indexManagement.changeTabs('enrich_policiesTab');
await pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.indexManagement.navigateToIndexManagementTab('enrich_policies');
// Click create policy button
await testSubjects.click('enrichPoliciesEmptyPromptCreateButton');
});

after(async () => {
await log.debug('Cleaning up created index');
await log.debug('Cleaning up created index and policy');

try {
await es.enrich.deletePolicy({ name: POLICY_NAME });
} catch (e) {
log.debug(`[Teardown error] Error deleting test policy: ${e.message}`);
}
try {
await es.indices.delete({ index: INDEX_NAME });
} catch (e) {
log.debug('[Teardown error] Error deleting test policy');
throw e;
log.debug(`[Teardown error] Error deleting test index: ${e.message}`);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could separate these into two try-catch blocks so that if one fails the other resource is still deleted, and the log message would be more helpful (i.e. right now, if the policy deletion failed, the logs will say that the index deletion failed).

}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {

await log.debug('Navigating to the data streams tab');
await security.testUser.setRoles(['index_management_user']);
await pageObjects.common.navigateToApp('indexManagement');
// Navigate to the data streams tab
await pageObjects.indexManagement.changeTabs('data_streamsTab');
await pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.indexManagement.navigateToIndexManagementTab('data_streams');
});

after(async () => {
Expand Down Expand Up @@ -153,9 +150,13 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
// Submit the form
await testSubjects.click('saveButton');

// Expect to see a success toast
const successToast = await toasts.getElementByIndex(1);
expect(await successToast.getVisibleText()).to.contain(
// Wait for the modal to close after successful submission
await testSubjects.missingOrFail('editDataRetentionModal');

// Wait for and verify the success toast appears
await toasts.assertCount(1);
const successToastContent = await toasts.getContentByIndex(1);
expect(successToastContent).to.contain(
'Data retention has been updated for 2 data streams.'
);
// Clear up toasts for next test
Expand All @@ -172,9 +173,13 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
// Submit the form
await testSubjects.click('saveButton');

// Expect to see a success toast
const successToast = await toasts.getElementByIndex(1);
expect(await successToast.getVisibleText()).to.contain(
// Wait for the modal to close after successful submission
await testSubjects.missingOrFail('editDataRetentionModal');

// Wait for and verify the success toast appears
await toasts.assertCount(1);
const successToastContent = await toasts.getContentByIndex(1);
expect(successToastContent).to.contain(
'Data retention has been updated for 2 data streams.'
);
// Clear up toasts for next test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {

await log.debug('Navigating to the data streams tab');
await security.testUser.setRoles(['index_management_user']);
await pageObjects.common.navigateToApp('indexManagement');
// Navigate to the data streams tab
await pageObjects.indexManagement.changeTabs('data_streamsTab');
await pageObjects.indexManagement.navigateToIndexManagementTab('data_streams');
await pageObjects.header.waitUntilLoadingHasFinished();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,20 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {

await log.debug('Navigating to the enrich policies tab');
await security.testUser.setRoles(['index_management_user']);
await pageObjects.common.navigateToApp('indexManagement');
// Navigate to the enrich policies tab
await pageObjects.indexManagement.changeTabs('enrich_policiesTab');
await pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.indexManagement.navigateToIndexManagementTab('enrich_policies');
});

after(async () => {
await log.debug('Cleaning up created index and policy');

try {
await es.enrich.deletePolicy({ name: ENRICH_POLICY_NAME });
} catch (e) {
log.debug(`[Teardown error] Error deleting test policy: ${e.message}`);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment here

}
try {
await es.indices.delete({ index: ENRICH_INDEX_NAME });
} catch (e) {
log.debug('[Teardown error] Error deleting test policy');
throw e;
log.debug(`[Teardown error] Error deleting test index: ${e.message}`);
}
});

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

it('can delete a policy', async () => {
await security.testUser.setRoles(['index_management_user']);
await pageObjects.common.navigateToApp('indexManagement');
// Navigate to the enrich policies tab
await pageObjects.indexManagement.changeTabs('enrich_policiesTab');
await pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.indexManagement.navigateToIndexManagementTab('enrich_policies');
// Since we disabled wait_for_completion in the server request, we dont know when
// a given policy will finish executing. Until that happens the policy cannot
// be deleted. 2s seems to be plenty enough to guarantee that, at least for this
Expand All @@ -121,9 +118,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
this.tags('skipFIPS');
it('read only access', async () => {
await security.testUser.setRoles(['index_management_monitor_enrich_only']);
await pageObjects.common.navigateToApp('indexManagement');
await pageObjects.indexManagement.changeTabs('enrich_policiesTab');
await pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.indexManagement.navigateToIndexManagementTab('enrich_policies');

await testSubjects.missingOrFail('createPolicyButton');
await testSubjects.missingOrFail('deletePolicyButton');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
const browser = getService('browser');
const retry = getService('retry');
const security = getService('security');
const es = getService('es');

describe('Home page', function () {
before(async () => {
Expand Down Expand Up @@ -66,6 +67,14 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
await pageObjects.indexManagement.clickCreateIndexSaveButton();
await pageObjects.indexManagement.expectIndexToExist(testIndexName);
});

after(async () => {
try {
await es.indices.delete({ index: testIndexName });
} catch (e) {
log.debug(`Index cleanup failed for ${testIndexName}: ${e.message}`);
}
});
});

describe('Data streams', () => {
Expand Down Expand Up @@ -123,7 +132,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {

describe('Enrich policies', () => {
it('renders the enrich policies tab', async () => {
// Navigate to the component templates tab
// Navigate to the enrich policies tab
await pageObjects.indexManagement.changeTabs('enrich_policiesTab');

await pageObjects.header.waitUntilLoadingHasFinished();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,29 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
const find = getService('find');
const browser = getService('browser');
const log = getService('log');
const es = getService('es');

describe('Index template wizard', function () {
before(async () => {
await security.testUser.setRoles(['index_management_user']);
await pageObjects.common.navigateToApp('indexManagement');
// Navigate to the index templates tab
await pageObjects.indexManagement.changeTabs('templatesTab');
await pageObjects.header.waitUntilLoadingHasFinished();
});

describe('Create', () => {
before(async () => {
await pageObjects.indexManagement.navigateToIndexManagementTab('templates');
// Click Create Template button
await testSubjects.click('createTemplateButton');
});

after(async () => {
try {
await es.indices.deleteIndexTemplate({ name: 'test-index-template' });
await pageObjects.indexManagement.navigateToIndexManagementTab('templates');
} catch (e) {
log.debug(`Template cleanup failed for test-index-template: ${e.message}`);
}
});

it('should set the correct page title', async () => {
const pageTitle = await testSubjects.exists('pageTitle');
expect(pageTitle).to.be(true);
Expand Down Expand Up @@ -114,81 +121,91 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
});

// https://github.com/elastic/kibana/pull/195174
it('can preview index template that matches a_fake_index_pattern_that_wont_match_any_indices', async () => {
// Click Create Template button
await testSubjects.click('createTemplateButton');
const pageTitleText = await testSubjects.getVisibleText('pageTitle');
expect(pageTitleText).to.be('Create template');
describe('Preview template test', () => {
before(async () => {
await pageObjects.indexManagement.navigateToIndexManagementTab('templates');
});

const stepTitle1 = await testSubjects.getVisibleText('stepTitle');
expect(stepTitle1).to.be('Logistics');
after(async () => {
try {
await es.indices.deleteIndexTemplate({ name: 'a-star' });
} catch (e) {
log.debug(`Template cleanup failed for a-star: ${e.message}`);
}
});

// Fill out required fields
await testSubjects.setValue('nameField', 'a-star');
await testSubjects.setValue('indexPatternsField', 'a*');
await testSubjects.setValue('priorityField', '1000');
it('can preview index template that matches a_fake_index_pattern_that_wont_match_any_indices', async () => {
// Click Create Template button
await testSubjects.click('createTemplateButton');
const pageTitleText = await testSubjects.getVisibleText('pageTitle');
expect(pageTitleText).to.be('Create template');

// Click Next button
await pageObjects.indexManagement.clickNextButton();
const stepTitle1 = await testSubjects.getVisibleText('stepTitle');
expect(stepTitle1).to.be('Logistics');

// Verify empty prompt
const emptyPrompt = await testSubjects.exists('emptyPrompt');
expect(emptyPrompt).to.be(true);
// Fill out required fields
await testSubjects.setValue('nameField', 'a-star');
await testSubjects.setValue('indexPatternsField', 'a*');
await testSubjects.setValue('priorityField', '1000');

// Click Next button
await pageObjects.indexManagement.clickNextButton();
// Click Next button
await pageObjects.indexManagement.clickNextButton();

// Verify step title
const stepTitle2 = await testSubjects.getVisibleText('stepTitle');
expect(stepTitle2).to.be('Index settings (optional)');
// Verify empty prompt
const emptyPrompt = await testSubjects.exists('emptyPrompt');
expect(emptyPrompt).to.be(true);

// Click Next button
await pageObjects.indexManagement.clickNextButton();
// Click Next button
await pageObjects.indexManagement.clickNextButton();

// Verify step title
const stepTitle3 = await testSubjects.getVisibleText('stepTitle');
expect(stepTitle3).to.be('Mappings (optional)');
// Verify step title
const stepTitle2 = await testSubjects.getVisibleText('stepTitle');
expect(stepTitle2).to.be('Index settings (optional)');

// Click Next button
await pageObjects.indexManagement.clickNextButton();
// Click Next button
await pageObjects.indexManagement.clickNextButton();

// Verify step title
const stepTitle4 = await testSubjects.getVisibleText('stepTitle');
expect(stepTitle4).to.be('Aliases (optional)');
// Verify step title
const stepTitle3 = await testSubjects.getVisibleText('stepTitle');
expect(stepTitle3).to.be('Mappings (optional)');

// Click Next button
await pageObjects.indexManagement.clickNextButton();
// Click Next button
await pageObjects.indexManagement.clickNextButton();

// Verify step title
const stepTitle = await testSubjects.getVisibleText('stepTitle');
expect(stepTitle).to.be("Review details for 'a-star'");
// Verify step title
const stepTitle4 = await testSubjects.getVisibleText('stepTitle');
expect(stepTitle4).to.be('Aliases (optional)');

// Verify that summary exists
const summaryTabContent = await testSubjects.exists('summaryTabContent');
expect(summaryTabContent).to.be(true);
// Click Next button
await pageObjects.indexManagement.clickNextButton();

// Verify that index mode is set to "Standard"
expect(await testSubjects.exists('indexModeTitle')).to.be(true);
expect(await testSubjects.getVisibleText('indexModeValue')).to.be('Standard');
// Verify step title
const stepTitle = await testSubjects.getVisibleText('stepTitle');
expect(stepTitle).to.be("Review details for 'a-star'");

// Click Create template
await pageObjects.indexManagement.clickNextButton();
// Verify that summary exists
const summaryTabContent = await testSubjects.exists('summaryTabContent');
expect(summaryTabContent).to.be(true);

// Click preview tab, we know its the last one
const tabs = await testSubjects.findAll('tab');
await tabs[tabs.length - 1].click();
const templatePreview = await testSubjects.getVisibleText('simulateTemplatePreview');
expect(templatePreview).to.not.contain('error');
// Verify that index mode is set to "Standard"
expect(await testSubjects.exists('indexModeTitle')).to.be(true);
expect(await testSubjects.getVisibleText('indexModeValue')).to.be('Standard');

await testSubjects.click('closeDetailsButton');
});
// Click Create template
await pageObjects.indexManagement.clickNextButton();

// Click preview tab, we know its the last one
const tabs = await testSubjects.findAll('tab');
await tabs[tabs.length - 1].click();
const templatePreview = await testSubjects.getVisibleText('simulateTemplatePreview');
expect(templatePreview).to.not.contain('error');

await testSubjects.click('closeDetailsButton');
});
});
describe('Mappings step', () => {
beforeEach(async () => {
await pageObjects.common.navigateToApp('indexManagement');
// Navigate to the index templates tab
await pageObjects.indexManagement.changeTabs('templatesTab');
await pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.indexManagement.navigateToIndexManagementTab('templates');

// Click Create Template button
await testSubjects.click('createTemplateButton');
Expand All @@ -202,6 +219,14 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
expect(await testSubjects.getVisibleText('stepTitle')).to.be('Mappings (optional)');
});

afterEach(async () => {
try {
await es.indices.deleteIndexTemplate({ name: 'test-index-template' });
} catch (e) {
log.debug(`Template cleanup failed in mappings test: ${e.message}`);
}
});

// Test for catching the bug reported in https://github.com/elastic/kibana/issues/156202
it("clearing up the Numeric subtype dropdown doesn't break the page", async () => {
// Add a mapping field
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
before(async () => {
await log.debug('Navigating to the index templates tab');
await security.testUser.setRoles(['index_management_user']);
await pageObjects.common.navigateToApp('indexManagement');

// Navigate to the templates tab
await pageObjects.indexManagement.changeTabs('templatesTab');
await pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.indexManagement.navigateToIndexManagementTab('templates');
});

it('shows warning callout when deleting a managed index template', async () => {
Expand Down
Loading