oncall-engine/grafana-plugin/e2e-tests/utils/outgoingWebhooks.ts
Dominik Broj d3b1dc619e
Brojd/add e2e test for webhooks creation (#3709)
# What this PR does

## Which issue(s) this PR fixes

## 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)
2024-01-19 12:57:03 +00:00

28 lines
993 B
TypeScript

import { Page, expect } from '@playwright/test';
export const checkWebhookPresenceInTable = async ({
page,
webhookName,
expectedTriggerType,
}: {
page: Page;
webhookName: string;
expectedTriggerType: string;
}) => {
// filter table to show only created schedule
await page
.locator('div')
.filter({ hasText: /^Search or filter results\.\.\.$/ })
.nth(1)
.click();
await page.keyboard.insertText(webhookName);
await page.keyboard.press('Enter');
await page.waitForTimeout(2000);
// webhooks table displays details created webhook
const webhooksTable = page.getByTestId('outgoing-webhooks-table');
await expect(webhooksTable.getByRole('cell', { name: webhookName })).toBeVisible();
await expect(webhooksTable.getByRole('cell', { name: expectedTriggerType })).toBeVisible();
await expect(webhooksTable.getByRole('cell', { name: webhookName })).toBeVisible();
await expect(webhooksTable.getByRole('cell', { name: 'No team' })).toBeVisible();
};