oncall-engine/grafana-plugin/e2e-tests/labels/createNewLabelKeysAndValues.test.ts
Dominik Broj 344cd0efde
Add missing labels permissions, fix tilt ci from ops-devenv, fix expensive e2e tests (#4842)
# What this PR does

- add missing labels-related permissions for external service account
used by new oncall init process
- fix expensive e2e tests in new oncall init process
- unify Grafana versions between standard and expensive e2e tests
- fix running tilt through ops-devenv in new oncall init process
- avoid duplicated standard e2e tests on workflows that run daily and on
merges to main

## Which issue(s) this PR closes

Related to https://github.com/grafana/oncall-private/issues/2656

<!--
*Note*: If you want the issue to be auto-closed once the PR is merged,
change "Related to" to "Closes" in the line above.
If you have more than one GitHub issue that this PR closes, be sure to
preface
each issue link with a [closing
keyword](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue).
This ensures that the issue(s) are auto-closed once the PR has been
merged.
-->

## 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.

---------

Co-authored-by: Joey Orlando <joseph.t.orlando@gmail.com>
2024-08-19 18:17:10 +00:00

41 lines
1.5 KiB
TypeScript

import { test, expect } from '../fixtures';
import { isGrafanaVersionGreaterThan } from '../utils/constants';
import { clickButton, generateRandomValidLabel, openDropdown } from '../utils/forms';
import { openCreateIntegrationModal } from '../utils/integrations';
import { goToOnCallPage } from '../utils/navigation';
test.skip(
() => isGrafanaVersionGreaterThan('10.3.0'),
'Above 10.3 labels need enterprise version to validate permissions'
);
test('New label keys and labels can be created @expensive', async ({ adminRolePage }) => {
const { page } = adminRolePage;
await goToOnCallPage(page, 'integrations');
await openCreateIntegrationModal(page);
const NEW_LABEL_KEY = generateRandomValidLabel();
const NEW_LABEL_VALUE = generateRandomValidLabel();
await page
.getByTestId('create-integration-modal')
.getByTestId('integration-display-name')
.filter({ hasText: 'Webhook' })
.first()
.click();
await clickButton({ page, buttonText: /^Add Labels$/ });
await openDropdown({ page, text: /^Select key$/ });
await page.keyboard.insertText(NEW_LABEL_KEY);
await page.getByText('Hit enter to add').waitFor();
await page.keyboard.press('Enter');
await page.waitForTimeout(1000);
await openDropdown({ page, text: /^Select value$/ });
await page.keyboard.insertText(NEW_LABEL_VALUE);
await page.getByText('Hit enter to add').waitFor();
await page.keyboard.press('Enter');
await expect(page.getByText(NEW_LABEL_KEY)).toBeVisible();
await expect(page.getByText(NEW_LABEL_VALUE)).toBeVisible();
});