mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-01-11 08:02:15 +01:00
68d690b6b9
Some checks are pending
/ release (push) Waiting to run
testing / test-remote-cacher (redis) (push) Blocked by required conditions
testing / backend-checks (push) Waiting to run
testing / frontend-checks (push) Waiting to run
testing / test-unit (push) Blocked by required conditions
testing / test-e2e (push) Blocked by required conditions
testing / test-remote-cacher (valkey) (push) Blocked by required conditions
testing / test-remote-cacher (garnet) (push) Blocked by required conditions
testing / test-remote-cacher (redict) (push) Blocked by required conditions
testing / test-mysql (push) Blocked by required conditions
testing / test-pgsql (push) Blocked by required conditions
testing / test-sqlite (push) Blocked by required conditions
testing / security-check (push) Blocked by required conditions
Replaced manual login and context loading across tests with Playwright's `test.use` configuration for user authentication. This simplifies test setup, improves readability, and reduces repetition. For #6362 Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6400 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: Julian Schlarb <julian.schlarb@denktmit.de> Co-committed-by: Julian Schlarb <julian.schlarb@denktmit.de>
40 lines
1.8 KiB
TypeScript
40 lines
1.8 KiB
TypeScript
// @watch start
|
|
// web_src/js/features/repo-migrate.js
|
|
// @watch end
|
|
|
|
import {expect} from '@playwright/test';
|
|
import {test, save_visual, test_context} from './utils_e2e.ts';
|
|
|
|
test.use({user: 'user2'});
|
|
|
|
test('Migration Progress Page', async ({page, browser}, workerInfo) => {
|
|
test.skip(workerInfo.project.name === 'Mobile Safari', 'Flaky actionability checks on Mobile Safari');
|
|
|
|
expect((await page.goto('/user2/invalidrepo'))?.status(), 'repo should not exist yet').toBe(404);
|
|
|
|
await page.goto('/repo/migrate?service_type=1');
|
|
|
|
const form = page.locator('form');
|
|
await form.getByRole('textbox', {name: 'Repository Name'}).fill('invalidrepo');
|
|
await form.getByRole('textbox', {name: 'Migrate / Clone from URL'}).fill('https://codeberg.org/forgejo/invalidrepo');
|
|
await save_visual(page);
|
|
await form.locator('button.primary').click({timeout: 5000});
|
|
await expect(page).toHaveURL('user2/invalidrepo');
|
|
await save_visual(page);
|
|
// page screenshot of unauthenticatedPage is checked automatically after the test
|
|
|
|
const ctx = await test_context(browser);
|
|
const unauthenticatedPage = await ctx.newPage();
|
|
expect((await unauthenticatedPage.goto('/user2/invalidrepo'))?.status(), 'public migration page should be accessible').toBe(200);
|
|
await expect(unauthenticatedPage.locator('#repo_migrating_progress')).toBeVisible();
|
|
|
|
await page.reload();
|
|
await expect(page.locator('#repo_migrating_failed')).toBeVisible();
|
|
await save_visual(page);
|
|
await page.getByRole('button', {name: 'Delete this repository'}).click();
|
|
const deleteModal = page.locator('#delete-repo-modal');
|
|
await deleteModal.getByRole('textbox', {name: 'Confirmation string'}).fill('user2/invalidrepo');
|
|
await save_visual(page);
|
|
await deleteModal.getByRole('button', {name: 'Delete repository'}).click();
|
|
await expect(page).toHaveURL('/');
|
|
});
|