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('Delete Test', async t => { await t .click(Selector('td').withText('Delete').nth(-1).find('.btn.btn-dark').nth(0)) .expect(Selector('tr').nth(-1).child().nextSibling(0).innerText).notEql('Pontiac') .expect(Selector('tr').nth(-1).child().nextSibling(1).innerText).notEql('TransAm') .expect(Selector('tr').nth(-1).child().nextSibling(2).innerText).notEql('1993'); });
test.disablePageReloads('Article can not be created without title', async t => { debugger await t.click(page.form.find('button[type=submit]')) await t.expect(Selector('#title-helper-text').innerText).eql('Title is required') })
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 submitting the form without data */ test('Test greeting form: empty input', async t => { await t // Click submit button .click(Selector('#root button')) .expect(Selector('#root h1').innerText).eql('you didn\'t tell me who you are.') })
test.disablePageReloads('Article can not be saved without title', async t => { debugger await t.selectText(page.inputs.title.find('input'), 0).pressKey('delete') await t.click(page.form.find('button[type=submit]')) await t.expect(Selector('#title-helper-text').innerText).eql('Title is required') })
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('Should click on main menu [Selector]', async t => { await t.click('body'); await clickOnMainMenuItem(['Test', 'Click']); await t.expect(checkMainMenuClicked()).ok(); });
test('remove items in second shopping list', async t => { await t.click(Selector('a').withText('Second Shopping List')) await t.wait(3000) await t.click(Selector('.example-close-button')) await t.click(Selector('.example-close-button')) await t.click(Selector('.example-close-button')) await t.expect(await Selector('td > a').count).eql(0) })
test('Should click on main menu [Snapshot]', async t => { await t.click('body'); const snapshot = await getMainMenuItem(['Test', 'Click']); await clickOnMainMenuItem(snapshot); await t.expect(checkMainMenuClicked()).ok(); });
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('Should handle Open Dialog', async t => { await t.click('body'); await setElectronDialogHandler(type => type + ' handled'); await clickOnMainMenuItem(['Test', 'Dialog']); await t.expect(checkDialogHandled()).eql('open-dialog handled'); });
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('remove items in first shopping list', async t => { await t.click(Selector('a').withText('First Shopping List')) await t.wait(3000) await t.click(Selector('.example-close-button')) await t.click(Selector('.example-close-button')) await t.click(Selector('.example-close-button')) await t.expect(await Selector('td > a').count).eql(0) })