forked from mirrors/forgejo
fix(e2e): improve org-members, issue-sidebar and runner-management test (#12164)
Followup to https://codeberg.org/forgejo/forgejo/pulls/11848 Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/12164 Reviewed-by: 0ko <0ko@noreply.codeberg.org> Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: Beowulf <beowulf@beocode.eu> Co-committed-by: Beowulf <beowulf@beocode.eu>
This commit is contained in:
parent
4001ab027a
commit
1b6fe54e08
3 changed files with 23 additions and 8 deletions
|
|
@ -25,6 +25,8 @@ test.describe('Pull: Toggle WIP', () => {
|
|||
}
|
||||
|
||||
async function check_wip({page}: {page: Page}, is: boolean) {
|
||||
await page.waitForLoadState();
|
||||
|
||||
const elemTitle = 'h1';
|
||||
const stateLabel = '.issue-state-label';
|
||||
await page.waitForLoadState('domcontentloaded');
|
||||
|
|
@ -66,7 +68,6 @@ test.describe('Pull: Toggle WIP', () => {
|
|||
});
|
||||
|
||||
test('manual edit', async ({page}) => {
|
||||
await page.goto('/user2/repo1/pulls/5');
|
||||
// manually edit title to another prefix
|
||||
await page.locator('#issue-title-edit-show').click();
|
||||
await page.locator('#issue-title-editor input').fill(`[WIP] ${prTitle}`);
|
||||
|
|
@ -78,7 +79,6 @@ test.describe('Pull: Toggle WIP', () => {
|
|||
});
|
||||
|
||||
test('maximum title length', async ({page}) => {
|
||||
await page.goto('/user2/repo1/pulls/5');
|
||||
// check maximum title length is handled gracefully
|
||||
const maxLenStr = prTitle + 'a'.repeat(240);
|
||||
await page.locator('#issue-title-edit-show').click();
|
||||
|
|
@ -95,7 +95,6 @@ test.describe('Pull: Toggle WIP', () => {
|
|||
});
|
||||
|
||||
test('wip prefix casing', async ({page}) => {
|
||||
await page.goto('/user2/repo1/pulls/5');
|
||||
await setTitle({page}, `wIP:${prTitle}`);
|
||||
await expect(page.locator('h1')).toContainText(`wIP:${prTitle}`);
|
||||
await check_wip({page}, true);
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ test('Toggle visibility', async ({page}) => {
|
|||
|
||||
// Revert for repeatability
|
||||
await showUser2.click();
|
||||
await expect(hideUser2).toBeVisible();
|
||||
await expect(showUser2).toBeHidden();
|
||||
});
|
||||
|
||||
test('Leave org', async ({page}) => {
|
||||
|
|
@ -50,7 +52,7 @@ test('Leave org', async ({page}) => {
|
|||
await expect(page.locator('.flash-error').getByText('You cannot remove the last user from the "owners" team.')).toBeVisible();
|
||||
});
|
||||
|
||||
test('Add a new member to the org', async ({page}) => {
|
||||
test('Add and remove a new member to the org', async ({page}) => {
|
||||
page.goto('/org/org3/members');
|
||||
|
||||
// Click the "Add member" button
|
||||
|
|
@ -72,6 +74,17 @@ test('Add a new member to the org', async ({page}) => {
|
|||
// Click the button
|
||||
await page.locator('#add-member-modal .actions button.ok').click();
|
||||
|
||||
// Getting error is enough to know that the correct request went though
|
||||
// Verify that the user was added
|
||||
await expect(page.locator('.organization.members .list a').getByText('user5 (User Five)')).toBeVisible();
|
||||
|
||||
// Revert for repeatability
|
||||
const removeButton = page.locator('.delete-button[data-url="/org/org3/members/action/remove"][data-datauid="5"]');
|
||||
await expect(async () => {
|
||||
await removeButton.click();
|
||||
// A confirmation modal will appear
|
||||
await expect(page.locator('.modal#remove-organization-member')).toBeVisible();
|
||||
// Proceed removing from the org
|
||||
await page.locator('.modal#remove-organization-member .actions button.ok').click();
|
||||
await expect(page.locator('.organization.members .list a').getByText('user5 (User Five)')).toBeHidden();
|
||||
}).toPass();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -125,9 +125,12 @@ test.describe('Runners of user2', () => {
|
|||
const runnerUUID = await page.evaluate(() => navigator.clipboard.readText());
|
||||
expect(runnerUUID).toMatch(uuidPattern);
|
||||
|
||||
await page.getByRole('button', {name: 'Copy runner token'}).click();
|
||||
const runnerToken = await page.evaluate(() => navigator.clipboard.readText());
|
||||
expect(runnerToken).toMatch(tokenPattern);
|
||||
let runnerToken;
|
||||
await expect(async () => {
|
||||
await page.getByRole('button', {name: 'Copy runner token'}).click();
|
||||
runnerToken = await page.evaluate(() => navigator.clipboard.readText());
|
||||
expect(runnerToken).toMatch(tokenPattern);
|
||||
}).toPass();
|
||||
|
||||
await expect(page.getByRole('term')).toHaveText(['UUID', 'Token']);
|
||||
await expect(page.getByRole('definition')).toContainText([runnerUUID, runnerToken]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue