Fix cypress tests

This commit is contained in:
Ramon Wenger 2021-08-05 16:05:09 +02:00
parent 8b1b4d3c7b
commit e7d25535a9
6 changed files with 19 additions and 19 deletions

View File

@ -40,4 +40,10 @@ export default {
assignment: 'Assignment Text',
solution: 'Assignment Solution',
}),
PrivateUserNode: () => ({
readOnly: false
}),
SchoolClassNode: () => ({
readOnly: false
})
};

View File

@ -94,13 +94,10 @@ const operations = {
describe('Project Entry', () => {
beforeEach(() => {
cy.viewport('macbook-15');
cy.fakeLogin('rachel.green', 'test');
cy.server();
cy.setup();
cy.task('getSchema').then(schema => {
cy.mockGraphql({
schema,
cy.mockGraphqlOps({
operations,
});
});

View File

@ -2,16 +2,7 @@ const module = require('../../fixtures/module.json');
describe('Survey', () => {
beforeEach(() => {
cy.server();
cy.task('getSchema').then(schema => {
cy.mockGraphql({
schema,
});
});
cy.viewport('macbook-15');
cy.fakeLogin('rachel.green', 'test');
cy.setup();
});
it('should display and fill out the survey', () => {
@ -48,6 +39,11 @@ describe('Survey', () => {
__typename: 'UpdateAnswerPayload'
}
};
},
ModuleSolutions: {
module: {
solutionsEnabled: false
}
}
}
});

View File

@ -22,7 +22,8 @@
<project-actions
:id="id"
:final="final"
data-cy="project-widget-actions"/>
data-cy="project-widget-actions"
v-if="!readOnly"/>
</widget-footer>
</div>
</template>
@ -34,7 +35,7 @@
import WidgetFooter from '@/components/WidgetFooter';
export default {
props: ['title', 'appearance', 'slug', 'id', 'final', 'student', 'entriesCount', 'userId'],
props: ['title', 'appearance', 'slug', 'id', 'final', 'student', 'entriesCount', 'userId', 'readOnly'],
components: {
WidgetFooter,
@ -50,7 +51,6 @@
isOwner() {
return this.student.id === this.userId;
},
},
};
</script>

View File

@ -9,6 +9,7 @@
v-bind="project"
:user-id="userId"
:key="project.id"
:read-only="me.readOnly"
class="portfolio__project"
v-for="project in projects"
/>

View File

@ -31,7 +31,7 @@
const Survey = SurveyVue.Survey;
const MODULE_QUERY = gql`
query Module($id: ID) {
query ModuleSolutions($id: ID) {
module(id: $id) {
solutionsEnabled
}