# 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)
73 lines
2.9 KiB
TypeScript
73 lines
2.9 KiB
TypeScript
import { test } from '../fixtures';
|
|
import { generateRandomValue } from '../utils/forms';
|
|
import { createIntegration, searchIntegrationAndAssertItsPresence } from '../utils/integrations';
|
|
|
|
test('Integrations table shows data in Connections and Direct Paging tabs', async ({ adminRolePage: { page } }) => {
|
|
const ID = generateRandomValue();
|
|
const WEBHOOK_INTEGRATION_NAME = `Webhook-${ID}`;
|
|
const ALERTMANAGER_INTEGRATION_NAME = `Alertmanager-${ID}`;
|
|
const DIRECT_PAGING_INTEGRATION_NAME = `Direct paging integration name`;
|
|
|
|
// Create 2 integrations that are not Direct Paging
|
|
await createIntegration({ page, integrationSearchText: 'Webhook', integrationName: WEBHOOK_INTEGRATION_NAME });
|
|
await page.waitForTimeout(1000);
|
|
await page.getByRole('tab', { name: 'Tab Integrations' }).click();
|
|
await createIntegration({
|
|
page,
|
|
integrationSearchText: 'Alertmanager',
|
|
shouldGoToIntegrationsPage: false,
|
|
integrationName: ALERTMANAGER_INTEGRATION_NAME,
|
|
});
|
|
await page.waitForTimeout(1000);
|
|
await page.getByRole('tab', { name: 'Tab Integrations' }).click();
|
|
|
|
// Create 1 Direct Paging integration if it doesn't exist
|
|
await page.getByRole('tab', { name: 'Tab Direct Paging' }).click();
|
|
const integrationsTable = page.getByTestId('integrations-table');
|
|
await page.waitForTimeout(2000);
|
|
const isDirectPagingAlreadyCreated = (await integrationsTable.getByText('Direct paging').count()) >= 1;
|
|
if (!isDirectPagingAlreadyCreated) {
|
|
await createIntegration({
|
|
page,
|
|
integrationSearchText: 'Direct paging',
|
|
shouldGoToIntegrationsPage: false,
|
|
integrationName: DIRECT_PAGING_INTEGRATION_NAME,
|
|
});
|
|
await page.waitForTimeout(1000);
|
|
}
|
|
await page.getByRole('tab', { name: 'Tab Integrations' }).click();
|
|
|
|
// By default Connections tab is opened and newly created integrations are visible except Direct Paging one
|
|
await searchIntegrationAndAssertItsPresence({ page, integrationsTable, integrationName: WEBHOOK_INTEGRATION_NAME });
|
|
await searchIntegrationAndAssertItsPresence({
|
|
page,
|
|
integrationsTable,
|
|
integrationName: ALERTMANAGER_INTEGRATION_NAME,
|
|
});
|
|
await searchIntegrationAndAssertItsPresence({
|
|
page,
|
|
integrationsTable,
|
|
integrationName: DIRECT_PAGING_INTEGRATION_NAME,
|
|
visibleExpected: false,
|
|
});
|
|
|
|
// Then after switching to Direct Paging tab only Direct Paging integration is visible
|
|
await page.getByRole('tab', { name: 'Tab Direct Paging' }).click();
|
|
await searchIntegrationAndAssertItsPresence({
|
|
page,
|
|
integrationsTable,
|
|
integrationName: WEBHOOK_INTEGRATION_NAME,
|
|
visibleExpected: false,
|
|
});
|
|
await searchIntegrationAndAssertItsPresence({
|
|
page,
|
|
integrationsTable,
|
|
integrationName: ALERTMANAGER_INTEGRATION_NAME,
|
|
visibleExpected: false,
|
|
});
|
|
await searchIntegrationAndAssertItsPresence({
|
|
page,
|
|
integrationsTable,
|
|
integrationName: 'Direct paging',
|
|
});
|
|
});
|