diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 06fe398..4f4f798 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,7 +20,7 @@ jobs: - name: Install dependencies run: | pnpm install - npx puppeteer browsers install chrome + npx puppeteer browsers install cd test && pnpm install - name: Build the extension run: pnpm build diff --git a/.puppeteerrc.cjs b/.puppeteerrc.cjs index 5e5c94d..3cb1b7e 100644 --- a/.puppeteerrc.cjs +++ b/.puppeteerrc.cjs @@ -5,4 +5,14 @@ const { join } = require("path"); */ module.exports = { cacheDirectory: join(__dirname, ".cache", "puppeteer"), + browserRevision: "130.0.6723.58", + defaultLaunchOptions: { + headless: "new", + args: [ + "--no-sandbox", + "--disable-setuid-sandbox", + "--disable-dev-shm-usage", + "--disable-gpu" + ] + } }; diff --git a/package.json b/package.json index cdbe782..3f19a73 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "@types/chrome": "0.0.287", "@types/mocha": "^10.0.7", "@types/node": "20.14.5", + "@types/puppeteer": "^7.0.4", "@types/react": "18.3.3", "@types/react-dom": "18.3.1", "@types/validator": "^13.12.0", @@ -50,6 +51,7 @@ "postcss": "^8.4.47", "prettier": "3.3.3", "puppeteer": "^23.6.0", + "puppeteer-core": "^24.1.1", "source-map-support": "^0.5.21", "tailwindcss": "^3.4.15", "ts-node": "^10.9.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 99d0eef..8fea044 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -63,6 +63,9 @@ importers: '@types/node': specifier: 20.14.5 version: 20.14.5 + '@types/puppeteer': + specifier: ^7.0.4 + version: 7.0.4(typescript@5.5.4) '@types/react': specifier: 18.3.3 version: 18.3.3 @@ -108,6 +111,9 @@ importers: puppeteer: specifier: ^23.6.0 version: 23.6.0(typescript@5.5.4) + puppeteer-core: + specifier: ^24.1.1 + version: 24.1.1 source-map-support: specifier: ^0.5.21 version: 0.5.21 @@ -1365,6 +1371,11 @@ packages: engines: {node: '>=18'} hasBin: true + '@puppeteer/browsers@2.7.0': + resolution: {integrity: sha512-bO61XnTuopsz9kvtfqhVbH6LTM1koxK0IlBR+yuVrM2LB7mk8+5o1w18l5zqd5cs8xlf+ntgambqRqGifMDjog==} + engines: {node: '>=18'} + hasBin: true + '@sindresorhus/is@5.6.0': resolution: {integrity: sha512-TV7t8GKYaJWsn00tFDqBw8+Uqmr8A0fRU1tvTQhyZzGv0sJCGRQL3JGMI3ucuKo3XIZdUP+Lx7/gh2t3lewy7g==} engines: {node: '>=14.16'} @@ -1660,6 +1671,10 @@ packages: '@types/prop-types@15.7.5': resolution: {integrity: sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==} + '@types/puppeteer@7.0.4': + resolution: {integrity: sha512-ja78vquZc8y+GM2al07GZqWDKQskQXygCDiu0e3uO0DMRKqE0MjrFBFmTulfPYzLB6WnL7Kl2tFPy0WXSpPomg==} + deprecated: This is a stub types definition. puppeteer provides its own type definitions, so you do not need this installed. + '@types/react-dom@18.3.1': resolution: {integrity: sha512-qW1Mfv8taImTthu4KoXgDfLuk4bydU6Q/TkADnDWWHwi4NX4BR+LWfTp2sVmTqRrsHvyDDTelgelxJ+SsejKKQ==} @@ -1792,6 +1807,10 @@ packages: resolution: {integrity: sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==} engines: {node: '>= 14'} + agent-base@7.1.3: + resolution: {integrity: sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw==} + engines: {node: '>= 14'} + ajv@6.12.6: resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} @@ -2059,6 +2078,11 @@ packages: peerDependencies: devtools-protocol: '*' + chromium-bidi@1.1.0: + resolution: {integrity: sha512-HislCEczCuamWm3+55Lig9XKmMF13K+BGKum9rwtDAzgUAHT4h5jNwhDmD4U20VoVUG8ujnv9UZ89qiIf5uF8w==} + peerDependencies: + devtools-protocol: '*' + classnames@2.5.1: resolution: {integrity: sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow==} @@ -2224,6 +2248,15 @@ packages: supports-color: optional: true + debug@4.4.0: + resolution: {integrity: sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + decamelize@4.0.0: resolution: {integrity: sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==} engines: {node: '>=10'} @@ -2282,6 +2315,9 @@ packages: devtools-protocol@0.0.1354347: resolution: {integrity: sha512-BlmkSqV0V84E2WnEnoPnwyix57rQxAM5SKJjf4TbYOCGLAWtz8CDH8RIaGOjPgPCXo2Mce3kxSY497OySidY3Q==} + devtools-protocol@0.0.1380148: + resolution: {integrity: sha512-1CJABgqLxbYxVI+uJY/UDUHJtJ0KZTSjNYJYKqd9FRoXT33WDakDHNxRapMEgzeJ/C3rcs01+avshMnPmKQbvA==} + didyoumean@1.2.2: resolution: {integrity: sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==} @@ -2770,6 +2806,10 @@ packages: resolution: {integrity: sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg==} engines: {node: '>= 14'} + https-proxy-agent@7.0.6: + resolution: {integrity: sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==} + engines: {node: '>= 14'} + human-signals@2.1.0: resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==} engines: {node: '>=10.17.0'} @@ -2823,6 +2863,10 @@ packages: resolution: {integrity: sha512-Y+R5hJrzs52QCG2laLn4udYVnxsfny9CpOhNhUvk/SSSVyF6T27FzRbF0sroPidSu3X8oEAkOn2K804mjpt6UQ==} engines: {node: '>= 0.4'} + ip-address@9.0.5: + resolution: {integrity: sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g==} + engines: {node: '>= 12'} + ip@1.1.8: resolution: {integrity: sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg==} @@ -3001,6 +3045,9 @@ packages: resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} hasBin: true + jsbn@1.1.0: + resolution: {integrity: sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==} + jsesc@2.5.2: resolution: {integrity: sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==} engines: {node: '>=4'} @@ -3431,10 +3478,18 @@ packages: resolution: {integrity: sha512-ASV8yU4LLKBAjqIPMbrgtaKIvxQri/yh2OpI+S6hVa9JRkUI3Y3NPFbfngDtY7oFtSMD3w31Xns89mDa3Feo5A==} engines: {node: '>= 14'} + pac-proxy-agent@7.1.0: + resolution: {integrity: sha512-Z5FnLVVZSnX7WjBg0mhDtydeRZ1xMcATZThjySQUHqr+0ksP8kqaw23fNKkaaN/Z8gwLUs/W7xdl0I75eP2Xyw==} + engines: {node: '>= 14'} + pac-resolver@7.0.0: resolution: {integrity: sha512-Fd9lT9vJbHYRACT8OhCbZBbxr6KRSawSovFpy8nDGshaK99S/EBhVIHp9+crhxrsZOuvLpgL1n23iyPg6Rl2hg==} engines: {node: '>= 14'} + pac-resolver@7.0.1: + resolution: {integrity: sha512-5NPgf87AT2STgwa2ntRMr45jTKrYBGkVU36yT0ig/n/GMAa3oPqhZfIQ2kMEimReg0+t9kZViDVZ83qfVUlckg==} + engines: {node: '>= 14'} + package-json-from-dist@1.0.1: resolution: {integrity: sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==} @@ -3616,6 +3671,10 @@ packages: resolution: {integrity: sha512-u0piLU+nCOHMgGjRbimiXmA9kM/L9EHh3zL81xCdp7m+Y2pHIsnmbdDoEDoAz5geaonNR6q6+yOPQs6n4T6sBQ==} engines: {node: '>= 14'} + proxy-agent@6.5.0: + resolution: {integrity: sha512-TmatMXdr2KlRiA2CyDu8GqR8EjahTG3aY3nXjdzFyoZbmB8hrBsTyMezhULIXKnC0jpfjlmiZ3+EaCzoInSu/A==} + engines: {node: '>= 14'} + proxy-from-env@1.1.0: resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==} @@ -3633,6 +3692,10 @@ packages: resolution: {integrity: sha512-se1bhgUpR9C529SgHGr/eyT92mYyQPAhA2S9pGtGrVG2xob9qE6Pbp7TlqiSPlnnY1lINqhn6/67EwkdzOmKqQ==} engines: {node: '>=18'} + puppeteer-core@24.1.1: + resolution: {integrity: sha512-7FF3gq6bpIsbq3I8mfbodXh3DCzXagoz3l2eGv1cXooYU4g0P4mcHQVHuBD4iSZPXNg8WjzlP5kmRwK9UvwF0A==} + engines: {node: '>=18'} + puppeteer@23.6.0: resolution: {integrity: sha512-l+Fgo8SVFSd51STtq2crz8t1Y3VXowsuR4zfR64qDOn6oggz7YIZauWiNR4IJjczQ6nvFs3S4cgng55/nesxTQ==} engines: {node: '>=18'} @@ -3863,10 +3926,18 @@ packages: resolution: {integrity: sha512-8zuqoLv1aP/66PHF5TqwJ7Czm3Yv32urJQHrVyhD7mmA6d61Zv8cIXQYPTWwmg6qlupnPvs/QKDmfa4P/qct2g==} engines: {node: '>= 14'} + socks-proxy-agent@8.0.5: + resolution: {integrity: sha512-HehCEsotFqbPW9sJ8WVYB6UbmIMv7kUUORIF2Nncq4VQvBfNBLibW9YZR5dlYCSUhwcD628pRllm7n+E+YTzJw==} + engines: {node: '>= 14'} + socks@2.7.1: resolution: {integrity: sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ==} engines: {node: '>= 10.13.0', npm: '>= 3.0.0'} + socks@2.8.3: + resolution: {integrity: sha512-l5x7VUUWbjVFbafGLxPWkYsHIhEvmF85tbIeFZWc8ZPtoMyybuEhL7Jye/ooC4/d48FgOjSJXgsF/AJPYCW8Zw==} + engines: {node: '>= 10.0.0', npm: '>= 3.0.0'} + source-map-js@1.0.2: resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==} engines: {node: '>=0.10.0'} @@ -3886,6 +3957,9 @@ packages: resolution: {integrity: sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==} engines: {node: '>= 8'} + sprintf-js@1.1.3: + resolution: {integrity: sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==} + srcset@4.0.0: resolution: {integrity: sha512-wvLeHgcVHKO8Sc/H/5lkGreJQVeYMm9rlmt8PuR1xE31rIuXhuzznUUqAt8MqLhB3MqJdFzlNAfpcWnxiFUcPw==} engines: {node: '>=12'} @@ -4361,6 +4435,9 @@ packages: zod@3.23.8: resolution: {integrity: sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==} + zod@3.24.1: + resolution: {integrity: sha512-muH7gBL9sI1nciMZV67X5fTKKBLtwpZ5VBp1vsOQzj1MhrBZ4wlVCm3gedKZWLp0Oyel8sIGfeiz54Su+OVT+A==} + snapshots: '@aashutoshrathi/word-wrap@1.2.6': {} @@ -5981,6 +6058,19 @@ snapshots: transitivePeerDependencies: - supports-color + '@puppeteer/browsers@2.7.0': + dependencies: + debug: 4.4.0 + extract-zip: 2.0.1 + progress: 2.0.3 + proxy-agent: 6.5.0 + semver: 7.6.3 + tar-fs: 3.0.6 + unbzip2-stream: 1.4.3 + yargs: 17.7.2 + transitivePeerDependencies: + - supports-color + '@sindresorhus/is@5.6.0': {} '@svgr/babel-plugin-add-jsx-attribute@6.5.1(@babel/core@7.22.15)': @@ -6220,6 +6310,15 @@ snapshots: '@types/prop-types@15.7.5': {} + '@types/puppeteer@7.0.4(typescript@5.5.4)': + dependencies: + puppeteer: 23.6.0(typescript@5.5.4) + transitivePeerDependencies: + - bufferutil + - supports-color + - typescript + - utf-8-validate + '@types/react-dom@18.3.1': dependencies: '@types/react': 18.3.3 @@ -6405,6 +6504,8 @@ snapshots: transitivePeerDependencies: - supports-color + agent-base@7.1.3: {} + ajv@6.12.6: dependencies: fast-deep-equal: 3.1.3 @@ -6713,6 +6814,12 @@ snapshots: urlpattern-polyfill: 10.0.0 zod: 3.23.8 + chromium-bidi@1.1.0(devtools-protocol@0.0.1380148): + dependencies: + devtools-protocol: 0.0.1380148 + mitt: 3.0.1 + zod: 3.24.1 + classnames@2.5.1: {} cli-cursor@3.1.0: @@ -6869,6 +6976,10 @@ snapshots: dependencies: ms: 2.1.3 + debug@4.4.0: + dependencies: + ms: 2.1.3 + decamelize@4.0.0: {} decompress-response@6.0.0: @@ -6915,6 +7026,8 @@ snapshots: devtools-protocol@0.0.1354347: {} + devtools-protocol@0.0.1380148: {} + didyoumean@1.2.2: {} diff@4.0.2: {} @@ -7535,6 +7648,13 @@ snapshots: transitivePeerDependencies: - supports-color + https-proxy-agent@7.0.6: + dependencies: + agent-base: 7.1.3 + debug: 4.4.0 + transitivePeerDependencies: + - supports-color + human-signals@2.1.0: {} iconv-lite@0.4.24: @@ -7595,6 +7715,11 @@ snapshots: has: 1.0.3 side-channel: 1.0.4 + ip-address@9.0.5: + dependencies: + jsbn: 1.1.0 + sprintf-js: 1.1.3 + ip@1.1.8: {} ip@2.0.0: {} @@ -7750,6 +7875,8 @@ snapshots: dependencies: argparse: 2.0.1 + jsbn@1.1.0: {} + jsesc@2.5.2: {} json-buffer@3.0.1: {} @@ -8193,12 +8320,30 @@ snapshots: transitivePeerDependencies: - supports-color + pac-proxy-agent@7.1.0: + dependencies: + '@tootallnate/quickjs-emscripten': 0.23.0 + agent-base: 7.1.3 + debug: 4.4.0 + get-uri: 6.0.1 + http-proxy-agent: 7.0.2 + https-proxy-agent: 7.0.6 + pac-resolver: 7.0.1 + socks-proxy-agent: 8.0.5 + transitivePeerDependencies: + - supports-color + pac-resolver@7.0.0: dependencies: degenerator: 5.0.1 ip: 1.1.8 netmask: 2.0.2 + pac-resolver@7.0.1: + dependencies: + degenerator: 5.0.1 + netmask: 2.0.2 + package-json-from-dist@1.0.1: {} package-json@8.1.1: @@ -8446,6 +8591,19 @@ snapshots: transitivePeerDependencies: - supports-color + proxy-agent@6.5.0: + dependencies: + agent-base: 7.1.3 + debug: 4.4.0 + http-proxy-agent: 7.0.2 + https-proxy-agent: 7.0.6 + lru-cache: 7.18.3 + pac-proxy-agent: 7.1.0 + proxy-from-env: 1.1.0 + socks-proxy-agent: 8.0.5 + transitivePeerDependencies: + - supports-color + proxy-from-env@1.1.0: {} prr@1.0.1: @@ -8471,6 +8629,19 @@ snapshots: - supports-color - utf-8-validate + puppeteer-core@24.1.1: + dependencies: + '@puppeteer/browsers': 2.7.0 + chromium-bidi: 1.1.0(devtools-protocol@0.0.1380148) + debug: 4.4.0 + devtools-protocol: 0.0.1380148 + typed-query-selector: 2.12.0 + ws: 8.18.0 + transitivePeerDependencies: + - bufferutil + - supports-color + - utf-8-validate + puppeteer@23.6.0(typescript@5.5.4): dependencies: '@puppeteer/browsers': 2.4.0 @@ -8725,11 +8896,24 @@ snapshots: transitivePeerDependencies: - supports-color + socks-proxy-agent@8.0.5: + dependencies: + agent-base: 7.1.3 + debug: 4.4.0 + socks: 2.8.3 + transitivePeerDependencies: + - supports-color + socks@2.7.1: dependencies: ip: 2.0.0 smart-buffer: 4.2.0 + socks@2.8.3: + dependencies: + ip-address: 9.0.5 + smart-buffer: 4.2.0 + source-map-js@1.0.2: {} source-map-js@1.2.1: {} @@ -8745,6 +8929,8 @@ snapshots: dependencies: whatwg-url: 7.1.0 + sprintf-js@1.1.3: {} + srcset@4.0.0: {} stable@0.1.8: {} @@ -9318,3 +9504,5 @@ snapshots: yocto-queue@0.1.0: {} zod@3.23.8: {} + + zod@3.24.1: {} diff --git a/src/button/button-contributions.ts b/src/button/button-contributions.ts index d4c3a23..f8c7f35 100644 --- a/src/button/button-contributions.ts +++ b/src/button/button-contributions.ts @@ -202,6 +202,13 @@ export const buttonContributions: ButtonContributionParams[] = [ }, ], }, + { + id: "gl-repo-empty", + exampleUrls: ["https://gitlab.com/filiptronicek/empty"], + selector: `xpath://*[@id="js-project-show-empty-page"]/div[1]/div[1]/div[2]`, + containerElement: { type: "div", props: { marginLeft: "8px" } }, + application: "gitlab", + }, { id: "gl-file", exampleUrls: [ @@ -412,7 +419,8 @@ export const buttonContributions: ButtonContributionParams[] = [ ], selector: 'xpath://*[@id="main"]/div/div/div[1]/div/div/div/div[1]/div/div[2]/div/div[2]/div/div', // grandparent div of the "Request changes" and "Approve" buttons containerElement: createElement("div", {}), - insertBefore: 'xpath:(//*[@id="main"]/div/div/div[1]/div/div/div/div[1]/div/div[2]/div/div[2]/div/div/div)[last()]', // note the [last()] to insert before the last child (the kebab menu) + insertBefore: + 'xpath:(//*[@id="main"]/div/div/div[1]/div/div/div/div[1]/div/div[2]/div/div[2]/div/div/div)[last()]', // note the [last()] to insert before the last child (the kebab menu) application: "bitbucket", }, { diff --git a/src/contents/button.tsx b/src/contents/button.tsx index f7cade0..0df625b 100644 --- a/src/contents/button.tsx +++ b/src/contents/button.tsx @@ -108,6 +108,9 @@ class ButtonContributionManager { return this.buttons.get(this.getContainerId(this.active.contribution)); } + /** + * Checks if the contribution applies to the current page. + */ private isActive(contrib: ButtonContributionParams) { if (typeof contrib.match === "function" && !contrib.match()) { return false; diff --git a/test/src/button-contributions-copy.ts b/test/src/button-contributions-copy.ts index c3e6f6d..f8c7f35 100644 --- a/test/src/button-contributions-copy.ts +++ b/test/src/button-contributions-copy.ts @@ -202,6 +202,13 @@ export const buttonContributions: ButtonContributionParams[] = [ }, ], }, + { + id: "gl-repo-empty", + exampleUrls: ["https://gitlab.com/filiptronicek/empty"], + selector: `xpath://*[@id="js-project-show-empty-page"]/div[1]/div[1]/div[2]`, + containerElement: { type: "div", props: { marginLeft: "8px" } }, + application: "gitlab", + }, { id: "gl-file", exampleUrls: [ @@ -410,9 +417,10 @@ export const buttonContributions: ButtonContributionParams[] = [ exampleUrls: [ // "https://bitbucket.org/efftinge/browser-extension-test/pull-requests/1" ], - selector: 'xpath://*[@id="main"]/div/div/div[1]/div/div/div[1]/div/div[2]/div/div[2]/div/div', // grandparent div of the "Request changes" and "Approve" buttons + selector: 'xpath://*[@id="main"]/div/div/div[1]/div/div/div/div[1]/div/div[2]/div/div[2]/div/div', // grandparent div of the "Request changes" and "Approve" buttons containerElement: createElement("div", {}), - insertBefore: 'xpath:(//*[@id="main"]/div/div/div[1]/div/div/div[1]/div/div[2]/div/div[2]/div/div/div)[last()]', // note the [last()] to insert before the last child (the kebab menu) + insertBefore: + 'xpath:(//*[@id="main"]/div/div/div[1]/div/div/div/div[1]/div/div[2]/div/div[2]/div/div/div)[last()]', // note the [last()] to insert before the last child (the kebab menu) application: "bitbucket", }, { diff --git a/test/src/button-contributions.spec.ts b/test/src/button-contributions.spec.ts index f09c9c5..ddf6a29 100644 --- a/test/src/button-contributions.spec.ts +++ b/test/src/button-contributions.spec.ts @@ -4,7 +4,7 @@ import puppeteer, { Browser, Page } from "puppeteer"; import { buttonContributions } from "./button-contributions-copy.js"; -describe("Query Selector Tests", function () { +describe("Platform match tests", function () { let browser: Browser; let page: Page; @@ -46,7 +46,8 @@ describe("Query Selector Tests", function () { return false; } const allowedApps = ["GitHub", "GitLab", "Bitbucket"]; - return allowedApps.includes(appName); + + return allowedApps.some((app) => appName.includes(app)); }; return isSiteSuitable(); @@ -66,6 +67,7 @@ describe("Query Selector Tests", function () { before(async function () { browser = await puppeteer.launch({ headless: "new", + product: "chrome", }); page = await browser.newPage(); });