cypress

How to login in Auth0 in an E2E test with Cypress?

邮差的信 提交于 2020-02-03 03:46:26
问题 I have started testing a react webapp but I didn't go far because I had issues with the login. I am using cypress e2e testing tool. A welcome page is shown with a button to login, which will redirect you to auth0 service. User is login with email and password , then is redirected back to the webapp with a token. I tried many different approach each of them resulting in a different problem. Note: I don't want to test Auth0, I just want to enter in my webapp. Attempt 1. Clicking on login button

Parallel Cypress tests on TeamCity

喜欢而已 提交于 2020-02-01 09:24:46
问题 We currently have a repo containing 24 integration/*.js files. We are successfully running Cypress tests via our TeamCity CI workflow, however, I am unable to get the tests to run in parallel. By way of configuration, we have the repo/tests wired up to an org in dashboard.cypress.io. Along with the dashboard key, we are calling Cypress in a TeamCity build step via npm run with the following configs in our package.json scripts{} : "cypress:run:qa": "cypress run -c cypress.qa.json --record -

cypress XHR API call validation in test cases

ⅰ亾dé卋堺 提交于 2020-01-30 11:05:31
问题 I am exploring if I can use cypress for end-to-end testing or not in angular? I am super beginner in it. Cypress has some server() instance for XHR. Question: Suppose I am testing the login page so I can write test cases for querying elements and do the validation. In this process the browser will be making some API call, will it possible to write test cases for validating what was the statusCode the API had retured? What was XHR API response etc? 回答1: of course. With cypress you can spy the

cypress XHR API call validation in test cases

百般思念 提交于 2020-01-30 11:04:55
问题 I am exploring if I can use cypress for end-to-end testing or not in angular? I am super beginner in it. Cypress has some server() instance for XHR. Question: Suppose I am testing the login page so I can write test cases for querying elements and do the validation. In this process the browser will be making some API call, will it possible to write test cases for validating what was the statusCode the API had retured? What was XHR API response etc? 回答1: of course. With cypress you can spy the

Cypress: I want run tests in 100 spec files by login one time and persist login for every file. Is it possible?

泪湿孤枕 提交于 2020-01-25 09:32:06
问题 I have almost 100 specs files including multiple tests. I want run all these specs files by login one time. I dont want my cypress should login process every time on every spec file It it possible to persist single login for all spec files 回答1: This is the recommend approach that Cypress.io suggest you use, as this is quite the anti-pattern. Cypress Docs Anti-Pattern: Sharing page objects, using your UI to log in, and not taking shortcuts. Best Practice: Test specs in isolation,

How to capture all API calls in cypress?

点点圈 提交于 2020-01-25 09:15:31
问题 I have API call when loading a chat app, 30 calls/group (it's to load last 30 messages on each group). Let's say in a case, I test a user which has 2 groups only. So I expect to see 60 API calls for this. I tried with following code. it('Call 30 group messages APIs for every favorite group', () => { cy.server() cy.route(awsUrl + '/**').as('apiMessageContent') for (let i = 0; i < 60; i++) { cy.wait('@apiMessageContent', { timeout: 30000 }).then(res => { expect(res.status).not.to.be.null }) } }

How to use a variable as a parameter in an API call in Cypress

匆匆过客 提交于 2020-01-25 08:20:28
问题 I am capturing a value from an API call and have set it to a variable. I would now like to use that variable as a URL parameter in a second API call. This is probably super simple for a lot of folks but I'm just starting out learning javascript and everything I'm reading and trying is not working for me. I'd appreciate any help you can offer and I'm happy to add detail if you like! 回答1: This has been answered many times before (I gave at least two similar answers here and here). You can

cypress: use a variable in several functions

妖精的绣舞 提交于 2020-01-25 08:09:12
问题 I want to use one variable in two different functions. More precisely I want to get a number (as a string) of a label and set it into an input field. Afterwards I check another label for the right (resulted) text. I have written two functions that are working correctly (executed separately) but I want to use the value (stored in a variable) of the first function within the second function. So I have tried to put the functions together but then cypress doesn't find the given csspath '

How to handle elements on PayPal popup with cypress.io

南楼画角 提交于 2020-01-25 06:47:08
问题 I need to automate an end to end test that include purchase an order with PayPal. This test includes validate some elements in a screen that appears once the order is purchased. I'm currently trying with cypress.io. I know cypress recommend against visiting 3rd party sites but I need to interact with PayPal in this test. I have not been able to deal with it. Is there any workaround to interact with the PayPal popup when using cypress.io? 回答1: Unless you are testing Paypal itself, you should

In Cypress when to use Custom Command vs Task?

痞子三分冷 提交于 2020-01-24 23:59:08
问题 What is the difference between a Custom Command and a Task? I am trying to understand how they should each be used. Custom Command documentation: https://docs.cypress.io/api/cypress-api/custom-commands.html Task documentation: https://docs.cypress.io/api/commands/task.html 回答1: A command ( most methods on cy object) is function that enqueues (pushes) an "action" to a queue of currently-executing commands, and executed serially and asynchronously (that's why return value of a command has .then