Skip to content

Commit 2e5cb17

Browse files
committed
test(release): cover the locked release form in the browser
The edit form is the one place the immutable state is only expressed in a template, so nothing below the browser could catch it rendering the upload area or an editable asset field for a locked release. Assisted-by: Claude Code:claude-opus-5
1 parent 6e1c8b9 commit 2e5cb17

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

tests/e2e/release.test.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {env} from 'node:process';
22
import {test, expect} from '@playwright/test';
3-
import {login, apiCreateRepo, randomString} from './utils.ts';
3+
import {login, apiCreateRepo, apiHeaders, baseUrl, randomString} from './utils.ts';
44

55
test('create a release', async ({page, request}) => {
66
const repoName = `e2e-release-${randomString(8)}`;
@@ -17,3 +17,17 @@ test('create a release', async ({page, request}) => {
1717
await page.waitForURL(new RegExp(`/${owner}/${repoName}/releases$`));
1818
await expect(page.locator('.release-list-title')).toContainText(title);
1919
});
20+
21+
test('immutable release locks its assets', async ({page, request}) => {
22+
const repoName = `e2e-immutable-${randomString(8)}`;
23+
const owner = env.GITEA_TEST_E2E_USER;
24+
const tag = `v1.0.0-${randomString(8)}`;
25+
await Promise.all([apiCreateRepo(request, {name: repoName}), login(page)]);
26+
const api = `${baseUrl()}/api/v1/repos/${owner}/${repoName}`;
27+
await request.patch(api, {headers: apiHeaders(), data: {immutable_releases: true}});
28+
const release = await request.post(`${api}/releases`, {headers: apiHeaders(), data: {tag_name: tag, name: tag}});
29+
expect((await release.json()).immutable).toBe(true);
30+
await page.goto(`/${owner}/${repoName}/releases/edit/${tag}`);
31+
await expect(page.getByText('You cannot change the tag, target or assets of a published immutable release.')).toBeVisible();
32+
await expect(page.locator('.dropzone')).toHaveCount(0);
33+
});

0 commit comments

Comments
 (0)