Fix cypress tests
This commit is contained in:
parent
c50aa19f94
commit
e9d8fdad24
File diff suppressed because one or more lines are too long
|
|
@ -4,7 +4,7 @@ describe('The Login Page', () => {
|
||||||
const password = 'test';
|
const password = 'test';
|
||||||
cy.visit('/beta-login');
|
cy.visit('/beta-login');
|
||||||
cy.login(username, password, true);
|
cy.login(username, password, true);
|
||||||
cy.assertStartPage();
|
cy.assertStartPage(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('user sees error message if username is omitted', () => {
|
it('user sees error message if username is omitted', () => {
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,7 @@ describe('Bookmarks', () => {
|
||||||
|
|
||||||
cy.viewport('macbook-15');
|
cy.viewport('macbook-15');
|
||||||
cy.startGraphQLCapture();
|
cy.startGraphQLCapture();
|
||||||
cy.login('rahel.cueni', 'test', true);
|
cy.apolloLogin('rahel.cueni', 'test');
|
||||||
cy.assertStartPage();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should bookmark content block', () => {
|
it('should bookmark content block', () => {
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,7 @@ describe('Email Verifcation', () => {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
cy.login('rahel.cueni', 'test', true)
|
cy.apolloLogin('rahel.cueni', 'test')
|
||||||
cy.assertStartPage();
|
|
||||||
|
|
||||||
cy.visit('/license-activation');
|
cy.visit('/license-activation');
|
||||||
cy.redeemCoupon('12345asfd');
|
cy.redeemCoupon('12345asfd');
|
||||||
|
|
@ -29,8 +28,7 @@ describe('Email Verifcation', () => {
|
||||||
|
|
||||||
it('displays error if input is missing', () => {
|
it('displays error if input is missing', () => {
|
||||||
cy.viewport('macbook-15');
|
cy.viewport('macbook-15');
|
||||||
cy.login('rahel.cueni', 'test', true)
|
cy.apolloLogin('rahel.cueni', 'test');
|
||||||
cy.assertStartPage();
|
|
||||||
|
|
||||||
cy.visit('/license-activation');
|
cy.visit('/license-activation');
|
||||||
cy.redeemCoupon('');
|
cy.redeemCoupon('');
|
||||||
|
|
@ -45,8 +43,7 @@ describe('Email Verifcation', () => {
|
||||||
Coupon: new GraphQLError('invalid_coupon')
|
Coupon: new GraphQLError('invalid_coupon')
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
cy.login('rahel.cueni', 'test', true)
|
cy.apolloLogin('rahel.cueni', 'test');
|
||||||
cy.assertStartPage();
|
|
||||||
|
|
||||||
cy.visit('/license-activation');
|
cy.visit('/license-activation');
|
||||||
cy.redeemCoupon('12345asfd');
|
cy.redeemCoupon('12345asfd');
|
||||||
|
|
@ -61,8 +58,7 @@ describe('Email Verifcation', () => {
|
||||||
Coupon: new GraphQLError('unknown_error')
|
Coupon: new GraphQLError('unknown_error')
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
cy.login('rahel.cueni', 'test', true)
|
cy.apolloLogin('rahel.cueni', 'test');
|
||||||
cy.assertStartPage();
|
|
||||||
|
|
||||||
cy.visit('/license-activation');
|
cy.visit('/license-activation');
|
||||||
cy.redeemCoupon('12345asfd');
|
cy.redeemCoupon('12345asfd');
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
const schema = require('../fixtures/schema.json');
|
const schema = require('../fixtures/schema.json');
|
||||||
|
const me = require('../fixtures/me.new-student.json');
|
||||||
|
|
||||||
describe('Project Entry', () => {
|
describe('Project Entry', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
|
@ -11,6 +12,7 @@ describe('Project Entry', () => {
|
||||||
MeQuery: {
|
MeQuery: {
|
||||||
me: {
|
me: {
|
||||||
id: 'VXNlck5vZGU6NQ==',
|
id: 'VXNlck5vZGU6NQ==',
|
||||||
|
onboardingVisited: true,
|
||||||
permissions: []
|
permissions: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -41,35 +43,37 @@ describe('Project Entry', () => {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ProjectQuery: {
|
ProjectQuery: {
|
||||||
"project": {
|
'project': {
|
||||||
"id": "UHJvamVjdE5vZGU6MzY=",
|
'id': 'UHJvamVjdE5vZGU6MzY=',
|
||||||
"title": "Groot",
|
'title': 'Groot',
|
||||||
"appearance": "yellow",
|
'appearance': 'yellow',
|
||||||
"description": "I am Groot",
|
'description': 'I am Groot',
|
||||||
"slug": "groot",
|
'slug': 'groot',
|
||||||
"objectives": "Be Groot\nBe awesome",
|
'objectives': 'Be Groot\nBe awesome',
|
||||||
"final": false,
|
'final': false,
|
||||||
"student": {
|
'student': {
|
||||||
"firstName": "Rahel",
|
'firstName': 'Rahel',
|
||||||
"lastName": "Cueni",
|
'lastName': 'Cueni',
|
||||||
"id": "VXNlck5vZGU6NQ==",
|
'id': 'VXNlck5vZGU6NQ==',
|
||||||
"avatarUrl": "",
|
'avatarUrl': '',
|
||||||
"__typename": "UserNode"
|
'__typename': 'UserNode'
|
||||||
},
|
},
|
||||||
"entriesCount": 1,
|
'entriesCount': 1,
|
||||||
"__typename": "ProjectNode",
|
'__typename': 'ProjectNode',
|
||||||
"entries": {
|
'entries': {
|
||||||
"edges": [{
|
'edges': [{
|
||||||
"node": {
|
'node': {
|
||||||
"id": "UHJvamVjdEVudHJ5Tm9kZTo2NQ==",
|
'id': 'UHJvamVjdEVudHJ5Tm9kZTo2NQ==',
|
||||||
"activity": "Kill Thanos",
|
'activity': 'Kill Thanos',
|
||||||
"reflection": "He sucks",
|
'reflection': 'He sucks',
|
||||||
"nextSteps": "Go for the head",
|
'nextSteps': 'Go for the head',
|
||||||
"documentUrl": "",
|
'documentUrl': '',
|
||||||
"__typename": "ProjectEntryNode",
|
'__typename': 'ProjectEntryNode',
|
||||||
"created": "2020-01-20T15:20:31.262510+00:00"
|
'created': '2020-01-20T15:20:31.262510+00:00'
|
||||||
}, "__typename": "ProjectEntryNodeEdge"
|
},
|
||||||
}], "__typename": "ProjectEntryNodeConnection"
|
'__typename': 'ProjectEntryNodeEdge'
|
||||||
|
}],
|
||||||
|
'__typename': 'ProjectEntryNodeConnection'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,49 @@
|
||||||
|
const schema = require('../fixtures/schema.json');
|
||||||
|
const me = require('../fixtures/me.join-class.json');
|
||||||
|
|
||||||
describe('The Rooms Page', () => {
|
describe('The Rooms Page', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.server();
|
||||||
|
cy.mockGraphql({
|
||||||
|
schema: schema,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// todo: mock all the graphql queries and mutations
|
// todo: mock all the graphql queries and mutations
|
||||||
it('goes to the rooms page', () => {
|
it('goes to the rooms page', () => {
|
||||||
|
let teacher = Object.assign({}, {
|
||||||
|
...me
|
||||||
|
},
|
||||||
|
{
|
||||||
|
me: {
|
||||||
|
permissions: ['users.can_manage_school_class_content']
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.mockGraphqlOps({
|
||||||
|
schema: schema,
|
||||||
|
operations: {
|
||||||
|
MeQuery: teacher
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
cy.apolloLogin('nico.zickgraf', 'test');
|
cy.apolloLogin('nico.zickgraf', 'test');
|
||||||
cy.visit('/rooms');
|
cy.visit('/rooms');
|
||||||
|
|
||||||
|
|
||||||
cy.get('[data-cy=add-room]').should('exist');
|
cy.get('[data-cy=add-room]').should('exist');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('add room should not exist for student', () => {
|
it('add room should not exist for student', () => {
|
||||||
|
cy.mockGraphqlOps({
|
||||||
|
schema: schema,
|
||||||
|
operations: {
|
||||||
|
MeQuery: me
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
cy.apolloLogin('rahel.cueni', 'test');
|
cy.apolloLogin('rahel.cueni', 'test');
|
||||||
cy.visit('/rooms');
|
cy.visit('/rooms');
|
||||||
|
|
||||||
|
|
||||||
cy.get('[data-cy=add-room]').should('not.exist');
|
cy.get('[data-cy=add-room]').should('not.exist');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,8 @@ describe('Spellcheck', () => {
|
||||||
operations: {
|
operations: {
|
||||||
MeQuery: {
|
MeQuery: {
|
||||||
me: {
|
me: {
|
||||||
permissions: []
|
permissions: [],
|
||||||
|
onboardingVisited: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
AssignmentsQuery: {
|
AssignmentsQuery: {
|
||||||
|
|
|
||||||
|
|
@ -14,14 +14,14 @@ describe('Survey', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should display and fill out the survey', () => {
|
it('should display and fill out the survey', () => {
|
||||||
|
|
||||||
let answer = null;
|
let answer = null;
|
||||||
|
|
||||||
cy.mockGraphqlOps({
|
cy.mockGraphqlOps({
|
||||||
operations: {
|
operations: {
|
||||||
MeQuery: {
|
MeQuery: {
|
||||||
me: {
|
me: {
|
||||||
permissions: []
|
permissions: [],
|
||||||
|
onboardingVisited: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ModuleQuery: variables => ({module}),
|
ModuleQuery: variables => ({module}),
|
||||||
|
|
@ -68,7 +68,5 @@ describe('Survey', () => {
|
||||||
cy.visit('/survey/U3VydmV5Tm9kZTox');
|
cy.visit('/survey/U3VydmV5Tm9kZTox');
|
||||||
|
|
||||||
cy.get('#sq_100i').should('have.value', 'Wohlwollen')
|
cy.get('#sq_100i').should('have.value', 'Wohlwollen')
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -163,6 +163,10 @@ Cypress.Commands.add('redeemCoupon', coupon => {
|
||||||
cy.get('[data-cy="coupon-button"]').click();
|
cy.get('[data-cy="coupon-button"]').click();
|
||||||
})
|
})
|
||||||
|
|
||||||
Cypress.Commands.add('assertStartPage', () => {
|
Cypress.Commands.add('assertStartPage', (onboarding) => {
|
||||||
cy.get('[data-cy=onboarding-page]').should('exist');
|
if (onboarding) {
|
||||||
|
cy.get('[data-cy=onboarding-page]').should('exist');
|
||||||
|
} else {
|
||||||
|
cy.get('[data-cy=start-modules-list]').should('exist');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ from registration.mutations_public import RegistrationMutations
|
||||||
class Mutation(UserMutations, RegistrationMutations, graphene.ObjectType):
|
class Mutation(UserMutations, RegistrationMutations, graphene.ObjectType):
|
||||||
|
|
||||||
if settings.DEBUG:
|
if settings.DEBUG:
|
||||||
debug = graphene.Field(DjangoDebug, name='__debug')
|
debug = graphene.Field(DjangoDebug, name='_debug')
|
||||||
|
|
||||||
|
|
||||||
class Query(AllNewsTeasersQuery, graphene.ObjectType):
|
class Query(AllNewsTeasersQuery, graphene.ObjectType):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue