From f6e0ec83d866f245a92a76aa4ef0f7ae29d7214a Mon Sep 17 00:00:00 2001 From: Joey Orlando Date: Wed, 5 Jul 2023 11:15:21 +0200 Subject: [PATCH] remove networkIdle wait state when switching pages (#2428) # Which issue(s) this PR fixes speed up e2e tests + improve stability ## Checklist - [ ] Unit, integration, and e2e (if applicable) tests updated - [ ] Documentation added (or `pr:no public docs` PR label added if not required) - [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not required) --- .../integration-tests/schedules/quality.test.ts | 8 ++------ grafana-plugin/integration-tests/utils/navigation.ts | 3 +-- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/grafana-plugin/integration-tests/schedules/quality.test.ts b/grafana-plugin/integration-tests/schedules/quality.test.ts index bcf55442..b5de7461 100644 --- a/grafana-plugin/integration-tests/schedules/quality.test.ts +++ b/grafana-plugin/integration-tests/schedules/quality.test.ts @@ -8,19 +8,15 @@ test('check schedule quality for simple 1-user schedule', async ({ adminRolePage await createOnCallSchedule(page, onCallScheduleName, userName); - /** - * this page.reload() call is a hack to temporarily get around this issue - * https://github.com/grafana/oncall/issues/1968 - */ - await page.reload({ waitUntil: 'networkidle' }); - const scheduleQualityElement = page.getByTestId('schedule-quality'); + await scheduleQualityElement.waitFor({ state: 'visible' }); await expect(scheduleQualityElement).toHaveText('Quality: Great', { timeout: 15_000 }); await scheduleQualityElement.hover(); const scheduleQualityDetailsElement = page.getByTestId('schedule-quality-details'); + await scheduleQualityDetailsElement.waitFor({ state: 'visible' }); await expect(scheduleQualityDetailsElement.locator('span[class*="Text"] >> nth=2 ')).toHaveText( 'Schedule has no gaps' diff --git a/grafana-plugin/integration-tests/utils/navigation.ts b/grafana-plugin/integration-tests/utils/navigation.ts index 120b0ee3..662f7a34 100644 --- a/grafana-plugin/integration-tests/utils/navigation.ts +++ b/grafana-plugin/integration-tests/utils/navigation.ts @@ -4,8 +4,7 @@ import { BASE_URL } from './constants'; type GrafanaPage = '/plugins/grafana-oncall-app'; type OnCallPage = 'incidents' | 'integrations' | 'escalations' | 'schedules' | 'users'; -const _goToPage = (page: Page, url = ''): Promise => - page.goto(`${BASE_URL}${url}`, { waitUntil: 'networkidle' }); +const _goToPage = (page: Page, url = ''): Promise => page.goto(`${BASE_URL}${url}`); export const goToGrafanaPage = (page: Page, url: GrafanaPage): Promise => _goToPage(page, url);