Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Discover] Fix management flaky test #141650

Merged
merged 6 commits into from
Sep 26, 2022
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
27 changes: 16 additions & 11 deletions test/functional/apps/management/_scripted_fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.discover.clickFieldListItemVisualize(scriptedPainlessFieldName);
await PageObjects.header.waitUntilLoadingHasFinished();
// verify Lens opens a visualization
expect(await testSubjects.getVisibleTextAll('lns-dimensionTrigger')).to.contain(
'@timestamp',
'Median of ram_Pain1'
);
await retry.waitFor('lens visualization', async () => {
const elements = await testSubjects.getVisibleTextAll('lns-dimensionTrigger');
return elements[0] === '@timestamp' && elements[1] === 'Median of ram_Pain1';
});
});
});

Expand Down Expand Up @@ -314,9 +314,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.discover.clickFieldListItemVisualize(scriptedPainlessFieldName2);
await PageObjects.header.waitUntilLoadingHasFinished();
// verify Lens opens a visualization
expect(await testSubjects.getVisibleTextAll('lns-dimensionTrigger')).to.contain(
'Top 5 values of painString'
);
await retry.waitFor('lens visualization', async () => {
const elements = await testSubjects.getVisibleTextAll('lns-dimensionTrigger');
return elements[0] === 'Top 5 values of painString';
});
});

after(async () => {
Expand Down Expand Up @@ -408,9 +409,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.discover.clickFieldListItemVisualize(scriptedPainlessFieldName2);
await PageObjects.header.waitUntilLoadingHasFinished();
// verify Lens opens a visualization
expect(await testSubjects.getVisibleTextAll('lns-dimensionTrigger')).to.contain(
'Top 5 values of painBool'
);
await retry.waitFor('lens visualization', async () => {
const elements = await testSubjects.getVisibleTextAll('lns-dimensionTrigger');
return elements[0] === 'Top 5 values of painBool';
});
});

after(async () => {
Expand Down Expand Up @@ -503,7 +505,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.discover.clickFieldListItemVisualize(scriptedPainlessFieldName2);
await PageObjects.header.waitUntilLoadingHasFinished();
// verify Lens opens a visualization
expect(await testSubjects.getVisibleTextAll('lns-dimensionTrigger')).to.contain('painDate');
await retry.waitFor('lens visualization', async () => {
const elements = await testSubjects.getVisibleTextAll('lns-dimensionTrigger');
return elements[0] === 'painDate';
});
});
});

Expand Down
3 changes: 2 additions & 1 deletion test/functional/page_objects/discover_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -486,14 +486,15 @@ export class DiscoverPageObject extends FtrService {

public async clickFieldListItemVisualize(fieldName: string) {
const field = await this.testSubjects.find(`field-${fieldName}-showDetails`);
const isActive = await field.elementHasClass('dscSidebarItem--active');
const isActive = await field.elementHasClass('kbnFieldButton-isActive');

if (!isActive) {
// expand the field to show the "Visualize" button
await field.click();
}

await this.testSubjects.click(`fieldVisualize-${fieldName}`);
await this.header.waitUntilLoadingHasFinished();
}

public async expectFieldListItemVisualize(field: string) {
Expand Down