Questions tagged [cypress-each]

Iteration command in a Cypress test, like for-each but applied to subjects on the Cypress command queue.

17 questions
2
votes
2 answers

Cypress+TS, how to get second text that wrapped double quotes?

I got this web page to test claim number. But I am not able to extract the same.

"Claims #" "75078"

The xpath I am…
Pulkit Agrawal
  • 331
  • 2
  • 15
2
votes
1 answer

I am new to cypress+TS. Not able to return a value inside the each loop in Cypress with Typescript

Not able to return a value inside each loop in Cypress with Typescript. patientBalance value is undefined. Main class code let patientBalance: number = getPatientBalance(claimNumber); Function as below: let amountInDollar1: string[]; let amount1:…
Pulkit Agrawal
  • 331
  • 2
  • 15
2
votes
2 answers

How to find one of many selectors that contain another nested selector

I have a web page and there is a list with multiple elements: First type of element:
  • Something Second type of element:
  • As you…
    Mag
    • 207
    • 1
    • 8
    2
    votes
    3 answers

    Cypress - verify if each table row in one column contains the same item

    I have a table, however some kind of ag-grid, created by DIV's, not real table element:
    Name 1
    25
    Name…
    Darksymphony
    • 2,155
    • 30
    • 54
    2
    votes
    3 answers

    How can we get the multiple elements with one expression like using for loop

    We have 5 elements and we need to match the text of all 5 elements with some expected text. Say //div[@class="xyz"] is the common element selector and for 1st element we need to use (//div[@class="xyz"])[1], and so-on using a for-loop. for (i=0;…
    2
    votes
    2 answers

    Cypress foreach loop stop condition

    I need some help with the following loop: localStorage.removeItem('DDFound'); cy.get(sel).each(($el, index, $list) => { if(localStorage.getItem('DDFound')!='1') { cy.log(localStorage.getItem('DDFound')); …
    2
    votes
    1 answer

    Testing alphabetical order after looping over elements

    I try to code something that will check the alphabetical order of the options in a dropdown menu. So what I do is to loop through the dropdown menu and adding the values of the options into an array. Then I want to check if the values of the array…
    TA1-q
    • 33
    • 1
    • 6
    1
    vote
    3 answers

    Why does cypress only loop through once inside the for loop

    Why does cypress only loop through once inside the for loop? Test code is this: cy.get('body').contains('Automation').each(($el, index) => { cy.get('body').contains('Automation').parents() .eq(1) .find('mfc-dropdown > div > mfc-button >…
    khiz
    • 37
    • 3
    1
    vote
    2 answers

    Cypress: How to click on a array-list element if matching text found

    I want to add an item in cart with a matching text like 'cashews'. I tried below code but .click() function is giving error as "bind and event handler to the click javascript event" cy.get('.products').find('.product').each(($e1, index, $list) => { …
    vish176
    • 21
    • 5
    0
    votes
    2 answers

    Using await keyword with promisify for cypress.io

    I just tried to use await with promisify library. I put my code below. import promisify from 'cypress-promise'; describe('My First Test', () => { it('Does not do much!', async() => { const url =…
    AMendis
    • 1,346
    • 4
    • 18
    • 34
    0
    votes
    3 answers

    Cypress Test fails when doing each loop for a list

    I am having issues with using each loop for lists in cypress. Website code:
    Pb An
    • 25
    • 4
    0
    votes
    2 answers

    Traverse through a list, perform actions and return back to the next item in list

    Is there a way I can traverse through the list, perform click again and then return to the same page again for the next item in list. cy.get('#collaborators').next().children().each((items) => { // Here I have to write code to access list element …
    Anand Kiran
    • 101
    • 1
    • 6
    0
    votes
    2 answers

    How to loop through datatable to validate select control option values in Cypress?

    Below is a step & datatable in my Cypress / Cucumber test: And Results per page drop down has the below options | 10 | | 50 | | 80 | | 100 | | 150 | In my test, I want to loop through the options inside a select…
    user9847788
    • 2,135
    • 5
    • 31
    • 79
    0
    votes
    4 answers

    How can I access to each element inside of a grid element with Cypress?

    I have a Grid component which includes 24 divs and inside of each div I need to take the value. This value actually arrives in

    , so which is the best way to do this? Below is the app image. I would appreciate an example.

    SkuzKabel
    • 1
    • 2
    1
    2