Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-28 20:56:11 +01:00
forgejo/tests/e2e/explore.test.e2e.js
Otto Richter 7765153b40 tests(e2e): Allow tests to run only on file changes
- supports glob patterns in testfiles
- only runs tests on changes
- always runs tests without specified patterns

tests(e2e): refactor global watch patterns

tests(e2e): add watch patterns to test files
2024-10-04 15:14:45 +02:00

47 lines
1.3 KiB
JavaScript

// @ts-check
// document is a global in evaluate, so it's safe to ignore here
// eslint playwright/no-conditional-in-test: 0
// @watch start
// templates/explore/**
// web_src/modules/fomantic/**
// @watch end
import {expect} from '@playwright/test';
import {test} from './utils_e2e.js';
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);
});