Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,32 @@ export class ServiceMapPage {
await this.serviceMap.waitFor({ state: 'visible' });
return expect(this.serviceMap.getByLabel('Loading')).toBeHidden();
}

/**
* Clicks zoom buttons by waiting for them to be enabled and handling tooltip interference
* @param direction - 'in' for zoom in, 'out' for zoom out
*/
async clickZoom(direction: 'in' | 'out') {
const button = direction === 'in' ? this.zoomInBtn : this.zoomOutBtn;

// Wait for the button to be visible
await button.waitFor({ state: 'visible' });
// Wait a bit for any tooltips to settle
await this.page.waitForTimeout(500);
// Try to click with force if normal click fails due to tooltip interference
try {
await button.click({ timeout: 5000 });
} catch (error) {
// If normal click fails, try with force to bypass tooltip interference
await button.click({ force: true, timeout: 5000 });
}
}

async clickZoomIn() {
await this.clickZoom('in');
}

async clickZoomOut() {
await this.clickZoom('out');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ test.describe('Service map', { tag: ['@ess', '@svlOblt'] }, () => {
);
expect(page.url()).toContain('/app/apm/service-map');
await serviceMapPage.waitForServiceMapToLoad();
await serviceMapPage.zoomInBtn.click();
await serviceMapPage.serviceMap.focus();
await serviceMapPage.clickZoomIn();
await serviceMapPage.centerServiceMapBtn.click();
await serviceMapPage.serviceMap.focus();
await serviceMapPage.waitForServiceMapToLoad();
});

Expand All @@ -37,12 +35,9 @@ test.describe('Service map', { tag: ['@ess', '@svlOblt'] }, () => {
);
expect(page.url()).toContain('/services/opbeans-java/service-map');
await serviceMapPage.waitForServiceMapToLoad();
await serviceMapPage.zoomOutBtn.click();
await serviceMapPage.serviceMap.focus();
await serviceMapPage.clickZoomOut();
await serviceMapPage.centerServiceMapBtn.click();
await serviceMapPage.serviceMap.focus();
await serviceMapPage.zoomInBtn.click();
await serviceMapPage.serviceMap.focus();
await serviceMapPage.clickZoomIn();
await serviceMapPage.waitForServiceMapToLoad();
});

Expand Down