From 7f049b7d99bbc4557853736c4fb9368b5951f30c Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Wed, 10 Mar 2021 09:01:02 -0500 Subject: [PATCH] test Flaws dashboard in CI (#3181) --- .github/workflows/developing.yml | 22 +++++++------- client/src/writers-homepage/index.tsx | 2 +- testing/tests/developing.test.js | 42 +++++++++++++++++---------- 3 files changed, 38 insertions(+), 28 deletions(-) diff --git a/.github/workflows/developing.yml b/.github/workflows/developing.yml index 5b3685d352cb..d3ffdfb494e5 100644 --- a/.github/workflows/developing.yml +++ b/.github/workflows/developing.yml @@ -76,15 +76,13 @@ jobs: # of the yarn installs above PUPPETEER_EXECUTABLE_PATH: /usr/bin/google-chrome run: | - status=0 - yarn test:testing developing || ( - status=$? - echo "Testing failed! Going to dump stdout and stderr" - echo "STDOUT..................................................." - cat /tmp/stdout.log - echo "STDERR..................................................." - cat /tmp/stderr.log - echo $status - exit $status - ) - exit $status + yarn test:testing developing + + - name: Debug server's stdout and stderr if tests failed + if: failure() + run: | + echo "STDOUT..................................................." + cat /tmp/stdout.log + echo "" + echo "STDERR..................................................." + cat /tmp/stderr.log diff --git a/client/src/writers-homepage/index.tsx b/client/src/writers-homepage/index.tsx index 5cebb400b0f8..8895645b4a46 100644 --- a/client/src/writers-homepage/index.tsx +++ b/client/src/writers-homepage/index.tsx @@ -14,7 +14,7 @@ export default function WritersHomepage() { return (
-

Welcome to MDN

+

Writer's home page

diff --git a/testing/tests/developing.test.js b/testing/tests/developing.test.js index 72cd52107edf..26935174ef98 100644 --- a/testing/tests/developing.test.js +++ b/testing/tests/developing.test.js @@ -26,23 +26,21 @@ const SKIP_DEV_URL = JSON.parse(process.env.DEVELOPING_SKIP_DEV_URL || "false"); // all `**/*.test.js` it doesn't actually run these tests unless explicitly // prepared to do so. // The source of this idea comes from https://github.com/facebook/jest/issues/7245 -const withDeveloping = JSON.parse(process.env.TESTING_DEVELOPING || "false") - ? it - : it.skip; +const isTesting = JSON.parse(process.env.TESTING_DEVELOPING || "false"); +const withDeveloping = isTesting ? it : it.skip; +// If the test suite runs in a way that there's no separate dev server, +// don't bother using the `DEV_BASE_URL`. +// For example, when it tests the `npm pack` tarball, it's starting only +// the one server (on `localhost:5000`) that suite will set the `DEV_BASE_URL` +// to be the same as `SAME_BASE_URL`. +// In conclusion, if there's only 1 base URL to test again; don't test both. +const withCrud = isTesting && !SKIP_DEV_URL ? it : it.skip; describe("Testing the kitchensink page", () => { - withDeveloping("open the page", async () => { - // If the test suite runs in a way that there's no separate dev server, - // don't bother using the `DEV_BASE_URL`. - // For example, when it tests the `npm pack` tarball, it's starting only - // the one server (on `localhost:5000`) that suite will set the `DEV_BASE_URL` - // to be the same as `SAME_BASE_URL`. - // In conclusion, if there's only 1 base URL to test again; don't test both. - if (!SKIP_DEV_URL) { - await page.goto(devURL("/en-US/docs/MDN/Kitchensink")); - await expect(page).toMatch("The MDN Content Kitchensink"); - await expect(page).toMatch("No known flaws at the moment"); - } + withCrud("open the page", async () => { + await page.goto(devURL("/en-US/docs/MDN/Kitchensink")); + await expect(page).toMatch("The MDN Content Kitchensink"); + await expect(page).toMatch("No known flaws at the moment"); }); withDeveloping("server-side render HTML", async () => { @@ -176,3 +174,17 @@ describe("Testing the Express server", () => { expect(response.headers.location).toBe("/sv-SE/"); }); }); + +describe("Testing the CRUD apps", () => { + withCrud("open the writer's home page", async () => { + await page.goto(devURL("/")); + await expect(page).toMatch("Writer's home page"); + await expect(page).toMatchElement("a", { text: "Flaws Dashboard" }); + }); + + withCrud("open the Flaws Dashboard", async () => { + await page.goto(devURL("/")); + await expect(page).toClick("a", { text: "Flaws Dashboard" }); + await expect(page).toMatch("Documents with flaws found (0)"); + }); +});