diff --git a/cypress/e2e/projects/detail/comments.spec.js b/cypress/e2e/projects/detail/comments.spec.js index aeed407..3118047 100644 --- a/cypress/e2e/projects/detail/comments.spec.js +++ b/cypress/e2e/projects/detail/comments.spec.js @@ -16,6 +16,8 @@ describe('Comments', () => { beforeEach(() => { + cy.clearLocalStorage() + cy.task('questionnaire:delete') cy.clearServerCache() @@ -35,6 +37,7 @@ describe('Comments', () => { project.openCommentsFor('Options Question 1') project.startNewCommentThread('This is a new thread') project.expectCommentCount(1) + cy.clearCurrentQuestionnaireSidePanelLocalStorage() cy.reload() project.expectCommentCount(1) } @@ -47,6 +50,7 @@ describe('Comments', () => { project.openPrivateNotesFor('Options Question 1') project.startNewPrivateNotesThread('This is a new thread') project.expectCommentCount(2) + cy.clearCurrentQuestionnaireSidePanelLocalStorage() cy.reload() project.expectCommentCount(2) } @@ -54,9 +58,10 @@ describe('Comments', () => { const testNoPrivateNotes = () => { project.openCommentsFor('Options Question 1') cy.getCy('comments_nav_private-notes').should('not.exist') + cy.clearCurrentQuestionnaireSidePanelLocalStorage() } - it('as DSW Admin', () => { + it('as Admin', () => { cy.logout() cy.loginAs('admin') project.open(projectName) @@ -231,6 +236,7 @@ describe('Comments', () => { project.startNewCommentThread('This is a new thread') project.addUser('Nikola Tesla', 'Commenter') cy.logout() + cy.clearLocalStorage() cy.loginAs('datasteward') project.open(projectName) @@ -245,6 +251,7 @@ describe('Comments', () => { project.startNewPrivateNotesThread('This is a new thread') project.addUser('Nikola Tesla', 'Editor') cy.logout() + cy.clearLocalStorage() cy.loginAs('datasteward') project.open(projectName) diff --git a/cypress/e2e/projects/detail/questionnaire/basic.spec.js b/cypress/e2e/projects/detail/questionnaire/basic.spec.js index 087ef49..4726bc0 100644 --- a/cypress/e2e/projects/detail/questionnaire/basic.spec.js +++ b/cypress/e2e/projects/detail/questionnaire/basic.spec.js @@ -312,4 +312,15 @@ describe('Basic Questionnaire Tests', () => { cy.get('.nav-link').contains('Chapter 2').click() project.checkAnswerChecked('Answer 2.2') }) + + + it('keep sidepanel open after refresh', () => { + // open comments tab + cy.get('.item').contains('Comments').click() + cy.get('.comments-overview').should('be.visible') + + // check that it remains open after reopening the page + cy.reload() + cy.get('.comments-overview').should('be.visible') + }) }) diff --git a/cypress/e2e/projects/detail/todos.spec.js b/cypress/e2e/projects/detail/todos.spec.js index 466f595..44283fa 100644 --- a/cypress/e2e/projects/detail/todos.spec.js +++ b/cypress/e2e/projects/detail/todos.spec.js @@ -16,9 +16,11 @@ describe('TODOs', () => { beforeEach(() => { + cy.clearLocalStorage() + cy.task('questionnaire:delete') cy.clearServerCache() - + cy.createQuestionnaire({ visibility: project.VisibleView, sharing: project.Restricted, @@ -61,6 +63,7 @@ describe('TODOs', () => { // save, reopen and check again project.awaitSave() + cy.clearCurrentQuestionnaireSidePanelLocalStorage() project.open(projectName) project.expectTodo(test.question) }) diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 0b604b2..83493b8 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -245,6 +245,13 @@ Cypress.Commands.add('updateQuestionnaireContent', (questionnaireUuid, data) => }) }) +Cypress.Commands.add('clearCurrentQuestionnaireSidePanelLocalStorage', () => { + cy.url().then((url) => { + const projectUuid = url.match(/\/wizard\/projects\/(.*)/)[1] + cy.clearLocalStorage(`project-${projectUuid}-right-panel`) + }) +}) + // KM Editor commands @@ -451,6 +458,7 @@ Cypress.Commands.add('wsSendAs', (role, url, msg) => { // Cache + Cypress.Commands.add('clearServerCache', () => { cy.task('user:addPermission', { perm: 'DEV_PERM', email: Cypress.env('admin_username') })