cypress

Cypress - Typescript - How can i make my fixture variables global?

三世轮回 提交于 2021-02-10 17:49:22
问题 Fairly new to Cypress/Typescript etc, i want to grab a value from my fixture and make it usable for the 'perform search and verify returned header is correct' test. However i cant seem to access the variable from within my test, any help appreciated: Here's the values in my fixture: { "manufacturer": "Dyson", "product": "9kJ Hand Dryer" } Here's my code that creates an alias from the fixture and attempts to access the variable, but im getting the following error: Cannot find name 'manuTerm'

Excel file upload/import using cypress

雨燕双飞 提交于 2021-02-10 15:15:59
问题 I've a UI similar to I need to upload a xlsx file which I have placed in fixture folder in to the application. Any suggestions how to do it using cypress? 回答1: This what I found as the solution Install cypress-file-upload npm install --save-dev cypress-file-upload Add following to command .js file import 'cypress-file-upload'; Use cy.attachFile const yourFixturePath = 'data.json'; cy.get('[data-cy="file-input"]').attachFile(yourFixturePath); For details https://www.npmjs.com/package/cypress

Compatibility between cypress and react-apollo

人走茶凉 提交于 2021-02-10 14:22:59
问题 I am using react-apollo to make GraphQL queries, and I am using Cypress for testing. The problem is that these 2 dont seem to play well along. Apollo seems to be making all its requests through the Fetch API. But Cypress seems like it is not able to capture anything, except XHR requests. So what could I do to solve this problem? Is there a way for Cypress to capture "fetch" requests? Is there a way for react-apollo to use "xhr" instead of "fetch"? 回答1: Try out cypress-graphql-mock You just

easy way of running different groups of Cypress tests

冷暖自知 提交于 2021-02-10 12:32:07
问题 So I have a project dir under that I have my Cypress dir under that I have two dir's with different tests I run. Right now in my project dir I have a cypress.json that has the setting "integrationFolder": "cypress/test_tests",when I issue the command npx cypress run it gets the dir from the integrationFolder setting in the .json file but if I want to run the tests from a different dir I have to edit the cypress.json file and set the integrationFolder to the other dir, is there a way I can

easy way of running different groups of Cypress tests

时光怂恿深爱的人放手 提交于 2021-02-10 12:31:58
问题 So I have a project dir under that I have my Cypress dir under that I have two dir's with different tests I run. Right now in my project dir I have a cypress.json that has the setting "integrationFolder": "cypress/test_tests",when I issue the command npx cypress run it gets the dir from the integrationFolder setting in the .json file but if I want to run the tests from a different dir I have to edit the cypress.json file and set the integrationFolder to the other dir, is there a way I can

Bypass UI Login using Cypress

北城余情 提交于 2021-02-10 08:43:37
问题 I am having problem bypassing UI login. My web application doesn't use API to authenticate users. There are no endpoints like /login . index.php will just open the login page and submit the form to login. The application authenticate the user by auth($_REQUEST['username'], $_REQUEST['password_tx']); This is what cypress printed after UI login submit. I have no idea how to move on from here. // This doesn't work. The application doesn't get the user details from the body. It is in the

Bypass UI Login using Cypress

无人久伴 提交于 2021-02-10 08:42:14
问题 I am having problem bypassing UI login. My web application doesn't use API to authenticate users. There are no endpoints like /login . index.php will just open the login page and submit the form to login. The application authenticate the user by auth($_REQUEST['username'], $_REQUEST['password_tx']); This is what cypress printed after UI login submit. I have no idea how to move on from here. // This doesn't work. The application doesn't get the user details from the body. It is in the

Compare datetime function cypress

旧时模样 提交于 2021-02-07 20:01:31
问题 I have a form in which a user is allowed to enter the date range and the output will have results form that particular date alone. I am able to input the date to the form using .type() function. However, I am not sure how to check if the results are within the range specified. For example, if the typed date is ('17/03/2019') I should be able to check if the results in the table are within the range using a code like this, cy.get('.table') .should('not.contain','18/03/2019') // This is wrong I

Cypress “have.attr” with regular expressions

寵の児 提交于 2021-02-07 12:32:18
问题 In Cypress I can match an attribute's value by exact text like this: cy.get("my-element") .should("have.attr", "title", "Exact title") But, is there a way to match the attribute's value by a substring or a regular expression? something like: cy.get("my-element") .should("have.attr", "title", /Partial title/) So far, this is the best I have: cy.get("my-element") .should("have.attr", "title") .then(title => expect(title).to.match(/Partial title/)); 回答1: Per the Cypress docs, have.attr comes

Cypress “have.attr” with regular expressions

≡放荡痞女 提交于 2021-02-07 12:31:28
问题 In Cypress I can match an attribute's value by exact text like this: cy.get("my-element") .should("have.attr", "title", "Exact title") But, is there a way to match the attribute's value by a substring or a regular expression? something like: cy.get("my-element") .should("have.attr", "title", /Partial title/) So far, this is the best I have: cy.get("my-element") .should("have.attr", "title") .then(title => expect(title).to.match(/Partial title/)); 回答1: Per the Cypress docs, have.attr comes