adf0d17497
publish / version_or_publish (push) Has been cancelled
storybook-build / changes (push) Has been cancelled
storybook-build / :storybook-build (push) Has been cancelled
Sync Gradio Skills to Hugging Face / sync-skills (push) Has been cancelled
functional / changes (push) Has been cancelled
functional / build-frontend (push) Has been cancelled
functional / functional-test-SSR=false (push) Has been cancelled
functional / functional-reload (push) Has been cancelled
js / changes (push) Has been cancelled
js / js-test (push) Has been cancelled
docs-build / changes (push) Has been cancelled
docs-build / docs-build (push) Has been cancelled
docs-build / website-build (push) Has been cancelled
functional / functional-test-SSR=true (push) Has been cancelled
hygiene / hygiene-test (push) Has been cancelled
python / changes (push) Has been cancelled
python / build (push) Has been cancelled
python / test-ubuntu-latest-flaky (push) Has been cancelled
python / test-ubuntu-latest-not-flaky (push) Has been cancelled
python / test-windows-latest-flaky (push) Has been cancelled
python / test-windows-latest-not-flaky (push) Has been cancelled
63 lines
1.8 KiB
TypeScript
63 lines
1.8 KiB
TypeScript
import { test, expect } from "@self/tootils";
|
|
|
|
test("renders the correct elements", async ({ page }) => {
|
|
await expect(page.getByTestId("markdown")).toHaveCount(2);
|
|
});
|
|
|
|
test("applies the custom CSS styles", async ({ page }) => {
|
|
test.skip(process.env?.GRADIO_SSR_MODE?.toLowerCase() === "true");
|
|
// Test for CSSKeyframesRule
|
|
const animationName = await page
|
|
.locator(".cool-col")
|
|
.evaluate((node) => getComputedStyle(node).animationName);
|
|
expect(animationName).toBe("animation");
|
|
|
|
// Test for CSSMediaRule and CSSStyleRule
|
|
await page.setViewportSize({ width: 500, height: 720 });
|
|
await expect(page.locator(".markdown").nth(1)).toHaveCSS(
|
|
"background-color",
|
|
"rgb(0, 0, 255)"
|
|
);
|
|
await expect(page.locator(".markdown p")).toHaveCSS(
|
|
"color",
|
|
"rgb(173, 216, 230)"
|
|
);
|
|
|
|
await page.setViewportSize({ width: 1280, height: 720 });
|
|
await expect(page.locator(".markdown").nth(1)).toHaveCSS(
|
|
"background-color",
|
|
"rgb(173, 216, 230)"
|
|
);
|
|
await expect(page.locator(".markdown p")).toHaveCSS(
|
|
"color",
|
|
"rgb(65, 105, 225)"
|
|
);
|
|
});
|
|
|
|
test("applies the custom font family", async ({ page }) => {
|
|
await expect(
|
|
page.getByRole("heading", { name: "Gradio Demo with Custom CSS" })
|
|
).toHaveCSS("font-family", "test-font");
|
|
});
|
|
|
|
test("applies resources from the @import rule", async ({ page }) => {
|
|
await expect(page.getByText("Resize the browser window to")).toHaveCSS(
|
|
"font-family",
|
|
'"Protest Riot", sans-serif'
|
|
);
|
|
});
|
|
|
|
test(".dark styles are applied corrently", async ({ page }) => {
|
|
await page.goto(`${page.url()}?__theme=dark`);
|
|
await page.waitForTimeout(500);
|
|
|
|
await expect(page.locator(".markdown").nth(1)).toHaveCSS(
|
|
"background-color",
|
|
"rgb(255, 192, 203)"
|
|
);
|
|
await expect(page.locator(".darktest h3")).toHaveCSS(
|
|
"color",
|
|
"rgb(255, 255, 0)"
|
|
);
|
|
});
|