68 lines
2.1 KiB
JavaScript
68 lines
2.1 KiB
JavaScript
import { getMinimalMe } from '../../../support/helpers';
|
|
|
|
const MeQuery = getMinimalMe();
|
|
|
|
describe('Create Content Block', () => {
|
|
beforeEach(() => {
|
|
cy.setup();
|
|
|
|
cy.mockGraphqlOps({
|
|
operations: {
|
|
MeQuery,
|
|
ModuleDetailsQuery: {
|
|
module: {},
|
|
},
|
|
AddContentBlock: {
|
|
addContentBlock: {},
|
|
},
|
|
},
|
|
});
|
|
});
|
|
|
|
it('visits the page', () => {
|
|
// todo:
|
|
// add mocks
|
|
cy.visit('/module/some-module/add-after/bliblablub');
|
|
// add title
|
|
cy.getByDataCy('content-block-form-heading').should('exist');
|
|
cy.getByDataCy('content-list').should('not.exist');
|
|
cy.getByDataCy('save-button').should('exist').should('be.disabled');
|
|
cy.getByDataCy('content-block-title').within(() => {
|
|
cy.getByDataCy('input-with-label-input').type('Title of my book');
|
|
});
|
|
|
|
cy.getByDataCy('add-content-link').click();
|
|
cy.getByDataCy('chooser-heading').should('contain', 'Neuer Inhalt');
|
|
// add text element
|
|
cy.getByDataCy('choose-text-widget').click();
|
|
cy.get('.tip-tap__editor').last().type('Hallo Sam');
|
|
|
|
// add list item
|
|
cy.getByDataCy('add-content-link').last().click();
|
|
cy.getByDataCy('convert-to-list-checkbox').click();
|
|
// add text element to list item
|
|
cy.getByDataCy('choose-text-widget').click();
|
|
cy.getByDataCy('content-list').within(() => {
|
|
cy.get('.tip-tap__editor').last().type('Hallo Velo');
|
|
// add second list item
|
|
cy.getByDataCy('add-content-link').click();
|
|
// add text element to second list item
|
|
cy.getByDataCy('choose-text-widget').click();
|
|
cy.get('.tip-tap__editor').last().type('Hallo Velo');
|
|
// add another text element to second list item
|
|
cy.getByDataCy('add-content-link').last().click();
|
|
cy.getByDataCy('choose-text-widget').click();
|
|
cy.get('.tip-tap__editor').last().type('Hallo Outo');
|
|
});
|
|
// save
|
|
cy.getByDataCy('save-button').should('exist').should('not.be.disabled').click();
|
|
|
|
// another test
|
|
// go to page
|
|
// click cancel, go back
|
|
});
|
|
});
|
|
|
|
// todo: another test
|
|
// edit existing content block
|