Files
gitea/tests/e2e/actions.test.ts
wxiaoguangandsilverwind f690ea8efd chore: refactor legacy JS init code to use "data-global-init" (#39836)
Move the remaining legacy init code, which probed page classes with
`querySelector`, to `data-global-init`, so each feature initializes from
its own element. `hashchange` listeners now go through one module that
runs them in priority order, because independent listeners broke when
mount order changed.

- Convert issue list, diff, repo create, settings and org team inits to
`data-global-init`
- Run `hashchange` listeners by priority, the diff scroll handler last
- Make the devtest mock's failing log requests deterministic
- Add e2e tests for diff tree navigation to folded files and job log
permalinks

---------

Co-authored-by: silverwind <me@silverwind.io>
2026-10-18 13:59:51 +00:00

35 lines
1.5 KiB
TypeScript

import {env} from 'node:process';
import {expect, test} from '@playwright/test';
import {apiCreateFiles, apiCreateRepo, apiHeaders, randomString} from './utils.ts';
test('job queue refreshes with filter open', async ({page, request}) => {
const owner = env.GITEA_TEST_E2E_USER;
const repo = `e2e-queue-${randomString(8)}`;
await apiCreateRepo(request, {name: repo, autoInit: false});
await apiCreateFiles(request, owner, repo, [{
path: '.gitea/workflows/queue.yml',
content: 'on: workflow_dispatch\njobs:\n queued:\n runs-on: no-runner\n steps:\n - run: exit 0\n',
}]);
const dispatch = async () => {
const response = await request.post(`/api/v1/repos/${owner}/${repo}/actions/workflows/queue.yml/dispatches`, {headers: apiHeaders(), data: {ref: 'main'}});
expect(response.ok()).toBe(true);
};
await dispatch();
await page.clock.install();
await page.goto(`/${owner}/${repo}/actions/job_queue`);
await page.getByRole('menu').getByText('Status', {exact: true}).click();
const waitingFilter = page.getByRole('menuitem', {name: 'Waiting'});
await expect(waitingFilter).toBeVisible();
await dispatch();
await page.clock.fastForward(3000);
await expect(page.getByRole('link', {name: 'queued #2'})).toBeVisible();
await expect(waitingFilter).toBeVisible();
});
test('job log line permalink expands its step', async ({page}) => {
await page.goto('/devtest/repo-action-view/runs/10/jobs/1#jobstep-1-23');
await expect(page.getByRole('link', {name: '23', exact: true})).toBeInViewport();
});