Mock the backend for the cypress test
This commit is contained in:
parent
99487c9705
commit
97469ce419
|
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"me": {
|
||||
"id": "VXNlck5vZGU6NQ==",
|
||||
"pk": 5,
|
||||
"username": "rahel.cueni",
|
||||
"email": "rahel.cueni@skillbox.example",
|
||||
"firstName": "Rahel",
|
||||
"lastName": "Cueni",
|
||||
"avatarUrl": "",
|
||||
"lastModule": {
|
||||
"id": "TW9kdWxlTm9kZToxNw==",
|
||||
"slug": "lohn-und-budget",
|
||||
"__typename": "ModuleNode"
|
||||
},
|
||||
"selectedClass": {
|
||||
"id": "U2Nob29sQ2xhc3NOb2RlOjI=",
|
||||
"__typename": "SchoolClassNode"
|
||||
},
|
||||
"schoolClasses": {
|
||||
"edges": [
|
||||
{
|
||||
"node": {
|
||||
"id": "U2Nob29sQ2xhc3NOb2RlOjE=",
|
||||
"name": "FLID2018a",
|
||||
"__typename": "SchoolClassNode"
|
||||
},
|
||||
"__typename": "SchoolClassNodeEdge"
|
||||
}
|
||||
],
|
||||
"__typename": "SchoolClassNodeConnection"
|
||||
},
|
||||
"__typename": "UserNode",
|
||||
"permissions": []
|
||||
}
|
||||
}
|
||||
|
|
@ -1500,6 +1500,79 @@
|
|||
"isDeprecated": false,
|
||||
"deprecationReason": null
|
||||
},
|
||||
{
|
||||
"name": "myInstrumentActivity",
|
||||
"description": null,
|
||||
"args": [
|
||||
{
|
||||
"name": "before",
|
||||
"description": null,
|
||||
"type": {
|
||||
"kind": "SCALAR",
|
||||
"name": "String",
|
||||
"ofType": null
|
||||
},
|
||||
"defaultValue": null
|
||||
},
|
||||
{
|
||||
"name": "after",
|
||||
"description": null,
|
||||
"type": {
|
||||
"kind": "SCALAR",
|
||||
"name": "String",
|
||||
"ofType": null
|
||||
},
|
||||
"defaultValue": null
|
||||
},
|
||||
{
|
||||
"name": "first",
|
||||
"description": null,
|
||||
"type": {
|
||||
"kind": "SCALAR",
|
||||
"name": "Int",
|
||||
"ofType": null
|
||||
},
|
||||
"defaultValue": null
|
||||
},
|
||||
{
|
||||
"name": "last",
|
||||
"description": null,
|
||||
"type": {
|
||||
"kind": "SCALAR",
|
||||
"name": "Int",
|
||||
"ofType": null
|
||||
},
|
||||
"defaultValue": null
|
||||
},
|
||||
{
|
||||
"name": "slug",
|
||||
"description": null,
|
||||
"type": {
|
||||
"kind": "SCALAR",
|
||||
"name": "String",
|
||||
"ofType": null
|
||||
},
|
||||
"defaultValue": null
|
||||
},
|
||||
{
|
||||
"name": "type",
|
||||
"description": null,
|
||||
"type": {
|
||||
"kind": "SCALAR",
|
||||
"name": "String",
|
||||
"ofType": null
|
||||
},
|
||||
"defaultValue": null
|
||||
}
|
||||
],
|
||||
"type": {
|
||||
"kind": "OBJECT",
|
||||
"name": "InstrumentNodeConnection",
|
||||
"ofType": null
|
||||
},
|
||||
"isDeprecated": false,
|
||||
"deprecationReason": null
|
||||
},
|
||||
{
|
||||
"name": "node",
|
||||
"description": "The ID of the object",
|
||||
|
|
@ -3277,6 +3350,18 @@
|
|||
"isDeprecated": false,
|
||||
"deprecationReason": null
|
||||
},
|
||||
{
|
||||
"name": "code",
|
||||
"description": "",
|
||||
"args": [],
|
||||
"type": {
|
||||
"kind": "SCALAR",
|
||||
"name": "String",
|
||||
"ofType": null
|
||||
},
|
||||
"isDeprecated": false,
|
||||
"deprecationReason": null
|
||||
},
|
||||
{
|
||||
"name": "hiddenContentBlocks",
|
||||
"description": null,
|
||||
|
|
@ -9285,6 +9370,33 @@
|
|||
"isDeprecated": false,
|
||||
"deprecationReason": null
|
||||
},
|
||||
{
|
||||
"name": "joinClass",
|
||||
"description": null,
|
||||
"args": [
|
||||
{
|
||||
"name": "input",
|
||||
"description": null,
|
||||
"type": {
|
||||
"kind": "NON_NULL",
|
||||
"name": null,
|
||||
"ofType": {
|
||||
"kind": "INPUT_OBJECT",
|
||||
"name": "JoinClassInput",
|
||||
"ofType": null
|
||||
}
|
||||
},
|
||||
"defaultValue": null
|
||||
}
|
||||
],
|
||||
"type": {
|
||||
"kind": "OBJECT",
|
||||
"name": "JoinClassPayload",
|
||||
"ofType": null
|
||||
},
|
||||
"isDeprecated": false,
|
||||
"deprecationReason": null
|
||||
},
|
||||
{
|
||||
"name": "addProject",
|
||||
"description": null,
|
||||
|
|
@ -11434,6 +11546,88 @@
|
|||
"enumValues": null,
|
||||
"possibleTypes": null
|
||||
},
|
||||
{
|
||||
"kind": "OBJECT",
|
||||
"name": "JoinClassPayload",
|
||||
"description": null,
|
||||
"fields": [
|
||||
{
|
||||
"name": "success",
|
||||
"description": null,
|
||||
"args": [],
|
||||
"type": {
|
||||
"kind": "SCALAR",
|
||||
"name": "Boolean",
|
||||
"ofType": null
|
||||
},
|
||||
"isDeprecated": false,
|
||||
"deprecationReason": null
|
||||
},
|
||||
{
|
||||
"name": "schoolClass",
|
||||
"description": null,
|
||||
"args": [],
|
||||
"type": {
|
||||
"kind": "OBJECT",
|
||||
"name": "SchoolClassNode",
|
||||
"ofType": null
|
||||
},
|
||||
"isDeprecated": false,
|
||||
"deprecationReason": null
|
||||
},
|
||||
{
|
||||
"name": "clientMutationId",
|
||||
"description": null,
|
||||
"args": [],
|
||||
"type": {
|
||||
"kind": "SCALAR",
|
||||
"name": "String",
|
||||
"ofType": null
|
||||
},
|
||||
"isDeprecated": false,
|
||||
"deprecationReason": null
|
||||
}
|
||||
],
|
||||
"inputFields": null,
|
||||
"interfaces": [],
|
||||
"enumValues": null,
|
||||
"possibleTypes": null
|
||||
},
|
||||
{
|
||||
"kind": "INPUT_OBJECT",
|
||||
"name": "JoinClassInput",
|
||||
"description": null,
|
||||
"fields": null,
|
||||
"inputFields": [
|
||||
{
|
||||
"name": "code",
|
||||
"description": null,
|
||||
"type": {
|
||||
"kind": "NON_NULL",
|
||||
"name": null,
|
||||
"ofType": {
|
||||
"kind": "SCALAR",
|
||||
"name": "String",
|
||||
"ofType": null
|
||||
}
|
||||
},
|
||||
"defaultValue": null
|
||||
},
|
||||
{
|
||||
"name": "clientMutationId",
|
||||
"description": null,
|
||||
"type": {
|
||||
"kind": "SCALAR",
|
||||
"name": "String",
|
||||
"ofType": null
|
||||
},
|
||||
"defaultValue": null
|
||||
}
|
||||
],
|
||||
"interfaces": null,
|
||||
"enumValues": null,
|
||||
"possibleTypes": null
|
||||
},
|
||||
{
|
||||
"kind": "OBJECT",
|
||||
"name": "AddProjectPayload",
|
||||
|
|
|
|||
|
|
@ -1,13 +1,37 @@
|
|||
describe('Survey', () => {
|
||||
const schema = require('../fixtures/schema.json');
|
||||
const me = require('../fixtures/me.join-class.json');
|
||||
|
||||
describe('Join Class', () => {
|
||||
beforeEach(() => {
|
||||
// todo: mock all the graphql queries and mutations
|
||||
// cy.exec("python ../server/manage.py prepare_bookmarks_for_cypress");
|
||||
cy.server();
|
||||
|
||||
cy.mockGraphql({
|
||||
schema: schema,
|
||||
});
|
||||
|
||||
cy.viewport('macbook-15');
|
||||
cy.apolloLogin('rahel.cueni', 'test');
|
||||
|
||||
});
|
||||
|
||||
it('should join class', () => {
|
||||
cy.mockGraphqlOps({
|
||||
operations: {
|
||||
MeQuery: me,
|
||||
JoinClass: {
|
||||
joinClass: {
|
||||
success: true,
|
||||
schoolClass: {
|
||||
id: "U2Nob29sQ2xhc3NOb2RlOjI=",
|
||||
name: "KF1A",
|
||||
__typename: "SchoolClassNode"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
cy.visit('/me/profile');
|
||||
|
||||
cy.get('[data-cy=class-selection]').click();
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ describe('Survey', () => {
|
|||
});
|
||||
|
||||
cy.viewport('macbook-15');
|
||||
|
||||
cy.apolloLogin('rahel.cueni', 'test');
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue