Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,16 @@ jobs:
- name: install-chromium
run: npx playwright install chromium

- name: e2e
- name: e2e (Opencloud)
if: matrix.server == 'Opencloud'
run: pnpm test:e2e tests/e2e/features/**/*.feature
env:
HEADLESS: true
TARGET_APP: opencloud

- name: e2e (Ocis)
if: matrix.server == 'Ocis'
run: pnpm test:e2e tests/e2e/features/**/*.feature
env:
HEADLESS: true
TARGET_APP: ocis
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,17 @@ docker compose -f docker-compose-ocis.yml up

server URL: [localhost:9200](https://localhost:9200)

### Running e2e tests:
For oCIS:
```bash
pnpm run test:e2e <path_to_feature_file>
```

For OpenCloud:
```bash
TARGET_APP=opencloud pnpm run test:e2e <path_to_feature_file>
```

## Building Docker Container

For OpenCloud:
Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const config = {
timeout: parseInt(process.env.TIMEOUT) || 60,
minTimeout: parseInt(process.env.MIN_TIMEOUT) || 5,
headless: process.env.HEADLESS === 'true',
debug: process.env.DEBUG === 'true'
debug: process.env.DEBUG === 'true',
targetApp: process.env.TARGET_APP || 'ocis'
}

module.exports = config
16 changes: 16 additions & 0 deletions tests/e2e/pageObjects/OpencloudPage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const Ocis = require('./OcisPage')

class Opencloud extends Ocis {
constructor() {
super()
this.openWithBtnSelector = 'button[id^="oc-files-context-actions-open-with-toggle"]'
}

async openMDFileInPresentationViewer() {
await page.click(this.contextMenuBtnSelector)
await page.click(this.openWithBtnSelector)
await page.click(this.openInPresentationViewerBtnSelector)
}
}

module.exports = Opencloud
11 changes: 10 additions & 1 deletion tests/e2e/stepDefinitions/presentationViewerContext.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
const { Given, When, Then } = require('@cucumber/cucumber')
const { expect } = require('@playwright/test')

const config = require('../config')

const { getUserCredentials } = require('../utils/userHelper')
const { uploadFile } = require('../utils/fileHelper')
const PresentationViewer = require('../pageObjects/PresentationViewerPage')
const Ocis = require('../pageObjects/OcisPage')
const Opencloud = require('../pageObjects/OpencloudPage')

const presentationViewer = new PresentationViewer()
const ocis = new Ocis()
Expand All @@ -25,7 +29,12 @@ Given('user {string} has logged in', async function (user) {
When(
'user {string} previews a markdown file {string} in presentation viewer',
async function (user, fileName) {
await ocis.openMDFileInPresentationViewer()
if (config.targetApp === 'opencloud') {
const opencloud = new Opencloud()
await opencloud.openMDFileInPresentationViewer()
} else {
await ocis.openMDFileInPresentationViewer()
}
}
)

Expand Down