Skip to content

Instantly share code, notes, and snippets.

@strass
Last active May 3, 2018 16:45
Show Gist options
  • Save strass/6d2785856fbcbb8745ffb554249da58f to your computer and use it in GitHub Desktop.
Save strass/6d2785856fbcbb8745ffb554249da58f to your computer and use it in GitHub Desktop.
// Doesnt work (puts everything in password field):
const emailField = cy.getByLabelText('Email Address');
const passwordField = cy.getByLabelText('Password');
emailField.type('[email protected]');
passwordField.type('password01');
// Works (types in correct inputs):
const emailField = cy.getByLabelText('Email Address');
emailField.type('[email protected]');
const passwordField = cy.getByLabelText('Password');
passwordField.type('password01');
@kentcdodds
Copy link

This should be written like:

cy
  .getByLabelText('Email Address')
  .type('[email protected]')
  .getByLabelText('Password')
  .type('password01')

That's more idiomatic cypress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment