-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Edit login page test to use page objects
- Loading branch information
Showing
2 changed files
with
16 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
username: '#username', | ||
password: '#password', | ||
btnSubmit: 'form button[type="submit"]', | ||
banner: '#flash', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,21 @@ | ||
const login = require('../page-objects/login.page.js'); | ||
|
||
describe('the-internet.herokuapp.com login form', () => { | ||
it('should deny access with wrong creds', () => { | ||
browser.url('http://the-internet.herokuapp.com/login'); | ||
$('#username').setValue('test Wrong Name'); | ||
$('#password').setValue('test Wrong Password'); | ||
$('form button[type="submit"]').click(); | ||
$(login.username).setValue('test Wrong Name'); | ||
$(login.password).setValue('test Wrong Password'); | ||
$(login.btnSubmit).click(); | ||
|
||
expect($('#flash')).toHaveTextContaining('Your username is invalid!'); | ||
expect($(login.banner)).toHaveTextContaining('Your username is invalid!'); | ||
|
||
}); | ||
it('should accept access with correct creds', () => { | ||
browser.url('http://the-internet.herokuapp.com/login'); | ||
$('#username').setValue('tomsmith'); | ||
$('#password').setValue('SuperSecretPassword!'); | ||
$('form button[type="submit"]').click(); | ||
$(login.username).setValue('tomsmith'); | ||
$(login.password).setValue('SuperSecretPassword!'); | ||
$(login.btnSubmit).click(); | ||
|
||
expect($('#flash')).toHaveTextContaining('You logged into a secure area!'); | ||
expect($(login.banner)).toHaveTextContaining('You logged into a secure area!'); | ||
}); | ||
}); | ||
|