Last active
June 19, 2021 08:46
-
-
Save hoangsetup/498e774098568353e1e3b3db49435b6c to your computer and use it in GitHub Desktop.
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
import loginPo from './pages/login.po'; | |
describe('Login', () => { | |
beforeEach(async () => { | |
await loginPo.go(); | |
}); | |
it.each` | |
username | password | message | |
${'wrong_username'}| ${'secret_sauce'} | ${'Epic sadface: Username and password do not match any user in this service'}, | |
${'standard_user'}| ${'wrong_password'} | ${'Epic sadface: Username and password do not match any user in this service'}, | |
${'locked_out_user'}| ${'secret_sauce'} | ${'Epic sadface: Sorry, this user has been locked out.'} | |
`('should display "$message" when username|password is "$username|$password"', async ({ username, password, message }) => { | |
await loginPo.login(username, password); | |
expect(await loginPo.getErrorMessage()).toEqual(message); | |
}); | |
it('should go to inventory page when username and password are correct', async () => { | |
await loginPo.login('standard_user', 'secret_sauce'); | |
expect(page.url()).toContain('/inventory.html'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment