Skip to content

Commit

Permalink
feat: implement core feature (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
noriapi authored Jan 6, 2024
1 parent eea6f4b commit 27c7ca0
Show file tree
Hide file tree
Showing 17 changed files with 1,238 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ jobs:
- name: lint check
run: pnpm lint

- name: test
run: pnpm test

- name: test build (chrome)
run: pnpm build

Expand Down
30 changes: 30 additions & 0 deletions e2e/pages/popup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { type Locator, type Page } from "@playwright/test";

export class PopupPage {
readonly message: Locator;
readonly messageOwner: Locator;
readonly messageOwnerHide: Locator;
readonly messageOwnerShow: Locator;
readonly messageOwnerNohighlight: Locator;

constructor(
public readonly page: Page,
public readonly extensionId: string,
) {
this.message = this.page.getByRole("group", { name: "Message" });
this.messageOwner = this.message.getByRole("group", { name: "Owner" });
this.messageOwnerHide = this.messageOwner.getByRole("radio", {
name: "Hide",
});
this.messageOwnerShow = this.messageOwner.getByRole("radio", {
name: "Show",
});
this.messageOwnerNohighlight = this.messageOwner.getByRole("radio", {
name: "No highlight",
});
}

async goto() {
await this.page.goto(`chrome-extension://${this.extensionId}/popup.html`);
}
}
16 changes: 16 additions & 0 deletions e2e/popup.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { expect, test } from "./fixtures";
import { PopupPage } from "./pages/popup";

test("should persist config", async ({ page, extensionId }) => {
const popup = new PopupPage(page, extensionId);

await popup.goto();

await expect(popup.messageOwnerHide).toBeChecked({ checked: false });

await popup.messageOwnerHide.click();

await popup.page.reload();

await expect(popup.messageOwnerHide).toBeChecked({ checked: true });
});
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,18 @@
"lint:fix": "eslint --fix . && prettier --write src/**/*.{js,jsx,ts,tsx,html}",
"submit": "env-cmd -f .env.submit --silent -- tsx scripts/submit.ts",
"submit:firefox": "env-cmd -f .env.submit --silent -- tsx scripts/submit.ts -b firefox",
"test": "vitest",
"zip": "wxt zip",
"zip:firefox": "wxt zip -b firefox"
},
"dependencies": {
"io-ts": "^2.2.21",
"solid-js": "^1.8.8"
},
"devDependencies": {
"@commander-js/extra-typings": "^11.1.0",
"@eslint/eslintrc": "^3.0.0",
"@fast-check/vitest": "^0.0.9",
"@playwright/test": "^1.40.1",
"@types/node": "^20.10.6",
"@types/webextension-polyfill": "^0.10.7",
Expand All @@ -57,6 +60,7 @@
"typescript-plugin-css-modules": "^5.0.2",
"vite": "^5.0.11",
"vite-plugin-solid": "^2.8.0",
"vitest": "^1.1.1",
"wxt": "^0.13.3"
},
"packageManager": "[email protected]",
Expand Down
Loading

0 comments on commit 27c7ca0

Please sign in to comment.