# What this PR does Stabilize e2e tests by: - improve usage of locators - fix unreliable selectors - prevent parallelism within the same test file Additionally: - configure eslint for e2e tests and fix existing errors/warnings - bump Playwright version to latest stable ## Which issue(s) this PR fixes https://github.com/grafana/oncall/issues/3217 ## 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)
37 lines
1.6 KiB
TypeScript
37 lines
1.6 KiB
TypeScript
import { test, expect } from '../fixtures';
|
|
import { clickButton, fillInInput } from '../utils/forms';
|
|
import { goToOnCallPage } from '../utils/navigation';
|
|
|
|
/**
|
|
* TODO: test that we can also direct page a team. This is a bit more involved because we need to
|
|
* create a team via the Grafana API then go and configure the team's direct paging integration so that
|
|
* it will show up in the dropdown (ie. create an escalation chain and assign it to the integration)
|
|
*/
|
|
|
|
test('we can directly page a user', async ({ adminRolePage }) => {
|
|
const message = 'Help me please!';
|
|
const { page } = adminRolePage;
|
|
|
|
await goToOnCallPage(page, 'alert-groups');
|
|
await page.waitForTimeout(1000);
|
|
await clickButton({ page, buttonText: 'Escalation' });
|
|
await fillInInput(page, 'textarea[name="message"]', message);
|
|
await clickButton({ page, buttonText: 'Invite' });
|
|
|
|
const addRespondersPopup = page.getByTestId('add-responders-popup');
|
|
|
|
await addRespondersPopup.getByText('Users').click();
|
|
await addRespondersPopup.getByText(adminRolePage.userName).click();
|
|
|
|
// If user is not on call, confirm invitation
|
|
await page.waitForTimeout(1000);
|
|
const isConfirmationModalShown = await page.getByText('Confirm Participant Invitation').isVisible();
|
|
if (isConfirmationModalShown) {
|
|
await page.getByTestId('confirm-non-oncall').click();
|
|
}
|
|
|
|
await clickButton({ page, buttonText: 'Create' });
|
|
// Check we are redirected to the alert group page
|
|
await page.waitForURL('**/alert-groups/I*'); // Alert group IDs always start with "I"
|
|
await expect(page.getByTestId('incident-message')).toContainText(message);
|
|
});
|