Split up frontend only and e2e tests
This commit is contained in:
parent
59f98023d6
commit
337cd8f5ec
|
|
@ -4,4 +4,5 @@ const prodEnv = require('./prod.env')
|
|||
|
||||
module.exports = merge(prodEnv, {
|
||||
NODE_ENV: '"development"',
|
||||
VUE_APP_ENABLE_SPELLCHECK: 'true'
|
||||
});
|
||||
|
|
|
|||
|
|
@ -3,8 +3,9 @@
|
|||
"videoUploadOnPasses": false,
|
||||
"reporter": "junit",
|
||||
"reporterOptions": {
|
||||
"mochaFile": "cypress/test-reports/cypress-results-[hash].xml",
|
||||
"mochaFile": "cypress/test-reports/e2e/cypress-results-[hash].xml",
|
||||
"toConsole": true
|
||||
},
|
||||
"integrationFolder": "cypress/integration/e2e",
|
||||
"$schema": "https://on.cypress.io/cypress.schema.json"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const schema = require('../fixtures/schema_public.json');
|
||||
const schema = require('../../fixtures/schema_public.json');
|
||||
|
||||
describe('Email Verifcation', () => {
|
||||
beforeEach(() => {
|
||||
|
|
@ -12,7 +12,7 @@ describe('Email Verifcation', () => {
|
|||
operations: {
|
||||
Registration: {
|
||||
registration: {
|
||||
message: "success",
|
||||
message: 'success',
|
||||
success: true
|
||||
}
|
||||
},
|
||||
|
|
@ -24,7 +24,6 @@ describe('Email Verifcation', () => {
|
|||
// user should be logged in at that stage. As the cookie cannot be set at the right time
|
||||
// we just check if the user gets redirected to the login page as we can't log her in
|
||||
cy.url().should('include', 'hello?redirect=%2F');
|
||||
|
||||
});
|
||||
|
||||
it('displays error if key is incorrect', () => {
|
||||
|
|
@ -35,7 +34,7 @@ describe('Email Verifcation', () => {
|
|||
operations: {
|
||||
Registration: {
|
||||
registration: {
|
||||
message: "invalid_key",
|
||||
message: 'invalid_key',
|
||||
success: false
|
||||
}
|
||||
},
|
||||
|
|
@ -45,7 +44,6 @@ describe('Email Verifcation', () => {
|
|||
cy.visit('/verify-email?confirmation=abcd1234&id=12');
|
||||
cy.get('[data-cy="code-nok-msg"]').contains('Der angegebene Verifizierungscode ist ungültig oder abgelaufen.');
|
||||
cy.get('[data-cy="code-ok-msg"]').should('not.exist');
|
||||
|
||||
});
|
||||
|
||||
it('displays error if an error occured', () => {
|
||||
|
|
@ -56,7 +54,7 @@ describe('Email Verifcation', () => {
|
|||
operations: {
|
||||
Registration: {
|
||||
registration: {
|
||||
message: "unkown_error",
|
||||
message: 'unkown_error',
|
||||
success: false
|
||||
}
|
||||
},
|
||||
|
|
@ -65,7 +63,6 @@ describe('Email Verifcation', () => {
|
|||
|
||||
cy.visit('/verify-email?confirmation=abcd1234&id=12');
|
||||
cy.get('[data-cy="code-nok-msg"]').contains('Ein Fehler ist aufgetreten. Bitte kontaktieren Sie den Administrator.');
|
||||
|
||||
});
|
||||
|
||||
it('forwards to coupon page if user has no valid license', () => {
|
||||
|
|
@ -76,7 +73,7 @@ describe('Email Verifcation', () => {
|
|||
operations: {
|
||||
Registration: {
|
||||
registration: {
|
||||
message: "no_valid_license",
|
||||
message: 'no_valid_license',
|
||||
success: false
|
||||
}
|
||||
},
|
||||
|
|
@ -88,7 +85,5 @@ describe('Email Verifcation', () => {
|
|||
// user should be logged in at that stage. As the cookie cannot be set at the right time
|
||||
// we just check if the user gets redirected to the coupon page as we can't log her in
|
||||
cy.url().should('include', 'hello?redirect=%2Flicense-activation');
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import {mockUpdateOnboardingProgress} from '../../support/helpers';
|
||||
|
||||
const schema = require('../../fixtures/schema.json');
|
||||
const me = require('../../fixtures/me.new-student.json');
|
||||
|
||||
|
|
@ -9,7 +11,7 @@ describe('New student', () => {
|
|||
schema: schema,
|
||||
});
|
||||
|
||||
cy.fakeLogin('hansli', 'test');
|
||||
cy.apolloLogin('hansli', 'test');
|
||||
|
||||
const __typename = 'SchoolClassNode';
|
||||
const name = 'KF1A';
|
||||
|
|
@ -39,11 +41,7 @@ describe('New student', () => {
|
|||
}
|
||||
}
|
||||
},
|
||||
UpdateOnboardingProgress: {
|
||||
updateOnboardingProgress: {
|
||||
success: true
|
||||
}
|
||||
}
|
||||
...mockUpdateOnboardingProgress()
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const schema = require('../../fixtures/schema.json');
|
||||
// const schema = require('../../fixtures/schema.json');
|
||||
const assignments = require('../../fixtures/assignments.json');
|
||||
const mePayload = require('../../fixtures/me.join-class.json');
|
||||
const topics = require('../../fixtures/topics.json');
|
||||
|
|
@ -16,12 +16,66 @@ const topic = {
|
|||
...Object.values(moduleTeasers).map(module => {
|
||||
return {
|
||||
node: module,
|
||||
__typename: 'ModuleNodeEdge'
|
||||
__typename: 'ModuleNodeEdge',
|
||||
};
|
||||
})
|
||||
]
|
||||
}
|
||||
}
|
||||
}),
|
||||
],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const me = {
|
||||
...mePayload.me,
|
||||
lastModule: {
|
||||
// 'id': 'TW9kdWxlTm9kZToxNw==',
|
||||
'slug': 'lohn-und-budget',
|
||||
'__typename': 'ModuleNode',
|
||||
},
|
||||
lastTopic: {
|
||||
'id': 'VG9waWNOb2RlOjU=',
|
||||
'slug': 'geld-und-kauf',
|
||||
'__typename': 'TopicNode',
|
||||
},
|
||||
recentModules: {
|
||||
'edges': [],
|
||||
'__typename': 'ModuleNodeConnection',
|
||||
},
|
||||
};
|
||||
|
||||
const operations = {
|
||||
MeQuery: variables => {
|
||||
return {
|
||||
me: {
|
||||
...me,
|
||||
'__typename': 'UserNode',
|
||||
'permissions': [],
|
||||
},
|
||||
};
|
||||
},
|
||||
AssignmentsQuery: {
|
||||
assignments,
|
||||
},
|
||||
ModulesQuery: variables => {
|
||||
return {
|
||||
module: fullModules[variables.slug],
|
||||
};
|
||||
},
|
||||
TopicsQuery: topics,
|
||||
Topic: topic,
|
||||
UpdateLastTopic: {
|
||||
'updateLastTopic': {
|
||||
'topic': topic.topic,
|
||||
'__typename': 'UpdateLastTopicPayload',
|
||||
},
|
||||
},
|
||||
UpdateLastModule: variables => {
|
||||
return {
|
||||
updateLastModule: {
|
||||
lastModule: moduleTeasers[variables.input.id],
|
||||
__typename: 'UpdateLastModulePayload',
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
Cypress.Commands.add('checkHome', (n, skipHome) => {
|
||||
|
|
@ -43,62 +97,20 @@ describe('Current Module', () => {
|
|||
before(() => {
|
||||
cy.server();
|
||||
|
||||
let me = {
|
||||
...mePayload.me,
|
||||
lastModule: {
|
||||
// 'id': 'TW9kdWxlTm9kZToxNw==',
|
||||
'slug': 'lohn-und-budget',
|
||||
'__typename': 'ModuleNode'
|
||||
},
|
||||
lastTopic: {
|
||||
'id': 'VG9waWNOb2RlOjU=',
|
||||
'slug': 'geld-und-kauf',
|
||||
'__typename': 'TopicNode'
|
||||
},
|
||||
recentModules: {
|
||||
'edges': [],
|
||||
'__typename': 'ModuleNodeConnection'
|
||||
},
|
||||
};
|
||||
cy.mockGraphql({
|
||||
schema: schema,
|
||||
// endpoint: '/api/graphql'
|
||||
operations: {
|
||||
MeQuery: variables => {
|
||||
return {
|
||||
me: {
|
||||
...me,
|
||||
'__typename': 'UserNode',
|
||||
'permissions': []
|
||||
}
|
||||
};
|
||||
},
|
||||
AssignmentsQuery: {
|
||||
assignments
|
||||
},
|
||||
ModulesQuery: variables => {
|
||||
return {
|
||||
module: fullModules[variables.slug]
|
||||
};
|
||||
},
|
||||
TopicsQuery: topics,
|
||||
Topic: topic,
|
||||
UpdateLastTopic: {
|
||||
'updateLastTopic': {
|
||||
'topic': topic.topic,
|
||||
'__typename': 'UpdateLastTopicPayload'
|
||||
}
|
||||
},
|
||||
UpdateLastModule: variables => {
|
||||
return {
|
||||
updateLastModule: {
|
||||
lastModule: moduleTeasers[variables.input.id],
|
||||
__typename: 'UpdateLastModulePayload'
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
cy.task('getSchema').then(schema => {
|
||||
cy.mockGraphql({
|
||||
schema,
|
||||
// endpoint: '/api/graphql'
|
||||
// mocks,
|
||||
operations,
|
||||
});
|
||||
});
|
||||
|
||||
// cy.mockGraphql({
|
||||
// schema: schema,
|
||||
// // endpoint: '/api/graphql'
|
||||
// operations,
|
||||
// });
|
||||
});
|
||||
|
||||
it('is set correctly', () => {
|
||||
|
|
|
|||
|
|
@ -1,49 +1,54 @@
|
|||
const schema = require('../../fixtures/schema.json');
|
||||
// const schema = require('../../fixtures/schema.json');
|
||||
|
||||
const operations = {
|
||||
ProjectsQuery: {
|
||||
projects: {
|
||||
edges: [
|
||||
{
|
||||
node: {
|
||||
id: 'UHJvamVjdE5vZGU6NjY=',
|
||||
title: 'Some random title',
|
||||
appearance: 'blue',
|
||||
description: 'This description rocks',
|
||||
slug: 'some-random-title',
|
||||
objectives: 'Git gud',
|
||||
final: false,
|
||||
student: {
|
||||
firstName: 'Rahel',
|
||||
lastName: 'Cueni',
|
||||
id: 'VXNlck5vZGU6NQ==',
|
||||
avatarUrl: '',
|
||||
// __typename: 'UserNode',
|
||||
},
|
||||
entriesCount: 0,
|
||||
// __typename: 'ProjectNode',
|
||||
},
|
||||
// __typename: 'ProjectNodeEdge',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
MeQuery: {},
|
||||
AddProject: variables => ({
|
||||
addProject: {
|
||||
project: Object.assign({}, variables.input.project),
|
||||
errors: null,
|
||||
__typename: 'AddProjectPayload',
|
||||
},
|
||||
}),
|
||||
};
|
||||
|
||||
describe('New project', () => {
|
||||
it('creates a new project and displays it', () => {
|
||||
cy.server();
|
||||
|
||||
cy.mockGraphql({
|
||||
schema: schema,
|
||||
operations: {
|
||||
ProjectsQuery: {
|
||||
projects: {
|
||||
edges: [
|
||||
{
|
||||
node: {
|
||||
id: 'UHJvamVjdE5vZGU6NjY=',
|
||||
title: 'Some random title',
|
||||
appearance: 'blue',
|
||||
description: 'This description rocks',
|
||||
slug: 'some-random-title',
|
||||
objectives: 'Git gud',
|
||||
final: false,
|
||||
student: {
|
||||
firstName: 'Rahel',
|
||||
lastName: 'Cueni',
|
||||
id: 'VXNlck5vZGU6NQ==',
|
||||
avatarUrl: '',
|
||||
__typename: 'UserNode'
|
||||
},
|
||||
entriesCount: 0,
|
||||
__typename: 'ProjectNode',
|
||||
},
|
||||
__typename: 'ProjectNodeEdge'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
AddProject: variables => ({
|
||||
addProject: {
|
||||
project: Object.assign({}, variables.input.project),
|
||||
errors: null,
|
||||
__typename: 'AddProjectPayload'
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
;
|
||||
cy.task('getSchema').then(schema => {
|
||||
cy.mockGraphql({
|
||||
schema,
|
||||
mocks: {},
|
||||
operations,
|
||||
});
|
||||
});
|
||||
|
||||
cy.viewport('macbook-15');
|
||||
cy.fakeLogin('rahel.cueni', 'test');
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import {mockUpdateOnboardingProgress} from '../../support/helpers';
|
||||
|
||||
const schema = require('../../fixtures/schema.json');
|
||||
const me = require('../../fixtures/me.join-class.json');
|
||||
|
||||
|
|
@ -11,7 +13,7 @@ describe('Onboarding', () => {
|
|||
});
|
||||
|
||||
it('shows the onboarding steps and finishes them', () => {
|
||||
cy.apolloLogin('hansli', 'test');
|
||||
cy.fakeLogin('hansli', 'test');
|
||||
|
||||
cy.mockGraphqlOps({
|
||||
operations: {
|
||||
|
|
@ -20,7 +22,8 @@ describe('Onboarding', () => {
|
|||
...me.me,
|
||||
onboardingVisited: false
|
||||
}
|
||||
}
|
||||
},
|
||||
...mockUpdateOnboardingProgress()
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -34,7 +37,7 @@ describe('Onboarding', () => {
|
|||
});
|
||||
|
||||
it('shows the onboarding steps and skips them', () => {
|
||||
cy.apolloLogin('hansli', 'test');
|
||||
cy.fakeLogin('hansli', 'test');
|
||||
|
||||
cy.mockGraphqlOps({
|
||||
operations: {
|
||||
|
|
@ -43,7 +46,8 @@ describe('Onboarding', () => {
|
|||
...me.me,
|
||||
onboardingVisited: false
|
||||
}
|
||||
}
|
||||
},
|
||||
...mockUpdateOnboardingProgress()
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -54,11 +58,12 @@ describe('Onboarding', () => {
|
|||
});
|
||||
|
||||
it('does not show the onboarding', () => {
|
||||
cy.apolloLogin('hansli', 'test');
|
||||
cy.fakeLogin('hansli', 'test');
|
||||
|
||||
cy.mockGraphqlOps({
|
||||
operations: {
|
||||
MeQuery: me
|
||||
MeQuery: me,
|
||||
...mockUpdateOnboardingProgress()
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ describe('Project Entry', () => {
|
|||
beforeEach(() => {
|
||||
cy.viewport('macbook-15');
|
||||
cy.fakeLogin('rahel.cueni', 'test');
|
||||
cy.server();
|
||||
|
||||
cy.mockGraphql({
|
||||
schema: schema,
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import {mockUpdateLastModule} from '../../support/helpers';
|
||||
|
||||
const schema = require('../../fixtures/schema.json');
|
||||
const assignments = require('../../fixtures/assignments.json');
|
||||
const module = require('../../fixtures/module.json');
|
||||
|
|
@ -23,7 +25,8 @@ describe('Spellcheck', () => {
|
|||
},
|
||||
SpellCheck: {
|
||||
spellCheck
|
||||
}
|
||||
},
|
||||
...mockUpdateLastModule()
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -54,8 +54,8 @@ describe('Apply module visibility', () => {
|
|||
cy.viewport('macbook-15');
|
||||
|
||||
// login as teacher
|
||||
// cy.fakeLogin('nico.zickgraf', 'test');
|
||||
cy.apolloLogin('nico.zickgraf', 'test');
|
||||
cy.fakeLogin('nico.zickgraf', 'test');
|
||||
// cy.apolloLogin('nico.zickgraf', 'test');
|
||||
// cy.wait('@gqlBetaLogin');
|
||||
// go to module
|
||||
cy.visit('/module/lohn-und-budget');
|
||||
|
|
|
|||
|
|
@ -351,3 +351,23 @@ export const getModules = () => {
|
|||
},
|
||||
};
|
||||
};
|
||||
|
||||
export const mockUpdateOnboardingProgress = () => {
|
||||
return {
|
||||
UpdateOnboardingProgress: {
|
||||
updateOnboardingProgress: {
|
||||
success: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export const mockUpdateLastModule = () => {
|
||||
return {
|
||||
UpdateLastModule: {
|
||||
updateLastModule: {
|
||||
lastModule: {}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -10,8 +10,10 @@
|
|||
"lint": "eslint --ext .js,.vue src",
|
||||
"fix-lint": "eslint --ext .js,.vue --fix src",
|
||||
"build": "node build/build.js",
|
||||
"open:cypress": "cypress open",
|
||||
"test:cypress": "cypress run",
|
||||
"open:cypress:e2e": "cypress open --config-file cypress.e2e.json",
|
||||
"open:cypress:frontend": "cypress open --config-file cypress.frontend.json",
|
||||
"test:cypress:e2e": "cypress run --config-file cypress.e2e.json",
|
||||
"test:cypress:frontend": "cypress run --config-file cypress.frontend.json",
|
||||
"install:cypress": "cypress install",
|
||||
"test:unit": "jest"
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue