Skip to content

Commit

Permalink
Fixed assertion in hybrid index pattern test to iterate through indic…
Browse files Browse the repository at this point in the history
…es (elastic#70130)

* Fixed assertion to check through all indices before making assertion.

* Restored yarn.lock file.

* Removed only from describe.

* Fixed linting issue.

* Fixed nits that were in the PR conversation.

Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
2 people authored and John Dorlus committed Jul 2, 2020
1 parent ad3ae82 commit 9f9eb92
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
7 changes: 7 additions & 0 deletions test/functional/page_objects/settings_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,13 @@ export function SettingsPageProvider({ getService, getPageObjects }: FtrProvider
);
}

async getAllIndexPatternNames() {
const indexPatterns = await this.getIndexPatternList();
return await mapAsync(indexPatterns, async (index) => {
return await index.getVisibleText();
});
}

async isIndexPatternListEmpty() {
await testSubjects.existOrFail('indexPatternTable', { timeout: 5000 });
const indexPatternList = await this.getIndexPatternList();
Expand Down
11 changes: 7 additions & 4 deletions x-pack/test/functional/apps/rollup_job/hybrid_index_pattern.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,13 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.settings.createIndexPattern(rollupIndexPatternName, '@timestamp', false);

await PageObjects.settings.clickKibanaIndexPatterns();
const indexPattern = (await PageObjects.settings.getIndexPatternList()).pop();
const indexPatternText = await indexPattern.getVisibleText();
expect(indexPatternText).to.contain(rollupIndexPatternName);
expect(indexPatternText).to.contain('Rollup');
const indexPatternNames = await PageObjects.settings.getAllIndexPatternNames();
//The assertion is going to check that the string has the right name and that the text Rollup
//is included (since there is a Rollup tag).
const filteredIndexPatternNames = indexPatternNames.filter(
(i) => i.includes(rollupIndexPatternName) && i.includes('Rollup')
);
expect(filteredIndexPatternNames.length).to.be(1);
});

after(async () => {
Expand Down

0 comments on commit 9f9eb92

Please sign in to comment.