Fixing the flakiness in openInspectorView method in inspector service (#135488)

This commit is contained in:
Bhavya RM 2022-06-30 19:43:59 -04:00 committed by GitHub
parent a38064b841
commit f1d8a370bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 11 deletions

View file

@ -190,16 +190,21 @@ export class InspectorService extends FtrService {
}
/**
* Opens inspector view
* Opens inspector viewId for example 'Requests
* @param viewId
*/
public async openInspectorView(viewId: string): Promise<void> {
this.log.debug(`Open Inspector view ${viewId}`);
const dtsViewId = 'inspectorViewChooser' + viewId;
await this.retry.try(async () => {
await this.testSubjects.click('inspectorViewChooser');
// check whether popover menu opens, if not, fail and retry opening
await this.testSubjects.existOrFail(viewId, { timeout: 2000 });
await this.testSubjects.click(viewId);
await this.testSubjects.existOrFail(dtsViewId, { timeout: 2000 });
await this.testSubjects.click(dtsViewId);
const selection = await this.testSubjects.getVisibleText('inspectorViewChooser');
this.log.debug(`inspector view selection = ${selection}`);
expect(selection.includes(viewId)).to.be(true);
});
}
@ -207,7 +212,7 @@ export class InspectorService extends FtrService {
* Opens inspector requests view
*/
public async openInspectorRequestsView(): Promise<void> {
await this.openInspectorView('inspectorViewChooserRequests');
await this.openInspectorView('Requests');
}
/**

View file

@ -14,7 +14,7 @@ export class VegaDebugInspectorViewService extends FtrService {
private readonly dataGrid = this.ctx.getService('dataGrid');
async openVegaDebugInspectorView() {
await this.inspector.openInspectorView('inspectorViewChooserVega debug');
await this.inspector.openInspectorView('Vega debug');
}
public getOpenDataViewerButton() {

View file

@ -11,6 +11,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const a11y = getService('a11y');
const testSubjects = getService('testSubjects');
const retry = getService('retry');
const inspector = getService('inspector');
const PageObjects = getPageObjects(['common', 'settings', 'header', 'home', 'maps']);
describe('Maps app Accessibility', () => {
@ -61,12 +62,12 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await a11y.testAppSnapshot();
});
it('map inspector view chooser requests', async function () {
await testSubjects.click('inspectorViewChooserRequests');
it('map inspector panel - view requests', async function () {
await inspector.openInspectorRequestsView();
await a11y.testAppSnapshot();
});
it('map inspector view chooser requests', async function () {
it('map inspector panel - view maps', async function () {
await PageObjects.maps.openInspectorMapView();
await a11y.testAppSnapshot();
});

View file

@ -564,7 +564,7 @@ export class GisPageObject extends FtrService {
}
async openInspectorMapView() {
await this.inspector.openInspectorView('~inspectorViewChooserMap');
await this.inspector.openInspectorView('Map details');
}
// Method should only be used when multiple requests are expected
@ -608,7 +608,7 @@ export class GisPageObject extends FtrService {
}
async _getResponse(requestName: string) {
await this.inspector.openInspectorView('inspectorViewChooserRequests');
await this.inspector.openInspectorRequestsView();
if (requestName) {
await this.testSubjects.click('inspectorRequestChooser');
await this.testSubjects.click(`inspectorRequestChooser${requestName}`);

View file

@ -98,7 +98,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
expect(await find.existsByCssSelector('.vgaVis__view')).to.be(true);
log.debug('Checking map rendered');
await dashboardPanelActions.openInspectorByTitle('[Flights] Origin Time Delayed');
await inspector.openInspectorView('inspectorViewChooserRequests');
await inspector.openInspectorView('Requests');
const requestStats = await inspector.getTableData();
const totalHits = PageObjects.maps.getInspectorStatRowHit(requestStats, 'Hits');
expect(totalHits).to.equal('0');