Fix broken cypress test

This commit is contained in:
Ramon Wenger 2021-07-29 11:41:22 +02:00
parent d4182e7e1a
commit cccaf21c9c
4 changed files with 5 additions and 11 deletions

View File

@ -55,7 +55,7 @@ describe('Assignment feedback read-only - Teacher', () => {
// cy.get('@textarea').should('have.attr', 'readonly');
cy.isSubmissionReadOnly(myText);
cy.canReopen(false);
cy.getByDataCy('final-submission-reopen').should('not.exist');
});
it('can edit', () => {
cy.mockGraphqlOps({
@ -63,6 +63,7 @@ describe('Assignment feedback read-only - Teacher', () => {
});
cy.visit('submission/submission-id');
cy.canReopen(false);
cy.getByDataCy('final-submission-reopen').should('exist');
});
});

View File

@ -90,7 +90,7 @@ describe('Assignments read-only - Student', () => {
cy.visit('module/module-with-assignment');
cy.isSubmissionReadOnly(myText);
cy.canReopen(false);
cy.getByDataCy('final-submission-reopen').should('not.exist');
});
it('can revoke turn in', () => {
@ -110,6 +110,6 @@ describe('Assignments read-only - Student', () => {
cy.visit('module/module-with-assignment');
cy.getByDataCy('final-submission').should('exist');
cy.canReopen(false);
cy.getByDataCy('final-submission-reopen').should('not.exist');
});
});

View File

@ -146,11 +146,6 @@ Cypress.Commands.add('fakeLogin', () => {
cy.setCookie('loginStatus', 'true');
});
Cypress.Commands.add('canReopen', (exists) => {
let check = exists ? 'exist' : 'not.exist';
cy.getByDataCy('final-submission-reopen').should(check);
});
Cypress.Commands.add('isSubmissionReadOnly', (myText) => {
cy.get('.submission-form__textarea--readonly').as('textarea');

View File

@ -24,8 +24,6 @@ declare namespace Cypress {
fakeLogin(username: string, password: string): void
canReopen(exists: boolean): void
isSubmissionReadOnly(myText: string): void
openSidebar(): void