Skip to content

Commit

Permalink
Merge pull request #32 from owncloud/test/e2e-tests
Browse files Browse the repository at this point in the history
test: add e2e test suite
  • Loading branch information
JammingBen authored Jul 26, 2024
2 parents 5ee771a + afaed88 commit cd25151
Show file tree
Hide file tree
Showing 19 changed files with 1,367 additions and 23 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ dist
.env
.idea
.vscode

# dev setup
/docker/traefik/certificates
docker-compose.override.yml
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,10 @@ Extensions are provided by apps. These are the apps, that are provided by this r
- [web-app-draw-io](./packages/web-app-draw-io/)
- [web-app-external-sites](./packages/web-app-external-sites/)
- [web-app-progress-bars](./packages/web-app-progress-bars/)

## Adding a new app

New apps must be placed inside the `packages` folder and be prefixed with `web-app-`. Additionally, the following changes are needed:

- add the new app to the `APPS` variable in the `.drone.star` file
- add the `dist` folder of the new app to the list of volume mounts of the docker `ocis` service
8 changes: 8 additions & 0 deletions cucumber.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
default: {
require: ['tests/e2e/**/*.ts'],
requireModule: ['ts-node/register'],
retry: process.env.RETRY || 0,
format: ['@cucumber/pretty-formatter']
}
}
81 changes: 81 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
services:
ocis:
image: ${OCIS_IMAGE:-owncloud/ocis-rolling:master}
entrypoint: /bin/sh
command: ['-c', 'ocis init || true && ocis server']
environment:
OCIS_URL: https://host.docker.internal:9200
OCIS_INSECURE: true
OCIS_LOG_LEVEL: error
IDM_ADMIN_PASSWORD: admin
PROXY_ENABLE_BASIC_AUTH: true
PROXY_TLS: 'false'
WEB_ASSET_APPS_PATH: /web/apps
WEB_UI_CONFIG_FILE: /web/config.json
labels:
traefik.enable: true
traefik.http.routers.ocis.tls: true
traefik.http.routers.ocis.rule: Host(`host.docker.internal`) && PathPrefix(`/`)
traefik.http.routers.ocis.entrypoints: ocis
traefik.http.services.ocis.loadbalancer.server.port: 9200
traefik.http.routers.ocis.middlewares: cors
volumes:
- ocis-config:/etc/ocis
- ./docker/ocis.web.config.json:/web/config.json
# apps
- ./packages/web-app-cast/dist:/web/apps/cast
- ./packages/web-app-draw-io/dist:/web/apps/draw-io
- ./packages/web-app-external-sites/dist:/web/apps/external-sites
- ./packages/web-app-progress-bars/dist:/web/apps/progress-bars
depends_on:
- traefik

traefik:
image: traefik:2.10.7
restart: unless-stopped
entrypoint:
[
'/bin/sh',
'-c',
"[ -f /certificates/server.key ] && ./entrypoint.sh $$@ || (apk add openssl && openssl req -subj '/CN=ocis.test' -x509 -sha256 -nodes -days 3650 -newkey rsa:2048 -keyout /certificates/server.key -out /certificates/server.crt && chmod -R 777 /certificates && ./entrypoint.sh $$@)"
]
command:
- '--pilot.dashboard=false'
- '--log.level=DEBUG'
- '--api.dashboard=true'
- '--api.insecure=true'
- '--providers.file.directory=/configs'
- '--providers.docker=true'
- '--providers.docker.exposedbydefault=false'
- '--entrypoints.web.address=:80'
- '--entrypoints.ocis.address=:9200'
- '--entrypoints.ocis-federated.address=:10200'
- '--entrypoints.websecure.address=:443'
- '--entrypoints.websecure.http.middlewares=https_config@docker'
- '--entrypoints.websecure.http.tls.options=default'
labels:
traefik.enable: true
traefik.http.routers.http_catchall.rule: HostRegexp(`{any:.+}`)
traefik.http.routers.http_catchall.entrypoints: web
traefik.http.routers.http_catchall.middlewares: https_config
traefik.http.middlewares.https_config.headers.sslRedirect: true
traefik.http.middlewares.https_config.headers.stsSeconds: 63072000
traefik.http.middlewares.https_config.headers.stsIncludeSubdomains: true
traefik.http.middlewares.cors.headers.accesscontrolallowmethods: '*'
traefik.http.middlewares.cors.headers.accesscontrolallowheaders: '*'
traefik.http.middlewares.cors.headers.accesscontrolalloworiginlist: '*'
traefik.http.middlewares.cors.headers.accesscontrolexposeheaders: '*'
traefik.http.middlewares.cors.headers.accesscontrolmaxage: 100
traefik.http.middlewares.cors.headers.addvaryheader: true
ports:
- '9200:9200'
volumes:
- './docker/traefik/certificates:/certificates'
- './docker/traefik/configs:/configs'
- '/var/run/docker.sock:/var/run/docker.sock:ro'

volumes:
ocis-config:

networks:
traefik:
12 changes: 12 additions & 0 deletions docker/ocis.web.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"server": "https://host.docker.internal:9200",
"theme": "https://host.docker.internal:9200/themes/owncloud/theme.json",
"openIdConnect": {
"metadata_url": "https://host.docker.internal:9200/.well-known/openid-configuration",
"authority": "https://host.docker.internal:9200",
"client_id": "web",
"response_type": "code",
"scope": "openid profile email"
},
"apps": ["files", "text-editor", "pdf-viewer", "search", "external", "admin-settings"]
}
6 changes: 6 additions & 0 deletions docker/traefik/configs/tls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
tls:
stores:
default:
defaultCertificate:
certFile: /certificates/server.crt
keyFile: /certificates/server.key
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,25 @@
"homepage": "https://github.com/owncloud/web-extensions",
"type": "module",
"scripts": {
"build": "pnpm -r build",
"build:w": "pnpm -r build:w",
"check:types": "pnpm -r check:types",
"lint": "eslint 'packages/**/*.{js,ts,vue}' --color",
"test:unit": "pnpm -r test:unit"
"test:unit": "pnpm -r test:unit",
"test:e2e": "NODE_TLS_REJECT_UNAUTHORIZED=0 TS_NODE_PROJECT=./tests/e2e/tsconfig.json cucumber-js packages/"
},
"devDependencies": {
"@cucumber/cucumber": "^10.3.1",
"@cucumber/pretty-formatter": "^1.0.0",
"@ownclouders/eslint-config": "0.0.1",
"@ownclouders/extension-sdk": "0.0.7",
"@ownclouders/prettier-config": "0.0.1",
"@ownclouders/tsconfig": "0.0.6",
"@playwright/test": "^1.41.2",
"@types/node": "20.14.12",
"eslint": "8.57.0",
"prettier": "3.3.3",
"ts-node": "^10.9.2",
"typescript": "5.5.4",
"vite": "5.3.5",
"vitest": "2.0.4"
Expand Down
6 changes: 6 additions & 0 deletions packages/web-app-draw-io/tests/e2e/progress-bars.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Feature: progress-bars

Scenario: select nyan cat progress bar
Given the user has logged in with username "admin" and password "admin"
And the user has navigated to the account menu
Then the user selects the progress bar extension "Nyan Cat progress bar"
Loading

0 comments on commit cd25151

Please sign in to comment.