mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-31 11:52:10 +00:00
Fixes an visual bug where the info box to dispatch a workflow is shown even for users that lack permissions to actualy run the workflow. (#4305)
Example: Visit https://v8.next.forgejo.org/Mai-Lapyst/test/actions?workflow=dispatch.yaml&actor=0&status=0 without being logged in.  Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4305 Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org> Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: Mai-Lapyst <mai-lapyst@noreply.codeberg.org> Co-committed-by: Mai-Lapyst <mai-lapyst@noreply.codeberg.org>
This commit is contained in:
parent
c49afdf0ff
commit
98c8d45f0b
2 changed files with 13 additions and 2 deletions
|
@ -6,6 +6,8 @@ test.beforeAll(async ({browser}, workerInfo) => {
|
|||
await login_user(browser, workerInfo, 'user2');
|
||||
});
|
||||
|
||||
const workflow_trigger_notification_text = 'This workflow has a workflow_dispatch event trigger.';
|
||||
|
||||
test('Test workflow dispatch present', async ({browser}, workerInfo) => {
|
||||
const context = await load_logged_in_context(browser, workerInfo, 'user2');
|
||||
/** @type {import('@playwright/test').Page} */
|
||||
|
@ -13,7 +15,7 @@ test('Test workflow dispatch present', async ({browser}, workerInfo) => {
|
|||
|
||||
await page.goto('/user2/test_workflows/actions?workflow=test-dispatch.yml&actor=0&status=0');
|
||||
|
||||
await expect(page.getByText('This workflow has a workflow_dispatch event trigger.')).toBeVisible();
|
||||
await expect(page.getByText(workflow_trigger_notification_text)).toBeVisible();
|
||||
|
||||
const run_workflow_btn = page.locator('#workflow_dispatch_dropdown>button');
|
||||
await expect(run_workflow_btn).toBeVisible();
|
||||
|
@ -72,3 +74,10 @@ test('Test workflow dispatch success', async ({browser}, workerInfo) => {
|
|||
|
||||
await expect(page.locator('.run-list>:first-child .run-list-meta', {hasText: 'now'})).toBeVisible();
|
||||
});
|
||||
|
||||
test('Test workflow dispatch box not available for unauthenticated users', async ({page}) => {
|
||||
await page.goto('/user2/test_workflows/actions?workflow=test-dispatch.yml&actor=0&status=0');
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
await expect(page.locator('body')).not.toContainText(workflow_trigger_notification_text);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue