Skip to content

Instantly share code, notes, and snippets.

import { Selector } from 'testcafe';
fixture`The Kitchen - Select`
.page`https://kitchen.applitools.com/ingredients/select`
const ingredientsSelect = Selector('#spices-select-single');
const ingredientsOption = ingredientsSelect.find('option');
test('TestCafe', async t => {
await t
const { Builder, By } = require('selenium-webdriver');
const chrome = require('selenium-webdriver/chrome');
const assert = require('assert');
describe('DemoApp - ClassicRunner', function () {
it('Smoke Test', async () => {
const driver = await new Builder()
.forBrowser('chrome')
.setChromeOptions(new chrome.Options())
.build();
const puppeteer = require('puppeteer')
describe('Puppeteer + Jest', () => {
test('should select an ingredient from the list', async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://kitchen.applitools.com/ingredients/select');
await page.select('#spices-select-single', 'garlic');
const { chromium } = require('playwright')
describe('Playwright + Jest', () => {
test('should select an ingredient from the list', async () => {
const browser = await chromium.launch();
const page = await browser.newPage();
await page.goto('https://kitchen.applitools.com/ingredients/select');
await page.selectOption('#spices-select-single', 'garlic');
context('Cypress', () => {
it('should select an ingredient from the list', () => {
cy.visit('https://the-kitchen-applitools.netlify.app/ingredients/select')
cy.get('#spices-select-single').select('garlic').should('have.value', 'garlic')
});
});
describe('Protractor', function() {
it('should select an ingredient from the list', function() {
browser.waitForAngularEnabled(false);
browser.get('https://kitchen.applitools.com/ingredients/select');
element(by.id('spices-select-single')).click();
element(by.css("#spices-select-single [value='garlic']")).click();
expect(element(by.id('spices-select-single')).getAttribute('value')).toEqual('garlic');
});
alert('This is an alert!');
cy.window().then(win => {
cy.stub(win, 'prompt').callsFake(() => null);
it('should trigger a prompt with a message', () => {
cy.window().then(win => {
cy.stub(win, 'prompt').returns('This is my answer.');
cy.get('#prompt-button').click();
cy.get('#prompt-answer').contains('Answer: This is my answer.');
});
});
cy.on('window:confirm', (text) => {
expect(text).to.contains('Would you like to confirm?');
return false;
});