Automation with Cypress

[Pages:82]Automation with Cypress

Corina Pip

@imalittletester

Installation

? Install Node (). Check version with: node ?version

? Install npm (). Check version with: npm ?v

? Install Visual Studio Code from ? On your machine create folder: cypresstutorial. Open it in Visual Studio Code ? In the Terminal in Visual Studio Code: npm init -y. A new .json file will be

created in your folder. ? Install Cypress by typing in the same terminal: npm install cypress ? Once the installation is finished, in the console: npx cypress open. The Cypress

test runner window should open. You are done.

Default Configuration

? Override any default configuration in: cypress.json

? Can override configurations per test (in 'it' declaration) or in commands

? A few default configurations:

defaultCommandTimeout = 4 sec downloadsFolder = cypress/downloads integrationFolder = cypress/integration

pageLoadTimeout = 60 sec fixturesFolder = cypress/fixtures screenshotsFolder = cypress/screenshots

Default Configuration

{

it('first test', () => {

}) })

Command chaining

? A command:

? For identifying page elements ? For interacting with page elements ? For validating the interactions (assertions) ? Others: e.g. clearing cookies

? Chaining:

? Some commands can only be chained from cy (e.g. clearCookies()) ? Others can be chained to other commands. E.g.

cy.identificationComand.interactionCommand.assertionCommand

? Multiple commands of same type can be chained together (e.g. for identification to be very specific; multiple interactions like clearing before typing)

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download