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

cypress: init at 3.1.5 #56387

Closed
wants to merge 1 commit into from
Closed

cypress: init at 3.1.5 #56387

wants to merge 1 commit into from

Conversation

@acyuta108
Copy link

acyuta108 commented Feb 25, 2019

Motivation for this change

Missing package.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@nixos-discourse

This comment has been minimized.

Copy link

nixos-discourse commented Feb 28, 2019

This pull request has been mentioned on Nix community. There might be relevant details there:

https://discourse.nixos.org/t/cypress-ui-testing-issue/2208/3

@aanderse

This comment has been minimized.

Copy link
Contributor

aanderse commented Mar 25, 2019

@acyuta108 Do you have interest in adapting the code from @erosennin as described in the discourse discussion? I think it would be great to get cypress packaged for NixOS.

@acyuta108

This comment has been minimized.

Copy link
Author

acyuta108 commented Mar 26, 2019

@aanderse

This comment has been minimized.

Copy link
Contributor

aanderse commented Mar 27, 2019

@acyuta108 That sounds great.

@acyuta108

This comment has been minimized.

Copy link
Author

acyuta108 commented Mar 27, 2019

Rebased and upgraded to latest version of Cypress (3.2.0)

#58423

Thanks for your help @thorstenweber83, @erosennin and @aanderse

@acyuta108 acyuta108 closed this Mar 27, 2019
@aanderse

This comment has been minimized.

Copy link
Contributor

aanderse commented Mar 27, 2019

@acyuta108 I misunderstood the new solution you adopted. The solution @erosenin provided actually included the cypress binary and was reproducible. The solution you have chosen requires more work from the user and is not as reproducible as it depends on user steps and environment variables, correct?

@acyuta108

This comment has been minimized.

Copy link
Author

acyuta108 commented Mar 27, 2019

The solution @erosenin provided actually included the cypress binary and was reproducible

Both solutions install the binary and depend on the npm steps. It is the standard way to install cypress in any project/system. I'll explain why.
In fact if you look closely, @erosennin mentions the env vars in his comment as described in my pull request.

The standard way is to npm i cypress which downloads the binary and caches it in the home directory. See here. Then the user runs it (cypress run or cypress open) from their project directory which includes the tests/specs to be run by the app (cypress).
For nix our solution is: The user (pre) installs the cypress binary using nix, and then when the user starts working on her project, she tells npm installer . not to install the binary (CYPRESS_INSTALL_BINARY=0) and 2. run cypress from the nix-installed version, opposed to the one expected to be cached by npm install cypress (CYPRESS_RUN_BINARY=./result/Cypress/Cypress`).

These ENV options are documented by Cypress as well, which I am glad are available, otherwise we would have to inject/override somehow our binary (path).

@aanderse

This comment has been minimized.

Copy link
Contributor

aanderse commented Mar 27, 2019

Ah I see. So could you use makeWrapper to make this seamless to the user?

@acyuta108

This comment has been minimized.

Copy link
Author

acyuta108 commented Mar 27, 2019

I'd rather not. I don't see the use and I actually foresee issues.
For a UI developer it is straightforward to set these flags/envs and be aware that they are running the nix installed version of cypress. I am afraid that if we start "tucking under" the details, users might run into trouble when they need to override the settings and/or they might be confused if they use nix package manager along with the regular installed cypress (non-Nixos users) and lead to unexpected behavior.
I think it's better to keep it clean as it is. I can in fact create a pull request in the Cypress repo, to document this simple process for Nix users.

Besides, how would you even achieve that? When you run cypress run, this command calls the cypress in the .node_modules/ folder which in turn decides where and how to run the actual binary. I would have to override the ./node_modules/.bin/cypress to wrap the CYPRESS_RUN_BINARY env.
Basically, it gets very messy.

@aanderse

This comment has been minimized.

Copy link
Contributor

aanderse commented Mar 27, 2019

I've never used cypress so I'll defer to your experience.

My interest in cypress is that I'd like to start using a web testing framework inside nixos tests for web modules to provide more thorough tests. Currently most nixos tests simply ensure a web application can boot without testing functionality of the web application at all.

This sounds achievable with what you've described, right?

@acyuta108

This comment has been minimized.

Copy link
Author

acyuta108 commented Mar 27, 2019

Absolutely. Any Nix/NixOS user can now use Cypress which is a pretty fantastic UI and end-to-end testing tool. Specs are written and javascript and run natively on a chrome browser. You can test VueJs (my fav), Reach, Angular and pretty much anything that has a UI that runs on the browser. I've been writing end-to-end specs for many years now and nothing compares to Cypress in speed, reliability and ease of use.

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

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.