I am writing a test for login into non-angular application.
describe('login Test for App', function () {
beforeEach(function () {
browser.ignoreSynchronization=true;
browser.get(loginPageURL,2000);
});
it('It should Login a User', function () {
element(by.id('username')).sendKeys(constants.userName);
element(by.id('password')).sendKeys(constants.password);
element(by.id('Login')).click().then(function () {
// Waiting to open modal
browser.wait(function () {
return browser.getCurrentUrl().then(function (url) {
return url==dashboardUrl;
});
});
});
});
});
After login, I want to check currentUrl. But After login button click, It waits till dashboard url appeared. But when after loginbutton click, It go to diffrent url, Then it also wait for dashboard url infinite. I want to check current url after login event, if it is not dashboard url, then it should fail, and do not run next test suite cases, because login Test is failed.
Like-
When clickOn login button.
- Wait for complete page load.
2.Then check current url, If it is not dashboard url, then test should failed, and not proceed for any test cases.