test('create first shopping list', async (t) => { await loginFirstUser(t) await waitSelector(t, 'ShoppingLists', Selector('.example-form-control')) await t.typeText( await Selector('.example-form-control'), 'First Shopping List' ) await t.click(await Selector('button').withText('Add Shopping List')) await refreshAndWait(t, () => Selector('.shopping-list').count, 2) })
test.disablePageReloads('Create article through form', async t => { debugger const typeOptions = { paste: true } await t.typeText(page.inputs.title, title, typeOptions) await t.typeText(page.inputs.teaser, teaser, typeOptions) await t.typeText(page.inputs.body, body, typeOptions) await t.typeText(page.inputs.published_at, publishedAt) await t.click(page.form.find('button[type=submit]')) await t.expect(page.title.innerText).eql(`Article #${db.articles.length + 1}`) })
test('create second shopping list', async t => { await t.typeText(Selector('input[type=text]').nth(0), 'Second Shopping List') await t.click(Selector('button').withText('Add Shopping List')) await t.expect(await Selector('td > a').count).eql(2) })
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('Create 3 task and check it items', async t => { await t .typeText('input', 'task 1') .click('button') .typeText('input', 'task 2') .click('button') .typeText('input', 'task 3') .click('button') .expect(Selector('.alert').count).eql(3) .expect(Selector('.alert').nth(0).innerText).eql('task 1') .expect(Selector('.alert').nth(1).innerText).eql('task 2') .expect(Selector('.alert').nth(2).innerText).eql('task 3') })
test('Create 1 task and check it item', async t => { await t .typeText('input', 'task 1') .click('button') .expect(Selector('.alert').innerText).eql('task 1') })
test('Edit article through form', async t => { debugger const typeOptions = { paste: true, replace: true } await t.typeText(page.inputs.title, title, typeOptions) await t.click(page.form.find('button[type=submit]')) await t.expect(page.title.innerText).eql('Articles') const titleFields = Selector('[data-test="field-title"]') await t.expect(titleFields.nth((await titleFields.count) - 1).innerText).eql(title) })
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('Test greeting form: with name', async t => { await t // Input name .typeText(Selector('#root input[type="text"]'), 'Atreus', { replace: true }) // Click submit button .click(Selector('#root button')) .expect(Selector('#root h1').innerText).eql('hello Atreus!') })
// specify the start page //then create a test and place your code there test('My first test', async t => { await t .typeText('div.FPdoLc.VlcLAe > center > input:nth-of-type(1)', 'Aditya Inapurapu') .pressKey('enter') // Use the assertion to check if the actual header text is equal to the expected one .expect(Selector('#rso > div:first-child > div.srg > div:first-child > div > div.rc > h3.r > a').innerText).eql('Aditya Inapurapu - Senior Automation / Release Engineer - Blue ...'); });
test('create second shopping list', async (t) => { await loginFirstUser(t) await waitSelector(t, 'ShoppingLists', Selector('.example-form-control')) await t.typeText( await Selector('.example-form-control'), 'Second Shopping List' ) await t.click(await Selector('button').withText('Add Shopping List')) await refreshAndWait(t, () => Selector('.shopping-list').count, 3) })
test('create first shopping list', async t => { await t.typeText(Selector('input[type=text]').nth(0), 'First Shopping List') await t.click(Selector('button').withText('Add Shopping List')) await t.expect(await Selector('td > a').count).eql(1) })
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) })