oncall-engine/grafana-plugin/integration-tests/integrations/uniqueIntegrationNames.test.ts
Joey Orlando f5495ed702
add first multi-role e2e tests (#2417)
# What this PR does

Lays ground work for #1586. Adds three new fixtures, `adminRolePage`,
`editorRolePage`, and `viewerRolePage`. These fixtures can be easily
accessed in a `test` context and allow the test to be run as a user
authenticated with one of these Grafana basic roles.

The bulk of the changes in the PR are to the "global setup" step. There
is a bit of logic + communication with the Grafana instance's API, in
order to create all the necessary authentication credentials.

Lastly, adds the first basic role authorization test, asserting that
Admin/Editors can view the list of OnCall users, whereas Viewers cannot.

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-07-04 09:19:14 +00:00

12 lines
546 B
TypeScript

import { test, expect } from '../fixtures';
import { openCreateIntegrationModal } from '../utils/integrations';
test('integrations have unique names', async ({ adminRolePage }) => {
const { page } = adminRolePage;
await openCreateIntegrationModal(page);
const integrationNames = await page.getByTestId('integration-display-name').allInnerTexts();
const uniqueLowercasedIntegrationNames = new Set(integrationNames.map((elem) => elem.toLowerCase()));
expect(uniqueLowercasedIntegrationNames.size).toEqual(integrationNames.length);
});