I have angular 5 Application developing, and writing test cases in Jasmin using the protractor. my test scenario is that I want to get all page links("a href") and open one by one, for that I am writing below test case, it is opening 5-6 links, but after opening(executing ) some links it is giving below error , all links not opening ,loop is terminating after some time
Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
describe('home page test ', function() {
let page: AppPage;
let linksArray:string[]=[];
beforeEach(() => {
page = new AppPage();
});
it('home page links test ', () => {
page.navigateTo();
//find all links
let linkCount = element.all(by.tagName('a'));
//here you click each of the links:
linkCount.each(function(elem,index){
elem.getAttribute('href').then(function(link){
if(link!=null && link !='http://localhost:4200/showcase')
linksArray.push(link);
})
});
});
it('all links navigate test ', () => {
linksArray.forEach(function (plink) {
console.log('going to get link'+plink);
browser.get(plink);
browser.sleep(5000);
});
});
});