0

I'm trying to automate the application to check the status for 1000 employees and Below if the code. First it tries to open and next when it tries to hit another time the pop-up comes so, the test fails. But I have to open in 1000 tabs to check the status. Is there any way to do it. For example:

  it('check status functionaltiy', function () {
    cy.visit('https://egov.uscis.gov/casestatus/landing.do')

    var genArr = Array.from({length:1000},(v,k)=>k+1)
    cy.wrap(genArr).each((index) => {
      cy.get('input[type="text"]')
      .type(`IOE1234567${index}`)
      cy.log(`IOE1234567${index}`,'ppppppppp')
      cy.get('input[type="submit"]').click();
    })    
})
Hema Nandagopal
  • 668
  • 12
  • 35
  • Maybe you should try to stub your newly opened tab? I don't see any status checking, one iteration of your test stops on clicking submit button which invokes opening a new tab I guess, correct me if I'm wrong. If so, just stub opening a new tab and go further through the loop – Valeriia Feb 19 '23 at 22:31
  • I'm learning cypress and I dont know how to open the new tab. I'll check but for each tab will it check? – Hema Nandagopal Feb 20 '23 at 07:01
  • I thought if you click the submit button your new tab opens automatically. Is it right? – Valeriia Feb 20 '23 at 09:27
  • No it didnt .. the pop-up comes and its unable to test the next one – Hema Nandagopal Feb 20 '23 at 12:22
  • To prevent popup from opening, you should use cy.stub function the following way: cy.window().then((win) => { cy.stub(win, 'open').as('Open'); }); somewhere before opening it (I usually use it in the beginning of helper functions which clicks on the button) – Valeriia Feb 20 '23 at 12:29
  • Okay, I tried something like this cy.get('input[type="submit"]').click(); cy.get("#ui-id-1") .invoke('text') .should('eq', 'Data Entry Errors') .then(() => { cy.get('.ui-dialog-buttonset').click(); }) }) but thing is sometimes its failing after 20 attemtps – Hema Nandagopal Feb 20 '23 at 12:50
  • Please update your question with the screenshot and/or text of error which you get – Valeriia Feb 20 '23 at 13:31

0 Answers0