@nooreo92 wrote:
I am testing a login page that sends the credentials to an api, and returns either "error" if failed or "user@email.com" on success. If the response is successful, i want it to redirect to another page. So far, this is all I wrote, can someone help me fix this? because now it displays the result of the request.
describe('clicking on the login button', function() { var username, password, loginbutton beforeEach(function(){ browser.get('#/loginPage'); username= element(by.id('username')); password= element(by.id('password')); loginButton= element(by.id('loginButton')); }); it('should validate the credentials for a successful login and display the recommended view', function() { // username.sendKeys('user@gmail.com'); password.sendKeys('abc12345'); loginButton.click().then(function() { browser.get('http://website.com/api/login?email=user@gmail.com&password=abc12345') expect(browser.driver.getCurrentUrl()).toMatch('/menu.recommendedJobs') },10000) })
Posts: 5
Participants: 2