File size: 1,516 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
import data from '../../shared/testing/data';
const user = data.users.find(user => user.username === 'brian');
describe('/messages', () => {
beforeEach(() => {
cy.auth(user.id).then(() => cy.visit('/messages'));
});
it('should load list of direct messages', () => {
cy.contains('Max Stoiber and Bryn Jackson').should('be.visible');
cy.contains('A fifth one').should('be.visible');
cy.contains('Previous member').should('be.visible');
cy.contains('No messages yet...').should('be.visible');
});
it('should select an individual conversation', () => {
cy.contains('Max Stoiber and Bryn Jackson')
.should('be.visible')
.click();
cy.get('[data-cy="dm-header"]').should('be.visible');
cy.get('[data-cy="dm-header"]').contains('Max Stoiber, Bryn Jackson');
cy.get('[data-cy="message"]').should($p => {
expect($p).to.have.length(5);
});
});
it('should switch conversations', () => {
cy.contains('Max Stoiber and Bryn Jackson')
.should('be.visible')
.click();
cy.get('[data-cy="dm-header"]').should('be.visible');
cy.get('[data-cy="dm-header"]').contains('Max Stoiber, Bryn Jackson');
cy.get('[data-cy="message"]').should($p => {
expect($p).to.have.length(5);
});
cy.contains('Previous member')
.should('be.visible')
.click();
cy.get('[data-cy="dm-header"]').should('not.be.visible');
cy.get('[data-cy="message"]').should($p => {
expect($p).to.have.length(0);
});
});
});
|