/** * Get the cart amount * * @return {Promise<string>} */ async getCartAmount() { await t.wait(500); return this.cart.innerText; }
/** * Remove swag from the cart based on text or a number * * @param {number|string} needle * * @return {Promise<void>} */ removeSwag(needle) { return t.click(this.getSwagRemoveButton(needle)); }
// 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.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('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); });
/** * Open the about page * * @returns {Promise<void>} */ async openAboutPage() { return t.click(this.aboutButton); }
/** * Add a swag item to the cart * * @param {number|string} needle * * @returns {Promise<void>} */ addSwagToCart(needle) { return t.click(this.getSwagItemAddButton(needle)); }
/** * Open the cart * * @returns {Promise<void>} */ openCart() { return t.click(this.cart); }
/** * Cancel checkout * * @returns {Promise<void>} */ cancelCheckout() { return t.click(this.cancelButton); }
/** * Add the item to the cart * * @returns {Promise<void>} */ addToCart(){ return t.click(this.addButton); }
/** * Finsh checkout * * @returns {Promise<void>} */ finishCheckout() { return t.click(this.finishButton); }
/** * Remove the item from the cart * * @returns {Promise<void>} */ removeFromCart(){ return t.click(this.removeButton); }
/** * Remove a swag item from the cart * * @param {number|string} needle * * @returns {Promise<void>} */ removeSwagFromCart(needle) { return t.click(this.getSwagItemRemoveButton(needle)); }
/** * Cancel checkout * * @returns {Promise<void>} */ cancelCheckout() { return t.click(this.cancelButton); }