cypress

Make selection using cypress in Angular if you're using material forms

徘徊边缘 提交于 2019-12-05 02:11:11
问题 I have a form that looks something like this: <form class="col s12" materialize [formGroup]="newUserForm"> ... <div class="row"> <div class="input-field col m4 s12"> <select formControlName="genderBound" materialize="material_select" id="gender" name="test"> <option value="" disabled selected name="chooseGender">Choose gender</option> <option *ngFor="let gender of genders">{{gender}}</option> </select> <label for="gender">Gender</label> </div> ... When I try to use cypress to select the

How to check for an element that may not exist using Cypress

随声附和 提交于 2019-12-05 00:36:03
I am writing a Cypress test to log into a website. There are username and password fields and a Submit button. Mostly logins are straightforward, but sometimes a warning dialog appears first that has to be dismissed. I tried this: cy.get('#login-username').type('username'); cy.get('#login-password').type(`password{enter}`); // Check for a possible warning dialog and dismiss it if (cy.get('.warning')) { cy.get('#warn-dialog-submit').click(); } which works fine, except that the test fails if the warning doesn't appear: CypressError: Timed out retrying: Expected to find element: '.warning', but

How does module resolution in TypeScript work for global values (i.e. describe)?

风格不统一 提交于 2019-12-05 00:33:12
While using jest on its own the corresponding typescript definitions got detected right after installing @types/jest . I then started to implement integration tests with cypress. Since cypress is using mocha, I now incorrectly see references of mocha type definitions inside my jest tests. In fact, a number of overlapping type definitions are detected. For instance, describe seems to be defined in a number of files. I even tried to implement my own typing for describe pointing to jest. Unfortunately, every single time mocha "wins". How can I specify the order of precedence when multiple

Detailed Reporting Cypress/Mochawesome

拥有回忆 提交于 2019-12-04 12:49:04
Has anyone had much experience of generating good detailed reports from Cypress tests using Mochawesome as the report engine? I've followed the info on the Mochawesome GIT page but what I get is rather dull!! I'd like to be able to include the odd screen-shot and the output from the assertions - here's the current cypress.json file...... { "projectId": "haw8v6", "baseUrl": "https://obmng.dbm.guestline.net/", "chromeWebSecurity": false, "reporter" : "mochawesome", "reporterOptions" : { "reportFilename" : "DBM Smoke-Test", "overwrite": true, "inline": true } } I've been toying with var

Is it possible to use Cypress e2e testing with a firebase auth project?

拥有回忆 提交于 2019-12-04 03:47:00
I am exploring Cypress for e2e testing, looks like great software. The problem is Authentication, the Cypress documentation explains why using the UI is very bad here . So I tried looking at the network tap of my application, to see if I could create a POST request to the firebase API, and authenticate without using the GUI. But I can see that there at least 2 request fired, and token saved to application storage. So what approach should I use? Authenticate with the UI of my application, and instruct Cybress not to touch the local storage Keep experimenting with a way of sending the correct

In Cypress how to count a selection of items and get the length?

限于喜欢 提交于 2019-12-03 22:10:22
I'm starting to learn Cypress. I have a 4 row table (with a class of datatable). I can verify the number of rows this way: cy.get('.datatable').find('tr').each(function(row, i){ expect(i).to.be.lessThan(4) }) This is fine, but it seems awkward, since I just want to count the length and don't really need to access the stuff in the rows, and I assume it's faster to do one thing than do 4 things. If I log the selection (not sure what else to call it): cy.log(cy.get('.datatable').find('tr')) it comes out as [object Object] and I'm not quite sure how to deconstruct that, which suggests to me that I

Make selection using cypress in Angular if you're using material forms

こ雲淡風輕ζ 提交于 2019-12-03 16:30:06
I have a form that looks something like this: <form class="col s12" materialize [formGroup]="newUserForm"> ... <div class="row"> <div class="input-field col m4 s12"> <select formControlName="genderBound" materialize="material_select" id="gender" name="test"> <option value="" disabled selected name="chooseGender">Choose gender</option> <option *ngFor="let gender of genders">{{gender}}</option> </select> <label for="gender">Gender</label> </div> ... When I try to use cypress to select the dropdown menu, it tells me that it's not visible. When I follow the explanatory URL that cypress provides,

How do I enter data into a form input in an iframe using cypress?

China☆狼群 提交于 2019-12-03 06:27:46
I have been trying to test a stripe checkout form using cypress.io If anyone has managed to get this to work please let me know. I found a thread on the matter here https://github.com/cypress-io/cypress/issues/136 and based on this I came up with: cy.get('iframe.stripe_checkout_app') .wait(10000) .then($iframe => { const iframe = $iframe.contents() const myInput0 = iframe.find('input:eq(0)') const myInput1 = iframe.find('input:eq(1)') const myInput2 = iframe.find('input:eq(2)') const myButton = iframe.find('button') cy .wrap(myInput0) .invoke('val', 4000056655665556) .trigger('change') cy

In Cypress, set a token in localStorage before test

寵の児 提交于 2019-12-02 22:08:57
I want to login and set a localStorage token on the client (specifically jwt ) How can I accomplish this using cy.request , as suggested in the Cypress Documentation? Here's an example of adding a command cy.login() that you can use in any Cypress test, or put in a beforeEach hook. Cypress.Commands.add('login', () => { cy.request({ method: 'POST', url: 'http://localhost:3000/api/users/login', body: { user: { email: 'jake@jake.jake', password: 'jakejake', } } }) .then((resp) => { window.localStorage.setItem('jwt', resp.body.user.token) }) }) Then in your test: beforeEach(() => { cy.login() }) I

cypress 3

混江龙づ霸主 提交于 2019-12-02 12:45:15
https://blog.csdn.net/u014647208/article/details/80525226 来源: https://www.cnblogs.com/hshy/p/11745687.html