2024-03-12 03:56:09 +03:00
|
|
|
// document is a global in evaluate, so it's safe to ignore here
|
2024-07-22 21:03:32 +03:00
|
|
|
// eslint playwright/no-conditional-in-test: 0
|
2024-09-11 23:34:33 +03:00
|
|
|
|
|
|
|
// @watch start
|
|
|
|
// templates/explore/**
|
|
|
|
// web_src/modules/fomantic/**
|
|
|
|
// @watch end
|
|
|
|
|
2024-08-15 00:34:36 +03:00
|
|
|
import {expect} from '@playwright/test';
|
2024-11-08 11:55:54 +03:00
|
|
|
import {test} from './utils_e2e.ts';
|
2024-03-12 03:56:09 +03:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
2024-10-23 17:22:25 +03:00
|
|
|
expect(res).toBe(exp);
|
2024-03-12 03:56:09 +03:00
|
|
|
});
|