skillbox/client/cypress/e2e/frontend/survey.spec.js

105 lines
2.0 KiB
JavaScript

const module = require('../../fixtures/module.json');
describe('Survey', () => {
beforeEach(() => {
cy.setup();
});
it('should display a matrix correctly', () => {
// todo: fix bitbucket hickup and re-enable
let answer = null;
cy.mockGraphqlOps({
operations: {
MeQuery: {
me: {
permissions: [],
},
},
ModuleQuery: (variables) => ({ module }),
SurveyQuery: () => ({
survey: {
id: 'U3VydmV5Tm9kZTox',
title: 'Test',
data: ` {
"title": "Titel Übung",
"logoPosition": "right",
"pages": [
{
"name": "page1",
"elements": [
{
"type": "matrixdropdown",
"name": "question3",
"title": "Frage",
"columns": [
{
"name": "Column 1",
"title": "Spalte A"
},
{
"name": "Column 2",
"title": "Spalte B"
}
],
"choices": [
"Placeholder"
],
"cellType": "checkbox",
"rows": [
{
"value": "Row 1",
"text": "Zeile 1"
},
{
"value": "Row 2",
"text": "Zeile 2"
},
{
"value": "Row 3",
"text": "Zeile 3"
}
]
}
],
"title": "Titel Seite 1"
}
]
}
`,
module: {
id: 'TW9kdWxlTm9kZToxNw==',
__typename: 'ModuleNode',
},
answer,
__typename: 'SurveyNode',
},
}),
UpdateAnswer: (variables) => {
answer = variables.input.answer;
return {
updateAnswer: {
answer,
__typename: 'UpdateAnswerPayload',
},
};
},
ModuleSolutions: {
module: {
solutionsEnabled: false,
},
},
},
});
cy.visit('/survey/U3VydmV5Tm9kZTox');
cy.get('h1').should('contain', 'Titel Übung');
cy.get('.base-input-container__label').should('not.be.visible');
// cy.get('[value="Speichern & Weiter"]').click();
});
});