From dd136858f1ea40ad3c94191d647487fa4f31926c Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 18 Oct 2024 20:33:49 +0200 Subject: Adding upstream version 9.0.0. Signed-off-by: Daniel Baumann --- tests/e2e/explore.test.e2e.js | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 tests/e2e/explore.test.e2e.js (limited to 'tests/e2e/explore.test.e2e.js') diff --git a/tests/e2e/explore.test.e2e.js b/tests/e2e/explore.test.e2e.js new file mode 100644 index 0000000..9603443 --- /dev/null +++ b/tests/e2e/explore.test.e2e.js @@ -0,0 +1,40 @@ +// @ts-check +// document is a global in evaluate, so it's safe to ignore here +// eslint playwright/no-conditional-in-test: 0 +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); +}); -- cgit v1.2.3