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

Poc/#130 - e2e testing implementation #132

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

alfdocimo
Copy link
Contributor

Initial implementation of e2e-testing functionality #130

What's new:

This PR introduces:

  • A new npm package cypress for e2e-testing automation
  • A new folder at root level named shared for all things that both the the web app and the tests use. For instance, selectors

Travel Infra-Page-4

The structure for testing is correctly approached as:

  • Layout: common elements shared among each route, such as Navbar, Footer, Volunteers FAQ (not yet implemented)
  • All other elements under integration should either be flows, like the donation flow, or a concrete route functionality such as /, /volunteer... etc.

Important things to consider:

If this needs to be added to the CI/CD process we would need to start the dev server with yarn develop and while that's started, run yarn cy:test. Optionally, we can always use contcurrently. Could really use your input here @jcooter as I'm sure you're more familiar than me with DevOps practices 😁

Looking forward to hearing your thoughts on this, as there's quite a bit of work to be done for this but it will definitely pay off!

@alfdocimo alfdocimo changed the title Poc/#130 Poc/#130 - e2e testing implementation Apr 26, 2020
Copy link
Member

@jcooter jcooter left a comment

Choose a reason for hiding this comment

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

I think this approach looks fine, and in terms of actually integrating this into our CI/CD workflow - we have a super basic workflow so I think we should be able to add cypress to our tests in GitHub.

Not approving because I want to defer to @gvan12 on some naming stuff, and also because the build preview didn't work for some reason I'm probably not going to have a chance to dig into today.

});

describe('[Make Masks] CTAs', () => {
const mapPatternRoutes = {
Copy link
Member

Choose a reason for hiding this comment

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

I believe the pattern pages should be defined via the CMS. I'm not immediately sure how this could be done, but it would be nice if the pattern tests would update automatically rather than being hard-coded.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, totally!

One option could be checking/getting the href and then asserting that it goes there, but if there's a way to get al the registered page templates in the cms that would be amazing

src/components/StyledElements/MoreDots.js Show resolved Hide resolved
@jcooter jcooter requested a review from gvan12 April 27, 2020 09:56
Copy link
Contributor

@gvan12 gvan12 left a comment

Choose a reason for hiding this comment

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

I'll look more deeply at this later today/tonight - great start on testing and thanks for the work!

getByTestId(landing.sections.afterSignUp.makeMasks[pattern])
).click();

// Adding this for testing on local; as opening /patterns/[xyz] causes the website to crash so the test fails
Copy link
Contributor

Choose a reason for hiding this comment

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

You may need to check out the how-to docs for integrating cypress with gatsby here: https://www.gatsbyjs.org/docs/end-to-end-testing/

It may make the test run when navigating to /patterns/[xyz] work correctly.

Copy link
Contributor Author

@alfdocimo alfdocimo Apr 30, 2020

Choose a reason for hiding this comment

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

I checked that out and added start-server-and-test and @testing-library/cypress which is amazing! this will make things easier for us when it comes to CI.

However - I still can't seem to make the patterns page to work locally... Is this just me? Am I missing some kind of configuration? 😭
image

@gvan12
Copy link
Contributor

gvan12 commented May 1, 2020

I get similar errors when trying to visit the donate page even on master locally. I think there's probably a package dep issue but haven't determined which yet.

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

Successfully merging this pull request may close these issues.

4 participants