Merge pull request 'test: assert navigation URLs in release E2E test' (#5167) from solomonv/fix-flaky-e2e into forgejo

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5167
Reviewed-by: Otto <otto@codeberg.org>
This commit is contained in:
Otto 2024-09-03 12:01:23 +00:00
commit c2e0ce5674

View file

@ -22,6 +22,7 @@ test('External Release Attachments', async ({browser, isMobile}, workerInfo) =>
await page.click('.button.small.primary'); await page.click('.button.small.primary');
// Fill out form and create new release // Fill out form and create new release
await expect(page).toHaveURL('/user2/repo2/releases/new');
await page.fill('input[name=tag_name]', '2.0'); await page.fill('input[name=tag_name]', '2.0');
await page.fill('input[name=title]', '2.0'); await page.fill('input[name=title]', '2.0');
await page.click('#add-external-link'); await page.click('#add-external-link');
@ -33,6 +34,7 @@ test('External Release Attachments', async ({browser, isMobile}, workerInfo) =>
await page.click('.button.small.primary'); await page.click('.button.small.primary');
// Validate release page and click edit // Validate release page and click edit
await expect(page).toHaveURL('/user2/repo2/releases');
await expect(page.locator('.download[open] li')).toHaveCount(3); await expect(page.locator('.download[open] li')).toHaveCount(3);
await expect(page.locator('.download[open] li:nth-of-type(3)')).toContainText('Test'); await expect(page.locator('.download[open] li:nth-of-type(3)')).toContainText('Test');
await expect(page.locator('.download[open] li:nth-of-type(3) a')).toHaveAttribute('href', 'https://forgejo.org/'); await expect(page.locator('.download[open] li:nth-of-type(3) a')).toHaveAttribute('href', 'https://forgejo.org/');
@ -40,6 +42,7 @@ test('External Release Attachments', async ({browser, isMobile}, workerInfo) =>
await page.locator('.octicon-pencil').first().click(); await page.locator('.octicon-pencil').first().click();
// Validate edit page and edit the release // Validate edit page and edit the release
await expect(page).toHaveURL('/user2/repo2/releases/edit/2.0');
await expect(page.locator('.attachment_edit:visible')).toHaveCount(2); await expect(page.locator('.attachment_edit:visible')).toHaveCount(2);
await expect(page.locator('.attachment_edit:visible').nth(0)).toHaveValue('Test'); await expect(page.locator('.attachment_edit:visible').nth(0)).toHaveValue('Test');
await expect(page.locator('.attachment_edit:visible').nth(1)).toHaveValue('https://forgejo.org/'); await expect(page.locator('.attachment_edit:visible').nth(1)).toHaveValue('https://forgejo.org/');
@ -53,6 +56,7 @@ test('External Release Attachments', async ({browser, isMobile}, workerInfo) =>
await page.click('.button.small.primary'); await page.click('.button.small.primary');
// Validate release page and click edit // Validate release page and click edit
await expect(page).toHaveURL('/user2/repo2/releases');
await expect(page.locator('.download[open] li')).toHaveCount(4); await expect(page.locator('.download[open] li')).toHaveCount(4);
await expect(page.locator('.download[open] li:nth-of-type(3)')).toContainText('Test2'); await expect(page.locator('.download[open] li:nth-of-type(3)')).toContainText('Test2');
await expect(page.locator('.download[open] li:nth-of-type(3) a')).toHaveAttribute('href', 'https://gitea.io/'); await expect(page.locator('.download[open] li:nth-of-type(3) a')).toHaveAttribute('href', 'https://gitea.io/');
@ -62,6 +66,8 @@ test('External Release Attachments', async ({browser, isMobile}, workerInfo) =>
await page.locator('.octicon-pencil').first().click(); await page.locator('.octicon-pencil').first().click();
// Delete release // Delete release
await expect(page).toHaveURL('/user2/repo2/releases/edit/2.0');
await page.click('.delete-button'); await page.click('.delete-button');
await page.click('.button.ok'); await page.click('.button.ok');
await expect(page).toHaveURL('/user2/repo2/releases');
}); });