Skip to main content

Cypress SDK Commands

Below are the most essential commands offered by the Applitools Cypress SDK.

eyesOpen()

This command initializes a session with the Applitools server, allows you to configure the Eyes object and marks the beginning of a Visual AI Test.

This function must be called before any calls to cy.eyesCheckWindow(). Therefore, it is recommended to place it in the beforeEach or the before hook for your test suite:

beforeEach(() => {
// Start Applitools Visual AI Test
cy.eyesOpen({
appName: 'ACME Bank',
testName: Cypress.currentTest.title,
})
})

Parameters

This command takes a Configuration Object as a parameter. Check out that page for a full list of configuration options.

eyesCheckWindow()

This command takes a Visual AI assertion of the current status of the page that you're testing. This method should be called after cy.eyesOpen():

cy.eyesCheckWindow({
tag: "Login page"
});
Checkpoint Configuration

For a full guide on the types of checkpoints available, check out Checkpoint Configuration

eyesClose()

The cy.eyesClose() command is the opposite of cy.eyesOpen() and marks the end of your Visual AI Test. This method should be called once per call to cy.eyesOpen(). So, if you're calling cy.eyesOpen() in the beforeEach hook, then call this method in the afterEach hook:

afterEach(() => {
// End Applitools Visual AI Test
cy.eyesClose()
})

eyesGetAllTestResults()

This command returns an object with the Eyes test results from a given test or test file. This command should be called after cy.eyesClose():

after(() => {
cy.eyesGetAllTestResults().then(summary => {
console.log(summary)
})
})

eyesGetResults()

Returns TestResults for all tests that were were run in an Eyes instance. If the test was run with the Ultrafast Grid, TestResults includes results for all environments. If you call getResults before cy.eyesClose() the method aborts the test.

cy.eyesGetResults().then(results => {...})
cy.eyesGetResults({throwErr: true}).then(results => {...})
cy.eyesGetResults({throwErr: false}).then(results => {...})