Hi all, I'm new to testing with zombieJS and I'm having a block and I don't seem to understand it.
I have a link (anchor tag), that on click redirects to another url say `
http://www.example.com` from the testing page say `localhost:3000/global.html`
I have written a test to check if the href has a value which actually passes.
describe('On link click with redirect link', function() {
it('confirm that it has href value', function(done) {
var link = browser.link('#link2');
done();
});
it('do not follow that redirection', function(done){
var link = browser.query('#link');
browser.click(link, function(evt){
//Do something and not follow the redirection
//more like evt.preventDefault();
done();
})
});
it('redirects page to href value', function(done){
var link = browser.query('#link');
browser.click(link, function(){
assert(browser.redirected);
done();
})
});
});
the remaining two tests fail because I couldn't detect or stop the browser from loading the page if it detects redirection.
Please can anyone advice on what I need to do?.
Also is there an underlying principle or what is generally the concept around testing browser redirection.
PS: I have also tried using browser.wait, but the test is still failing.
Thanks!