cypress

How to listen global events with Cypress?

半腔热情 提交于 2020-01-03 16:52:57
问题 We have an application that polls the server periodically until a task is completed. We fire a global event so that Cypress can catch and find out if the task is finished but we had trouble using document.addEventListener on Cypress. Here's what we're doing: document.addEventListener('queryEnd', () => { cy.get('.chart').should('be.visible') cy.get('.table').should('be.visible') }) However; when we use it in a spec, it doesn't work expected and we're not able to catch it. Also, Cypress doesn't

How to listen global events with Cypress?

余生长醉 提交于 2020-01-03 16:52:28
问题 We have an application that polls the server periodically until a task is completed. We fire a global event so that Cypress can catch and find out if the task is finished but we had trouble using document.addEventListener on Cypress. Here's what we're doing: document.addEventListener('queryEnd', () => { cy.get('.chart').should('be.visible') cy.get('.table').should('be.visible') }) However; when we use it in a spec, it doesn't work expected and we're not able to catch it. Also, Cypress doesn't

In Cypress, is there a way to avoid a failure depending on a daily message?

两盒软妹~` 提交于 2020-01-03 02:30:48
问题 I'm developing a testing tool using Cypress for a webpage that is currently live. The problem is that sometimes I get a modal showing the new features, events, etc.; and this breaks the remaining tests. I already tried to close the modal as soon as I login (which is one of the previous tests), but this leads the login test to fail. I was wondering if there is a way to make the test ignore the last 2 instructions from the code below, wether or not they are visible. it('Visits habitica and

How do you reliably wait for page idle in cypress.io test

ぐ巨炮叔叔 提交于 2020-01-02 03:04:14
问题 When using cypress.io to test an angular web page, whats the best / most reliable way to detect when the page is fully loaded and idle. Not just the onload event. Needs to include all XHR requests, angular digest cycles complete and all rendering complete including all animations complete. The reason is that at this point I want to test that the page does NOT contain an element and cant test that until all the above is fully complete. 回答1: You can make Cypress wait for any request to complete

How do you reliably wait for page idle in cypress.io test

淺唱寂寞╮ 提交于 2020-01-02 03:03:47
问题 When using cypress.io to test an angular web page, whats the best / most reliable way to detect when the page is fully loaded and idle. Not just the onload event. Needs to include all XHR requests, angular digest cycles complete and all rendering complete including all animations complete. The reason is that at this point I want to test that the page does NOT contain an element and cant test that until all the above is fully complete. 回答1: You can make Cypress wait for any request to complete

How to implement drag and drop in cypress test?

≡放荡痞女 提交于 2020-01-02 00:59:29
问题 I am struggling to test drag and drop with Cypress and Angular Material Drag and Drop. So the goal is to move "Get to work" from Todo to Done. I have created the following test, that should make it easy for you to reproduce: You can play with the Stackblitz here. describe('Trying to implement drag-n-drop', () => { before(() => { Cypress.config('baseUrl', null); cy.viewport(1000, 600); cy.visit('https://angular-oxkc7l-zirwfs.stackblitz.io') .url().should('contain', 'angular') .get('h2').should

How to expose/access a data store like Redux within a cypress test?

烂漫一生 提交于 2019-12-30 10:10:52
问题 The Cypress docs say you can Expose data stores (like in Redux) so you can programmatically alter the state of your application directly from your test code. I also watched a course on testing by Mr. Kent C. Dodds where he mentions a redux store could be initialized with existing data in Cypress (before or within tests, not sure) I went through pretty much all the docs and googled and I just can't find any references or examples of actually doing this other than it being mentioned as one of

How to expose/access a data store like Redux within a cypress test?

你离开我真会死。 提交于 2019-12-30 10:10:07
问题 The Cypress docs say you can Expose data stores (like in Redux) so you can programmatically alter the state of your application directly from your test code. I also watched a course on testing by Mr. Kent C. Dodds where he mentions a redux store could be initialized with existing data in Cypress (before or within tests, not sure) I went through pretty much all the docs and googled and I just can't find any references or examples of actually doing this other than it being mentioned as one of

Compare two values and make decision in Cypress

戏子无情 提交于 2019-12-24 19:53:09
问题 So I have two values on a page that I need to compare and as per the result perform some actions. //First Block cy.get('selctor1').invoke('text').then(somevalue => { cy.get('selector2').should('have.text', somevalue).then(() => { #Do Something when equal }) }) //Second Block cy.get('selctor1').invoke('text').then(somevalue => { cy.get('selector2').should('not.have.text', somevalue).then(() => { #Do Something when not equal }) }) So for the positive case when both values are equal everything

why do i get kicked out of a logged in web session?

馋奶兔 提交于 2019-12-24 19:32:51
问题 so i still have the same problem, but this time, my code is not the problem, at least i think so My Code: import * as LogConst from 'C:\\Users\\Kristi\\Desktop\\BATests\\tests\\cypress\\fixtures\\Login_Data.json' describe('all testcases hopefully', function () { before(function () { cy.clearLocalStorage(); cy.clearCookies(); }); it('loading', function () { cy.visit('https://' + LogConst.server.name + ':' + LogConst.server.password + '@dev.capitalpioneers.de/'); cy.request({ method: 'POST',