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';
|
||||
cy.visit('/beta-login');
|
||||
cy.login(username, password, true);
|
||||
cy.assertStartPage();
|
||||
cy.assertStartPage(true);
|
||||
});
|
||||
|
||||
it('user sees error message if username is omitted', () => {
|
||||
|
|
|
|||
|
|
@ -5,8 +5,7 @@ describe('Bookmarks', () => {
|
|||
|
||||
cy.viewport('macbook-15');
|
||||
cy.startGraphQLCapture();
|
||||
cy.login('rahel.cueni', 'test', true);
|
||||
cy.assertStartPage();
|
||||
cy.apolloLogin('rahel.cueni', 'test');
|
||||
});
|
||||
|
||||
it('should bookmark content block', () => {
|
||||
|
|
|
|||
|
|
@ -19,8 +19,7 @@ describe('Email Verifcation', () => {
|
|||
},
|
||||
}
|
||||
});
|
||||
cy.login('rahel.cueni', 'test', true)
|
||||
cy.assertStartPage();
|
||||
cy.apolloLogin('rahel.cueni', 'test')
|
||||
|
||||
cy.visit('/license-activation');
|
||||
cy.redeemCoupon('12345asfd');
|
||||
|
|
@ -29,8 +28,7 @@ describe('Email Verifcation', () => {
|
|||
|
||||
it('displays error if input is missing', () => {
|
||||
cy.viewport('macbook-15');
|
||||
cy.login('rahel.cueni', 'test', true)
|
||||
cy.assertStartPage();
|
||||
cy.apolloLogin('rahel.cueni', 'test');
|
||||
|
||||
cy.visit('/license-activation');
|
||||
cy.redeemCoupon('');
|
||||
|
|
@ -45,8 +43,7 @@ describe('Email Verifcation', () => {
|
|||
Coupon: new GraphQLError('invalid_coupon')
|
||||
}
|
||||
});
|
||||
cy.login('rahel.cueni', 'test', true)
|
||||
cy.assertStartPage();
|
||||
cy.apolloLogin('rahel.cueni', 'test');
|
||||
|
||||
cy.visit('/license-activation');
|
||||
cy.redeemCoupon('12345asfd');
|
||||
|
|
@ -61,8 +58,7 @@ describe('Email Verifcation', () => {
|
|||
Coupon: new GraphQLError('unknown_error')
|
||||
}
|
||||
});
|
||||
cy.login('rahel.cueni', 'test', true)
|
||||
cy.assertStartPage();
|
||||
cy.apolloLogin('rahel.cueni', 'test');
|
||||
|
||||
cy.visit('/license-activation');
|
||||
cy.redeemCoupon('12345asfd');
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
const schema = require('../fixtures/schema.json');
|
||||
const me = require('../fixtures/me.new-student.json');
|
||||
|
||||
describe('Project Entry', () => {
|
||||
beforeEach(() => {
|
||||
|
|
@ -11,6 +12,7 @@ describe('Project Entry', () => {
|
|||
MeQuery: {
|
||||
me: {
|
||||
id: 'VXNlck5vZGU6NQ==',
|
||||
onboardingVisited: true,
|
||||
permissions: []
|
||||
}
|
||||
},
|
||||
|
|
@ -41,35 +43,37 @@ describe('Project Entry', () => {
|
|||
}
|
||||
},
|
||||
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"
|
||||
'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"
|
||||
'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'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,18 +1,49 @@
|
|||
const schema = require('../fixtures/schema.json');
|
||||
const me = require('../fixtures/me.join-class.json');
|
||||
|
||||
describe('The Rooms Page', () => {
|
||||
beforeEach(() => {
|
||||
cy.server();
|
||||
cy.mockGraphql({
|
||||
schema: schema,
|
||||
});
|
||||
});
|
||||
|
||||
// todo: mock all the graphql queries and mutations
|
||||
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.visit('/rooms');
|
||||
|
||||
|
||||
cy.get('[data-cy=add-room]').should('exist');
|
||||
});
|
||||
|
||||
it('add room should not exist for student', () => {
|
||||
cy.mockGraphqlOps({
|
||||
schema: schema,
|
||||
operations: {
|
||||
MeQuery: me
|
||||
}
|
||||
});
|
||||
|
||||
cy.apolloLogin('rahel.cueni', 'test');
|
||||
cy.visit('/rooms');
|
||||
|
||||
|
||||
cy.get('[data-cy=add-room]').should('not.exist');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -11,7 +11,8 @@ describe('Spellcheck', () => {
|
|||
operations: {
|
||||
MeQuery: {
|
||||
me: {
|
||||
permissions: []
|
||||
permissions: [],
|
||||
onboardingVisited: true
|
||||
}
|
||||
},
|
||||
AssignmentsQuery: {
|
||||
|
|
|
|||
|
|
@ -14,14 +14,14 @@ describe('Survey', () => {
|
|||
});
|
||||
|
||||
it('should display and fill out the survey', () => {
|
||||
|
||||
let answer = null;
|
||||
|
||||
cy.mockGraphqlOps({
|
||||
operations: {
|
||||
MeQuery: {
|
||||
me: {
|
||||
permissions: []
|
||||
permissions: [],
|
||||
onboardingVisited: true
|
||||
}
|
||||
},
|
||||
ModuleQuery: variables => ({module}),
|
||||
|
|
@ -68,7 +68,5 @@ describe('Survey', () => {
|
|||
cy.visit('/survey/U3VydmV5Tm9kZTox');
|
||||
|
||||
cy.get('#sq_100i').should('have.value', 'Wohlwollen')
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -163,6 +163,10 @@ Cypress.Commands.add('redeemCoupon', coupon => {
|
|||
cy.get('[data-cy="coupon-button"]').click();
|
||||
})
|
||||
|
||||
Cypress.Commands.add('assertStartPage', () => {
|
||||
Cypress.Commands.add('assertStartPage', (onboarding) => {
|
||||
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):
|
||||
|
||||
if settings.DEBUG:
|
||||
debug = graphene.Field(DjangoDebug, name='__debug')
|
||||
debug = graphene.Field(DjangoDebug, name='_debug')
|
||||
|
||||
|
||||
class Query(AllNewsTeasersQuery, graphene.ObjectType):
|
||||
|
|
|
|||
Loading…
Reference in New Issue