Use of For Loop & return method in Cypress automation : describe(" Use Of For Loop and return method ",function(){ it ( 'Test Case 15' , function () { cy . visit ( 'www.exapmle.com/',{timeout:1000} ); cy . get ( '.tab-tools > .icon > .svg-inline--fa' ). click ({ force : true }); // Now this method will fetch the text which is already displayed & will save it. cy . get ( '.last-updated-date > span' ). then (( $txt ) => { const txt = $txt . text () cy . log ( txt ) // For loop will run 50 times & after each 3 seconds // it will check Visibility of element. // If it gets newly appeared element/Text It will be terminated before 50 runs var i ; for ( i = 0 ; i < 50 ; i ++) { cy . wait ( 3000 ) cy . get ( '.last-updated-date > span' ). each (( $text ) => { c
Cypress Automation Solution website is to post the issues and their best solutions to the Cypress Automation Community.