@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.
the senario.js
describe('clicking on the login button', function() { var username, password, loginbutton,httpBackend, result beforeEach(function(){ browser.get('#/loginPage'); username= element(by.id('username')); password= element(by.id('password')); loginButton= element(by.id('loginButton')); }); // checks credentials it('should validate the credentials for a successful login', function() { username.sendKeys('user@gmail.com'); password.sendKeys('12345'); loginButton.click().then(function($httpBackend) { $httpBackend.whenGET('http://website.com/api/login?email=user@gmail.com&password=12345').respond('1 - user@gmail.com' ) }) }) })
Posts: 1
Participants: 1