Add test to check solution display in surveys

This commit is contained in:
Ramon Wenger 2020-01-16 16:07:00 +01:00
parent 00b2b02113
commit 6b8b520bc5
2 changed files with 22 additions and 5 deletions

View File

@ -27,6 +27,13 @@ describe('Solutions', () => {
cy.get('[data-cy=toggle-enable-solutions]')
.should('not.exist');
cy.get('[data-cy=solution]').should('not.exist');
cy.visit('/survey/U3VydmV5Tm9kZTox');
cy.get('.survey__page').should('exist');
cy.get('[data-cy=solution]').should('not.exist');
cy.get('.close-button').click();
cy.logout();
cy.visit('/module/lohn-und-budget');
@ -54,6 +61,11 @@ describe('Solutions', () => {
.should('contain', 'ausblenden');
});
cy.visit('/survey/U3VydmV5Tm9kZTox');
cy.get('.survey__page').should('exist');
cy.get('[data-cy=solution]').should('exist');
});
});

View File

@ -1,6 +1,7 @@
from django.core.management import BaseCommand
from books.factories import ModuleFactory
from books.models import Module
from portfolio.factories import ProjectFactory
from portfolio.models import ProjectEntry
from surveys.models import Survey
@ -17,13 +18,15 @@ survey_data = {
{
"name": "A: Max gibt ihr das Geld und muss das Billardspiel absagen.",
"placeHolder": "Passende Tugenden erfassen...",
"type": "text"
"type": "text",
"correctAnswer": "Triss"
},
{
"name": "question2",
"placeHolder": "Passende Tugenden erfassen...",
"title": "B: Max gibt ihr das Geld nicht und geht Billard spielen.",
"type": "text"
"type": "text",
"correctAnswer": "Jaskier"
}
],
"name": "Fall 1",
@ -43,13 +46,15 @@ survey_data = {
"placeHolder": "Passende Tugenden erfassen...",
"title": "A: Silvio bringt seinen Mitfahrer in Sicherheit.",
"type": "text",
"useDisplayValuesInTitle": False
"useDisplayValuesInTitle": False,
"correctAnswer": "Yennefer"
},
{
"name": "question3",
"placeHolder": "Passende Tugenden erfassen...",
"title": "B: Silvio sperrt die Strasse ab.",
"type": "text"
"type": "text",
"correctAnswer": "Geralt"
}
],
"name": "panel1",
@ -70,7 +75,7 @@ class Command(BaseCommand):
Survey.objects.all().delete()
self.stdout.write("Creating survey")
module = ModuleFactory()
module = Module.objects.get(slug='lohn-und-budget')
Survey.objects.create(
title='Test',