Matteo Scandolo | d3b57a1 | 2017-04-20 14:33:04 -0700 | [diff] [blame] | 1 | const config = require('../test_helpers/config'); |
| 2 | const user = require('../test_helpers/user'); |
| 3 | const pwd = user.pwd; |
| 4 | const username = user.username; |
| 5 | const loginPage = require('./login.po'); |
| 6 | |
| 7 | describe('XOS Login page', function() { |
| 8 | |
| 9 | beforeEach(() => { |
| 10 | browser.get(`${config.url}/login`); |
| 11 | }); |
| 12 | |
| 13 | it('should not login with a wrong password', function() { |
| 14 | loginPage.sendUsername(username); |
| 15 | loginPage.sendPassword('wrongpwd'); |
| 16 | loginPage.submit(); |
| 17 | |
| 18 | const alert = element(by.css('.alert.alert-danger')); |
| 19 | expect(alert.isDisplayed()).toBeTruthy(); |
| 20 | }); |
| 21 | |
| 22 | it('should login', () => { |
| 23 | loginPage.sendUsername(username); |
| 24 | loginPage.sendPassword(pwd); |
| 25 | loginPage.submit(); |
| 26 | |
| 27 | expect(browser.getCurrentUrl()).toEqual(`${config.url}/dashboard`); |
| 28 | }); |
| 29 | }); |