Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ jobs:
- name: install-chromium
run: npx playwright install chromium

- name: e2e
- name: e2e-${{ matrix.server }}
run: pnpm test:e2e tests/e2e/features/**/*.feature
env:
HEADLESS: true
TARGET_SERVER: ${{ matrix.server }}
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_SERVER=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',
targetServer: process.env.TARGET_SERVER.toLowerCase() || 'ocis'
}

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

class Files {
constructor() {
this.contextMenuBtnSelector = '.resource-table-btn-action-dropdown'
this.openInPresentationViewerBtnSelector = '.oc-files-actions-presentation-viewer-trigger'
this.openWithBtnSelector = 'button[id^="oc-files-context-actions-open-with-toggle"]'
}

async openMDFileInPresentationViewer() {
await page.click(this.contextMenuBtnSelector)
if (config.targetServer === 'opencloud') {
await page.click(this.openWithBtnSelector)
}
await page.click(this.openInPresentationViewerBtnSelector)
}
}

module.exports = Files
5 changes: 0 additions & 5 deletions tests/e2e/pageObjects/OcisPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ class Ocis {
await page.fill(this.passwordInputFieldSelector, password)
await page.click(this.loginBtnSelector)
}

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

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

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

const presentationViewer = new PresentationViewer()
const ocis = new Ocis()
const files = new Files()

Given(
'user {string} has uploaded the markdown file {string} using API',
Expand All @@ -25,7 +28,7 @@ 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()
await files.openMDFileInPresentationViewer()
}
)

Expand Down