Skip to content

Instantly share code, notes, and snippets.

@washingtonsoares
Created December 7, 2015 13:11
Show Gist options
  • Save washingtonsoares/d34206f119cdab052f34 to your computer and use it in GitHub Desktop.
Save washingtonsoares/d34206f119cdab052f34 to your computer and use it in GitHub Desktop.
describe('Test login', function() {
var ptor = protractor.getInstance();
describe('Login correto', function() {
it('Testando login e redirecionamento para os cursos', function() {
ptor.get('/#/login');
var form = ptor.findElement(By.id('form-login'));
var emailInput = form.findElement(By.id('email')).sendKeys('[email protected]');
var passwordInput = form.findElement(By.id('password')).sendKeys('123mudar');
form.submit();
expect(ptor.getCurrentUrl()).toEqual(ptor.baseUrl+'#/');
});
});
describe('Logout', function() {
it('Testando o logou e redirecionamento para o login', function() {
ptor.findElement(By.id('btn-logout')).click();
expect(ptor.getCurrentUrl()).toEqual(ptor.baseUrl+'#/login');
});
});
describe('Login incorreto', function() {
it('Testando um login incorreto e mensagem de email e senha inválidos', function() {
var form = ptor.findElement(By.id('form-login'));
var emailInput = form.findElement(By.id('email')).sendKeys('[email protected]');
var passwordInput = form.findElement(By.id('password')).sendKeys('12345');
form.submit();
expect(element(by.id('alert-wrong-login')).isPresent()).toEqual(true);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment