Skip to content

Instantly share code, notes, and snippets.

debugger;
await t
.click('#populate')
.click('#submit-button');
await t
.click('#populate')
.debug()
.click('#submit-button');
await t
.setNativeDialogHandler(() => true)
.takeScreenshot(‘./screenshots’)
.click('#populate')
.takeScreenshot(‘./screenshots’)
.click('#submit-button');
.selector-icon {
width: 30px;
height: 30px;
min-width: 30px;
min-height: 30px;
&.html {
background: url(./images/sprite.png) -156px -76px no-repeat;
}
import { Selector, ClientFunction } from 'testcafe';
fixture `Let\'s take a look at the new TestCafe`
.page `url of delivery service here (hidden not to be an ad)`;
test(`Get a pizza`, async t => {
await t
.click(Selector('#menu-primary-menu').find('li').nth(2))
.switchToIframe('iframe');
import { Selector, ClientFunction } from 'testcafe';
fixture `Let\'s take a look at the new TestCafe`
.page `url of delivery service here (hidden not to be an ad)`;
class PizzaForm {
constructor (pizzaTitle, size) {
this.form = Selector('form').withAttribute('data-item-name', pizzaTitle);
this.sizeSelect = this.form.find('select[name="size"]');
this.sizeOption = this.sizeSelect.find('option').withText(size);
fixture `Let\'s take a look at the new TestCafe`
.page `url of delivery service here (hidden not to be an ad)`;
test(`Get a pizza`, async t => {
// TODO: test
});
test(`Get a pizza`, async t => {
await t.click(Selector('#menu-primary-menu').find('li').nth(2));
});
await t.switchToIframe('iframe');
const deferredOrderingButton = await Selector('#submit_ordering');
if (deferredOrderingButton.exists)
await t.click(deferredOrderingButton);
let pizzaForm = Selector('form').withAttribute('data-item-name', 'White Primavera');
const sizeSelect = pizzaForm.find('select[name="size"]');
const order = Selector('#order');
const orderItem = order.find('.order_item');
const orderItemTitle = order.find('.order_item > h3');
const orderItemDetail = order.find('.order_item > .item-detail');
const totalPriceElemnt = order.withText('Subtotal').find('strong');
await t
.expect(orderItem.count).eql(1)
.expect(orderItemTitle.textContent).contains('White Primavera')
.expect(orderItemDetail.textContent).contains('Large')