Skip to content
This repository was archived by the owner on Jul 14, 2025. It is now read-only.

Commit 0b3deee

Browse files
committed
two tests in one describe
to see if beforeAll is only run once
1 parent 4d91fd6 commit 0b3deee

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

tests/Integration/twouserRBACTest.spec.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { randomName, randomUrl } from '../UI/helpers/repoHelpers';
55
import { closePopupsIfExist, getRowByNameOrUrl } from '../UI/helpers/helpers';
66
import fs from 'fs';
77
import { deleteAllRepos } from '../UI/helpers/deleteRepositories';
8-
import { deleteAllPopularRepos } from '../UI/helpers/deletePopularRepositories';
98

109

1110

@@ -35,15 +34,16 @@ test.beforeAll(async () => {
3534

3635
const url = randomUrl();
3736

38-
test.describe.serial("Run as first user", { tag: "@admin" }, () => {
39-
test("Login as user 1", async ({ page }) => {
37+
test.describe.serial("Combined user tests", () => {
38+
test("Login as user 1 (admin)", { tag: "@admin" }, async ({ page }) => {
4039
await test.step('Navigate to the repository page', async () => {
4140
await switchToUser(page, process.env.USER1USERNAME!);
42-
console.log('Try to delete old repos');
41+
console.log('\n Try to delete old repos\n');
4342
await deleteAllRepos(page, `&search=${repoNamePrefix}`);
4443
await navigateToRepositories(page);
4544
await closePopupsIfExist(page);
4645
});
46+
4747
await test.step('Create a repository', async () => {
4848
await page.getByRole('button', { name: 'Add repositories' }).first().click();
4949
await expect(page.getByRole('dialog', { name: 'Add custom repositories' })).toBeVisible();
@@ -54,6 +54,7 @@ test.describe.serial("Run as first user", { tag: "@admin" }, () => {
5454
await page.getByLabel('URL').fill(url);
5555
await page.getByRole('button', { name: 'Save', exact: true }).click();
5656
});
57+
5758
await test.step('Read the repo', async () => {
5859
const repoName = getRepoName();
5960
const row = await getRowByNameOrUrl(page, repoName);
@@ -64,24 +65,24 @@ test.describe.serial("Run as first user", { tag: "@admin" }, () => {
6465
await expect(page.getByPlaceholder('Enter name', { exact: true })).toHaveValue(repoName);
6566
await expect(page.getByPlaceholder('https://', { exact: true })).toHaveValue(url);
6667
});
68+
6769
await test.step('Update the repository', async () => {
6870
const repoName = getRepoName();
69-
await page.getByPlaceholder('Enter name', { exact: true }).fill(repoName);
71+
await page.getByPlaceholder('Enter name', { exact: true }).fill(`${repoName}-Edited`);
7072
await page.getByRole('button', { name: 'Save changes', exact: true }).click();
7173
});
7274
});
73-
});
7475

75-
test.describe.serial("Run as second user", { tag: "@read-only" }, () => {
76-
test("Login as user 2", async ({ page }) => {
76+
test("Login as user 2 (read-only)", { tag: "@read-only" }, async ({ page }) => {
7777
await test.step('Navigate to the repository page', async () => {
7878
await switchToUser(page, process.env.RO_USER_USERNAME!);
7979
await navigateToRepositories(page);
8080
await closePopupsIfExist(page);
8181
});
82+
8283
await test.step('Read the repo', async () => {
8384
const repoName = getRepoName();
84-
const row = await getRowByNameOrUrl(page, repoName);
85+
const row = await getRowByNameOrUrl(page, `${repoName}-Edited`);
8586
await expect(row.getByText('Valid')).toBeVisible({ timeout: 60000 });
8687
await row.getByLabel('Kebab toggle').click();
8788
await row.getByRole('menuitem', { name: 'Edit' }).click();

0 commit comments

Comments
 (0)