skillbox/client/cypress/integration/frontend/custom-content-block.spec.js

76 lines
1.7 KiB
JavaScript

import getMe from '../../fixtures/me.minimal';
import module from '../../fixtures/module.minimal';
import mocks from '../../fixtures/mocks';
// title: String
// slug: String!
// hiddenFor: [SchoolClassNode]
// visibleFor: [SchoolClassNode]
// userCreated: Boolean!
// contents: GenericStreamFieldType
// type: String
// id: ID!
// mine: Boolean
// bookmarks: [ContentBlockBookmarkNode]
// originalCreator: PublicUserNode
const chapters = [{
title: 'ABC',
description: 'DEF',
contentBlocks: [
{
title: 'A ContentBlock',
userCreated: true,
mine: true,
contents: [],
},
],
}];
const operations = {
MeQuery: {
me: getMe(true),
},
ModuleDetailsQuery: {
module: {
...module,
chapters,
},
},
DeleteContentBlock: {
success: true,
},
};
describe('Custom Content Block', () => {
before(() => {
cy.task('getSchema').then(schema => {
cy.mockGraphql({
schema,
mocks,
operations,
});
});
cy.viewport('macbook-15');
});
it.skip('Deletes the custom content block and removes it from the view', () => {
cy.fakeLogin('ross.geller', 'test');
cy.visit('module/some-module');
cy.log('Toggling Edit Mode');
cy.getByDataCy('toggle-editing').click();
cy.getByDataCy('module-title').should('exist');
cy.get('.content-block').should('have.length', 1);
cy.log('Opening More Menu');
cy.getByDataCy('more-options-link').click();
// check if content block is still there
cy.log('Deleting Content Block');
cy.getByDataCy('delete-content-block-link').click();
cy.get('.content-block').should('have.length', 0);
});
});