From 9482948adb78659fdf7502b58656858ff49d4941 Mon Sep 17 00:00:00 2001 From: Benedikt Kulmann Date: Wed, 23 Nov 2022 15:13:41 +0100 Subject: [PATCH 1/2] docs: remove outdated test docs file --- docs/testing/acceptance-tests-all.md | 157 --------------------------- docs/testing/testing.md | 5 +- 2 files changed, 2 insertions(+), 160 deletions(-) delete mode 100644 docs/testing/acceptance-tests-all.md diff --git a/docs/testing/acceptance-tests-all.md b/docs/testing/acceptance-tests-all.md deleted file mode 100644 index d8e9ad74d19..00000000000 --- a/docs/testing/acceptance-tests-all.md +++ /dev/null @@ -1,157 +0,0 @@ ---- -title: "Running acceptance tests - all options" -date: 2020-04-15T00:00:00+00:00 -weight: 60 -geekdocRepo: https://github.com/owncloud/web -geekdocEditPath: edit/master/docs/testing -geekdocFilePath: acceptance-tests-all.md ---- - -{{< toc >}} - -## Setup backend - -### ownCloud 10 - -- set up the [ownCloud 10 backend]({{< ref "backend-oc10.md" >}}) -- clone and install the [testing app](http://github.com/owncloud/testing) into ownCloud - -### oCIS -In order to run the acceptance tests, you need to run oCIS using the oCIS storage driver. Also, you need to enable basic auth on the server with these environment variables. - -`PROXY_ENABLE_BASIC_AUTH=true STORAGE_HOME_DRIVER=owncloud STORAGE_USERS_DRIVER=owncloud` - -- set up the [oCIS backend]({{< ref "backend-ocis.md" >}}) - - if you are a Mac user, you need to start the server with additional environment variables: `STORAGE_HOME_DATA_SERVER_URL='http://host.docker.internal:9155/data' STORAGE_DATAGATEWAY_PUBLIC_URL='https://host.docker.internal:9200/data' STORAGE_USERS_DATA_SERVER_URL='http://host.docker.internal:9158/data' STORAGE_FRONTEND_PUBLIC_URL='https://host.docker.internal:9200' PROXY_ENABLE_BASIC_AUTH=true PROXY_OIDC_ISSUER='https://host.docker.internal:9200' IDP_INSECURE='true' IDP_IDENTIFIER_REGISTRATION_CONF='/tests/acceptance/mac-identifier-registration.yml' IDP_ISS='https://host.docker.internal:9200' IDP_TLS='true'` (`` needs to be replaced with the path of your local clone of ownCloud Web) - -## Setup the ownCloud test Middleware -To run the tests, we need to run the [owncloud-test-middleware](https://github.com/owncloud/owncloud-test-middleware). You can find the instructions on how to run the middleware server from its [github page](https://github.com/owncloud/owncloud-test-middleware#starting-the-server) - -## Setup Selenium - -There are multiple ways to run Selenium: - -- [Setup using Docker](#setup-using-docker) -- [Setup using Docker Desktop for Mac](#setup-using-docker-desktop-for-mac) -- [Setup using a standalone Selenium server](#setup-using-standalone-selenium-server) - -### Setup using Docker - -- Set the environment variables `SELENIUM_HOST` as `localhost` and `SERVER_HOST` in the format `http://:9100`. -- If you are a Linux user, run `docker run --rm -d --network="host" -v /dev/shm:/dev/shm -v ${REMOTE_UPLOAD_DIR:-/filesForUpload}:${LOCAL_UPLOAD_DIR:-/uploads}:ro --name web-tests-selenium selenium/standalone-chrome` -- If you are a Mac user, run `docker run --rm -d -p ${SELENIUM_PORT:-4444}:4444 -p 5900:5900 -v /dev/shm:/dev/shm -v ${REMOTE_UPLOAD_DIR:-/filesForUpload}:${LOCAL_UPLOAD_DIR:-/uploads}:ro --name web-tests-selenium selenium/standalone-chrome` - - This command creates a docker container which uses port forwarding instead of host networking [which is not supported on Mac](https://docs.docker.com/network/host/) - -`` needs to be replaced with the path where the middleware repository is cloned in your system. - -### Setup using Docker Desktop for Mac - -In order to run acceptance tests with selenium running in Docker Desktop for Mac while having ownCloud Server and Web running as services -on the host machine, `localhost` will not work as URL. Use the Docker host ip `172.17.0.1` or its alias `host.docker.internal` instead. -This requires adjusting all relevant config files to use `host.docker.internal` instead of `localhost` (config.json in Web and -config/config.php in oC10) and changing the web OIDC-callback url. Set the `SERVER_HOST` and `BACKEND_HOST` environment variables -accordingly. In order to use the same url for development on the host machine, define it as an alias to `127.0.0.1` in `/etc/hosts`. -After all these changes Web will be accessible at `http://host.docker.internal:9100` for both development and acceptance tests. - -### Setup using standalone Selenium server - -When running a standalone Selenium server, make sure to set the environment variable `SELENIUM_HOST`, `SELENIUM_PORT` and `LOCAL_UPLOAD_DIR` accordingly. - - -## Setup ownCloud Web - -- [build Web]({{< ref "../building.md" >}}) -- [start the Web server]({{< ref "backend-oc10.md#running-web" >}}) -- if you are running web against the oCIS backend, clone the testing app `git clone git@github.com:owncloud/testing.git tests/testing-app` - -## Run tests -- Change the directory to `tests/acceptance` -- Install all the test dependencies with `pnpm` command -- set `SERVER_HOST` to point at the URL where the Web web pages are served, for example "http://localhost:9100" -- set `BACKEND_HOST` to point to the URL of the backend, for example "http://localhost/owncloud/" -- set `MIDDLEWARE_HOST` to point to the URL of the [owncloud-test-middleware](https://github.com/owncloud/owncloud-test-middleware) -- to be able to run federation tests, additional setup is needed: - 1. Install and set up a second ownCloud server-instance that is accessible by a different URL. That second server-instance must have its own database and data directory. - 2. clone and install the testing app into the second ownCloud server-instance from http://github.com/owncloud/testing . - 3. when running the acceptance tests use `REMOTE_BACKEND_HOST` environment variable to define its address, for example, `REMOTE_BACKEND_HOST=http:// pnpm test:acceptance:oc10 ` - -- set the `SELENIUM_HOST` environment variable to your host that runs selenium, mostly `localhost` -- set the `SELENIUM_PORT` environment variable to your selenium port, mostly `4444` -- set the `TESTING_DATA_DIR` when running the tests on oCIS pointing to the testing data that includes data like skeleton directories. The testing directory is available [here](https://github.com/owncloud/testing/tree/master/data). This is handled automatically by the testrunner while running the tests in oc10. - -The feature files are located in the "tests/acceptance/features" subdirectories. - -see [available settings](#available-settings-to-be-set-by-environment-variables) for further setup if needed - -### with oC10 backend - -- run `pnpm test:acceptance:oc10 ` - -### with oCIS backend - -- run `pnpm test:acceptance:ocis ` -- If you are a mac user, run `STORAGE_HOME_DATA_SERVER_URL='http://host.docker.internal:9155/data' STORAGE_DATAGATEWAY_PUBLIC_URL='https://host.docker.internal:9200/data' STORAGE_USERS_DATA_SERVER_URL='http://host.docker.internal:9158/data' STORAGE_FRONTEND_PUBLIC_URL='https://host.docker.internal:9200' PROXY_ENABLE_BASIC_AUTH=true PROXY_OIDC_ISSUER='https://host.docker.internal:9200' IDP_INSECURE='true' IDP_IDENTIFIER_REGISTRATION_CONF='./mac-identifier-registration.yml' IDP_ISS='https://host.docker.internal:9200' IDP_TLS='true' pnpm test:acceptance:ocis ` - -## Available settings to be set by environment variables - -These values can be set using the environment variables to configure `pnpm test:acceptance:oc10` and `pnpm test:acceptance:ocis` to match your local test environment. - -| setting | meaning | default | -|-------------------- | -----------------------------------------------------------------------| ----------------------| -| `SERVER_HOST` | web URL | http://host.docker.internal:8080/index.php/apps/web/index.html or https://host.docker.internal:9200 | -| `BACKEND_HOST` | ownCloud server URL (or reva service url for running with oCIS) | http://host.docker.internal:8080 or https://host.docker.internal:9200 | -| `BACKEND_USERNAME` | ownCloud administrator username | admin | -| `BACKEND_PASSWORD` | ownCloud administrator password | admin | -| `SELENIUM_HOST` | selenium server host, if not set pnpm will start selenium automatically
if running the selenium docker container as mentioned above set to `localhost` | | -| `SELENIUM_PORT` | port of selenium server | 4444 | -| `SCREEN_RESOLUTION` | width and height in px to set the browser resolution to e.g. 375x812 | empty = fullscreen | -| `REMOTE_UPLOAD_DIR` | path to `filesForUpload` directory, used when uploading files through api | `./filesForUpload` | -| `LOCAL_UPLOAD_DIR` | `filesForUpload` directory available for selenium for direct uploads
If using selenium-docker and example above, set it as `/uploads`.
If running local selenium, set value same as `REMOTE_UPLOAD_DIR` (please, remember to use absolute path)| `/uploads` | -| `REMOTE_BACKEND_HOST` | ownCloud remote server URL | http://localhost:8080 | -| `RUN_ON_OCIS` | Running the tests using the oCIS backend | false | -| `OCIS_REVA_DATA_ROOT` | Data directory of oCIS | /var/tmp/reva | -| `TESTING_DATA_DIR` | Testing data directory for new users | - | -| `WEB_UI_CONFIG` | Path for the web config file (usually in the dist folder) | - | -| `MIDDLEWARE_HOST` | Middleware host URL | http://host.docker.internal:3000 | - -## Tips - -### too many open files - -If tests were running fine and then suddenly start to fail your system might run into open file limits. -In that case you will see messages in the oCIS log output that look like this: - -`2020-05-12 11:33:43.974552 I | http: Accept error: accept tcp [::]:9200: accept4: too many open files; retrying in 1s` - -In that case increase the open file limits, how to do that would be beyond the scope of this documentation. - -## Acceptance Tests in CI - -In the CI we run the UI tests using different backends on different repos. We use commit IDs to indicate the version of the backend or testrunner we want to use. These commit IDs should be regularly updated in the `.drone.star` file to keep the CI up to date. -We run web UI tests in the following repos in the CI. - -### 1. web Repo - -In the `owncloud/web` repo, we run the tests using both the oc10 backend and the oCIS backend. -For the oc10 backend, we use the `owncloudci/core` docker image which runs the latest `daily-master-qa` version of owncloud. - -For the oCIS backend, we use the Commit ID from the `owncloud/ocis` repo to indicate which version of backend to use. This can be specified in the `.drone.env` file. -``` - # The version of oCIS to use in pipelines that test against oCIS - OCIS_COMMITID=352034d9eba8be8c4bc4b80421f3c0093e7d472c - OCIS_BRANCH=master -``` -If the version you want to run is on a different branch from master, you also need to change the branch name. - -In order to check if new tests are compatible with oCIS, after changing the commit id and the branch name, we can create a draft PR in `owncloud/web` which triggers the CI, and we can see the result there. - -### 2. oCIS Repo - -We follow the same approach in the `owncloud/ocis` repo too. In order to run the UI tests in CI we use commit IDs from web which can be changed in the `.drone.env` file. - -``` - # The test runner source for UI tests - WEB_COMMITID=3cab4e32bca513f14f59127a0387b44a409763a3 - WEB_BRANCH=master -``` -This is the commit ID of web indicating the version of testrunner we want to use. If the version is on a branch other than master, we will also need to change the branch name. diff --git a/docs/testing/testing.md b/docs/testing/testing.md index 4a7f2c895bd..3cc16ec8374 100644 --- a/docs/testing/testing.md +++ b/docs/testing/testing.md @@ -1,5 +1,5 @@ --- -title: "Running acceptance tests" +title: "Running tests" date: 2021-07-27T00:00:00+00:00 weight: 60 geekdocRepo: https://github.com/owncloud/web @@ -135,8 +135,7 @@ to the nightwatch based e2e tests anymore. In other words: only continue reading about our nightwatch based acceptance tests below if you need to debug a failing test. {{< /hint >}} -At ownCloud, we have decided to adopt Docker as the main environment for developing our application. -This also applies for running our acceptance tests. To run the tests without Docker on your local machine, please refer to the [manual testing guide]({{< ref "acceptance-tests-all.md" >}}) +At ownCloud, we have decided to adopt Docker as the main environment for developing our application. This also applies for running our acceptance tests. #### Prerequisites From 1e9a1d2afc44dcd9af24887be1185481cf79defb Mon Sep 17 00:00:00 2001 From: Benedikt Kulmann Date: Wed, 23 Nov 2022 15:14:57 +0100 Subject: [PATCH 2/2] fix: pnpm serve --- .gitignore | 3 +++ dev/docker/ocis-ca/.keep | 0 dev/docker/ocis.idp.config.yaml | 14 ++++++++++++++ docker-compose.yml | 4 ++-- rollup.config.mjs | 6 +++++- .../mac-identifier-registration.yml | 19 ------------------- 6 files changed, 24 insertions(+), 22 deletions(-) create mode 100644 dev/docker/ocis-ca/.keep create mode 100644 dev/docker/ocis.idp.config.yaml delete mode 100644 tests/acceptance/mac-identifier-registration.yml diff --git a/.gitignore b/.gitignore index 34c2cd4cc52..532453dc8cc 100644 --- a/.gitignore +++ b/.gitignore @@ -60,3 +60,6 @@ tests/acceptance/report/cucumber_report.html # third party licenses /third-party-licenses + +# dev setup certificates +/dev/docker/ocis-ca diff --git a/dev/docker/ocis-ca/.keep b/dev/docker/ocis-ca/.keep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dev/docker/ocis.idp.config.yaml b/dev/docker/ocis.idp.config.yaml new file mode 100644 index 00000000000..381798117c0 --- /dev/null +++ b/dev/docker/ocis.idp.config.yaml @@ -0,0 +1,14 @@ +clients: +- id: web + name: ownCloud web app + application_type: web + insecure: yes + trusted: yes + redirect_uris: + - https://host.docker.internal:9100/ + - https://host.docker.internal:9200/ + - https://host.docker.internal:9100/oidc-callback.html + - https://host.docker.internal:9200/oidc-callback.html + origins: + - https://host.docker.internal:9100 + - https://host.docker.internal:9200 diff --git a/docker-compose.yml b/docker-compose.yml index 78ac23eb364..b1833b02798 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -32,7 +32,6 @@ services: # IDP IDP_LDAP_BIND_PASSWORD: "${IDP_LDAP_BIND_PASSWORD:-some-ldap-idp-password}" - IDP_IDENTIFIER_REGISTRATION_CONF: ${IDP_IDENTIFIER_REGISTRATION_CONF:-/web/identifier-registration.yml} # STORAGE STORAGE_HOME_DRIVER: ${STORAGE_HOME_DRIVER:-ocis} @@ -51,8 +50,9 @@ services: PROXY_ENABLE_BASIC_AUTH: "${PROXY_ENABLE_BASIC_AUTH:-true}" volumes: - ./dev/docker/ocis.entrypoint.sh:/usr/bin/entrypoint + - ./dev/docker/ocis.idp.config.yaml:/etc/ocis/idp.yaml + - ./dev/docker/ocis-ca:/var/lib/ocis/proxy - ./dist:/web/dist:ro - - ./tests/acceptance/mac-identifier-registration.yml:/web/identifier-registration.yml:ro - ${OCIS_WEB_CONFIG:-./dev/docker/ocis.web.config.json}:/web/config.json:ro extra_hosts: - host.docker.internal:${DOCKER_HOST:-host-gateway} diff --git a/rollup.config.mjs b/rollup.config.mjs index 2d4c14db3ee..0e697099abd 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -205,7 +205,11 @@ if (process.env.SERVER === 'true') { serve({ host: '0.0.0.0', contentBase: ['dist'], - port: process.env.PORT || 9100 + port: process.env.PORT || 9100, + https: { + key: fs.readFileSync('./dev/docker/ocis-ca/server.key'), + cert: fs.readFileSync('./dev/docker/ocis-ca/server.crt') + }, }) ) plugins.push( diff --git a/tests/acceptance/mac-identifier-registration.yml b/tests/acceptance/mac-identifier-registration.yml deleted file mode 100644 index 35b61ed9dff..00000000000 --- a/tests/acceptance/mac-identifier-registration.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- - - # OpenID Connect client registry. - clients: - - id: web - name: ownCloud web app - application_type: web - insecure: yes - trusted: yes - redirect_uris: - - http://host.docker.internal:9100/ - - https://host.docker.internal:9200/ - - http://host.docker.internal:9100/oidc-callback.html - - https://host.docker.internal:9200/oidc-callback.html - origins: - - http://host.docker.internal:9100 - - https://host.docker.internal:9200 - - authorities: \ No newline at end of file