Fix cypress tests

This commit is contained in:
Ramon Wenger 2020-07-10 15:15:56 +02:00
parent e9d8fdad24
commit 2c0039be42
5 changed files with 37 additions and 50 deletions

View File

@ -4,7 +4,7 @@ describe('The Login Page', () => {
const password = 'test';
cy.visit('/beta-login');
cy.login(username, password, true);
cy.assertStartPage(true);
cy.assertStartPage();
});
it('user sees error message if username is omitted', () => {

View File

@ -1,32 +1,6 @@
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');
@ -34,13 +8,6 @@ describe('The Rooms Page', () => {
});
it('add room should not exist for student', () => {
cy.mockGraphqlOps({
schema: schema,
operations: {
MeQuery: me
}
});
cy.apolloLogin('rahel.cueni', 'test');
cy.visit('/rooms');

View File

@ -11673,7 +11673,8 @@
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"aproba": {
"version": "1.2.0",
@ -11701,6 +11702,7 @@
"version": "1.1.11",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@ -11715,7 +11717,8 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"concat-map": {
"version": "0.0.1",
@ -11726,7 +11729,8 @@
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"core-util-is": {
"version": "1.0.2",
@ -11843,7 +11847,8 @@
"inherits": {
"version": "2.0.3",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"ini": {
"version": "1.3.5",
@ -11855,6 +11860,7 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@ -11869,6 +11875,7 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
@ -11876,12 +11883,14 @@
"minimist": {
"version": "0.0.8",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"minipass": {
"version": "2.3.5",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
@ -11900,6 +11909,7 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
@ -11980,7 +11990,8 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"object-assign": {
"version": "4.1.1",
@ -11992,6 +12003,7 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"wrappy": "1"
}
@ -12077,7 +12089,8 @@
"safe-buffer": {
"version": "5.1.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"safer-buffer": {
"version": "2.1.2",
@ -12113,6 +12126,7 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@ -12132,6 +12146,7 @@
"version": "3.0.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@ -12175,12 +12190,14 @@
"wrappy": {
"version": "1.0.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"yallist": {
"version": "3.0.3",
"bundled": true,
"dev": true
"dev": true,
"optional": true
}
}
},

View File

@ -53,7 +53,8 @@ class Command(BaseCommand):
is_staff=True,
is_superuser=True,
first_name='Nicol',
last_name='Bolas'
last_name='Bolas',
onboarding_visited=True
)
create_users(user_data)

View File

@ -23,11 +23,11 @@ def create_users(data=None):
if data is None:
teacher = UserFactory(username='teacher')
UserRole.objects.create(user=teacher, role=teacher_role)
UserRole.objects.create(user=teacher, role=teacher_role, onboarding_visited=True)
students = []
for i in range(1, 7):
student = create_student(username='student{}'.format(i))
student = create_student(username='student{}'.format(i), onboarding_visited=True)
students.append(student)
SchoolClassFactory(
@ -35,9 +35,9 @@ def create_users(data=None):
name='skillbox',
)
teacher2 = UserFactory(username='teacher2')
UserRole.objects.create(user=teacher2, role=teacher_role)
UserRole.objects.create(user=teacher2, role=teacher_role, onboarding_visited=True)
student_second_class = create_student(username='student_second_class')
student_second_class = create_student(username='student_second_class', onboarding_visited=True)
SchoolClassFactory(
users=[teacher2, student_second_class],
name='second_class'
@ -50,7 +50,8 @@ def create_users(data=None):
username='{}.{}'.format(first, last).lower(),
first_name=first,
last_name=last,
email='{}.{}@skillbox.example'.format(first, last).lower()
email='{}.{}@skillbox.example'.format(first, last).lower(),
onboarding_visited=True
)
UserRole.objects.create(user=teacher, role=teacher_role)
students = []
@ -60,7 +61,8 @@ def create_users(data=None):
username='{}.{}'.format(first, last).lower(),
first_name=first,
last_name=last,
email='{}.{}@skillbox.example'.format(first, last).lower()
email='{}.{}@skillbox.example'.format(first, last).lower(),
onboarding_visited=True
)
students.append(student)