await assertNoErrors(t); const stateContainer = Selector('#state'); const exists = await stateContainer.exists; if (!exists) { console.log('stateContainer not exists');
test('create items in first shopping list', async t => { await t.click(Selector('a').withText('First Shopping List')) await t.wait(3000) await t.typeText(Selector('input[type=text]').nth(1), 'Item 1') await t.click(Selector('button').withText('Add Item')) await t.typeText(Selector('input[type=text]').nth(1), 'Item 2') await t.click(Selector('button').withText('Add Item')) await t.typeText(Selector('input[type=text]').nth(1), 'Item 3') await t.click(Selector('button').withText('Add Item')) await t.expect(Selector('label').withText('Item 1').exists).eql(true) await t.expect(Selector('label').withText('Item 2').exists).eql(true) await t.expect(Selector('label').withText('Item 3').exists).eql(true) })
test('should be able to login with a standard user', async t => { await LoginPage.signIn(LOGIN_USERS.STANDARD); await t.expect(SwagListPage.screen.exists).ok(); });
/** * Check if the homepage content loads */ test('Welcome Page Loads', async t => { await t // Check for h1 tag .expect(Selector('#root h1').innerText).eql('Hello there') // Check for input tag .expect(Selector('#root input[type="text"]').exists).ok() // Check for submit button .expect(Selector('#root button').exists).ok() })
test('create items in first shopping list', async (t) => { await loginFirstUser(t) await waitSelector( t, 'ShoppingLists', Selector('a').withText('First Shopping List') ) await t.click(Selector('a').withText('First Shopping List')) await waitSelector(t, 'ShoppingLists', Selector('input[type=text]').nth(1)) await t.typeText(Selector('input[type=text]').nth(1), 'Item 1') await t.click(Selector('button').withText('Add Item')) await t.typeText(Selector('input[type=text]').nth(1), 'Item 2') await t.click(Selector('button').withText('Add Item')) await t.typeText(Selector('input[type=text]').nth(1), 'Item 3') await t.click(Selector('button').withText('Add Item')) await t.expect(Selector('label').withText('Item 1').exists).eql(true) await t.expect(Selector('label').withText('Item 2').exists).eql(true) await t.expect(Selector('label').withText('Item 3').exists).eql(true) })
test('create items in second shopping list', async t => { await t.click(Selector('a').withText('Second Shopping List')) await t.wait(3000) await t.typeText(Selector('input[type=text]').nth(1), 'Item 1') await t.click(Selector('button').withText('Add Item')) await t.typeText(Selector('input[type=text]').nth(1), 'Item 2') await t.click(Selector('button').withText('Add Item')) await t.typeText(Selector('input[type=text]').nth(1), 'Item 3') await t.click(Selector('button').withText('Add Item')) await t.expect(Selector('label').withText('Item 1').exists).eql(true) await t.expect(Selector('label').withText('Item 2').exists).eql(true) await t.expect(Selector('label').withText('Item 3').exists).eql(true) })