oncall-engine/grafana-plugin/e2e-tests/integrations/integrationsTable.test.ts
Dominik Broj 0b6fa6ad1d
types improvements (#4945)
# What this PR does

- Fix some types errors when OnCall type checking runs under IRM
- Make type check required on CI


## 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] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-08-28 14:43:52 +00:00

70 lines
2.6 KiB
TypeScript

import { test } from '../fixtures';
import { generateRandomValue } from '../utils/forms';
import { createIntegration, searchIntegrationAndAssertItsPresence } from '../utils/integrations';
import { goToOnCallPage } from '../utils/navigation';
test('Integrations table shows data in Monitoring Systems and Direct Paging tabs', async ({
adminRolePage: { page },
}) => {
test.slow();
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 goToOnCallPage(page, 'integrations');
await createIntegration({
page,
integrationSearchText: 'Alertmanager',
integrationName: ALERTMANAGER_INTEGRATION_NAME,
});
await page.waitForTimeout(1000);
await goToOnCallPage(page, 'integrations');
// Create 1 Direct Paging integration if it doesn't exist
await page.getByText('Manual 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',
integrationName: DIRECT_PAGING_INTEGRATION_NAME,
});
await page.waitForTimeout(1000);
}
await goToOnCallPage(page, 'integrations');
// By default Monitoring Systems tab is opened and newly created integrations are visible except Direct Paging one
await searchIntegrationAndAssertItsPresence({ page, integrationName: WEBHOOK_INTEGRATION_NAME });
await searchIntegrationAndAssertItsPresence({
page,
integrationName: ALERTMANAGER_INTEGRATION_NAME,
});
await searchIntegrationAndAssertItsPresence({
page,
integrationName: DIRECT_PAGING_INTEGRATION_NAME,
visibleExpected: false,
});
// Then after switching to Direct Paging tab only Direct Paging integration is visible
await page.getByText('Manual Direct Paging').click();
await searchIntegrationAndAssertItsPresence({
page,
integrationName: WEBHOOK_INTEGRATION_NAME,
visibleExpected: false,
});
await searchIntegrationAndAssertItsPresence({
page,
integrationName: ALERTMANAGER_INTEGRATION_NAME,
visibleExpected: false,
});
await searchIntegrationAndAssertItsPresence({
page,
integrationName: 'Direct paging',
});
});