Skip to content

Commit

Permalink
add more tests
Browse files Browse the repository at this point in the history
also fix font issues
  • Loading branch information
subhoghoshX committed Aug 9, 2024
1 parent c4858fc commit a4846ff
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/FocusMode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export default function FocusModeCard() {
}

return (
<Card className="lg:w-96 flex flex-col lg:h-1/2 h-80">
<Card className="lg:w-96 flex flex-col lg:h-1/2 h-80" id="focusmode">
<CardHeader>
<CardTitle className="text-lg flex items-center gap-3">
<HoverCard>
Expand Down
2 changes: 1 addition & 1 deletion src/newtab/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default function App() {
const [isDrawerOpen, setIsDrawerOpen] = useState(false);

return (
<main className="flex justify-center lg:items-center h-screen overflow-auto py-10 dark:bg-zinc-950 font-sans">
<main className="flex justify-center lg:items-center h-screen overflow-auto py-10 dark:bg-zinc-950">
<section className="flex gap-5 flex-col lg:flex-row h-fit">
<Card>
<CardHeader>
Expand Down
2 changes: 1 addition & 1 deletion src/newtab/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<link rel="stylesheet" href="../css/tailwind.css" />
<script type="text/javascript" src="./index.js"></script>
</head>
<body>
<body class="font-sans">
<div id="root"></div>
</body>
</html>
2 changes: 1 addition & 1 deletion src/redirect/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<link rel="stylesheet" href="../css/tailwind.css" />
<script type="text/javascript" src="./index.js"></script>
</head>
<body>
<body class="font-sans">
<div id="root"></div>
</body>
</html>
29 changes: 29 additions & 0 deletions tests/example.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,32 @@ test("Extension in New Tab page", async ({ page }) => {
],
});
});

test("Focus mode", async ({ page }) => {
await page.goto("chrome://newtab");
const fm = page.locator("#focusmode");
await expect(fm).toHaveScreenshot("focusmode.png");

await fm.locator("input").fill("www.youtube.com");
await page.keyboard.press("Enter");
await expect(fm).toHaveScreenshot("focusmode-blocklist-input-focused.png");

await fm.locator("li button").click();
await expect(fm).toHaveScreenshot("focusmode.png");

await fm.locator("input").fill("www.youtube.com");
await fm.getByText("Add").click();
await expect(fm).toHaveScreenshot("focusmode-blocklist-input-blurred.png");

await fm.getByRole("switch").click();
await page.goto("https://www.youtube.com");
await expect(page).toHaveScreenshot("redirect-page.png");
});

test("Drawer", async ({ page }) => {
await page.goto("https://example.com/");
await page.waitForTimeout(1000);
await page.goto("chrome://newtab");
page.getByRole("list").getByText("example.com").click();
await expect(page).toHaveScreenshot("drawer.png");
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a4846ff

Please sign in to comment.