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

Add playwright smoke tests for storybook #5329

Merged
merged 51 commits into from
May 3, 2022

Conversation

dac09
Copy link
Collaborator

@dac09 dac09 commented Apr 25, 2022

Closes #5276

What does the PR do?

Adds playwright smoke tests, after launching storybook on the test project.

There are 3 tests:

  1. Cell mocks are loaded correctly
  2. Cell mocks are also loaded when nested in a page (blogpostpage)
  3. mockCurrentUser does what it says on the tin

And implicitly - that the storybook command, and server are working as expected

Video walk through

Img

(sorry for the bad audio)

@netlify
Copy link

netlify bot commented Apr 25, 2022

Deploy Preview for redwoodjs-docs canceled.

Name Link
🔨 Latest commit 859a6c3
🔍 Latest deploy log https://app.netlify.com/sites/redwoodjs-docs/deploys/62713bcbdceeed0008310024

@dac09 dac09 requested a review from virtuoushub April 25, 2022 09:16
@dac09 dac09 added the release:chore This PR is a chore (means nothing for users) label Apr 25, 2022
@virtuoushub
Copy link
Collaborator

virtuoushub commented Apr 25, 2022

Awesome start!

Couple of questions:

  • Do we want this to test the build as well as the dev server? I imagine the tasks/smoke-test/tests/storybook.spec.ts can be reused and we'd just want to modify/fork tasks/smoke-test/playwright-fixtures/storybook.fixture.ts to also do a build. I see value in both testing the dev server, and the built artifact.

  • What is the plan for the legacy test: https://github.com/redwoodjs/redwood/blob/main/tasks/e2e/cypress/integration/03-storybook/storybook.spec.js ? iirc, it is currently disabled; do we have plans on removing it altogether?

@dac09
Copy link
Collaborator Author

dac09 commented Apr 27, 2022

Do we want this to test the build as well as the dev server? I imagine the tasks/smoke-test/tests/storybook.spec.ts can be reused and we'd just want to modify/fork tasks/smoke-test/playwright-fixtures/storybook.fixture.ts to also do a build. I see value in both testing the dev server, and the built artifact.

Yeah good point - I think certainly something we can add a test for, but I don't think we have a clear picture on how to even deploy the storybook after a build at the moment. Very happy to start looking at this option, and once we have documentation and an understanding of how we think it should work, we can add a smoke test

What is the plan for the legacy test: https://github.com/redwoodjs/redwood/blob/main/tasks/e2e/cypress/integration/03-storybook/storybook.spec.js ? iirc, it is currently disabled; do we have plans on removing it altogether?

I'll remove it!

@dac09
Copy link
Collaborator Author

dac09 commented May 2, 2022

Ok @virtuoushub - so I've been trying super hard to get these smoke tests to pass on Linux and Windows - and it looks like our currently implementation of mockCurrentUser without the loader, can be flakey under CI/Codespaces. Under normal human use I think ti doesn't matter, because by the time we refresh the page the mocks become available, but when playwright is running the test, maybe its too fast for the mocks to load?

I suspect this has something to do with:
a) The distro
b) Memory availability since e2e tests are heavy

I tried merging in your code in #4919 and the tests seem to pass - which says to me that the loader implementation is more solid!

Shall we merge that in then and merge in these tests after? Or maybe i'll just pull in your changes to this branch?
I've merged your code into this branch

@virtuoushub
Copy link
Collaborator

... and it looks like our currently implementation of mockCurrentUser without the loader, can be flakey under CI/Codespaces.
...
I tried merging in your code in #4919 and the tests seem to pass - which says to me that the loader implementation is more solid!

Awesome! And yes, that PR is directly meant to address the some of the issues you noticed in CI/CD. Glad you are able to take advantage.

dac09 added 11 commits May 2, 2022 21:24
…ok-smoke-test

* 'main' of github.com:redwoodjs/redwood:
  Remove extra checkout in RC workflow (redwoodjs#5414)
  chore(deps): update dependency @azure/msal-browser to v2.24.0 (redwoodjs#5412)
  fix(deps): update react monorepo (redwoodjs#5406)
  cli upgrade: Always search from the start for semvers (redwoodjs#5368)
  codegen graphql schema (redwoodjs#5213)
  fix(deps): update dependency core-js to v3.22.4 (redwoodjs#5409)
  fix(deps): update typescript-eslint monorepo to v5.22.0 (redwoodjs#5410)
  Add graphql-scalars to graphql-server (redwoodjs#5408)
  Update yarn.lock
  v1.2.1
  fix(deps): update dependency cross-undici-fetch to v0.3.6 (redwoodjs#5402)
  fix(deps): update dependency cross-undici-fetch to v0.3.5 (redwoodjs#5398)
  fix(deps): update dependency cross-undici-fetch to v0.3.3 (redwoodjs#5378)
  chore(story📗): extract MSW logic into a loader (redwoodjs#4919)
…into feat/storybook-smoke-test

* 'feat/storybook-smoke-test' of github.com:dac09/redwood:
@dac09
Copy link
Collaborator Author

dac09 commented May 3, 2022

FINALLY. Tests passing on all platforms. Ready for final review.

Copy link
Collaborator

@virtuoushub virtuoushub left a comment

Choose a reason for hiding this comment

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

🙇🏻‍♂️

@dac09 dac09 enabled auto-merge (squash) May 3, 2022 14:27
@dac09 dac09 merged commit 4129692 into redwoodjs:main May 3, 2022
@jtoar jtoar added this to the next-release milestone May 3, 2022
@dac09 dac09 deleted the feat/storybook-smoke-test branch May 3, 2022 14:54
@jtoar jtoar modified the milestones: next-release, v1.4.0 May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:chore This PR is a chore (means nothing for users)
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Improve e2e coverage on storybook
3 participants