Add e2e reaction test, improve accessibility, enable parallel testing (#37081)
Add a new e2e test for toggling issue reactions via the reaction picker dropdown. Add `aria-label` attributes to improve reaction accessibility: - Add `aria-label="Reaction"` to the reaction picker dropdown - Add `role="group"` with `aria-label="Reactions"` to the reactions container, giving it a semantic identity for screen readers - Include the reaction key in each reaction button's `aria-label` (e.g. `+1: user1, user2`) so screen readers announce which reaction a button represents E2e test improvements: - Simplify `randomString` to use `Math.random` instead of `node:crypto` - Replace `generatePassword` with a static password, remove unused `clickDropdownItem` - Enable `fullyParallel: true` and `workers: '50%'` in Playwright config - Run both chromium and firefox in all environments (not just CI) - Parallelize `login` and `apiCreateRepo` setup where possible - Use dedicated test user in `user-settings` test for concurrency safety Co-authored-by: Claude (Opus 4.6) <noreply@anthropic.com>
This commit is contained in:
+13
-15
@@ -1,7 +1,16 @@
|
||||
import {randomBytes} from 'node:crypto';
|
||||
import {env} from 'node:process';
|
||||
import {expect} from '@playwright/test';
|
||||
import type {APIRequestContext, Locator, Page} from '@playwright/test';
|
||||
import type {APIRequestContext, Page} from '@playwright/test';
|
||||
|
||||
/** Generate a random alphanumeric string. */
|
||||
export function randomString(length: number): string {
|
||||
const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
|
||||
let result = '';
|
||||
for (let index = 0; index < length; index++) {
|
||||
result += chars.charAt(Math.floor(Math.random() * chars.length));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
export const timeoutFactor = Number(env.GITEA_TEST_E2E_TIMEOUT_FACTOR) || 1;
|
||||
|
||||
@@ -63,14 +72,8 @@ export async function apiDeleteOrg(requestContext: APIRequestContext, name: stri
|
||||
}), 'apiDeleteOrg');
|
||||
}
|
||||
|
||||
/** Generate a random password that satisfies the complexity requirements. */
|
||||
function generatePassword() {
|
||||
const chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
||||
return `${Array.from(randomBytes(12), (b) => chars[b % chars.length]).join('')}!aA1`;
|
||||
}
|
||||
|
||||
/** Random password shared by all test users — used for both API user creation and browser login. */
|
||||
const testUserPassword = generatePassword();
|
||||
/** Password shared by all test users — used for both API user creation and browser login. */
|
||||
const testUserPassword = 'e2e-password!aA1';
|
||||
|
||||
export function apiUserHeaders(username: string) {
|
||||
return apiAuthHeader(username, testUserPassword);
|
||||
@@ -89,11 +92,6 @@ export async function apiDeleteUser(requestContext: APIRequestContext, username:
|
||||
}), 'apiDeleteUser');
|
||||
}
|
||||
|
||||
export async function clickDropdownItem(page: Page, trigger: Locator, itemText: string) {
|
||||
await trigger.click();
|
||||
await page.getByText(itemText).click();
|
||||
}
|
||||
|
||||
export async function loginUser(page: Page, username: string) {
|
||||
return login(page, username, testUserPassword);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user