Add test for current module
This commit is contained in:
parent
afe29f3f0c
commit
09d20e346d
|
|
@ -0,0 +1,22 @@
|
||||||
|
describe('Current Module', () => {
|
||||||
|
it('is set correctly', () => {
|
||||||
|
// cy.route('POST', '/api/graphql/').as('graphQL');
|
||||||
|
cy.startGraphQLCapture();
|
||||||
|
cy.login('nico.zickgraf', 'test');
|
||||||
|
cy.visit('/module/lohn-und-budget');
|
||||||
|
|
||||||
|
cy.get('[data-cy=module-title]').should('contain', 'Lohn und Budget')
|
||||||
|
|
||||||
|
cy.visit('/');
|
||||||
|
cy.waitFor('MeQuery');
|
||||||
|
cy.get('[data-cy="current-module-link"]').click();
|
||||||
|
cy.get('[data-cy=module-title]').should('contain', 'Lohn und Budget')
|
||||||
|
|
||||||
|
cy.visit('/module/geld');
|
||||||
|
cy.get('[data-cy=module-title]').should('contain', 'Geld')
|
||||||
|
|
||||||
|
cy.get('[data-cy="home-link"]').click();
|
||||||
|
cy.get('[data-cy="current-module-link"]').click();
|
||||||
|
cy.get('[data-cy=module-title]').should('contain', 'Geld')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
@ -8,10 +8,8 @@ describe('Solutions', () => {
|
||||||
// // });
|
// // });
|
||||||
//
|
//
|
||||||
it('toggles the solution as teacher, then the student can display it', () => {
|
it('toggles the solution as teacher, then the student can display it', () => {
|
||||||
cy.server();
|
|
||||||
cy.exec("python ../server/manage.py hidesolutions");
|
cy.exec("python ../server/manage.py hidesolutions");
|
||||||
// cy.login('nico.zickgraf', 'test');
|
cy.startGraphQLCapture();
|
||||||
// cy.visit('/module/lohn-und-budget');
|
|
||||||
cy.route('POST', '/api/graphql/').as('graphQL');
|
cy.route('POST', '/api/graphql/').as('graphQL');
|
||||||
// does not work with cypress yet, because of the fetch api
|
// does not work with cypress yet, because of the fetch api
|
||||||
// https://github.com/cypress-io/cypress/issues/95
|
// https://github.com/cypress-io/cypress/issues/95
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,11 @@ Cypress.Commands.add('loginByCsrf', (username, password, csrftoken) => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Cypress.Commands.add('startGraphQLCapture', () => {
|
||||||
|
cy.server();
|
||||||
|
cy.route('POST', '/api/graphql/').as('graphQL');
|
||||||
|
});
|
||||||
|
|
||||||
// from https://stackoverflow.com/questions/53814647/how-can-i-alias-specific-graphql-requests-in-cypress
|
// from https://stackoverflow.com/questions/53814647/how-can-i-alias-specific-graphql-requests-in-cypress
|
||||||
Cypress.Commands.add('waitFor', operationName => {
|
Cypress.Commands.add('waitFor', operationName => {
|
||||||
cy.wait('@graphQL').then(({request}) => {
|
cy.wait('@graphQL').then(({request}) => {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="mobile-header">
|
<div class="mobile-header">
|
||||||
<router-link to="/">
|
<router-link to="/" data-cy="home-link">
|
||||||
<logo></logo>
|
<logo></logo>
|
||||||
</router-link>
|
</router-link>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
class="start-sections__section"
|
class="start-sections__section"
|
||||||
title="Inhalte"
|
title="Inhalte"
|
||||||
subtitle="Neues Wissen erwerben"
|
subtitle="Neues Wissen erwerben"
|
||||||
|
data-cy="current-module-link"
|
||||||
:link-text="moduleText"
|
:link-text="moduleText"
|
||||||
:route="moduleRoute"
|
:route="moduleRoute"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue