Closed lauterry closed 5 years ago
Hi @lauterry,
We do intend on supporting Nightwatch.js but don't have an official SDK for this just yet.
In the meantime I've thrown together a quick way for you to use Percy for now. Please take a look at this pull request https://github.com/djones/nightwatch-example/pull/1 it integrates Percy into existing Nightwatch.js tests.
The core bit is this custom percySnapshot
command, which goes into commands/percySnapshot.js
module.exports.command = function(name, options) {
this
.injectScript('http://localhost:5338/percy-agent.js')
.pause(500)
.execute(
function(name, options) {
var percyAgentClient = new PercyAgent({
clientInfo: 'community-nightwatchjs/0.1.0',
});
percyAgentClient.snapshot(name, options);
}, [name, options]
);
return this;
};
When our official SDK is ready, I hope to be able to factor out the pause(500)
but for now this works.
Let me know if you have any questions and do report back if you pull this in and use it.
Cheers, David.
Hi @djones
I've tried to integrate your snippet in my code.
I cannot manage to take snapshots.
[percy] stopping percy...
[percy] waiting for 0 snapshots to complete...
[percy] done.
[percy] finalized build #65: https://percy.io/Perfectstay/La-Collection-Air-France/builds/1205811]
Here is my script :
"test:e2e": "PERCY_TOKEN=xxxxxxxx percy exec -- nightwatch -c test-e2e/conf/nightwatch.conf.local.js --group test-e2e/tests/$BRAND/ficheProduit/ficheProduitTest.js -e default",
Hi @lauterry,
Thanks for reporting back. We've actually almost shipped an early version of our official Nightwatch SDK.
It's waiting on a PR over here https://github.com/percy/percy-nightwatch/pull/1
If you're happy to wait a couple of days we can get you onto that.
Cheers, David.
Hi @lauterry,
Check it out 👉 https://github.com/percy/percy-nightwatch and here's the setup docs https://docs.percy.io/docs/nightwatch
Let us know if it works or you found a bug.
Cheers, David.
Hi @djones
Great !!
Can't wait to explore it !
Hi.
I'm using nightwatch.js to run e2e tests and I want to use Percy.io ?
How should I proceed ? Do I have to use the javascript low level API ?
I see you have an integration with nightmare.js : https://github.com/percy/example-percy-nightmare/blob/master/test/test.js
Do you intend to integrate with nightwatch.js ?
Best regards