# 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>
88 lines
3.5 KiB
TypeScript
88 lines
3.5 KiB
TypeScript
import { test, expect } from '../fixtures';
|
|
import { isGrafanaVersionLowerThan } from '../utils/constants';
|
|
import { goToOnCallPage } from '../utils/navigation';
|
|
import { verifyThatUserCanViewOtherUsers, accessProfileTabs } from '../utils/users';
|
|
|
|
test.describe('Users screen actions', () => {
|
|
test("Admin is allowed to edit other users' profile", async ({ adminRolePage: { page } }) => {
|
|
await goToOnCallPage(page, 'users');
|
|
const editableUsers = page.getByTestId('users-table').getByRole('button', { name: 'Edit', disabled: false });
|
|
await editableUsers.first().waitFor();
|
|
const editableUsersCount = await editableUsers.count();
|
|
expect(editableUsersCount).toBeGreaterThan(1);
|
|
});
|
|
|
|
test('Admin is allowed to view the list of users', async ({ adminRolePage: { page } }) => {
|
|
await verifyThatUserCanViewOtherUsers(page);
|
|
});
|
|
|
|
test('Viewer is not allowed to view the list of users', async ({ viewerRolePage: { page } }) => {
|
|
await verifyThatUserCanViewOtherUsers(page, false);
|
|
});
|
|
|
|
test('Viewer cannot access restricted tabs from View My Profile', async ({ viewerRolePage }) => {
|
|
const { page } = viewerRolePage;
|
|
const tabsToCheck = ['tab-phone-verification', 'tab-slack', 'tab-telegram'];
|
|
|
|
// After 10.3 it's been moved to global user profile
|
|
if (isGrafanaVersionLowerThan('10.3.0')) {
|
|
tabsToCheck.unshift('tab-mobile-app');
|
|
}
|
|
|
|
await accessProfileTabs(page, tabsToCheck, false);
|
|
});
|
|
|
|
test('Editor is allowed to view the list of users', async ({ editorRolePage }) => {
|
|
await verifyThatUserCanViewOtherUsers(editorRolePage.page);
|
|
});
|
|
|
|
test("Editor cannot view other users' data", async ({ editorRolePage }) => {
|
|
const { page } = editorRolePage;
|
|
|
|
await goToOnCallPage(page, 'users');
|
|
await page.getByTestId('users-email').and(page.getByText('editor')).waitFor();
|
|
|
|
await expect(page.getByTestId('users-email').and(page.getByText('editor'))).toHaveCount(1);
|
|
const maskedEmailsCount = await page.getByTestId('users-email').and(page.getByText('******')).count();
|
|
expect(maskedEmailsCount).toBeGreaterThan(1);
|
|
const maskedPhoneNumbersCount = await page.getByTestId('users-phone-number').and(page.getByText('******')).count();
|
|
expect(maskedPhoneNumbersCount).toBeGreaterThan(1);
|
|
});
|
|
|
|
test('Editor can access tabs from View My Profile', async ({ editorRolePage }) => {
|
|
const { page } = editorRolePage;
|
|
|
|
// the other tabs depend on Cloud, skip for now
|
|
await accessProfileTabs(page, ['tab-slack', 'tab-telegram'], true);
|
|
});
|
|
|
|
test("Editor is not allowed to edit other users' profile", async ({ editorRolePage: { page } }) => {
|
|
await goToOnCallPage(page, 'users');
|
|
await expect(page.getByTestId('users-table').getByRole('button', { name: 'Edit', disabled: false })).toHaveCount(1);
|
|
const usersCountWithDisabledEdit = await page
|
|
.getByTestId('users-table')
|
|
.getByRole('button', { name: 'Edit', disabled: true })
|
|
.count();
|
|
expect(usersCountWithDisabledEdit).toBeGreaterThan(1);
|
|
});
|
|
|
|
test('Search updates the table view', async ({ adminRolePage }) => {
|
|
const { page, userName } = adminRolePage;
|
|
await goToOnCallPage(page, 'users');
|
|
|
|
await page.waitForTimeout(2000);
|
|
|
|
await page
|
|
.locator('div')
|
|
.filter({ hasText: /^Search or filter results\.\.\.$/ })
|
|
.nth(1)
|
|
.click();
|
|
await page.keyboard.insertText(userName);
|
|
await page.keyboard.press('Enter');
|
|
await page.waitForTimeout(2000);
|
|
|
|
const result = page.locator(`[data-testid="users-username"]`);
|
|
|
|
expect(await result.count()).toBe(1);
|
|
});
|
|
});
|