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

Setup Cypress #1845

Merged
merged 28 commits into from
Jul 11, 2021
Merged

Setup Cypress #1845

merged 28 commits into from
Jul 11, 2021

Conversation

hasparus
Copy link
Member

@hasparus hasparus commented Jun 25, 2021

This should help test SSR on our docs and examples.

📦 Published PR as canary version: 0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0

✨ Test out this PR locally via:

npm install @theme-ui/color-modes@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
npm install @theme-ui/color@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
npm install @theme-ui/components@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
npm install @theme-ui/core@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
npm install @theme-ui/css@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
npm install @theme-ui/custom-properties@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
npm install @theme-ui/editor@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
npm install gatsby-plugin-theme-ui@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
npm install gatsby-theme-style-guide@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
npm install gatsby-theme-ui-layout@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
npm install @theme-ui/match-media@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
npm install @theme-ui/mdx@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
npm install @theme-ui/parse-props@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
npm install @theme-ui/preset-base@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
npm install @theme-ui/preset-bootstrap@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
npm install @theme-ui/preset-bulma@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
npm install @theme-ui/preset-dark@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
npm install @theme-ui/preset-deep@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
npm install @theme-ui/preset-funk@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
npm install @theme-ui/preset-future@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
npm install @theme-ui/preset-polaris@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
npm install @theme-ui/preset-roboto@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
npm install @theme-ui/preset-sketchy@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
npm install @theme-ui/preset-swiss@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
npm install @theme-ui/preset-system@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
npm install @theme-ui/preset-tailwind@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
npm install @theme-ui/preset-tosh@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
npm install @theme-ui/presets@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
npm install @theme-ui/prism@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
npm install @theme-ui/sidenav@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
npm install @theme-ui/style-guide@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
npm install @theme-ui/tachyons@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
npm install @theme-ui/tailwind@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
npm install @theme-ui/theme-provider@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
npm install theme-ui@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
npm install @theme-ui/typography@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
# or 
yarn add @theme-ui/color-modes@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
yarn add @theme-ui/color@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
yarn add @theme-ui/components@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
yarn add @theme-ui/core@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
yarn add @theme-ui/css@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
yarn add @theme-ui/custom-properties@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
yarn add @theme-ui/editor@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
yarn add gatsby-plugin-theme-ui@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
yarn add gatsby-theme-style-guide@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
yarn add gatsby-theme-ui-layout@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
yarn add @theme-ui/match-media@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
yarn add @theme-ui/mdx@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
yarn add @theme-ui/parse-props@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
yarn add @theme-ui/preset-base@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
yarn add @theme-ui/preset-bootstrap@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
yarn add @theme-ui/preset-bulma@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
yarn add @theme-ui/preset-dark@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
yarn add @theme-ui/preset-deep@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
yarn add @theme-ui/preset-funk@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
yarn add @theme-ui/preset-future@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
yarn add @theme-ui/preset-polaris@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
yarn add @theme-ui/preset-roboto@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
yarn add @theme-ui/preset-sketchy@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
yarn add @theme-ui/preset-swiss@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
yarn add @theme-ui/preset-system@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
yarn add @theme-ui/preset-tailwind@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
yarn add @theme-ui/preset-tosh@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
yarn add @theme-ui/presets@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
yarn add @theme-ui/prism@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
yarn add @theme-ui/sidenav@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
yarn add @theme-ui/style-guide@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
yarn add @theme-ui/tachyons@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
yarn add @theme-ui/tailwind@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
yarn add @theme-ui/theme-provider@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
yarn add theme-ui@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0
yarn add @theme-ui/typography@0.10.1-canary.1845.ed74e01f156bfe1c735f5e9a33c64ba4d4faeaf7.0

@hasparus hasparus requested a review from lachlanjc as a code owner June 25, 2021 11:09
@vercel
Copy link

vercel bot commented Jun 25, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/systemui/theme-ui/ExGi8hrJgHBZnuMgCQaXJY8xNhky
✅ Preview: https://theme-ui-git-ci-cypress-systemui.vercel.app

@hasparus
Copy link
Member Author

Hey @fcisio, @flo-sch, would you have a second to take a look at this? The CI currently being red is just canary release running into 503, so I think it's more or less ready to merge.

The gist of the change here is that

Percy is free until 5k screenshots per month with unlimited users (check Discord DMs), and 100 bucks for month after that. I doubt we'll reach the quota soon, as I mostly wanted it to test SSR / localStorage interactions to avoid bugs on color modes.

steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v1
Copy link
Collaborator

Choose a reason for hiding this comment

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

we could consider v2 for that one perhaps?
https://github.com/actions/setup-node/releases/tag/v2.2.0

@flo-sch
Copy link
Collaborator

flo-sch commented Jul 2, 2021

Looks good on the Percy admin, however I am unable to run those locally
I cannot get the docs server to start it seems, not sure if I am missing something?
--> Then obviously the e2e tests are not passing

$ yarn workspace docs serve

$ gatsby serve

You can now view docs in the browser.

http://localhost:9000/

ERROR

Error: ENOENT: no such file or directory, stat '/[...]/theme-ui/packages/docs/public/404.html'

When I try to build it:

$ yarn workspace docs build

// ...
success Building production JavaScript and CSS bundles - 15.747s
ERROR #98123 WEBPACK
Generating SSR bundle failed
Unexpected token (7:9)
File: ../editor/src/index.ts:7:9
not finished Building HTML renderer - 7.512s
error Command failed with exit code 1.

If possible, perhaps add a small README file with instructions how to run those (if at all possible and what token is potentially needed?)

Also perhaps worth adding a gitignore with:

  • packages/e2e/screenshots
  • packages/e2e/videos

(Looks like when the tests fail such folders are versioned)

Copy link
Collaborator

@flo-sch flo-sch left a comment

Choose a reason for hiding this comment

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

LGTM per say (the diff) but cannot run the tests locally, added a comment on the conversation

</a>
<a href="https://discord.gg/theme-ui">
<img
src="https://img.shields.io/discord/778553042466635786?color=%237289da&logo=discord"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure if it would really help with the tests, but badgen has an alernative showing the number of members (not just online) that potentially change less often?
https://badgen.net/discord/members/theme-ui

Copy link
Member Author

Choose a reason for hiding this comment

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

I removed all of these badges in Cypress test anyway — version numbers change, CI status changes — all the badges are effectively dynamic.

@lachlanjc
Copy link
Member

I don't have strong opinions here, but since color mode regression bugs are easy to cause & hard to detect, this seems great

@hasparus
Copy link
Member Author

hasparus commented Jul 11, 2021

Looks good on the Percy admin, however I am unable to run those locally
I cannot get the docs server to start it seems, not sure if I am missing something?
--> Then obviously the e2e tests are not passing

$ yarn workspace docs serve

$ gatsby serve

You can now view docs in the browser.

http://localhost:9000/
ERROR
Error: ENOENT: no such file or directory, stat '/[...]/theme-ui/packages/docs/public/404.html'

When I try to build it:

$ yarn workspace docs build

// ...
success Building production JavaScript and CSS bundles - 15.747s
ERROR #98123 WEBPACK
Generating SSR bundle failed
Unexpected token (7:9)
File: ../editor/src/index.ts:7:9
not finished Building HTML renderer - 7.512s
error Command failed with exit code 1.

That unexpected token seems to be * in export *.
Have you tried running yarn workspace docs clean, @flo-sch?

@hasparus hasparus merged commit 074ff25 into develop Jul 11, 2021
@hasparus hasparus deleted the ci/cypress branch July 11, 2021 06:03
@hasparus hasparus added internal Changes only affect the internal API skip-release Preserve the current version when merged labels Jul 11, 2021
@hasparus hasparus added the prerelease This change is available in a prerelease. label Jul 19, 2021
@hasparus
Copy link
Member Author

🚀 PR was released in v0.11.0 🚀

@hasparus hasparus added released This issue/pull request has been released. and removed prerelease This change is available in a prerelease. labels Aug 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal Changes only affect the internal API released This issue/pull request has been released. skip-release Preserve the current version when merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants