Skip to content

Commit

Permalink
Merge pull request #316 from david-tejada/update-packages
Browse files Browse the repository at this point in the history
Update dependencies jest-puppeteer, xo and eslint plugins
  • Loading branch information
david-tejada authored Sep 25, 2024
2 parents af42008 + 5016b0d commit c6692dd
Show file tree
Hide file tree
Showing 108 changed files with 5,765 additions and 4,425 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: "true"
with:
node-version: 18
node-version: 20
- run: npm install
- uses: david-tejada/puppeteer-headful@master
with:
Expand Down
113 changes: 113 additions & 0 deletions .xo-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
{
"extends": ["xo-react", "plugin:react/jsx-runtime"],
"parserOptions": {
"project": "./tsconfig.xo.json"
},
"envs": ["browser"],
"prettier": "true",
"globals": {
"page": true,
"browser": true,
"context": true,
"jestPuppeteer": true
},
"rules": {
"@typescript-eslint/switch-exhaustiveness-check": "off",
"no-unused-vars": [
"error",
{
"varsIgnorePattern": "browser"
}
],
"unicorn/prefer-top-level-await": "off",
"n/file-extension-in-import": "off",
"import/extensions": [
2,
"never",
{
"png": "always",
"html": "always"
}
],
"unicorn/filename-case": [
"error",
{
"cases": {
"camelCase": true,
"pascalCase": true
}
}
],
"node/prefer-global/process": "off",
"complexity": "off",
"no-use-extend-native/no-use-extend-native": "off",
"unicorn/no-array-callback-reference": "off",
"unicorn/prefer-node-protocol": "off",
"@typescript-eslint/ban-types": "off",
"no-redeclare": "off",
"@typescript-eslint/no-redeclare": "off",
"unicorn/prevent-abbreviations": [
"error",
{
"extendDefaultAllowList": true,
"allowList": {
"arg": true,
"i": true
},
"replacements": {
"props": false
}
}
]
},
"overrides": [
{
"files": ["src/background/**"],
"rules": {
"no-restricted-imports": [
"error",
{
"patterns": [
{
"group": ["**/content/**"],
"message": "Modules within /src/background can't import from /src/content"
}
]
}
]
}
},
{
"files": ["src/content/**"],
"rules": {
"no-restricted-imports": [
"error",
{
"patterns": [
{
"group": ["**/background/**"],
"message": "Modules within /src/content can't import from /src/background"
}
]
}
]
}
},
{
"files": ["src/common/**"],
"rules": {
"no-restricted-imports": [
"error",
{
"patterns": [
{
"group": ["**/background/**", "**/content/**"],
"message": "Modules within /src/content can't import from /src/background or /src/content"
}
]
}
]
}
}
]
}
10 changes: 5 additions & 5 deletions e2e/customHints.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ElementHandle, Frame } from "puppeteer";
import { type ElementHandle, type Frame } from "puppeteer";
import { getHintForElement } from "./utils/getHintForElement";
import {
rangoCommandWithTarget,
Expand All @@ -20,7 +20,7 @@ describe("Main frame", () => {
});

test("Extra hints are saved", async () => {
const hintable = await page.$("#custom-button")!;
const hintable = await page.$("#custom-button");
const hint = await hintable!.evaluate(getHintForElement);

await rangoCommandWithTarget("includeExtraSelectors", [hint]);
Expand Down Expand Up @@ -68,7 +68,7 @@ describe("iFrame", () => {
});

test("Extra hints are saved", async () => {
const hintable = await frame.$("#custom-button")!;
const hintable = await frame.$("#custom-button");
const hint = await hintable!.evaluate(getHintForElement);

await rangoCommandWithTarget("includeExtraSelectors", [hint]);
Expand Down Expand Up @@ -114,7 +114,7 @@ describe("Staging", () => {
});

test("Hints marked are removed after refreshing hints", async () => {
const hintable = await page.$("#custom-button")!;
const hintable = await page.$("#custom-button");
const hint = await hintable!.evaluate(getHintForElement);

await rangoCommandWithTarget("includeExtraSelectors", [hint]);
Expand All @@ -132,7 +132,7 @@ describe("Staging", () => {
});

test("Hints marked are removed after custom hints reset", async () => {
const hintable = await page.$("#custom-button")!;
const hintable = await page.$("#custom-button");
const hint = await hintable!.evaluate(getHintForElement);

await rangoCommandWithTarget("includeExtraSelectors", [hint]);
Expand Down
2 changes: 1 addition & 1 deletion e2e/keyboardClicking.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { keyTap } from "@hurdlegroup/robotjs";
import { Frame, Page } from "puppeteer";
import { type Frame, type Page } from "puppeteer";
import { rangoCommandWithoutTarget } from "./utils/rangoCommands";
import { sleep } from "./utils/testHelpers";

Expand Down
2 changes: 1 addition & 1 deletion e2e/noContentScript.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import clipboard from "clipboardy";
import { ResponseToTalon } from "../src/typings/RequestFromTalon";
import { type ResponseToTalon } from "../src/typings/RequestFromTalon";
import {
rangoCommandWithTarget,
rangoCommandWithoutTarget,
Expand Down
4 changes: 2 additions & 2 deletions e2e/scroll.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable max-nested-callbacks */
import { ElementHandle } from "puppeteer";
import { type ElementHandle } from "puppeteer";
import {
rangoCommandWithoutTarget,
rangoCommandWithTarget,
Expand Down Expand Up @@ -56,7 +56,7 @@ async function getActionableHint(containerSelector: string, top = true) {
if (visible) $$visible.push($node);
}

const $target = top ? $$visible[0] : $$visible[$$visible.length - 1];
const $target = top ? $$visible[0] : $$visible.at(-1);

return $target!.evaluate(getHintForElement);
}
Expand Down
4 changes: 2 additions & 2 deletions e2e/utils/testHelpers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export async function sleep(ms: number) {
return new Promise((r) => {
setTimeout(r, ms);
return new Promise((resolve) => {
setTimeout(resolve, ms);
});
}
2 changes: 1 addition & 1 deletion jest-puppeteer.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = {
product: "chrome",
executablePath: process.env.PUPPETEER_EXEC_PATH,
args: [
"no-sandbox",
"--no-sandbox",
`--disable-extensions-except=${EXTENSION_PATH}`,
`--load-extension=${EXTENSION_PATH}`,
],
Expand Down
Loading

0 comments on commit c6692dd

Please sign in to comment.