summaryrefslogtreecommitdiffstats
path: root/tests/e2e/explore.test.e2e.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-10-11 10:27:00 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-10-11 10:27:00 +0000
commit65aa53fc52ff15efe54df4147564828d535837f8 (patch)
tree31c51dad04fdcca80e6d3043c8bd49d2f1a51f83 /tests/e2e/explore.test.e2e.js
parentInitial commit. (diff)
downloadforgejo-65aa53fc52ff15efe54df4147564828d535837f8.tar.xz
forgejo-65aa53fc52ff15efe54df4147564828d535837f8.zip
Adding upstream version 8.0.3.HEADupstream/8.0.3upstreamdebian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/e2e/explore.test.e2e.js')
-rw-r--r--tests/e2e/explore.test.e2e.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/e2e/explore.test.e2e.js b/tests/e2e/explore.test.e2e.js
new file mode 100644
index 00000000..f486a3cb
--- /dev/null
+++ b/tests/e2e/explore.test.e2e.js
@@ -0,0 +1,39 @@
+// @ts-check
+// document is a global in evaluate, so it's safe to ignore here
+/* eslint no-undef: 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);
+});