Hi I am trying to automate pagination api using cypress. This api takes 2 parameters as 'pageNo' and 'pageSize', pageNo means on which page and pageSize means total records returned by server (at max 15 on 1 page).
Problem:- I want to search for a particular fileName that is returned by this api, i don't know on which pageNo it appears, as soon as i found it i have to come out of the both the loops (pageNo and pageSize) Here is my code:-
describe('Check particular value', function() {
it('Check record', ()=>{
for (let index = 1; index < 7; index++) {
cy.request({
method:"GET",
url:"https://mydomainName.com/api/v1/searchFile/getFileList",
qs:{"pageNo":index,"pageSize":15},
headers:{"authorization": "jwt token "}
}).then(function(response){
for (let j = 0; j < response.body.data.length; j++) {
if (response.body.data[j].fileName.includes('file_2021_08_20_04_31.txt')) {
break;
}
}
});
// how can i come out of this parent loop
}
});
});
Thanks in Advance!!