O
import LoginPage from '../pages/LoginPage.js'
describe('login form', () => {
it('should deny access with wrong creds', () => {
LoginPage.open()
LoginPage.username.setValue('foo')
LoginPage.password.setValue('bar')
LoginPage.submit()
expect(LoginPage.warning).toHaveText(`Sorry, the login/password you have entered seem to be incorrect. Please check your login credentials and try again.`)
})
it('should allow access with correct creds', () => {
LoginPage.open()
LoginPage.username.setValue('Administrator')
LoginPage.password.setValue('admin!')
LoginPage.submit()
expect(browser).toHaveTitle('Welcome');
})
})
class LoginPage {
get login() { return $('#login-input') }
get password() { return $('#password') }
get submitBtn() { return $('div.login') }
get warning() { return $('div.message-content') }
open() {
browser.url('Login')
}
submit() {
this.submitBtn.click()
}
}
export default new LoginPage()