Skip to content

Instantly share code, notes, and snippets.

@Test
public void addUser_checkReturnedData_shouldCorrespondToDataSent() {
GraphQLQuery query = new GraphQLQuery();
query.setQuery("mutation insert_users ($id: uuid!, $name: String!, $rocket: String!) { insert_users(objects: {id: $id, name: $name, rocket: $rocket}) { returning { id name rocket } } }");
User myUser = new User(
UUID.randomUUID(),
"Bas",
"My awesome rocket"
it('should trigger an alert with a message', () => {
cy.get('#alert-button').click();
cy.on('window:alert', (text) => {
expect(text).to.contains('This is an alert!');
});
});
it('should trigger a confirmation with a message', () => {
cy.get('#confirm-button').click();
cy.on('window:confirm', (text) => {
expect(text).to.contains('Would you like to confirm?');
});
cy.get('#confirm-answer').contains('Answer: Yes');
});
cy.on('window:confirm', (text) => {
expect(text).to.contains('Would you like to confirm?');
return false;
});
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.window().then(win => {
cy.stub(win, 'prompt').callsFake(() => null);
alert('This is an alert!');
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');
});
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')
});
});
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');