fix e2e tests (#3950)

# Which issue(s) this PR fixes

Fix failing e2e tests on `dev`

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)

---------

Co-authored-by: Dominik <dominik.broj@grafana.com>
This commit is contained in:
Joey Orlando 2024-02-22 19:41:21 +00:00 committed by GitHub
parent 666fc76cef
commit 182ee2fad7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 8 additions and 15 deletions

View file

@ -53,6 +53,6 @@ test('from_time and to_time for "Continue escalation if current UTC time is in r
await page.reload();
await page.waitForLoadState('networkidle');
expect(_getFromTimeInput()).toHaveValue(FROM_TIME);
expect(_getToTimeInput()).toHaveValue(TO_TIME);
await expect(_getFromTimeInput()).toHaveValue(FROM_TIME);
await expect(_getToTimeInput()).toHaveValue(TO_TIME);
});

View file

@ -74,7 +74,7 @@ const configureOnCallPlugin = async (page: Page): Promise<void> => {
* go to the oncall plugin configuration page and wait for the page to be loaded
*/
await goToGrafanaPage(page, '/plugins/grafana-oncall-app');
await page.waitForTimeout(2000);
await page.waitForTimeout(3000);
// if plugin is configured, go to OnCall
const isConfigured = (await page.getByText('Connected to OnCall').count()) >= 1;

View file

@ -18,10 +18,6 @@ test('check schedule quality for simple 1-user schedule', async ({ adminRolePage
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'
);
await expect(scheduleQualityDetailsElement.locator('span[class*="Text"] >> nth=3 ')).toHaveText(
'Schedule is perfectly balanced'
);
await expect(scheduleQualityDetailsElement).toHaveText(/Schedule has no gaps/);
await expect(scheduleQualityDetailsElement).toHaveText(/Schedule is perfectly balanced/);
});

View file

@ -1,7 +1,7 @@
import { Page } from '@playwright/test';
import dayjs from 'dayjs';
import { clickButton, fillInInput, selectDropdownValue } from './forms';
import { clickButton, selectDropdownValue } from './forms';
import { goToOnCallPage } from './navigation';
export const createOnCallSchedule = async (page: Page, scheduleName: string, userName: string): Promise<void> => {
@ -13,7 +13,7 @@ export const createOnCallSchedule = async (page: Page, scheduleName: string, use
(await page.waitForSelector('button >> text=Create >> nth=0')).click();
// fill in the name input
await fillInInput(page, 'div[class*="ScheduleForm"] input[name="name"]', scheduleName);
await page.getByTestId('schedule-form').locator('input[name="name"]').fill(scheduleName);
// Add a new layer w/ the current user to it
await clickButton({ page, buttonText: 'Create Schedule' });

View file

@ -77,7 +77,7 @@ export const ScheduleForm = observer((props: ScheduleFormProps) => {
onClose={onHide}
closeOnMaskClick={false}
>
<div className={cx('content')}>
<div className={cx('content')} data-testid="schedule-form">
<VerticalGroup>
<GForm form={formConfig} data={data} onSubmit={handleSubmit} />
<div className="buttons">

View file

@ -1,4 +1,3 @@
import { locationService } from '@grafana/runtime';
import { contextSrv } from 'grafana/app/core/core';
import { action, computed, makeObservable, observable, runInAction } from 'mobx';
import qs from 'query-string';
@ -40,7 +39,6 @@ import {
getOnCallApiUrl,
GRAFANA_LICENSE_CLOUD,
GRAFANA_LICENSE_OSS,
PLUGIN_ROOT,
} from 'utils/consts';
import { FaroHelper } from 'utils/faro';
@ -233,7 +231,6 @@ export class RootBaseStore {
* therefore there is no need to trigger an additional/separate sync, nor poll a status
*/
await PluginState.installPlugin();
locationService.push(PLUGIN_ROOT);
} catch (e) {
return this.setupPluginError(
PluginState.getHumanReadableErrorFromOnCallError(e, this.onCallApiUrl, 'install')