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.visit('/users');
cy.addUser(user1);
cy.get('[data-cy=users-table]').should('contain.text', user1);
});
it('should display filtered table containing user1 and not user2', () => {
- cy.task('add:user', user1);
- cy.task('add:user', user2);
+ const fixture = 'users.json';
+ cy.intercept('GET', '/api/users', { fixture }).as('users');
+ cy.visit('/users');
+ cy.wait('@users');
cy.filterByUser(user1);
cy.get('[data-cy=users-table]')
.should('contain.text', user1)
.should('not.contain.text', user2);
});
});
Last active
June 3, 2022 01:06
-
-
Save bobbyg603/dbaa0502428bd7d7a9e249ab1f56e3d5 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment