Skip to content

Commit 16b7bc6

Browse files
committed
test: add new page for both owncloud and opencloud
1 parent 1aa65dd commit 16b7bc6

File tree

7 files changed

+27
-42
lines changed

7 files changed

+27
-42
lines changed

.github/workflows/ci.yml

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

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'
105+
- name: e2e-${{ matrix.server }}
114106
run: pnpm test:e2e tests/e2e/features/**/*.feature
115107
env:
116108
HEADLESS: true
117-
TARGET_APP: ocis
109+
TARGET_SERVER: matrix.server

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ pnpm run test:e2e <path_to_feature_file>
106106

107107
For OpenCloud:
108108
```bash
109-
TARGET_APP=opencloud pnpm run test:e2e <path_to_feature_file>
109+
TARGET_SERVER=opencloud pnpm run test:e2e <path_to_feature_file>
110110
```
111111

112112
## Building Docker Container

tests/e2e/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const config = {
1010
minTimeout: parseInt(process.env.MIN_TIMEOUT) || 5,
1111
headless: process.env.HEADLESS === 'true',
1212
debug: process.env.DEBUG === 'true',
13-
targetApp: process.env.TARGET_APP || 'ocis'
13+
targetServer: process.env.TARGET_SERVER.toLowerCase() || 'ocis'
1414
}
1515

1616
module.exports = config

tests/e2e/pageObjects/FilesPage.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const Ocis = require('./OcisPage')
2+
const config = require('../config')
3+
4+
class Files {
5+
constructor() {
6+
this.contextMenuBtnSelector = '.resource-table-btn-action-dropdown'
7+
this.openInPresentationViewerBtnSelector = '.oc-files-actions-presentation-viewer-trigger'
8+
this.openWithBtnSelector = 'button[id^="oc-files-context-actions-open-with-toggle"]'
9+
}
10+
11+
async openMDFileInPresentationViewer() {
12+
await page.click(this.contextMenuBtnSelector)
13+
if (config.targetServer === 'opencloud') {
14+
await page.click(this.openWithBtnSelector)
15+
}
16+
await page.click(this.openInPresentationViewerBtnSelector)
17+
}
18+
}
19+
20+
module.exports = Files

tests/e2e/pageObjects/OcisPage.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@ class Ocis {
2222
await page.fill(this.passwordInputFieldSelector, password)
2323
await page.click(this.loginBtnSelector)
2424
}
25-
26-
async openMDFileInPresentationViewer() {
27-
await page.click(this.contextMenuBtnSelector)
28-
await page.click(this.openInPresentationViewerBtnSelector)
29-
}
3025
}
3126

3227
module.exports = Ocis

tests/e2e/pageObjects/OpencloudPage.js

Lines changed: 0 additions & 16 deletions
This file was deleted.

tests/e2e/stepDefinitions/presentationViewerContext.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
const { Given, When, Then } = require('@cucumber/cucumber')
22
const { expect } = require('@playwright/test')
33

4-
const config = require('../config')
5-
64
const { getUserCredentials } = require('../utils/userHelper')
75
const { uploadFile } = require('../utils/fileHelper')
86
const PresentationViewer = require('../pageObjects/PresentationViewerPage')
97
const Ocis = require('../pageObjects/OcisPage')
10-
const Opencloud = require('../pageObjects/OpencloudPage')
8+
const Files = require('../pageObjects/FilesPage')
119

1210
const presentationViewer = new PresentationViewer()
1311
const ocis = new Ocis()
12+
const files = new Files()
1413

1514
Given(
1615
'user {string} has uploaded the markdown file {string} using API',
@@ -29,12 +28,7 @@ Given('user {string} has logged in', async function (user) {
2928
When(
3029
'user {string} previews a markdown file {string} in presentation viewer',
3130
async function (user, fileName) {
32-
if (config.targetApp === 'opencloud') {
33-
const opencloud = new Opencloud()
34-
await opencloud.openMDFileInPresentationViewer()
35-
} else {
36-
await ocis.openMDFileInPresentationViewer()
37-
}
31+
await files.openMDFileInPresentationViewer()
3832
}
3933
)
4034

0 commit comments

Comments
 (0)