UNPKG

cypress-example-kitchensink

Version:

This is an example app used to showcase Cypress.io testing. For a full reference of our documentation, go to https://docs.cypress.io

33 lines (27 loc) 1.04 kB
/// <reference types="cypress" /> /* eslint-disable cypress/no-unnecessary-waiting */ context('Waiting', () => { beforeEach(() => { cy.visit('http://localhost:8080/commands/waiting') }) // BE CAREFUL of adding unnecessary wait times. // https://on.cypress.io/best-practices#Unnecessary-Waiting // https://on.cypress.io/wait it('cy.wait() - wait for a specific amount of time', () => { cy.get('.wait-input1').type('Wait 1000ms after typing') cy.wait(1000) cy.get('.wait-input2').type('Wait 1000ms after typing') cy.wait(1000) cy.get('.wait-input3').type('Wait 1000ms after typing') cy.wait(1000) }) it('cy.wait() - wait for a specific route', () => { // Listen to GET to comments/1 cy.intercept('GET', '**/comments/*').as('getComment') // we have code that gets a comment when // the button is clicked in scripts.js cy.get('.network-btn').click() // wait for GET comments/1 cy.wait('@getComment').its('response.statusCode').should('be.oneOf', [200, 304]) }) })