Questions tagged [cypress-testing-library]

Questions about Cypress end-to-end testing with the **Cypress Testing Library** utilities (a subset of the Testing Library).

Documentation can be found at Cypress Testing Library.

Testing Library provides additional testing commands to the Cypress framework.

214 questions
0
votes
3 answers

How to permanently remove `import { cy } from "date-fns/locale"` so it stops erroring out cypress tests?

UPDATE: This error comes from the auto import of cy from the date-fns library, which also has a cy of it's own. I've just commented it out in my code, since I don't necessarily want to get rid of auto-importing. For some reason, every now and then I…
LovelyAndy
  • 841
  • 8
  • 22
0
votes
0 answers

Showing Err For correct Code:'Cypress detected that you returned a promise from a command while also invoking one or more cy commands in that promise'

I have entered the code right, and it worked too. But now i dont know why i am getting same error on different lines of code each time i test. The error comes at the chained commands. Sometimes its a chained Cy.find commands while sometimes its some…
0
votes
1 answer

importing chai assertion from chai-openapi-response-validator plugin

I am using Cypress.io framework, and I would like to implement chai plugin called chai-openapi-response-validator which contains a new assertion called…
0
votes
1 answer

Cypress: How to save a variable and use it later for comparison

I have a div that has a value of 15,000 that can be retrieved by cy.get('.population').invoke('text').then((numbers) =>{ let people = parseInt(numbers.replaceAll(',','')) cy.wrap(people).as('population') }) However, I now need to get…
0
votes
1 answer

Is there any way to see automated the test cases run automatically on the UI/hosted site using cypress or pytest

By default, running 'npx cypress open' opens the Cypress window and then I have to manually hit the "Run All Tests" button to run them. How can I keep the browser open and run all tests in the browser/UI automatically? Can I keep a scheduler on…
basp
  • 1
  • 1
0
votes
1 answer

Cypress UI no specs

I have four files in my integration folder under cypress folder.But from today while using the same npx cypress open command in the terminal,But there were no specs in the UI. How to overcome the issue?
0
votes
0 answers

Prevent cypress from checking sort order with foreach?

Currently I have the current code: And('the user sees {string}', (kpi: string, tableDef: TableDefinition) => { asList(tableDef).forEach(color => { Does the foreach in a cypress expression automatically leads to checking sort order? Because my test…
0
votes
0 answers

I wane step by step testcase nname in terminal

describe('open popup', ()=>{ it('click minimize button',()=>{ cy.visit('url') cy.get('minimized-button').click() //it is minimize tab click var iframesrc=cy.get('#modal-iframe').invoke('attr','src') …
0
votes
0 answers

Cypress Tests throw Error: Exceeded maxRedirects. Probably stuck in a redirect loop

I have cypress UI tests running remotely. Our authentication team has recently made a change that redirects the page twice, previously only once. This change has caused my tests to fail at cy.visit('/') with error "Exceeded maxRedirects. Probably…
PriyaK
  • 23
  • 3
0
votes
2 answers

Cypress POM approach | How to read fixtures data in POM_Page.js file in cypress

I am new to cypress and trying to create framework on POM. I have followed these steps for creating framework Created Object repository with file named 'locators.json', data in that file looks like this { "RxClaims_LoginPage": { …
Buzz
  • 1
  • 2
0
votes
1 answer

Cypress: Intercept fetch request not working

I am using cypress to try and assert that a fetch request has a certain query params. I started by just intercepting and logging the cy.wait but even that isn't working and I keep getting the error "Timed out retrying after 5000ms: cy.wait() timed…
Steve
  • 197
  • 7
  • 17
0
votes
1 answer

Cypress: How to check query params in fetch request?

I am trying to intercept a fetch request and assert that the payload / query params are correct. I have searched the cypress documentation but everything mentioned is setting query params. I for example, need to assert that a fetch request such as…
Steve
  • 197
  • 7
  • 17
0
votes
1 answer

assign the value returned from .invoke() into a variable in Cypress

i am using the following code to get a text value from a < td > : let serviceName; cy.get('tr').eq(1).then(row => { cy.wrap(row).find('td').eq(1).invoke('prop', 'innerText').then(val => { serviceName = val }); }) its working fine…
0
votes
2 answers

Cypress intercept, detect how many times API was called

I'm trying to detect how many times an API endpoint is called when running tests with Cypress, I'm stubbing out the endpoints with cy.intercept(). My code is like so: cy.intercept("POST", "api/cancel/**", { statusCode:…
Jon Flynn
  • 440
  • 6
  • 15
0
votes
3 answers

'cypress-promise' library is not working as expected

I have tests in which i used the cypress-promise library. I have included promisify in that to wait until my commands are executed and give response. in my file i have 3 it's block when i ran individually it executes properly but when i run all at…