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', assignment: 'Assignment Text',
solution: 'Assignment Solution', solution: 'Assignment Solution',
}), }),
PrivateUserNode: () => ({
readOnly: false
}),
SchoolClassNode: () => ({
readOnly: false
})
}; };

View File

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

View File

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

View File

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

View File

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

View File

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