mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-10 04:05:42 +01:00
40baa96fc3
- Add https://github.com/playwright-community/eslint-plugin-playwright as a linter for the playwright tests. - `no-networkidle` and `no-conditional-in-test` are disabled as fixing those doesn't seem to really improve testing quality for our use case. - Some non-recommended linters are enabled to ensure consistency (the prefer rules).
39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
// @ts-check
|
|
// document is a global in evaluate, so it's safe to ignore here
|
|
// eslint playwright/no-conditional-in-test: 0
|
|
import {test, expect} from '@playwright/test';
|
|
|
|
test('Explore view taborder', async ({page}) => {
|
|
await page.goto('/explore/repos');
|
|
|
|
const l1 = page.locator('[href="https://forgejo.org"]');
|
|
const l2 = page.locator('[href="/assets/licenses.txt"]');
|
|
const l3 = page.locator('[href*="/stars"]').first();
|
|
const l4 = page.locator('[href*="/forks"]').first();
|
|
let res = 0;
|
|
const exp = 15; // 0b1111 = four passing tests
|
|
|
|
for (let i = 0; i < 150; i++) {
|
|
await page.keyboard.press('Tab');
|
|
if (await l1.evaluate((node) => document.activeElement === node)) {
|
|
res |= 1;
|
|
continue;
|
|
}
|
|
if (await l2.evaluate((node) => document.activeElement === node)) {
|
|
res |= 1 << 1;
|
|
continue;
|
|
}
|
|
if (await l3.evaluate((node) => document.activeElement === node)) {
|
|
res |= 1 << 2;
|
|
continue;
|
|
}
|
|
if (await l4.evaluate((node) => document.activeElement === node)) {
|
|
res |= 1 << 3;
|
|
continue;
|
|
}
|
|
if (res === exp) {
|
|
break;
|
|
}
|
|
}
|
|
await expect(res).toBe(exp);
|
|
});
|