skillbox/client/cypress/integration/frontend/sidebar.spec.js

41 lines
971 B
JavaScript

import {getMinimalMe} from '../../support/helpers';
describe('Sidebar', () => {
beforeEach(() => {
cy.setup();
});
it('should open sidebar and stay open', () => {
const {me} = getMinimalMe({});
const operations = {
MeQuery: {
me: {
...me,
schoolClasses: {
edges: [
...me.schoolClasses.edges,
{node: {}},
],
},
},
},
ProjectsQuery: {
projects: [],
},
};
cy.mockGraphqlOps({
operations,
});
cy.visit('/portfolio');
cy.getByDataCy('sidebar').should('not.exist');
cy.getByDataCy('user-widget-avatar').click();
cy.getByDataCy('sidebar').should('exist');
cy.getByDataCy('class-selection').click();
cy.getByDataCy('class-selection-entry').should('have.length', 2);
cy.getByDataCy('close-profile-sidebar-link').click();
cy.getByDataCy('sidebar').should('not.exist');
});
});