From 70c0f362574ff967bc804195d9521cf803a8aaf8 Mon Sep 17 00:00:00 2001 From: pradip Date: Fri, 27 Mar 2026 16:42:30 +0545 Subject: [PATCH] test: e2e test coverage for issue#13 --- tests/e2e/features/presentationViewer.feature | 9 +++++++-- tests/e2e/pageObjects/PresentationViewerPage.js | 5 +++++ tests/e2e/stepDefinitions/presentationViewerContext.js | 6 +++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/tests/e2e/features/presentationViewer.feature b/tests/e2e/features/presentationViewer.feature index e9ad4cb..ba38f9c 100644 --- a/tests/e2e/features/presentationViewer.feature +++ b/tests/e2e/features/presentationViewer.feature @@ -9,7 +9,12 @@ Feature: markdown presentation viewer Scenario: preview markdown file in presentation viewer - When user "admin" previews markdown file "test-markdown.md" in presentation viewer + When user "admin" previews markdown file "test-markdown.md" in presentation viewer using context menu + Then markdown file "test-markdown.md" should be opened in the presentation viewer + And the content of the current slide should be "PRESENTATION VIEWER" + # close and re-open presentation viewer + When user "admin" closes the presentation viewer + And user "admin" previews markdown file "test-markdown.md" in presentation viewer using context menu Then markdown file "test-markdown.md" should be opened in the presentation viewer And the content of the current slide should be "PRESENTATION VIEWER" # change slide with button in UI @@ -25,7 +30,7 @@ Feature: markdown presentation viewer @skipOnOpenCloud Scenario: re-open markdown file in presentation viewer after opening in text editor - When user "admin" previews markdown file "test-markdown.md" in presentation viewer + When user "admin" previews markdown file "test-markdown.md" in presentation viewer using context menu Then markdown file "test-markdown.md" should be opened in the presentation viewer And the content of the current slide should be "PRESENTATION VIEWER" When user "admin" opens file "test-markdown.md" in text editor using sidebar panel diff --git a/tests/e2e/pageObjects/PresentationViewerPage.js b/tests/e2e/pageObjects/PresentationViewerPage.js index a03782b..46e1719 100644 --- a/tests/e2e/pageObjects/PresentationViewerPage.js +++ b/tests/e2e/pageObjects/PresentationViewerPage.js @@ -9,6 +9,7 @@ class PresentationViewer { this.sidebarPanelSelector = '#app-sidebar' this.sidebarToggleBtnSelector = '#files-toggle-sidebar' this.actionsMenuSelector = '#sidebar-panel-actions-select' + this.closePresentationViewerButton = '#app-top-bar-close' } async getCurrentSlideContent() { @@ -30,6 +31,10 @@ class PresentationViewer { const key = direction === 'next' ? 'ArrowRight' : 'ArrowLeft' await page.locator('body').press(key) } + + async closePresentationViewer() { + await page.click(this.closePresentationViewerButton) + } } module.exports = PresentationViewer diff --git a/tests/e2e/stepDefinitions/presentationViewerContext.js b/tests/e2e/stepDefinitions/presentationViewerContext.js index dafa321..e0a7f4e 100644 --- a/tests/e2e/stepDefinitions/presentationViewerContext.js +++ b/tests/e2e/stepDefinitions/presentationViewerContext.js @@ -26,7 +26,7 @@ Given('user {string} has logged in', async function (user) { }) When( - 'user {string} previews markdown file {string} in presentation viewer', + 'user {string} previews markdown file {string} in presentation viewer using context menu', async function (user, fileName) { await files.openMDFileInPresentationViewer() } @@ -77,3 +77,7 @@ When( Then('file {string} should be opened in the text editor', async function (fileName) { await expect(page.locator(presentationViewer.textEditorContainerSelector)).toBeVisible() }) + +When('user {string} closes the presentation viewer', async function (user) { + await presentationViewer.closePresentationViewer() +})