percy / percy-cypress

Visual testing with Cypress and Percy
https://percy.io
MIT License
346 stars 40 forks source link

Using Cypress module api [question] #41

Closed filiphric closed 5 years ago

filiphric commented 5 years ago

Percy tutorial shows that running Percy requires wrapping cypress run command in percy exec command.

I am however using module api to run my Cypress tests. Is there any way to use Percy with this method of running Cypress?

Robdel12 commented 5 years ago

Hey Filip!

How do you run your tests in your application? Looking at this Cypress example of the test module API it seems you can wrap the mocha command with percy exec. So this line: https://github.com/cypress-io/cypress-test-module-api/blob/master/package.json#L8 would become

"test": "percy exec -- mocha --timeout 20000 test/spec.js",

Hopefully this helps!

Robdel12 commented 5 years ago

Going to close this out, if you have any other questions feel free to drop some more comments 😃

pascalism commented 3 years ago

@filiphric did you find a workaround for this? I am just running into the same problem. 😿

Robdel12 commented 3 years ago

It's not possible yet (look out for this SDK to be upgraded: https://docs.percy.io/docs/migrating-to-percy-cli#current-migration-status)

Once this SDK uses the new SDK tool chain (@percy/cli and friends) this will be possible with @percy/core. For example this is how Google AMP uses core: https://github.com/ampproject/amphtml/blob/4e459d08acbe04528ffefe1a63665edf3a867470/build-system/tasks/visual-diff/index.js#L164-L175

filiphric commented 3 years ago

@pascalism I run percy & cypress with module API like this: percy exec -- cypress.js where cypress.js is the name of the module file