describe('getUserName.js', () => { test('it returns a string when passed an object', () => { const name = getUserName({ first: 'Andy', last: 'Warhol' }); expect(name).toBe('Andy Warhol'); }); test('it returns a string when passed a string', () => { const name = getUserName('Andy Warhol'); expect(name).toBe('Andy Warhol'); }); });
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('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 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 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('Should retrieve all context menu items', async t => { await t.rightClick('body'); var items = await getContextMenuItems(); await t .expect(items[0].label).eql('Test') .expect(items[1].label).eql('Test 2') .expect(items[2].label).eql('New Test') .expect(items[3].label).eql('New Test'); });
// 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 ...'); });
describe('parseMarkdown.js', () => { test('it returns HTML when passed a string of Markdown', () => { const html = parseMarkdown('### Testing\n**Markdown** is working.'); expect(html).toBe('<h3>Testing</h3>\n<p><strong>Markdown</strong> is working.</p>\n'); }); });
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('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('should be able to clear the cart', async t => { await t.expect(await AppHeaderPage.getCartAmount()).eql('1'); await MenuPage.restAppState(); await t.expect(await AppHeaderPage.getCartAmount()).eql(''); });
test('Should click on main menu [Selector]', async t => { await t.click('body'); await clickOnMainMenuItem(['Test', 'Click']); await t.expect(checkMainMenuClicked()).ok(); });
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 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) })