I am currently working on an Angular application that consists of a login page and a landing page. My goal is to create a Protractor assertion that can verify the successful login and ensure that the landing page displays correct content.
The login process involves checking for a valid user via a JSON call to an endpoint. Once validated, it redirects to the landing page. This functionality performs as expected outside of testing. However, when running the assertion test case provided below, it seems to halt during the waiting period and completes without actually asserting anything:
//Attempting login with valid credentials
it('should attempt to login with valid credentials', function() {
element(by.css('#login_username')).sendKeys('testusername');
element(by.css('#login_password')).sendKeys('testpassword');
element(by.css('.btn-default')).click();
browser.driver.sleep(20000);
//Checking heading on landing page
expect(by.css('h1').html()).toEqual("Landing");
});
I'm unsure whether submitting the form button should be sufficient to pause Protractor while the next page loads, or if there's a step missing in my test setup. Any suggestions on how to proceed would be greatly appreciated.