Skip to content

Commit

Permalink
add some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinsung committed Jun 27, 2024
1 parent 05b5486 commit 6d7bc4e
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/js/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,19 @@ test.describe("top nav bar", () => {
await expect(pageToC).toHaveScreenshot();
});

test("uses custom page ToC icon on tablet dark mode cycle", async ({ page }) => {
await setTablet(page);
await page.goto("sphinx_guide/lists.html");
const pageToC = page.locator("div.content-icon-container");
await expect(pageToC).toHaveScreenshot();
await click(page, "div.theme-toggle-content button");
await expect(pageToC).toHaveScreenshot();
await click(page, "div.theme-toggle-content button");
await expect(pageToC).toHaveScreenshot();
await click(page, "div.theme-toggle-content button");
await expect(pageToC).toHaveScreenshot();
});

test("uses custom icons on mobile", async ({ page }) => {
await setMobile(page);
await page.goto("sphinx_guide/lists.html");
Expand Down Expand Up @@ -80,6 +93,13 @@ test.describe("api docs", () => {
await expect(content).toHaveScreenshot();
});

test("class page dark mode", async ({ page }) => {
await page.goto("stubs/api_example.Electron.html");
await click(page, "div.theme-toggle-content button");
const content = page.locator("div.article-container");
await expect(content).toHaveScreenshot();
});

test("function page", async ({ page }) => {
await page.goto("stubs/api_example.my_function1.html");
const content = page.locator("div.article-container");
Expand Down Expand Up @@ -146,6 +166,22 @@ test("custom directives", async ({ page }) => {
await expect(callToActions).toHaveScreenshot();
});

test("custom directives dark mode", async ({ page }) => {
await page.goto("sphinx_guide/custom_directives.html");
await click(page, "div.theme-toggle-content button");

const cards = page.locator("section#qiskit-card");
await cards.hover();
await expect(cards).toHaveScreenshot();

const callToActions = page.locator("section#qiskit-call-to-action-item");
await expect(callToActions).toHaveScreenshot();

await setMobile(page);
await expect(cards).toHaveScreenshot();
await expect(callToActions).toHaveScreenshot();
});

test("inline table of contents have correct fonts", async ({ page }) => {
await page.goto("");
const contents = page.locator("section#example-docs");
Expand Down
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.
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 6d7bc4e

Please sign in to comment.