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 (#70130) (#70541)

* 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 <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
  • Loading branch information
John Dorlus and elasticmachine authored Jul 2, 2020
1 parent cd37c33 commit 549fc5d
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 @@ -305,6 +305,13 @@ export function SettingsPageProvider({ getService, getPageObjects }: FtrProvider
return await find.allByCssSelector('[data-test-subj="indexPatternTable"] .euiTable a');
}

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 549fc5d

Please sign in to comment.