# 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)
34 lines
1.5 KiB
TypeScript
34 lines
1.5 KiB
TypeScript
import { test, expect, Page } from '../fixtures';
|
|
import { createEscalationChain } from '../utils/escalationChain';
|
|
import { generateRandomValue } from '../utils/forms';
|
|
|
|
const assertEscalationChainSearchWorks = async (
|
|
page: Page,
|
|
searchTerm: string,
|
|
escalationChainFullName: string
|
|
): Promise<void> => {
|
|
await page.getByTestId('escalation-chain-search-input').fill(searchTerm);
|
|
|
|
// wait for the API call(s) to finish
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
await expect(page.getByTestId('escalation-chains-list')).toHaveText(escalationChainFullName);
|
|
};
|
|
|
|
// TODO: add tests for the new filtering. Commented out as this search doesn't exist anymore
|
|
test.skip('searching allows case-insensitive partial matches', async ({ adminRolePage }) => {
|
|
const { page } = adminRolePage;
|
|
|
|
const escalationChainName = `${generateRandomValue()} ${generateRandomValue()}`;
|
|
const [firstHalf, secondHalf] = escalationChainName.split(' ');
|
|
|
|
await createEscalationChain(page, escalationChainName);
|
|
|
|
await assertEscalationChainSearchWorks(page, firstHalf, escalationChainName);
|
|
await assertEscalationChainSearchWorks(page, firstHalf.toUpperCase(), escalationChainName);
|
|
await assertEscalationChainSearchWorks(page, firstHalf.toLowerCase(), escalationChainName);
|
|
|
|
await assertEscalationChainSearchWorks(page, secondHalf, escalationChainName);
|
|
await assertEscalationChainSearchWorks(page, secondHalf.toUpperCase(), escalationChainName);
|
|
await assertEscalationChainSearchWorks(page, secondHalf.toLowerCase(), escalationChainName);
|
|
});
|