Refactor dummy users to be more anonymous

This commit is contained in:
Ramon Wenger 2021-08-03 14:16:15 +02:00
parent 57698e577e
commit 7728f654a5
27 changed files with 73 additions and 108 deletions

View File

@ -2,11 +2,11 @@
"me": {
"id": "VXNlck5vZGU6NQ==",
"pk": 5,
"username": "rahel.cueni",
"email": "rahel.cueni@skillbox.example",
"username": "rachel.green",
"email": "rachel.green@skillbox.example",
"expiryDate": "3596153600",
"firstName": "Rahel",
"lastName": "Cueni",
"firstName": "Rachel",
"lastName": "Green",
"avatarUrl": "",
"isTeacher": false,
"readOnly": false,

View File

@ -4,7 +4,7 @@ describe('Bookmarks', () => {
cy.exec('python ../server/manage.py prepare_bookmarks_for_cypress');
cy.viewport('macbook-15');
cy.apolloLogin('rahel.cueni', 'test');
cy.apolloLogin('rachel.green', 'test');
});
it('should bookmark content block', () => {

View File

@ -15,7 +15,6 @@ describe('New student', () => {
it('shows "Enter Code" page and adds the user to a class', () => {
cy.apolloLogin('hansli', 'test');
const __typename = 'SchoolClassNode';
const name = 'KF1A';
const id = 'U2Nob29sQ2xhc3NOb2RlOjI=';
@ -28,7 +27,6 @@ describe('New student', () => {
schoolClass: {
id,
name,
__typename,
},
},
},
@ -36,7 +34,6 @@ describe('New student', () => {
me: {
...me.me,
selectedClass: {
__typename,
name,
id,
members: [],
@ -51,7 +48,7 @@ describe('New student', () => {
cy.get('[data-cy=join-form-title]').should('contain', 'Einer Klasse beitreten');
cy.get('[data-cy=input-form-code]').type('XXXX');
cy.get('[data-cy=join-form-confirm]').click();
cy.skipOnboarding();
cy.getByDataCy('onboarding-skip-link').click();
cy.get('[data-cy=user-widget-avatar]').click();
cy.get('[data-cy=class-list-link]').click();
cy.get('[data-cy=group-list-title]').should('contain', 'Klassenliste');

View File

@ -3,7 +3,7 @@ describe('The Room Page', () => {
// todo: mock all the graphql queries and mutations
cy.viewport('macbook-15');
cy.apolloLogin('rahel.cueni', 'test');
cy.apolloLogin('rachel.green', 'test');
cy.visit('/room/ein-historisches-festival');
cy.get('[data-cy=add-room-entry-button]').click();
@ -15,6 +15,6 @@ describe('The Room Page', () => {
cy.get('[data-cy=text-form-input]').type(text);
cy.get('[data-cy=modal-save-button]').click();
cy.get('.room-entry__content:first').should('contain', text).should('contain', 'Rahel Cueni');
cy.get('.room-entry__content:first').should('contain', text).should('contain', 'Rachel Green');
});
});

View File

@ -1,14 +1,14 @@
describe('The Rooms Page', () => {
// todo: mock all the graphql queries and mutations
it('goes to the rooms page', () => {
cy.apolloLogin('nico.zickgraf', 'test');
cy.apolloLogin('ross.geller', 'test');
cy.visit('/rooms');
cy.get('[data-cy=add-room]').should('exist');
});
it('add room should not exist for student', () => {
cy.apolloLogin('rahel.cueni', 'test');
cy.apolloLogin('rachel.green', 'test');
cy.visit('/rooms');
cy.get('[data-cy=add-room]').should('not.exist');

View File

@ -5,7 +5,7 @@ describe('Solutions', () => {
// // it('does not display the solution at first, then displays them after clicking', () => {
// // cy.viewport('macbook-15');
// // cy.login('nico.zickgraf', 'test');
// // cy.login('ross.geller', 'test');
// //
// // cy.visit('/module/lohn-und-budget');
// // });
@ -25,7 +25,7 @@ describe('Solutions', () => {
// cy.viewport('macbook-15');
//
// cy.visit('/module/lohn-und-budget');
// cy.login('rahel.cueni', 'test');
// cy.login('rachel.green', 'test');
// cy.get('[data-cy=module-title]').should('be.visible');
// cy.get('[data-cy=toggle-enable-solutions]')
// .should('not.exist');
@ -40,7 +40,7 @@ describe('Solutions', () => {
// cy.logout();
//
// cy.visit('/module/lohn-und-budget');
// cy.login('nico.zickgraf', 'test');
// cy.login('ross.geller, 'test');
// cy.get('[data-cy=toggle-enable-solutions]').click();
// cy.waitFor('UpdateSolutionVisibility');
// cy.get('[data-cy=toggle-enable-solutions]').within(() => {
@ -50,7 +50,7 @@ describe('Solutions', () => {
// cy.logout();
//
// cy.visit('/module/lohn-und-budget');
// cy.login('rahel.cueni', 'test');
// cy.login('rachel.green', 'test');
// // cy.get('[data-cy=solution]').should('exist');
// cy.get('[data-cy=solution]').first()
// .should('contain', 'anzeigen')

View File

@ -36,7 +36,7 @@ describe('The Login Page', () => {
});
it('logs out then logs in again', () => {
const user = 'rahel.cueni';
const user = 'rachel.green';
const pw = 'test';
cy.viewport('macbook-15');

View File

@ -9,7 +9,7 @@ const redeemCoupon = coupon => {
cy.get('[data-cy="coupon-button"]').click();
};
describe('Email Verifcation', () => {
describe('Email Verification', () => {
beforeEach(() => {
cy.server();
});
@ -26,7 +26,7 @@ describe('Email Verifcation', () => {
},
}
});
cy.apolloLogin('rahel.cueni', 'test');
cy.apolloLogin('rachel.green', 'test');
cy.visit('/license-activation');
redeemCoupon('12345asfd');
@ -35,7 +35,7 @@ describe('Email Verifcation', () => {
it('displays error if input is missing', () => {
cy.viewport('macbook-15');
cy.apolloLogin('rahel.cueni', 'test');
cy.apolloLogin('rachel.green', 'test');
cy.visit('/license-activation');
redeemCoupon('');
@ -50,7 +50,7 @@ describe('Email Verifcation', () => {
Coupon: new GraphQLError('invalid_coupon')
}
});
cy.apolloLogin('rahel.cueni', 'test');
cy.apolloLogin('rachel.green', 'test');
cy.visit('/license-activation');
redeemCoupon('12345asfd');
@ -65,7 +65,7 @@ describe('Email Verifcation', () => {
Coupon: new GraphQLError('unknown_error')
}
});
cy.apolloLogin('rahel.cueni', 'test');
cy.apolloLogin('rachel.green', 'test');
cy.visit('/license-activation');
redeemCoupon('12345asfd');

View File

@ -50,8 +50,8 @@ describe('Apply module visibility', () => {
cy.viewport('macbook-15');
// login as teacher
cy.fakeLogin('nico.zickgraf', 'test');
// cy.apolloLogin('nico.zickgraf', 'test');
cy.fakeLogin('ross.geller', 'test');
// cy.apolloLogin('ross.geller', 'test');
// cy.wait('@gqlBetaLogin');
// go to module
cy.visit('/module/lohn-und-budget');

View File

@ -29,7 +29,7 @@ describe('Assignments', () => {
it('it does not display HTML tags', () => {
cy.server();
cy.viewport('macbook-15');
cy.fakeLogin('nico.zickgraf', 'test');
cy.fakeLogin('ross.geller', 'test');
cy.visit('/module/lohn-und-budget/submissions/QXNzaWdubWVudE5vZGU6MQ==');
cy.getByDataCy('assignment-solution').should('have.text', 'Eine Lösung');
});

View File

@ -115,8 +115,8 @@ describe('Current Module', () => {
// it('is set correctly', () => {
// cy.viewport('macbook-15');
//
// cy.fakeLogin('nico.zickgraf', 'test');
// // cy.apolloLogin('nico.zickgraf', 'test');
// cy.fakeLogin('ross.geller', 'test');
// // cy.apolloLogin('ross.geller', 'test');
// cy.visit('/');
//
// // module list exists, but does not have anything in it

View File

@ -54,7 +54,7 @@ describe('Custom Content Block', () => {
});
it.skip('Deletes the custom content block and removes it from the view', () => {
cy.fakeLogin('nico.zickgraf', 'test');
cy.fakeLogin('ross.geller', 'test');
cy.visit('module/some-module');
cy.log('Toggling Edit Mode');

View File

@ -12,16 +12,13 @@ const operations = {
objectives: 'Git gud',
final: false,
student: {
firstName: 'Rahel',
lastName: 'Cueni',
firstName: 'Rachel',
lastName: 'Green',
id: 'VXNlck5vZGU6NQ==',
avatarUrl: '',
// __typename: 'UserNode',
},
entriesCount: 0,
// __typename: 'ProjectNode',
},
// __typename: 'ProjectNodeEdge',
},
],
},
@ -42,21 +39,13 @@ const operations = {
describe('New project', () => {
before(() => {
cy.task('getSchema').then(schema => {
cy.mockGraphql({
schema,
mocks: {},
operations,
});
});
cy.setup();
});
it('creates a new project and displays it', () => {
cy.server();
cy.viewport('macbook-15');
cy.fakeLogin('rahel.cueni', 'test');
// cy.apolloLogin('rahel.cueni', 'test');
cy.mockGraphqlOps({
operations
});
cy.visit('/portfolio');
cy.get('[data-cy=add-project-button]').click();

View File

@ -80,7 +80,7 @@ describe('Objective Visibility', () => {
});
it('should display the correct objectives', () => {
cy.fakeLogin('rahel.cueni', 'test');
cy.fakeLogin('rachel.green', 'test');
cy.visit('/module/lohn-und-budget');
});

View File

@ -54,7 +54,7 @@ describe('Onboarding', () => {
cy.visit('/');
cy.assertStartPage(true);
cy.skipOnboarding();
cy.getByDataCy('onboarding-skip-link').click();
cy.assertStartPage(false);
});

View File

@ -19,8 +19,8 @@ const operations = {
'objectives': 'Be Groot\nBe awesome',
'final': false,
'student': {
'firstName': 'Rahel',
'lastName': 'Cueni',
'firstName': 'Rachel',
'lastName': 'Green',
'id': 'VXNlck5vZGU6NQ==',
'avatarUrl': '',
'__typename': 'UserNode',
@ -43,8 +43,8 @@ const operations = {
'objectives': 'Be Groot\nBe awesome',
'final': false,
'student': {
'firstName': 'Rahel',
'lastName': 'Cueni',
'firstName': 'Rachel',
'lastName': 'Green',
'id': 'VXNlck5vZGU6NQ==',
'avatarUrl': '',
'__typename': 'UserNode',
@ -95,7 +95,7 @@ const operations = {
describe('Project Entry', () => {
beforeEach(() => {
cy.viewport('macbook-15');
cy.fakeLogin('rahel.cueni', 'test');
cy.fakeLogin('rachel.green', 'test');
cy.server();
cy.task('getSchema').then(schema => {

View File

@ -1,4 +1,3 @@
import mocks from '../../../fixtures/mocks';
import minimalModule from '../../../fixtures/module.minimal';
const getOperations = ({readOnly}) => ({
@ -18,15 +17,7 @@ const getOperations = ({readOnly}) => ({
describe('Module Navigation - read only', () => {
beforeEach(() => {
cy.fakeLogin('nico.teacher', 'test');
cy.server();
cy.task('getSchema').then(schema => {
cy.mockGraphql({
schema,
mocks,
});
});
cy.viewport('macbook-15');
cy.setup();
});
it('is not shown', () => {

View File

@ -51,7 +51,7 @@ const checkSchoolClassTeamReadOnly = (readOnly) => {
describe('School Class and Team Management - Read only', () => {
beforeEach(() => {
cy.fakeLogin('rahel.cueni', 'test');
cy.fakeLogin('rachel.green', 'test');
cy.server();
cy.task('getSchema').then(schema => {
cy.mockGraphql({

View File

@ -12,7 +12,7 @@ describe('Class Management', () => {
});
cy.viewport('macbook-15');
cy.fakeLogin('rahel.cueni', 'test');
cy.fakeLogin('rachel.green', 'test');
});
// fixme: cache misbehaves with mequery, but only for test
@ -195,7 +195,7 @@ describe('Teacher Class Management', () => {
});
cy.viewport('macbook-15');
cy.fakeLogin('nico.zickgraf', 'test');
cy.fakeLogin('ross.geller', 'test');
});
it('changes class name', () => {

View File

@ -65,7 +65,7 @@ describe('Snapshot', () => {
});
it('Menu is visible for teacher', () => {
cy.fakeLogin('nico.zickgraf', 'test');
cy.fakeLogin('ross.geller', 'test');
cy.mockGraphqlOps(operations(true));
cy.visit('module/miteinander-reden/');
@ -73,7 +73,7 @@ describe('Snapshot', () => {
});
it('Menu is not visible for student', () => {
cy.fakeLogin('rahel.cueni', 'test');
cy.fakeLogin('rachel.green', 'test');
cy.mockGraphqlOps(operations(false));
cy.visit('module/miteinander-reden/');
@ -82,7 +82,7 @@ describe('Snapshot', () => {
});
it('Creates Snapshot', () => {
cy.fakeLogin('nico.zickgraf', 'test');
cy.fakeLogin('ross.geller', 'test');
cy.mockGraphqlOps(operations(true));
cy.visit('module/miteinander-reden/');
@ -95,7 +95,7 @@ describe('Snapshot', () => {
});
it('Applies Snapshot', () => {
cy.fakeLogin('nico.zickgraf', 'test');
cy.fakeLogin('ross.geller', 'test');
cy.mockGraphqlOps(operations(true));
cy.visit('module/miteinander-reden/snapshots');

View File

@ -142,7 +142,7 @@ describe('Spellcheck', () => {
});
it('should highlight three errors', () => {
cy.fakeLogin('rahel.cueni', 'test');
cy.fakeLogin('rachel.green', 'test');
cy.visit('/module/lohn-und-budget/');
cy.get('.spellcheck__correction').should('have.length', 0);

View File

@ -11,7 +11,7 @@ describe('Survey', () => {
});
cy.viewport('macbook-15');
cy.fakeLogin('rahel.cueni', 'test');
cy.fakeLogin('rachel.green', 'test');
});
it('should display and fill out the survey', () => {

View File

@ -127,10 +127,6 @@ Cypress.Commands.add('assertStartPage', (onboarding) => {
}
});
Cypress.Commands.add('skipOnboarding', (onboarding) => {
cy.get('[data-cy=onboarding-skip-link]').click();
});
Cypress.Commands.add('getByDataCy', (selector) => {
return cy.get(`[data-cy=${selector}]`);
});

View File

@ -18,11 +18,11 @@ export const getMe = ({schoolClasses, teacher}) => {
'me': {
'id': 'VXNlck5vZGU6NQ==',
'pk': 5,
'username': 'rahel.cueni',
'email': 'rahel.cueni@skillbox.example',
'username': 'rachel.green',
'email': 'rachel.green@skillbox.example',
'expiryDate': '3596153600',
'firstName': 'Rahel',
'lastName': 'Cueni',
'firstName': 'Rachel',
'lastName': 'Green',
'avatarUrl': '',
'isTeacher': teacher,
readOnly: false,

View File

@ -6,7 +6,7 @@ declare namespace Cypress {
* @param username
* @param password
* @example
* cy.apolloLogin('nico.zickgraf', 'test')
* cy.apolloLogin('ross.geller', 'test')
*/
apolloLogin(username: string, password: string): Chainable<any>

View File

@ -1,38 +1,30 @@
user_data = [
{
'teacher': ('Nico', 'Zickgraf',),
'class': 'FLID2018a',
'teacher': ('Ross', 'Geller',),
'class': 'Friends',
'code': 'XXXX',
'students': [
('Robin', 'Abbühl'),
('Zeynep', 'Catal'),
('Rahel', 'Cueni'),
('Ismatou', 'Diallo'),
('Mischa', 'Frech'),
('Melody', 'Merz'),
('Joelle', 'Perren'),
('Luca', 'Rutschmann'),
('Selina', 'Teuscher'),
('Kelly', 'To'),
('Deborah', 'Waldmeier'),
('Rahel', 'Weiss'),
('Cindy', 'Zimmermann'),
('Rachel', 'Green'),
('Monica', 'Geller'),
('Chandler', 'Bing'),
('Joey', 'Tribbiani'),
('Phoebe', 'Buffay'),
]
},
{
'teacher': ('Michael', 'Gurtner',),
'class': 'KF1A',
'teacher': ('Michael', 'Scott',),
'class': 'Scranton',
'code': 'YYYY',
'students': [
('Lisa', 'Arn'),
('Machado', 'Fernandes'),
('Sandro', 'Gyger'),
('Alain', 'Hofer'),
('Adrian', 'Luder'),
('Louis', 'Scherer'),
('Xhavit', 'Shala'),
('Marc', 'Uebersax'),
('Roman', 'Weber'),
('Jim', 'Halpert'),
('Pam', 'Beasley'),
('Dwight', 'Schrute'),
('Stanley', 'Hudson'),
('Angela', 'Kinsey'),
('Creed', 'Bratton'),
('Toby', 'Flenderson'),
('Kelly', 'Kapoor'),
('Kevin', 'Malone'),
]
}
]

View File

@ -9,7 +9,7 @@ from users.models import User
class Command(BaseCommand):
def handle(self, *args, **options):
self.stdout.write("Preparing projects")
user = User.objects.get(username='rahel.cueni')
user = User.objects.get(username='rachel.green')
self.stdout.write("Deleting all projects")
for project in user.projects.all():
project.delete()