Skip to content

Instantly share code, notes, and snippets.

@jessesanders
Created December 7, 2018 18:49
Show Gist options
  • Save jessesanders/fbc341c26f124c0c4b010c5de5153a31 to your computer and use it in GitHub Desktop.
Save jessesanders/fbc341c26f124c0c4b010c5de5153a31 to your computer and use it in GitHub Desktop.
Simple cypress test example
beforeEach(() => {
cy.visit('https://example.cypress.io/commands/actions')
});
it('.within() - query DOM elements within a specific element', () => {
// https://on.cypress.io/within
cy.get('.query-form').within(() => {
cy.get('input:first').should('have.attr', 'placeholder', 'Email')
cy.get('input:last').should('have.attr', 'placeholder', 'Password')
})
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment