Skip to content

Commit

Permalink
test(server): remove chromium testing (#1651)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs authored Sep 7, 2023
1 parent c58951b commit 06ac2f8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ jobs:
run: npm ci --ignore-scripts

- name: Install Playwright
run: npx playwright install --with-deps chromium firefox
run: npx playwright install --with-deps firefox

- name: Run macOS tests
if: matrix.os == 'macos-latest'
Expand Down
52 changes: 22 additions & 30 deletions src/server.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const { readFile } = require("node:fs/promises");
const Fastify = require("fastify");
const isHtml = require("is-html");
const { chromium, firefox } = require("playwright");
const { firefox } = require("playwright");
const startServer = require("./server");
const getConfig = require("./config");

Expand Down Expand Up @@ -1070,36 +1070,28 @@ describe("Server deployment", () => {
});

describe("Frontend", () => {
// Webkit not tested as it is flakey in context of Playwright
// TODO: use `it.concurrent.each()` once it is no longer experimental
it.each([
{ browser: chromium, name: "Chromium" },
{ browser: firefox, name: "Firefox" },
])(
"Renders docs page without error components - $name",
async ({ browser }) => {
const browserType = await browser.launch();
const page = await browserType.newPage();

await page.goto("http://localhost:3000/docs");
await expect(page.title()).resolves.toBe(
"Docsmith | Documentation"
);
/**
* Checks redoc has not rendered an error component.
* @see {@link https://github.com/Redocly/redoc/blob/main/src/components/ErrorBoundary.tsx | Redoc ErrorBoundary component}
*/
const heading = page.locator("h1 >> nth=0");
await heading.waitFor();

await expect(heading.textContent()).resolves.not.toMatch(
/something\s*went\s*wrong/iu
);
it("Renders docs page without error components", async () => {
const browserType = await firefox.launch();
const page = await browserType.newPage();

await page.close();
await browserType.close();
}
);
await page.goto("http://localhost:3000/docs");
await expect(page.title()).resolves.toBe(
"Docsmith | Documentation"
);
/**
* Checks redoc has not rendered an error component.
* @see {@link https://github.com/Redocly/redoc/blob/main/src/components/ErrorBoundary.tsx | Redoc ErrorBoundary component}
*/
const heading = page.locator("h1 >> nth=0");
await heading.waitFor();

await expect(heading.textContent()).resolves.not.toMatch(
/something\s*went\s*wrong/iu
);

await page.close();
await browserType.close();
});
});
});

Expand Down

0 comments on commit 06ac2f8

Please sign in to comment.