Add FAQ questions from gitter
See original GitHub issue@jennifer-shehane commented on Tue Aug 08 2017
There are some questions that are asked in the Cypress gitter chat that we’d like to have in a searchable, centralized place - our FAQ.
Please take note of the categories we have in terms of our FAQ:
- General Questions: Questions someone could ask without ever using Cypress. Maybe they have questions about how it works in general or what we support before diving in.
- Using Cypress: Questions about how to use Cypress including the API, the Desktop GUI, or running the tests.
- Dashboard - Questions about our Dashboard service.
- Company - Questions about Cypress as a company.
Make sure to place it in the correct category. When in doubt, just ask!
The list below is a rough draft. Some questions have rough answers taken from the chat, some have no answers. The questions and answers should be formatted clearly and edited.
Check off any questions from the list after adding it to the examples. Reference the PR to this issue #335.
Questions about Cypress:
-
Is there a way to ignore an exception thrown from my own application or a 3rd party library? Read about some of our suggestions for this in our issue here.
-
Could Cypress be used as a replacement for protractor? Protractor is essentially a wrapper around Selenium. In most cases Cypress can replace it just fine. There are some limitations to the way Cypress tests are ran (i.e. not via WebDriver, but within the browser under test itself). From my limited experience with Cypress (using it for few weeks now, I’m still evaluating) here are a few things you could test with Selenium (and hence Protractor) but you can’t with Cypress:
- Test in Firefox / IE / Edge.
- Assert on clipboard contents.
- Test TAB key (you can write your own .tab() command though, it’s just not part of Cypress’ API yet)
- cypress CLI tool doesn’t let you to execute a single test, just a single test suite. Not a big deal as you can just use it.only, but would be nice to have (and is offered by many Selenium-based runners)
- Can’t operate native browser dialogs / alerts.
-
can anyone tell me how much the dashboard feature costs? We have not released pricing on the Dashboard yet but anticipate it being free for open source projects and having paid plan starting at $99/month
-
Does anyone know if it’s possible to write Cypress tests in Typescript?
-
Is there a way to get a project recording link from a successful run/upload? I think this is what you’re asking for - https://github.com/cypress-io/cypress/issues/494 In which case, not right now.
-
Is there any documentation about interacting with saving a file using the system dialog? As soon as the system dialog comes up it just waits forever, never times out. You can’t do this in Cypress currently. You’ll need to bypass the way it normally works. Basically you could simply test the behavior before file prompting, like testing that an anchor has the right
href
. Or you could usecy.request()
to programmatically download the file. You don’t really need to test that a browser downloads a file because you would expect this to work. You just need to test the mechanism that would cause your application to prompt for file download and retain 100% coverage. -
Is there any way can take screenshot with console? No, not when running headlessly. The console would have to be open the whole time tests are run, then automatically failed when there are JavaScript errors on the page.
-
How do I make Cypress wait for an XHR request?
-
is there CLI option to run in chrome? Or is electron the only way to run headlessly?
-
How do I make conditional based assertions / control flow?
-
How do I run my tests in another browser?
-
Where do I get the key to run my tests in CI?
-
Can I create more than one key for CI?
-
I have an app that needs to be tested across multiple user sessions, like a chat app across 2 browsers. How do I test that?
-
I want to test clicking a link that navigates, how do I wait and check the resulting location url?
-
Is there a way to watch for an xhr request and assert that the response code came back a certain way?
-
How do I pass data to my webserver from Cypress?
-
How do I test drag-n-drop?
-
How do I wait for an element not to exist?
-
How do I do different things depending on what’s currently in the dom/url/cookies/localstore?
-
Any plans to add “Find React component in DOM” ability, like cy.getReactComponent() or something? (I’d guess you’d want to keep it separate from cy.get()) you could likely write this as a custom command yourself. Since you have the ability to access window globals, so long as your react application is exposed it should be possible to traverse the trees and access it that way (same as react dev tools essentially)
-
Is it possible to use cypress on
.jspa
? Yes. Cypress works on anything rendered to a browser. -
Is is possible to catch the promise chain in Cypress? No. You cannot add a
.catch
error handler to a failed command. Read more about how the Cypress commands are not Promises -
Is there a way to modify the screenshots/video resolution? Not at the moment. There is an open issue for this.
-
Can I run cypress on another browser other than Chrome? You can read about our currently available browsers here.
-
Does Cypress support ES7? Not currently. It uses browserify and babelify with the presets/plugins are hard-coded. There is an open issue for making this configurable.
-
How does one determine what the latest version of Cypress is? There are a few ways.
-
Is there an ESLint plugin for Cypress or a list of globals?
describe/it/beforeEach
etc globals come from Mocha. So you can use ESLint plugins for Mocha like this one. -
When I visit my site directly, the certificate is verified, however the browser launched through Cypress is showing it as “Not Secure”. Why? This is normal. Cypress modifies the traffic between your server and the browser. The browser notices this and displays a certificate warning. However, this is purely cosmetic and does not alter the way your application under test runs in any way, so you can safely ignore this warning.
-
My question is, there’s any option to run cypress with devtools open? We want to track network and console issues. Yeah, this is definitely the motivation behind https://github.com/cypress-io/cypress/issues/448, there is not a way to run cypress headlessly with devtools open. You may try running the tests locally and select the Electron browser, that’s as close as you’ll get with devtools open to replicating the environment that was run headlessly.
-
Can I test my Electron app? Testing your Electron app will not ‘just work’, as Cypress is designed to test anything that runs in a browser and Electron is a browser + node.
That being said, we use Cypress to test our own Desktop app’s front end - by stubbing events from Electron. Example: https://github.com/cypress-io/cypress-core-desktop-gui/blob/master/cypress/integration/login_spec.coffee
-
So what benefits would one get for converting one’s unit tests from Karma or Jest to Cypress? Unit tests are not something we are really trying to solve right now. Most of the
cy
commands are useless in unit tests. The biggest benefit of writing unit tests in Cypress is that they run in a browser, which has debugger support built in.We have internally experimented at doing DOM based component unit testing in Cypress - and that has the possibility of being an excellent “sweet spot” for unit tests. You’d get full DOM support, screenshot support, snapshot testing, and you could then use other
cy
commands (if need be). But as I mentioned this isn’t something we’re actively pushing, it just remains a thing that’s possible if we wanted to go down that route.With that said - we actually believe the best form of testing in Cypress is a combination of a “unit test” mixed with an “e2e test”. We don’t believe in a “hands off” approach. We want you to modify the state of your application, take shortcuts as much as possible (because you have native access to all objects including your app). In other words, we want you to think in unit tests while you write integration tests.
Add example of using request headers to cy.request
doc:
cy.request({ url: 'http://xxx', headers: { 'Content-Type': 'application/vnd.api+json' } })
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:16 (14 by maintainers)
Top GitHub Comments
For the same org you just type
#
and it will autocomplete. For everything else you just paste the URL as @jennifer-shehane said.You just past the link from the other repo directly. I think there may be some kind of shortcut if it’s in the same org, but I don’t know it.