DEV Community

Discussion on: Cypress - End to End Testing Framework

Collapse
 
nutankm profile image
Nutan Kumar

Hi Bushra,
Thank you for the very good article. I am new to cypress and javascript. please help me with below code. trying to get latest string value and compare it in while loop. but in while loop it keeps picking up old string value.
Thanking you in advance. Really appreciate your help.

allOpenCases.getCurrentSystemStep().then(($currentStep)=>
{
return $currentStep.text()

}).as('CSS')

cy.get('@CSS').then((cStep)=>{
let count = 1
while(cStep!==targetSystemStep && count < 50)
{
allOpenCases.getSearchButton().click()
cy.wait(3000)

allOpenCases.getCurrentSystemStep().then(function($currentStep)
{
let cStep = $currentStep.text() //latest text

})

count ++
}

})