diff --git a/x-pack/solutions/observability/plugins/apm/test/scout/ui/fixtures/page_objects/service_map.ts b/x-pack/solutions/observability/plugins/apm/test/scout/ui/fixtures/page_objects/service_map.ts index 6a82a7b54ca80..f1a5c96e71b6b 100644 --- a/x-pack/solutions/observability/plugins/apm/test/scout/ui/fixtures/page_objects/service_map.ts +++ b/x-pack/solutions/observability/plugins/apm/test/scout/ui/fixtures/page_objects/service_map.ts @@ -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'); + } } diff --git a/x-pack/solutions/observability/plugins/apm/test/scout/ui/parallel_tests/sevice_map/service_map.spec.ts b/x-pack/solutions/observability/plugins/apm/test/scout/ui/parallel_tests/sevice_map/service_map.spec.ts index 92db4b587571d..2b5d5ef78816b 100644 --- a/x-pack/solutions/observability/plugins/apm/test/scout/ui/parallel_tests/sevice_map/service_map.spec.ts +++ b/x-pack/solutions/observability/plugins/apm/test/scout/ui/parallel_tests/sevice_map/service_map.spec.ts @@ -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(); }); @@ -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(); });