mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[Failing Test] Fixes Spaces Data Before All Failure (#147519)
Fixes #52714 Fixes #52715 After all failure likely due to before failure - when before fails, the data set is not installed and cannot be removed. Before all failure seems likely to be a race condition of one or more elements being 'not interactable'. I was unable to reproduce the issue locally and via a [Flaky Test Runner](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/1646), but walking through the code noticed an incorrect attribute reference and a few places where we could improve determinism. - Replaced 'showSampleDataAccordion'->'class' check with 'showSampleDataButton'->'aria-expanded' - Added deterministic verification of sample data accordion open - Mirrored previous timing/enable check fix to 'removeSampleDataSet' in 'addSampleDataSet' - Improved determinism in 'removeSampleDataSet', adding an initial check for whether the data set was installed - Added additional debug logs to improve any future troubleshooting Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
e3376387e9
commit
c2be109ce6
1 changed files with 39 additions and 14 deletions
|
@ -13,6 +13,7 @@ export class HomePageObject extends FtrService {
|
|||
private readonly retry = this.ctx.getService('retry');
|
||||
private readonly find = this.ctx.getService('find');
|
||||
private readonly common = this.ctx.getPageObject('common');
|
||||
public readonly log = this.ctx.getService('log');
|
||||
|
||||
async clickSynopsis(title: string) {
|
||||
await this.testSubjects.click(`homeSynopsisLink${title}`);
|
||||
|
@ -27,17 +28,27 @@ export class HomePageObject extends FtrService {
|
|||
}
|
||||
|
||||
async openSampleDataAccordion() {
|
||||
const accordion = await this.testSubjects.find('showSampleDataAccordion');
|
||||
const className = await accordion.getAttribute('class');
|
||||
const accordionButton = await this.testSubjects.find('showSampleDataButton');
|
||||
let expandedAttribute = await accordionButton.getAttribute('aria-expanded');
|
||||
let expanded = expandedAttribute.toLocaleLowerCase().includes('true');
|
||||
this.log.debug(`Sample data accordion expanded: ${expanded}`);
|
||||
|
||||
if (!className.includes('euiAccordion-isOpen')) {
|
||||
await this.testSubjects.click('showSampleDataButton');
|
||||
if (!expanded) {
|
||||
await this.retry.waitFor('sample data according to be expanded', async () => {
|
||||
this.log.debug(`Opening sample data accordion`);
|
||||
await accordionButton.click();
|
||||
expandedAttribute = await accordionButton.getAttribute('aria-expanded');
|
||||
expanded = expandedAttribute.toLocaleLowerCase().includes('true');
|
||||
return expanded;
|
||||
});
|
||||
this.log.debug(`Sample data accordion expanded: ${expanded}`);
|
||||
}
|
||||
}
|
||||
|
||||
async isSampleDataSetInstalled(id: string) {
|
||||
const sampleDataCard = await this.testSubjects.find(`sampleDataSetCard${id}`);
|
||||
const deleteButton = await sampleDataCard.findAllByTestSubject(`removeSampleDataSet${id}`);
|
||||
this.log.debug(`Sample data installed: ${deleteButton.length > 0}`);
|
||||
return deleteButton.length > 0;
|
||||
}
|
||||
|
||||
|
@ -66,8 +77,14 @@ export class HomePageObject extends FtrService {
|
|||
await this.openSampleDataAccordion();
|
||||
const isInstalled = await this.isSampleDataSetInstalled(id);
|
||||
if (!isInstalled) {
|
||||
await this.retry.waitFor('wait until sample data is installed', async () => {
|
||||
this.log.debug(`Attempting to add sample data: ${id}`);
|
||||
await this.retry.waitFor('sample data to be installed', async () => {
|
||||
// Echoing the adjustments made to 'removeSampleDataSet', as we are seeing flaky test cases here as well
|
||||
// https://github.com/elastic/kibana/issues/52714
|
||||
await this.testSubjects.waitForEnabled(`addSampleDataSet${id}`);
|
||||
await this.common.sleep(1010);
|
||||
await this.testSubjects.click(`addSampleDataSet${id}`);
|
||||
await this.common.sleep(1010);
|
||||
await this._waitForSampleDataLoadingAction(id);
|
||||
return await this.isSampleDataSetInstalled(id);
|
||||
});
|
||||
|
@ -76,15 +93,22 @@ export class HomePageObject extends FtrService {
|
|||
|
||||
async removeSampleDataSet(id: string) {
|
||||
await this.openSampleDataAccordion();
|
||||
// looks like overkill but we're hitting flaky cases where we click but it doesn't remove
|
||||
await this.testSubjects.waitForEnabled(`removeSampleDataSet${id}`);
|
||||
// https://github.com/elastic/kibana/issues/65949
|
||||
// Even after waiting for the "Remove" button to be enabled we still have failures
|
||||
// where it appears the click just didn't work.
|
||||
await this.common.sleep(1010);
|
||||
await this.testSubjects.click(`removeSampleDataSet${id}`);
|
||||
await this.common.sleep(1010);
|
||||
await this._waitForSampleDataLoadingAction(id);
|
||||
const isInstalled = await this.isSampleDataSetInstalled(id);
|
||||
if (isInstalled) {
|
||||
this.log.debug(`Attempting to remove sample data: ${id}`);
|
||||
await this.retry.waitFor('sample data to be removed', async () => {
|
||||
// looks like overkill but we're hitting flaky cases where we click but it doesn't remove
|
||||
await this.testSubjects.waitForEnabled(`removeSampleDataSet${id}`);
|
||||
// https://github.com/elastic/kibana/issues/65949
|
||||
// Even after waiting for the "Remove" button to be enabled we still have failures
|
||||
// where it appears the click just didn't work.
|
||||
await this.common.sleep(1010);
|
||||
await this.testSubjects.click(`removeSampleDataSet${id}`);
|
||||
await this.common.sleep(1010);
|
||||
await this._waitForSampleDataLoadingAction(id);
|
||||
return !(await this.isSampleDataSetInstalled(id));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// loading action is either uninstall and install
|
||||
|
@ -93,6 +117,7 @@ export class HomePageObject extends FtrService {
|
|||
await this.retry.try(async () => {
|
||||
// waitForDeletedByCssSelector needs to be inside retry because it will timeout at least once
|
||||
// before action is complete
|
||||
this.log.debug(`Waiting for loading spinner to be deleted for sampleDataSetCard${id}`);
|
||||
await sampleDataCard.waitForDeletedByCssSelector('.euiLoadingSpinner');
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue