Skip to content

Instantly share code, notes, and snippets.

@bobbyg603
Last active June 2, 2022 23:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bobbyg603/e66206a1287277f80ef2f6b314e9772c to your computer and use it in GitHub Desktop.
Save bobbyg603/e66206a1287277f80ef2f6b314e9772c to your computer and use it in GitHub Desktop.
3 and 1/2 Reasons Your Tests Should Be Stateless
describe('Users Table', () => {
const user1 = 'bobby@bugsplat.com';
const user2 = 'bobbyg603@pm.me';
beforeEach(() => {
cy.visit('/users');
});
it('should add a user to the table', () => {
cy.addUser(user1);
cy.get('[data-cy=users-table]').should('contain.text', user1);
});
it('should display filtered table containing user1 and not user2', () => {
cy.addUser(user2);
cy.filterByUser(user1);
cy.get('[data-cy=users-table]')
.should('contain.text', user1)
.should('not.contain.text', user2);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment