Update frontend cypress tests
This commit is contained in:
parent
ef5c1c6279
commit
a8d3635d7b
|
|
@ -1,14 +1,15 @@
|
|||
import {mockUpdateOnboardingProgress} from '../../support/helpers';
|
||||
|
||||
const schema = require('../../fixtures/schema.json');
|
||||
const me = require('../../fixtures/me.join-class.json');
|
||||
|
||||
describe('Onboarding', () => {
|
||||
beforeEach(() => {
|
||||
cy.server();
|
||||
|
||||
cy.mockGraphql({
|
||||
schema: schema,
|
||||
cy.task('getSchema').then(schema => {
|
||||
cy.mockGraphql({
|
||||
schema,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,96 @@
|
|||
const schema = require('../../fixtures/schema.json');
|
||||
const me = require('../../fixtures/me.new-student.json');
|
||||
|
||||
const operations = {
|
||||
MeQuery: {
|
||||
me: {
|
||||
id: 'VXNlck5vZGU6NQ==',
|
||||
onboardingVisited: true,
|
||||
permissions: [],
|
||||
},
|
||||
},
|
||||
ProjectsQuery: {
|
||||
projects: {
|
||||
edges: [{
|
||||
node: {
|
||||
id: 'UHJvamVjdE5vZGU6MzM=',
|
||||
title: 'Groot',
|
||||
appearance: 'red',
|
||||
'description': 'I am Groot',
|
||||
'slug': 'groot',
|
||||
'objectives': 'Be Groot\nBe awesome',
|
||||
'final': false,
|
||||
'student': {
|
||||
'firstName': 'Rahel',
|
||||
'lastName': 'Cueni',
|
||||
'id': 'VXNlck5vZGU6NQ==',
|
||||
'avatarUrl': '',
|
||||
'__typename': 'UserNode',
|
||||
},
|
||||
'entriesCount': 2,
|
||||
'__typename': 'ProjectNode',
|
||||
},
|
||||
'__typename': 'ProjectNodeEdge',
|
||||
}],
|
||||
'__typename': 'ProjectNodeConnection',
|
||||
},
|
||||
},
|
||||
ProjectQuery: {
|
||||
'project': {
|
||||
'id': 'UHJvamVjdE5vZGU6MzY=',
|
||||
'title': 'Groot',
|
||||
'appearance': 'yellow',
|
||||
'description': 'I am Groot',
|
||||
'slug': 'groot',
|
||||
'objectives': 'Be Groot\nBe awesome',
|
||||
'final': false,
|
||||
'student': {
|
||||
'firstName': 'Rahel',
|
||||
'lastName': 'Cueni',
|
||||
'id': 'VXNlck5vZGU6NQ==',
|
||||
'avatarUrl': '',
|
||||
'__typename': 'UserNode',
|
||||
},
|
||||
'entriesCount': 1,
|
||||
'__typename': 'ProjectNode',
|
||||
'entries': {
|
||||
'edges': [{
|
||||
'node': {
|
||||
'id': 'UHJvamVjdEVudHJ5Tm9kZTo2NQ==',
|
||||
'activity': 'Kill Thanos',
|
||||
'reflection': 'He sucks',
|
||||
'nextSteps': 'Go for the head',
|
||||
'documentUrl': '',
|
||||
'__typename': 'ProjectEntryNode',
|
||||
'created': '2020-01-20T15:20:31.262510+00:00',
|
||||
},
|
||||
'__typename': 'ProjectEntryNodeEdge',
|
||||
}],
|
||||
'__typename': 'ProjectEntryNodeConnection',
|
||||
},
|
||||
},
|
||||
},
|
||||
AddProjectEntry: variables => ({
|
||||
addProjectEntry: {
|
||||
projectEntry: Object.assign({}, variables.input.projectEntry, {
|
||||
created: '2020-01-20T15:26:58.722773+00:00',
|
||||
}),
|
||||
errors: null,
|
||||
__typename: 'AddProjectEntryPayload',
|
||||
},
|
||||
}),
|
||||
UpdateProjectEntry: variables => ({
|
||||
updateProjectEntry: {
|
||||
projectEntry: variables.input.projectEntry,
|
||||
errors: null,
|
||||
__typename: 'UpdateProjectEntryPayload',
|
||||
},
|
||||
}),
|
||||
DeleteProjectEntry: {
|
||||
deleteProjectEntry: {
|
||||
success: true,
|
||||
__typename: 'DeleteProjectEntryPayload',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
describe('Project Entry', () => {
|
||||
beforeEach(() => {
|
||||
|
|
@ -7,100 +98,11 @@ describe('Project Entry', () => {
|
|||
cy.fakeLogin('rahel.cueni', 'test');
|
||||
cy.server();
|
||||
|
||||
cy.mockGraphql({
|
||||
schema: schema,
|
||||
operations: {
|
||||
MeQuery: {
|
||||
me: {
|
||||
id: 'VXNlck5vZGU6NQ==',
|
||||
onboardingVisited: true,
|
||||
permissions: []
|
||||
}
|
||||
},
|
||||
ProjectsQuery: {
|
||||
projects: {
|
||||
edges: [{
|
||||
node: {
|
||||
id: 'UHJvamVjdE5vZGU6MzM=',
|
||||
title: 'Groot',
|
||||
appearance: 'red',
|
||||
'description': 'I am Groot',
|
||||
'slug': 'groot',
|
||||
'objectives': 'Be Groot\nBe awesome',
|
||||
'final': false,
|
||||
'student': {
|
||||
'firstName': 'Rahel',
|
||||
'lastName': 'Cueni',
|
||||
'id': 'VXNlck5vZGU6NQ==',
|
||||
'avatarUrl': '',
|
||||
'__typename': 'UserNode'
|
||||
},
|
||||
'entriesCount': 2,
|
||||
'__typename': 'ProjectNode'
|
||||
},
|
||||
'__typename': 'ProjectNodeEdge'
|
||||
}],
|
||||
'__typename': 'ProjectNodeConnection'
|
||||
}
|
||||
},
|
||||
ProjectQuery: {
|
||||
'project': {
|
||||
'id': 'UHJvamVjdE5vZGU6MzY=',
|
||||
'title': 'Groot',
|
||||
'appearance': 'yellow',
|
||||
'description': 'I am Groot',
|
||||
'slug': 'groot',
|
||||
'objectives': 'Be Groot\nBe awesome',
|
||||
'final': false,
|
||||
'student': {
|
||||
'firstName': 'Rahel',
|
||||
'lastName': 'Cueni',
|
||||
'id': 'VXNlck5vZGU6NQ==',
|
||||
'avatarUrl': '',
|
||||
'__typename': 'UserNode'
|
||||
},
|
||||
'entriesCount': 1,
|
||||
'__typename': 'ProjectNode',
|
||||
'entries': {
|
||||
'edges': [{
|
||||
'node': {
|
||||
'id': 'UHJvamVjdEVudHJ5Tm9kZTo2NQ==',
|
||||
'activity': 'Kill Thanos',
|
||||
'reflection': 'He sucks',
|
||||
'nextSteps': 'Go for the head',
|
||||
'documentUrl': '',
|
||||
'__typename': 'ProjectEntryNode',
|
||||
'created': '2020-01-20T15:20:31.262510+00:00'
|
||||
},
|
||||
'__typename': 'ProjectEntryNodeEdge'
|
||||
}],
|
||||
'__typename': 'ProjectEntryNodeConnection'
|
||||
}
|
||||
}
|
||||
},
|
||||
AddProjectEntry: variables => ({
|
||||
addProjectEntry: {
|
||||
projectEntry: Object.assign({}, variables.input.projectEntry, {
|
||||
created: '2020-01-20T15:26:58.722773+00:00'
|
||||
}),
|
||||
errors: null,
|
||||
__typename: 'AddProjectEntryPayload'
|
||||
}
|
||||
}),
|
||||
UpdateProjectEntry: variables => ({
|
||||
updateProjectEntry: {
|
||||
projectEntry: variables.input.projectEntry,
|
||||
errors: null,
|
||||
__typename: 'UpdateProjectEntryPayload'
|
||||
}
|
||||
}),
|
||||
DeleteProjectEntry: {
|
||||
deleteProjectEntry: {
|
||||
success: true,
|
||||
__typename: 'DeleteProjectEntryPayload'
|
||||
}
|
||||
}
|
||||
}
|
||||
cy.task('getSchema').then(schema => {
|
||||
cy.mockGraphql({
|
||||
schema,
|
||||
operations,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
const schema = require('../../fixtures/schema.json');
|
||||
const me = require('../../fixtures/me.join-class.json');
|
||||
const selectedClass = require('../../fixtures/selected-school-class.json');
|
||||
|
||||
|
|
@ -6,8 +5,10 @@ describe('Class Management', () => {
|
|||
beforeEach(() => {
|
||||
cy.server();
|
||||
|
||||
cy.mockGraphql({
|
||||
schema: schema,
|
||||
cy.task('getSchema').then(schema => {
|
||||
cy.mockGraphql({
|
||||
schema,
|
||||
});
|
||||
});
|
||||
|
||||
cy.viewport('macbook-15');
|
||||
|
|
@ -104,7 +105,7 @@ describe('Class Management', () => {
|
|||
});
|
||||
|
||||
cy.visit('/me/my-class');
|
||||
cy.get('[data-cy=school-class-member]').should('have.length', 2);
|
||||
cy.get('[data-cy=group-list-member]').should('have.length', 2);
|
||||
cy.get('[data-cy=remove-from-class]').should('have.length', 0);
|
||||
cy.get('[data-cy=add-to-class]').should('have.length', 0);
|
||||
});
|
||||
|
|
@ -187,8 +188,10 @@ describe('Teacher Class Management', () => {
|
|||
beforeEach(() => {
|
||||
cy.server();
|
||||
|
||||
cy.mockGraphql({
|
||||
schema: schema,
|
||||
cy.task('getSchema').then(schema => {
|
||||
cy.mockGraphql({
|
||||
schema,
|
||||
});
|
||||
});
|
||||
|
||||
cy.viewport('macbook-15');
|
||||
|
|
@ -232,7 +235,7 @@ describe('Teacher Class Management', () => {
|
|||
cy.get('[data-cy=edit-group-name-link]').click();
|
||||
cy.get('[data-cy=edit-name-input] input').type('{selectall}{backspace}').type(className);
|
||||
cy.get('[data-cy=modal-save-button]').click();
|
||||
cy.get('[data-cy=school-class-name]').should('contain', className);
|
||||
cy.get('[data-cy=group-list-name]').should('contain', className);
|
||||
});
|
||||
|
||||
// // fixme: cache misbehaves with mequery, but only for test
|
||||
|
|
|
|||
|
|
@ -1,33 +1,37 @@
|
|||
import {mockUpdateLastModule} from '../../support/helpers';
|
||||
|
||||
const schema = require('../../fixtures/schema.json');
|
||||
const assignments = require('../../fixtures/assignments.json');
|
||||
const module = require('../../fixtures/module.json');
|
||||
const spellCheck = require('../../fixtures/spell-check.json');
|
||||
|
||||
const operations = {
|
||||
MeQuery: {
|
||||
me: {
|
||||
permissions: [],
|
||||
onboardingVisited: true,
|
||||
},
|
||||
},
|
||||
AssignmentsQuery: {
|
||||
assignments,
|
||||
},
|
||||
ModulesQuery: {
|
||||
module,
|
||||
},
|
||||
SpellCheck: {
|
||||
spellCheck,
|
||||
},
|
||||
...mockUpdateLastModule(),
|
||||
};
|
||||
|
||||
describe('Spellcheck', () => {
|
||||
before(() => {
|
||||
cy.server();
|
||||
cy.mockGraphql({
|
||||
schema: schema,
|
||||
operations: {
|
||||
MeQuery: {
|
||||
me: {
|
||||
permissions: [],
|
||||
onboardingVisited: true
|
||||
}
|
||||
},
|
||||
AssignmentsQuery: {
|
||||
assignments
|
||||
},
|
||||
ModulesQuery: {
|
||||
module
|
||||
},
|
||||
SpellCheck: {
|
||||
spellCheck
|
||||
},
|
||||
...mockUpdateLastModule()
|
||||
}
|
||||
|
||||
cy.task('getSchema').then(schema => {
|
||||
cy.mockGraphql({
|
||||
schema,
|
||||
operations,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
const schema = require('../../fixtures/schema.json');
|
||||
const module = require('../../fixtures/module.json');
|
||||
|
||||
describe('Survey', () => {
|
||||
beforeEach(() => {
|
||||
cy.server();
|
||||
|
||||
cy.mockGraphql({
|
||||
schema: schema,
|
||||
cy.task('getSchema').then(schema => {
|
||||
cy.mockGraphql({
|
||||
schema,
|
||||
});
|
||||
});
|
||||
|
||||
cy.viewport('macbook-15');
|
||||
|
|
|
|||
Loading…
Reference in New Issue