test('should allow users to login and see their documents', async (browser) => { await login({ email: 'user+1@test.com', password: 'password', browser, }); await browser.expect(getPageUrl()).contains('/documents'); });
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 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('Resize test', async t => { await t.resizeWindow(800, 600); var newSize = await t.eval(() => ({ width: window.innerWidth, height: window.innerHeight })); await t .expect(newSize.width).eql(800) .expect(newSize.height).eql(600); });
test('should be able to open the cart summary page', async t => { await setTestContext({ baseUrl: LoginPage.url, user: LOGIN_USERS.STANDARD, path: PAGES.SWAG_ITEMS, }); // The actual test await AppHeaderPage.openCart(); await t.expect(CartSummaryPage.isScreenDisplayed()).ok(); });
test('Take screenshot', async t => { var screenshotName = getTempFileName({ template: 'screenshot-XXXXXX.png' }); var screenshotPath = path.join('.screenshots', screenshotName); await t.takeScreenshot(screenshotName); await t.expect(statSync(screenshotPath).isFile()).ok(); });
// 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('Should retrieve main menu snapshot [Labels & Indexes]', async t => { let snapshot = await getMainMenuItem(['Test', 'New Menu']); await t.expect(snapshot.sublabel).eql('item 3'); snapshot = await getMainMenuItem(['Test', { label: 'New Menu', index: 2 }]); await t.expect(snapshot.sublabel).eql('item 4'); });
test('Should retrieve main menu snapshot [Labels & Indexes]', async t => { await t.rightClick('body'); let snapshot = await getContextMenuItem(['New Test']); await t.expect(snapshot.sublabel).eql('item 3'); snapshot = await getContextMenuItem([{ label: 'New Test', index: 2 }]); await t.expect(snapshot.sublabel).eql('item 4'); });
test('Should click on main menu [Snapshot]', async t => { await t.rightClick('body'); const snapshot = await getContextMenuItem(['Test']); await clickOnContextMenuItem(snapshot); await t.expect(checkContextMenuClicked()).ok(); });
test('should validate that we can continue shopping', async t => { await setTestContext({ baseUrl: LoginPage.url, user: LOGIN_USERS.STANDARD, path: PAGES.CHECKOUT_COMPLETE, }); await t.expect(CheckoutCompletePage.isScreenDisplayed()).ok(); });
test('Should retrieve main menu snapshot [Indexes]', async t => { await t.rightClick('body'); const snapshot = await getContextMenuItem([{ index: 2 }]); await t.expect(snapshot.sublabel).eql('item 2'); });
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) })