The previous retry wouldn't work because 'click' has it's own retry (#19078) (#19129)

* The previous retry wouldn't work because 'click' has it's own retry, need to use exists first.

* add comment with link to issue

* fix wrong function (wish we had typescript!)
This commit is contained in:
Stacey Gammon 2018-05-16 12:43:13 -04:00 committed by GitHub
parent e26a77f972
commit 3d7b3973fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 8 deletions

View file

@ -34,11 +34,8 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.dashboard.clickEdit();
// Opening legend colors has been flaky.
await retry.try(async () => {
await PageObjects.visualize.clickLegendOption('Count');
await PageObjects.visualize.selectNewLegendColorChoice('#EA6460');
});
await PageObjects.visualize.openLegendOptionColors('Count');
await PageObjects.visualize.selectNewLegendColorChoice('#EA6460');
await PageObjects.dashboard.saveDashboard('Overridden colors');
@ -194,7 +191,7 @@ export default function ({ getService, getPageObjects }) {
describe('for embeddable config color parameters on a visualization', () => {
it('updates a pie slice color on a soft refresh', async function () {
await dashboardAddPanel.addVisualization(PIE_CHART_VIS_NAME);
await PageObjects.visualize.clickLegendOption('80,000');
await PageObjects.visualize.openLegendOptionColors('80,000');
await PageObjects.visualize.selectNewLegendColorChoice('#F9D9F9');
const currentUrl = await remote.getCurrentUrl();
const newUrl = currentUrl.replace('F9D9F9', 'FFFFFF');

View file

@ -898,8 +898,21 @@ export function VisualizePageProvider({ getService, getPageObjects }) {
return await Promise.all(legendEntries.map(async chart => await chart.getAttribute('data-label')));
}
async clickLegendOption(name) {
await testSubjects.click(`legend-${name}`);
async openLegendOptionColors(name) {
await retry.try(async () => {
// This click has been flaky in opening the legend, hence the retry. See
// https://github.com/elastic/kibana/issues/17468
await testSubjects.click(`legend-${name}`);
// arbitrary color chosen, any available would do
const isOpen = await this.doesLegendColorChoiceExist('#EF843C');
if (!isOpen) {
throw new Error('legend color selector not open');
}
});
}
async doesLegendColorChoiceExist(color) {
return await testSubjects.exists(`legendSelectColor-${color}`);
}
async selectNewLegendColorChoice(color) {