await assertNoErrors(t); const stateContainer = Selector('#state'); const value = await stateContainer.innerText;
console.log('stateContainer exists'); const value = await stateContainer.innerText;
/** * Get the cart amount * * @return {Promise<string>} */ async getCartAmount() { await t.wait(500); return this.cart.innerText; }
/** * 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('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}`) })
/** * Return the error message text * * @returns {Promise<string>} */ getErrorMessage() { return this.errorMessage.innerText; }
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('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'); });
/** * Get the swag title * * @returns {Promise<string>} */ getSwagTitle(){ return this.swagTitle.innerText; }
test('Open page', async t => { debugger await t.expect(page.title.innerText).eql('Create Article') })
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 1 task and check it item', async t => { await t .typeText('input', 'task 1') .click('button') .expect(Selector('.alert').innerText).eql('task 1') })
/** * Return the error message text * * @returns {Promise<string>} */ getErrorMessage() { return this.errorMessage.innerText; }
test('Open page', async t => { debugger await t.expect(page.title.innerText).eql('Article #1') })