Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test Flaws dashboard in CI #3181

Merged
merged 1 commit into from
Mar 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions .github/workflows/developing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💜

run: |
echo "STDOUT..................................................."
cat /tmp/stdout.log
echo ""
echo "STDERR..................................................."
cat /tmp/stderr.log
2 changes: 1 addition & 1 deletion client/src/writers-homepage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default function WritersHomepage() {
return (
<PageContentContainer>
<div id="writers-homepage">
<h2>Welcome to MDN</h2>
<h2>Writer's home page</h2>

<Search />

Expand Down
42 changes: 27 additions & 15 deletions testing/tests/developing.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down Expand Up @@ -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)");
});
});