cypress

Cypress.io: How to send a trigger out of cy.then or cy.each function?

独自空忆成欢 提交于 2021-01-29 07:56:57
问题 I try to verify weather if there have store keyword I want between the elements of pages. For example: store keyword = "apple" the part structure of a page: <tbody> <tr> <td class="store"> <img class="offer-store" ... alt="amazon store" .../></td> <td ... ...</td> </tr> ... <tr> <td class="store"> <img class="offer-store" ... alt="apple store" .../></td> <td ... ...</td> </tr> </tbody> I have 3 products,need to verify that every product have a store contains store keyword. One product may

Cypress Drag and drop test

落爺英雄遲暮 提交于 2021-01-29 07:09:05
问题 I would like to test the sortable table with Cypress.io I follow their page instruction: https://docs.cypress.io/api/commands/trigger.html#Mouse-Events and it doesn't work... First: it doesn't move the element Second: when I see the step by step test on the left side, mouse down and mouse move are located in the same position... my test cy.get('.resource-filter-table') .trigger('mousedown', {witch:1, pageX:188, pageY:196}) .trigger('mousemove', {witch:1, pageX:188, pageY:261}) .trigger(

Cypress - how to wait for second of two elements to appear?

白昼怎懂夜的黑 提交于 2021-01-28 22:31:01
问题 I want to wait until the second of two elements to appear before performing an action on it. Currently, I have this: cy.get('[data-test="insert-item"]').click(); cy.get('[data-test="textarea"]').eq(1).type('Hello').type('{enter}'); This currently fails. I'm assuming this is because Cypress is going to collect all the occurrences of textarea , then try to select the second one before it has actually rendered on the page (because of the async request that creates it). If I add cy.wait(2000); in

Can I force Cypress to use a specific IP address?

余生颓废 提交于 2021-01-28 19:10:16
问题 I'm trying to force my automation to use specific ip address in Cypress. I made changes to cypress.json but doesn't seem to be working. Any ideas? 回答1: There is a baseUrl variable in the cypress.json file, where you should be able to set the Url, for example: { "baseUrl": "https://127.0.0.1", "video": false, "chromeWebSecurity": false, "testFiles": "**/*.spec.js" } Check also environment variables, keep in mind that variables in cypress.env.json will overwrite values in the cypress.json file.

How do i clear a multi-select input using Cypress?

陌路散爱 提交于 2021-01-28 10:00:59
问题 How do i clear (deselect) all options within a multi-select input using Cypress? The documentation here does not seem to cover this scenario: https://docs.cypress.io/api/commands/select.html#Syntax The clear() command apparently cannot be applied to selects, as you might expect https://docs.cypress.io/api/commands/clear.html#Syntax I have tried passing an empty string / array / null to select() but i get the following error: CypressError: Timed out retrying: cy.select() failed because it

How do i clear a multi-select input using Cypress?

一笑奈何 提交于 2021-01-28 09:56:29
问题 How do i clear (deselect) all options within a multi-select input using Cypress? The documentation here does not seem to cover this scenario: https://docs.cypress.io/api/commands/select.html#Syntax The clear() command apparently cannot be applied to selects, as you might expect https://docs.cypress.io/api/commands/clear.html#Syntax I have tried passing an empty string / array / null to select() but i get the following error: CypressError: Timed out retrying: cy.select() failed because it

Error with authentication in e2e tests using cypress: chrome-error://chromewebdata

偶尔善良 提交于 2021-01-28 09:28:27
问题 I'm using cypress for writing E2E tests for my UI (Note that it's a PowerBI report, hence it's kind of special case). When I am testing with a public report, it works fine. But when it's a private PBI report, I am having trouble with login part. After some research, I found this approach promising for Azure AD based auth, and added this login function in my commands.js file: Cypress.Commands.add('login', () => { cy.request({ method: 'POST', url: 'https://login.microsoftonline.com/{TENANT}

Cypress submitting form with preventDefault

左心房为你撑大大i 提交于 2021-01-28 08:53:08
问题 I am having trouble using Cypress. There are 2 problems I'm currently having. A form with preventDefault is being submitted and the page is refreshing. I have to .click() and input before I can .type() into it. -- I have a form that has preventDefault, and you can see from the test that it submites the form, which adds a empty query string to the url, and none of my error handling messages are shown. This doesn't actually happen when I use the app myself. it('requires email', () => { cy.visit

In Cypress tests, how do I retry a button click if an expected XHR request does not go out : waitUntil() with click XHR condition??

好久不见. 提交于 2021-01-28 07:43:51
问题 At a very high level, we click a button which commands a building-control point; turns a light on or off. The click is supposed to send a POST request to the server. The issue is sometimes, the button is clicked and the POST request does not go out. The button has no functionality to indicate if it has been clicked (minor enhancement) . For the time being, I want to work around this using Cypress plug-in waitUntil() . // define routes cy.server(); cy.route('POST', '\*\*/pointcommands').as(

How to use import with absolute paths in Cypress tests built with ParcelJS?

江枫思渺然 提交于 2021-01-28 01:16:45
问题 I'm using imports with absolute paths in my Parcel project but these absolute paths aren't equally resolved by Cypress tests. Difference in module resolution Parcel : import {foo} from '/foo.js' : relatively to project root Cypress : import {foo} from '/foo.js' : absolute on disk root When Parcel's entry point is in src folder importing /foo.js anywhere in the project looks for file in path <project>/src/foo.js . (Docs: https://parceljs.org/module_resolution.html#absolute-paths) But Cypress