cypress

cy.request doesn't allowing me to go to next UI test cases

余生长醉 提交于 2020-07-10 07:49:09
问题 Trying to integrate both UI & API test cases Created two files: API test --> DO Login and writing token & saving it to fixture file Spec test -->Do REAL Login by using username and password and once test case pass then in next test first get the response by using cy.request using token which saved by step1. Based on response keys search the data in search bar API Test File: it("Login Request API",function(){ cy.request({ method:"POST", url: POST URL, headers:{ "content-type" : "application

Cypress - Report not generating while running tests through cypress test runner

≯℡__Kan透↙ 提交于 2020-07-10 07:00:10
问题 When I hit the command npx cypress run , my test run and videos are recorded and also a mochawesome report is generated and saved. However when I run the test through cypress test runner, using the command cypress open and then selecting a spec run, the tests run , but the videos and the report are not generated. How can I make video/screenshot recording along with report generation using Cypress Test Runner? 来源: https://stackoverflow.com/questions/62628788/cypress-report-not-generating-while

Does cypress support soft assertion?

 ̄綄美尐妖づ 提交于 2020-07-08 20:33:07
问题 Does cypress support soft assertion? For example - I am navigating through 'n' number of elements and want to verify their values. If value of any element is mismatched then it fails the test. It doesn't continue to verify the value of next elements. Is there a way to verify all elements values and show the failed ones at the end? 回答1: EDIT: I probably misunderstood.. if you meant soft assertions of cy commands (not chai's expect / assert ), then this answer is not for you. WTBS, you could

How can I clear a Codemirror editor field from Cypress

时光总嘲笑我的痴心妄想 提交于 2020-07-07 05:44:17
问题 I already tried something like this from another SO answer How to type using cypress .type() inside the codemirror editor? If it helps this is the site I am working on Cypress with https://testing-playground.com/ // CodeMirror's editor doesn't let us clear it from the // textarea, but we can read the Window object and then // invoke `setValue` on the editor global cy.window().then(win => { win.editor.setValue("") }) The issue I am running into is when I try to implement this I am getting

Cypress - How can I run test files in order

若如初见. 提交于 2020-07-06 19:17:57
问题 When I press the "run all specs" button or use the run command that runs all files in Cypress it runs all test files alphabetically, so I don't want that. I want to sort all of them with my own rules. Let's say I have 3 steps in a chat app test. Can connect the chat app Can connect the chat Can the user send a message I want to test every step without being tied to each other. What I mean, Testing one of their own function. What I do is as follows chat_app_connect.spec.js describe('Server

Cypress - How can I run test files in order

夙愿已清 提交于 2020-07-06 19:11:47
问题 When I press the "run all specs" button or use the run command that runs all files in Cypress it runs all test files alphabetically, so I don't want that. I want to sort all of them with my own rules. Let's say I have 3 steps in a chat app test. Can connect the chat app Can connect the chat Can the user send a message I want to test every step without being tied to each other. What I mean, Testing one of their own function. What I do is as follows chat_app_connect.spec.js describe('Server

Testing a redirect to a new route with Cypress

邮差的信 提交于 2020-07-05 05:34:08
问题 I am using Cypress for testing my web application. This snippet currently works and will submit a new thing: describe('The Create Page', () => { it('successfully creates a thing', () => { cy.visit('/create') cy.get('input[name=description]').type('Hello World') cy.get('button#submit') .click() // After POST'ing this data via AJAX, the web app then // receives the id of the new thing that was just created // and redirects the user to /newthing/:id // How do I test that this redirection worked?

In Cypress, how do I stub a POST API request with parameters in the body?

笑着哭i 提交于 2020-06-27 08:05:11
问题 I am writing an end-to-end test with Cypress and I would like to stub the network requests which my application makes. Specifically, I would like to stub out multiple POST requests which have parameters in the body and to change my simulated response based on those parameters. I would like to do something like cy.route({ method: "POST", url: "/todos/add" params: { "urgency": 3, "stakeholder_id": "SKH001" }, response: "fixture:add1.json", }) cy.route({ method: "POST", url: "/todos/add" params:

Cypress IO- Writing a For Loop

不问归期 提交于 2020-06-24 22:25:09
问题 I have 15 buttons on a page. I need to test each button. I tried a simple for loop, like for (var i = 1; i < 15; i++) { cy.get("[=buttonid=" + i + "]").click() } But Cypress didn't like this. How would I write for loops in Cypress? 回答1: To force an arbitrary loop, I create an array with the indices I want, and then call cy.wrap var genArr = Array.from({length:250},(v,k)=>k+1) cy.wrap(genArr).each((index) => { cy.get("#button-" + index).click() }) 来源: https://stackoverflow.com/questions

Is it possible to verify a Hover text using cypress?

ⅰ亾dé卋堺 提交于 2020-06-17 04:15:31
问题 I am new to cypress and exploring the tool. I would like to know if there is an option to verify a hovered text. This is my scenario, My data is dynamic and changes every second. Imagine a table with Column city and city in charge. The city of incharge is dynamic and changes every minute. This is clickable, hovered and holds a link. When hovered over it shows the full name while on the button it has the first name alone. Also, the name changes more frequently and not constant so cannot use