Skip to content

Commit 81103cb

Browse files
committed
test: check content of currently open slide
1 parent 69f7920 commit 81103cb

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

tests/e2e/features/presentationViewer.feature

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,17 @@ Feature: markdown presentation viewer
22
As a user
33
I want to view markdown documents in presentation format
44
So that I can easily present content in a structured manner
5-
5+
66
Background:
77
Given user "admin" has uploaded the markdown file "test-markdown.md" using API
88
And user "admin" has logged in
99

1010

1111
Scenario: preview markdown file in presentation viewer
1212
When user "admin" previews a markdown file "test-markdown.md" in presentation viewer
13-
Then markdown file "test-markdown.md" should be opened in the presentation viewer
13+
Then markdown file "test-markdown.md" should be opened in the presentation viewer
14+
15+
16+
Scenario: check content of a slide
17+
When user "admin" previews a markdown file "test-markdown.md" in presentation viewer
18+
Then the content of the current slide should be "PRESENTATION VIEWER"

tests/e2e/pageObjects/PresentationViewerPage.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ class PresentationViewer {
22
constructor() {
33
this.slidesContainerSelector = '#presentation-viewer-main .slides'
44
this.presentationViewerHomepageSelector = '#presentation-viewer-main'
5+
this.currentSlideSelector = '#presentation-viewer-main section.present'
6+
}
7+
8+
async getCurrentSlideContent() {
9+
return await page.locator(this.currentSlideSelector).innerText()
510
}
611
}
712

tests/e2e/stepDefinitions/presentationViewerContext.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,9 @@ Then(
3939
await expect(page.locator(presentationViewer.slidesContainerSelector)).toBeVisible()
4040
}
4141
)
42+
43+
Then('the content of the current slide should be {string}', async function (content) {
44+
await expect(page.locator(presentationViewer.currentSlideSelector)).toBeVisible()
45+
const currentSlideContent = await presentationViewer.getCurrentSlideContent()
46+
await expect(currentSlideContent).toBe(content)
47+
})

0 commit comments

Comments
 (0)