Skip to content

Commit

Permalink
Update clickOptionalAddNewButton method used in createIndexPattern (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
liza-mae authored Nov 8, 2018
1 parent 57f5c67 commit dca4772
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
1 change: 0 additions & 1 deletion test/functional/apps/getting_started/_shakespeare.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export default function ({ getService, getPageObjects }) {

it('should create shakespeare index pattern', async function () {
log.debug('Create shakespeare index pattern');
await PageObjects.settings.navigateTo();
await PageObjects.settings.createIndexPattern('shakes', null);
const indexPageHeading = await PageObjects.settings.getIndexPageHeading();
const patternName = await indexPageHeading.getVisibleText();
Expand Down
2 changes: 0 additions & 2 deletions test/functional/apps/management/_handle_alias.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export default function ({ getService, getPageObjects }) {
});

it('should be able to create index pattern without time field', async function () {
await PageObjects.settings.navigateTo();
await PageObjects.settings.createIndexPattern('alias1', null);
const indexPageHeading = await PageObjects.settings.getIndexPageHeading();
const patternName = await indexPageHeading.getVisibleText();
Expand All @@ -64,7 +63,6 @@ export default function ({ getService, getPageObjects }) {


it('should be able to create index pattern with timefield', async function () {
await PageObjects.settings.navigateTo();
await PageObjects.settings.createIndexPattern('alias2', 'date');
const indexPageHeading = await PageObjects.settings.getIndexPageHeading();
const patternName = await indexPageHeading.getVisibleText();
Expand Down
11 changes: 3 additions & 8 deletions test/functional/page_objects/settings_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ export function SettingsPageProvider({ getService, getPageObjects }) {
await this.clickKibanaIndices();
await PageObjects.header.waitUntilLoadingHasFinished();
await this.clickOptionalAddNewButton();
await PageObjects.header.waitUntilLoadingHasFinished();
await retry.try(async () => {
await this.setIndexPatternField(indexPatternName);
});
Expand All @@ -302,15 +303,9 @@ export function SettingsPageProvider({ getService, getPageObjects }) {
return await this.getIndexPatternIdFromUrl();
}

//adding a method to check if the create index pattern button is visible(while adding more than 1 index pattern)

// adding a method to check if the create index pattern button is visible when more than 1 index pattern is present
async clickOptionalAddNewButton() {
const buttonParent = await testSubjects.find('createIndexPatternParent');
const buttonVisible = (await buttonParent.getProperty('innerHTML')).includes(
'createIndexPatternButton'
);
log.debug('found the button ' + buttonVisible);
if (buttonVisible) {
if (await testSubjects.isDisplayed('createIndexPatternButton')) {
await testSubjects.click('createIndexPatternButton');
}
}
Expand Down
7 changes: 7 additions & 0 deletions test/functional/services/test_subjects.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,13 @@ export function TestSubjectsProvider({ getService }) {
});
}

async isDisplayed(selector) {
return await retry.try(async () => {
const element = await this.find(selector);
return await element.isDisplayed();
});
}

async isSelected(selector) {
return await retry.try(async () => {
const element = await this.find(selector);
Expand Down

0 comments on commit dca4772

Please sign in to comment.