Amphtml: Explore using Cypress

Created on 30 Aug 2018  路  5Comments  路  Source: ampproject/amphtml

Cypress seems like it would provide a lot of awesome integration testing support that we could benefit from in amp-story (and I'm sure others may as well). Can we explore this and see whether it's feasible and/or desirable to use for AMP?

/cc @danielrozenberg @gmajoulet

Feature Request infra

Most helpful comment

I looked briefly into Cypress and saw how it could be really helpful for e2e tests (faster runs, easier to write tests, interactive debugging, etc). The only downside that I could find is that it only works with Chrome, with cross browser support coming later - https://github.com/cypress-io/cypress/issues/310

I'll try to add a small Cypress test in in our Travis builds and see what happens!

All 5 comments

This investigation can be done as a part of what @esthkim will be working on.

How would this fit in with the interactive visual diff testing that @danielrozenberg added in #19114?

I looked briefly into Cypress and saw how it could be really helpful for e2e tests (faster runs, easier to write tests, interactive debugging, etc). The only downside that I could find is that it only works with Chrome, with cross browser support coming later - https://github.com/cypress-io/cypress/issues/310

I'll try to add a small Cypress test in in our Travis builds and see what happens!

Hey Jon, here's what I found when trying out Cypress:

  • I was unable to navigate to any test page, whether on localhost or external, using Chrome 71. Came across others having similar issues here and also here. Unfortunately, it pretty much blocked me from testing any further.
  • Cypress can't talk to x-origin iframes, which is a use case for amp-analytics, not sure for amp-story. The workaround is to use window.postMessage(), which is fine, but for e2e testing we want all interactions on the page to be done from the user's perspective rather than inside the codebase.

If it helps, we'll be implementing e2e testing with Selenium soon! Stay tuned.

Selenium testing sounds like it can work too! We just want some way to write e2e tests for stories 馃槃

Was this page helpful?
0 / 5 - 0 ratings