-
Notifications
You must be signed in to change notification settings - Fork 45
/
66.test.js
31 lines (26 loc) · 1.06 KB
/
66.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const getDataTestIdSelector = dataTestId => `[data-testid="${dataTestId}"]`
describe('Login', () => {
beforeEach(async () => {
console.log('beforeEach do teste');
await page.goto(BASE_URL)
})
it('shows error message when password is not set', async () => {
console.log('preenchendo email');
await page.type(getDataTestIdSelector('email'), '[email protected]')
console.log('preenchendo senha');
await page.type(getDataTestIdSelector('senha'), 'teste')
console.log('clicando entrar');
await page.click(getDataTestIdSelector('entrar'))
console.log('esperando \'logout\'');
await page.waitForSelector(getDataTestIdSelector('logout'))
expect(true).toBe(false)
})
xit('successful login', async () => {
await page.type(getDataTestIdSelector('email'), '[email protected]')
await page.type(getDataTestIdSelector('senha'), 'somepass')
await page.click(getDataTestIdSelector('entrar'))
await page.waitForSelector(getDataTestIdSelector('logout'))
const url = await page.url()
expect(url).toContain('/admin/home')
})
})