Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

test(STADTPULS-622): add basic Cypress testing #261

Merged
merged 24 commits into from Jan 24, 2022

Conversation

dnsos
Copy link
Contributor

@dnsos dnsos commented Jan 18, 2022

This PR adds Cypress for integration testing. This includes the configuration of TypeScript and ESLint to work with Cypress.

Some basic test stubs were added as examples.


This article may be a good resource to start with testing canvas elements for our maps. EDIT: The article suggests using cypress-plugin-snapshots which may be an unmaintained project.

@vercel
Copy link

vercel bot commented Jan 18, 2022

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/technologiestiftung/stadtpuls-frontend/5DAcRA7fHBHyMorxgXYrndUEqwgt
✅ Preview: https://stadtpuls-frontend-git-test-stadtpu-3cee09-technologiestiftung1.vercel.app

@ff6347
Copy link
Member

ff6347 commented Jan 19, 2022

Awesome. Love it. Is it mandatory that the cypress files are called _spec? I would vote for .test as well. What do you think?

@dnsos dnsos temporarily deployed to remote-development January 19, 2022 12:28 Inactive
@dnsos
Copy link
Contributor Author

dnsos commented Jan 19, 2022

Is it mandatory that the cypress files are called _spec? I would vote for .test as well

Thanks for the feedback and good idea, @ff6347. _spec is the Cypress default but it's absolutely possible to use something else. I renamed the files in 55e3480.

@ff6347
Copy link
Member

ff6347 commented Jan 19, 2022

You need to make sure jest ignores the cypress folder

@dnsos
Copy link
Contributor Author

dnsos commented Jan 19, 2022

You need to make sure jest ignores the cypress folder

Yep, Jest already doesn't care about it

@dnsos dnsos marked this pull request as ready for review January 19, 2022 12:57
@dnsos dnsos requested a review from vogelino as a code owner January 19, 2022 12:57
@dnsos dnsos temporarily deployed to remote-development January 24, 2022 09:03 Inactive
Trying to avoid to build steps
@dnsos dnsos temporarily deployed to remote-development January 24, 2022 10:13 Inactive
We don't need this build because we later  build the project anyway via cypress-io/github-action@v2, in preparation for the integration tests. Should that build fail, we have a failing CI run as well.
@dnsos dnsos temporarily deployed to remote-development January 24, 2022 10:23 Inactive
@dnsos dnsos temporarily deployed to remote-development January 24, 2022 10:23 Inactive
@dnsos
Copy link
Contributor Author

dnsos commented Jan 24, 2022

@ff6347, I added the Cypress tests to a main.yml workflow. I also did some refactoring to shorten the duration of this workflow by only using one build step instead of two. Let me know if you have advice for shortening the workflow even more.

I also suspect that soon we'll have integration tests that need a lot of time, specifically the ones that access pages with long loading times such as /sensors or /accounts.

@dnsos dnsos requested review from vogelino and ff6347 January 24, 2022 10:39
.github/workflows/main.yml Outdated Show resolved Hide resolved
@dnsos dnsos temporarily deployed to remote-development January 24, 2022 10:45 Inactive
Copy link
Member

@ff6347 ff6347 left a comment

Choose a reason for hiding this comment

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

Great addition @dnsos

@dnsos dnsos merged commit 820e5b7 into staging Jan 24, 2022
@dnsos dnsos deleted the test/STADTPULS-622-add-cypress-testing branch January 24, 2022 10:54
@ff6347
Copy link
Member

ff6347 commented Jan 24, 2022 via email

Copy link
Contributor

@vogelino vogelino left a comment

Choose a reason for hiding this comment

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

Great additions indeed! Well done!

@tsboter
Copy link

tsboter commented Mar 29, 2022

🎉 This PR is included in version 1.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants