Skip to content

Commit 8223ff8

Browse files
committed
test: click one more button to view md file in opencloud
1 parent 973240e commit 8223ff8

File tree

4 files changed

+38
-3
lines changed

4 files changed

+38
-3
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,16 @@ jobs:
102102
- name: install-chromium
103103
run: npx playwright install chromium
104104

105-
- name: e2e
105+
- name: e2e (Opencloud)
106+
if: matrix.server == 'Opencloud'
107+
run: pnpm test:e2e tests/e2e/features/**/*.feature
108+
env:
109+
HEADLESS: true
110+
TARGET_APP: opencloud
111+
112+
- name: e2e (Ocis)
113+
if: matrix.server == 'Ocis'
106114
run: pnpm test:e2e tests/e2e/features/**/*.feature
107115
env:
108116
HEADLESS: true
117+
TARGET_APP: ocis

tests/e2e/config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ const config = {
99
timeout: parseInt(process.env.TIMEOUT) || 60,
1010
minTimeout: parseInt(process.env.MIN_TIMEOUT) || 5,
1111
headless: process.env.HEADLESS === 'true',
12-
debug: process.env.DEBUG === 'true'
12+
debug: process.env.DEBUG === 'true',
13+
targetApp: process.env.TARGET_APP || 'ocis'
1314
}
1415

1516
module.exports = config
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const Ocis = require('./OcisPage')
2+
3+
class Opencloud extends Ocis {
4+
constructor() {
5+
super()
6+
this.openWithBtnSelector = 'button[id^="oc-files-context-actions-open-with-toggle"]'
7+
}
8+
9+
async openMDFileInPresentationViewer() {
10+
await page.click(this.contextMenuBtnSelector)
11+
await page.click(this.openWithBtnSelector)
12+
await page.click(this.openInPresentationViewerBtnSelector)
13+
}
14+
}
15+
16+
module.exports = Opencloud

tests/e2e/stepDefinitions/presentationViewerContext.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
const { Given, When, Then } = require('@cucumber/cucumber')
22
const { expect } = require('@playwright/test')
3+
4+
const config = require('../config')
5+
36
const { getUserCredentials } = require('../utils/userHelper')
47
const { uploadFile } = require('../utils/fileHelper')
58
const PresentationViewer = require('../pageObjects/PresentationViewerPage')
69
const Ocis = require('../pageObjects/OcisPage')
10+
const Opencloud = require('../pageObjects/OpencloudPage')
711

812
const presentationViewer = new PresentationViewer()
913
const ocis = new Ocis()
@@ -25,7 +29,12 @@ Given('user {string} has logged in', async function (user) {
2529
When(
2630
'user {string} previews a markdown file {string} in presentation viewer',
2731
async function (user, fileName) {
28-
await ocis.openMDFileInPresentationViewer()
32+
if (config.targetApp === 'opencloud') {
33+
const opencloud = new Opencloud()
34+
await opencloud.openMDFileInPresentationViewer()
35+
} else {
36+
await ocis.openMDFileInPresentationViewer()
37+
}
2938
}
3039
)
3140

0 commit comments

Comments
 (0)