It's important to check the current URL and get the title of the HTML page. In my test, I clicked on the "My Account" button but since the user hadn't logged in before, the website redirected to the login page. I then used sendKeys to enter the username and password before clicking the login button. However, even after calling browser.getCurrentUrl() and browser.getTitle(), it still returned the same title as before logging in.
beforeEach(function () {
browser.ignoreSynchronization = true;
browser.get('https://*******************.net/');
});T
it(' children (li) of parent (ul) with class(nav) should have names Login/Register/Forgot Password/Forgot Username', function () {
var myAccount = element(by.id('navItem_MyAccount'));
myAccount.click();
list = element.all(by.css('#tabs-Login li'));
expect(list.get(0).getText()).toBe('Login');
expect(list.get(1).getText()).toBe('Register');
expect(list.get(2).getText()).toBe('Forgot Password');
expect(list.get(3).getText()).toBe('Forgot Username');
}, 10000);
it(' logIn should be active', function () {
var myAccount = element(by.id('navItem_MyAccount'));
myAccount.click();
_login = element.all(by.css('.active'));
expect(list.get(0).getText()).toBe('Login');
}, 1000);
it(' Page Title should be iSportsman: Home ', function () {
var _login = element.all(by.css('#Login'));
var log = element.all(by.css('#btnLogin'));
var _loginPw = element.all(by.css('#inputRow-Password'));
_login.sendKeys('************************');
console.log('step1 done');
_loginPw.sendKeys('*********');
console.log('step2 done');
log.click();
console.log('step3 done');
var _url = browser.getCurrentUrl();
console.log(_url.toString());
browser.get(_url.toString());
browser.getTitle().then(function (title) {
expect(title).toEqual('imakerman: Home');
})
},10000);
});