-
Notifications
You must be signed in to change notification settings - Fork 42
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
Trying to run Percy icm Cypress #138
Comments
Tried multiple environments with the same result When running the following $ npx percy exec -- cypress run Linux environment (Ubuntu 18.04)
Windows environment (Win 10)
both same result |
Hey Patrick! I'm going to look to try and reproduce this today. I can't reproduce it on my local machine but I'll try on my windows machine a little later today. It looks like from that output the release might have been botched. Could you try It looks like ubuntu gets further, even if it's spitting out a bunch of error goop at the beginning.
That usually means you're hitting this issue: #104 |
Hi @Robdel12, When running the command npx @percy/agent -- cypress run I get the following Did you mean exec? [y/n]: y hit enter
tested above on windows. |
Ahhh so sorry about my typo! I meant |
Hm, I can't replicate on my Windows machine either. Would you be able to tell me what version of NPM you're using? Typically when we see that kind of error its either a old NPM version (oclif/oclif#198) or an improperly built package (which I'd hope would impact everyone and not just a few 😱) Though, it can't be the NPM version either since you're able to use npx?? Hmm, I'm not sure what's going on here to be honest. |
@Robdel12 thanks for getting back to me on this matter. I guess my node.js was the latest version. That being said i did the tests on my workstation at the office. I Will do a test today also at my homestation and check out if im having the same issues. Will comeback with my findings later today. |
{stdout: "", stderr: "/c/Program: Files\Git\usr\bin\bash.exe: No such file or directory", code: 127} Is this something that can be fixed from my side or is this related too some library used by Cypress / Percy that needs to be fixed and what issue to follow #104 to keep track for an fix? |
It's a Cypress/execa bug where it can't find an installed version of You could try symlinking the Though, as I read that error message over and over again, it seems like it's a different error. It almost seems like execa isn't spawning the command correctly on Windows. This issue is interesting when googling the error that's spit out: yarnpkg/yarn#5717 |
This will fix #104 (and hopefully #138). `cy.task` will always execute within the version of node that is bundled with Cypress, so we no longer have to worry about `$PATH` issues that `cy.exec` faces. We're also no longer running a CLI command for the health check, this new implementation will make a HTTP request from node. This does mean we need to update the docs to let users know there's an extra step to configure the SDK properly now. In an ideal world we would be able to `.catch` on `cy.request` and disable Percy after the first failed `POST` of the DOM. I think in the future we should look into working with Cypress to implement this so we can shrink the integration, make the SDK more reliable, and faster (since we won't make 2 network requests per-snapshot).
…HANGE) (#140) BREAKING CHANGE: ## The problem In all of the Percy SDKs we do a thing called a "heath check", which makes sure the Percy agent server is open and ready to accept the DOM we're going to `POST` to it. If the health check fails, we will disable Percy in the SDK so we're not failing your tests due to Percy not running. In the Cypress SDK, this was implemented in an interesting way due a limitation with `cy.request`. The TL:DR of that is we can't `.catch` a failed request, so we needed to use `cy.exec` to health check & gracefully fall out. You can read a little more about that limitation here: cypress-io/cypress#3161 `cy.exec` has it's own issues, which are outlined here: #104 This is a major blocker for _a lot_ of customers. ## What is this? This will fix #104 (and hopefully #138). `cy.task` will always execute within the version of node that is bundled with Cypress, so we no longer have to worry about `$PATH` issues that `cy.exec` faces. We're also no longer running a CLI command for the health check, this new implementation will make a HTTP request from node. This does mean we need to update the docs to let users know there's an extra step to configure the SDK properly now. ### Upgrading to v2.x With this change, you will now need to import this new task into your projects plugins (`cypress/plugins/index.js`) file. Without that, the SDK will not work at all. ```js /// In cypress/plugins/index.js let percyHealthCheck = require('@percy/cypress/task') module.exports = (on, config) => { // `on` is used to hook into various events Cypress emits // `config` is the resolved Cypress config // Make it possible to log things to stdout by calling 'cy.task('log', 'some message to log'). // Useful for development and debugging. on("task", { log(message) { console.log(message); return null; } }); on("task", percyHealthCheck); }; ``` ## In the future In an ideal world we would be able to `.catch` on `cy.request` and disable Percy after the first failed `POST` of the DOM. I think in the future we should look into working with Cypress to implement this so we can shrink the integration, make the SDK more reliable, and faster (since we won't make 2 network requests per-snapshot). ## FAQ #### Why can't you use `fetch` over `cy.request` & `.catch` that? We need to use `cy.request` since those requests aren't actually executed in the browser and avoid any CORS issues. ## TODOs - [x] Update Docs - [x] How can I guarantee semantic release makes this a major version bump - [x] How does one integrate this task into their suite? It's not a default export.. And it runs in node. Maybe it can be apart of the default export
# [2.0.0](v1.0.9...v2.0.0) (2019-08-02) ### Bug Fixes * Use `cy.task` for health check rather than `cy.exec` (BREAKING CHANGE) ([#140](#140)) ([40550f7](40550f7)), closes [#104](#104) [#104](#104) [#138](#138) ### BREAKING CHANGES * ## The problem In all of the Percy SDKs we do a thing called a "heath check", which makes sure the Percy agent server is open and ready to accept the DOM we're going to `POST` to it. If the health check fails, we will disable Percy in the SDK so we're not failing your tests due to Percy not running. In the Cypress SDK, this was implemented in an interesting way due a limitation with `cy.request`. The TL:DR of that is we can't `.catch` a failed request, so we needed to use `cy.exec` to health check & gracefully fall out. You can read a little more about that limitation here: cypress-io/cypress#3161
Hey @pgroot91 can you give v2.x of the SDK a try? https://github.com/percy/percy-cypress/releases/tag/v2.0.0 Very curious to hear if this clears your issues up! |
In the runner and console i'm having the following error:
Running eg like $(npm bin)/cypress run, $(npm bin)/cypress open and npx @percy/agent exec -- cypress run |
Hey @pgroot91, Looks like you haven't added the new task that v2 needs. Make sure you follow the "Upgrading" section in the release: https://github.com/percy/percy-cypress/releases/tag/v2.0.0 I'll post it here too, for completeness. With v2, you will now need to import this new task into your projects plugins (cypress/plugins/index.js) file. Without that, the SDK will not work. /// In cypress/plugins/index.js
let percyHealthCheck = require('@percy/cypress/task')
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
on("task", percyHealthCheck);
}; |
Something funky is going on then. Is it possible to push up a reproduction project? I want to try and isolate what the issue is (your system vs the project). If I can reproduce with the project that'll be good. If not, we probably should jump onto a call and debug what's going on with your system. |
@Robdel12 Managed to get it working with Windows cmd. So its related somehow to git bash 🤔 Anyway want to thank you for your patience with me and the great support! 👍 Will close this thread and will demo this soon to the dev team and finally start using Percy. |
Hey @pgroot91 happy to hear that! I'm going to keep an eye out for git bash issues 🤔 Pretty curious as to what's going on there. Feel free to reach out with any other questions / issues, we'd love to help! |
Hi Guys,
I thought lets see if i could make Percy to work icm Cypress on my local machine. I have unfortunately some trouble with setting it up and run a cypress project.
I'm running the following command
$ DEBUG=* $(npm bin)/percy exec -- cypress run
Anyone has a clue on how to fix this?
Regards,
Patrick
The text was updated successfully, but these errors were encountered: