Skip to content

Commit

Permalink
Add unit tests for issues/9558 (#9590)
Browse files Browse the repository at this point in the history
* Add unit tests

* Ehanche changelog item

* Remove mock

* Remove debug output
  • Loading branch information
Jan committed Aug 17, 2023
1 parent 3a57043 commit 199dd47
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 42 deletions.
4 changes: 4 additions & 0 deletions backend-oc10.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ geekdocFilePath: backend-oc10.md

{{< toc >}}

## Compatibility

Please note that the usage of Web UI and ownCloud 10 as backend is not recommended starting with version 7.1.0 of the Web UI. Therefore, this section only applies to versions < 7.1.0.

## Prerequisites

Decide on which host and port Web will be served, for example `https://web-host:9100/web-path/`.
Expand Down
2 changes: 1 addition & 1 deletion custom-apps/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ This page documents how you can set up an example app within your frontend repo
## Setting up the example "skeleton app"

{{< hint info >}}
This guide assumes you have either an oCIS or ownCloud 10 backend running and followed the [getting started guide]({{< ref "../getting-started.md" >}}) for setting up a development environment with the `web` frontend, having it running via either `pnpm serve` or `pnpm build:w`. You should be able to use the web UI on localhost using the respective port you've assigned (defaults are `:8080` for OC10 and `:9200` for oCIS) and see changes to your .
This guide assumes you have an oCIS backend running and followed the [getting started guide]({{< ref "../getting-started.md" >}}) for setting up a development environment with the `web` frontend, having it running via either `pnpm vite` or `pnpm build:w`. You should be able to use the web UI on localhost using the respective port you've assigned (default is `:9200`) and see the changes you make.
{{< /hint >}}

From the root of the [web repository](https://github.com/owncloud/web), change into the example skeleton app by running
Expand Down
8 changes: 8 additions & 0 deletions deployments/oc10-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ geekdocFilePath: oc10-app.md

{{< toc >}}


## Compatibility

Please note that the usage of Web UI and ownCloud 10 as backend is not recommended starting with version 7.1.0 of the Web UI. Therefore, this section only applies to versions < 7.1.0.

## Introduction

ownCloud Web is being deployed as an app to [ownCloud marketplace](https://marketplace.owncloud.com/) to enable easy integration into existing ownCloud 10 instances.
After completing this setup, ownCloud Web will be available on `https://<your-owncloud-server>/index.php/apps/web`.

Expand Down Expand Up @@ -78,6 +85,7 @@ There are a few config values which need to be set in order for ownCloud Web to
"apps" : [
"files",
"preview",
"search",
"draw-io"
],
"applications" : [
Expand Down
15 changes: 11 additions & 4 deletions development/tooling.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,23 @@ After cloning the source code, install the dependencies via `pnpm install`.

### Starting the Server

Web supports oCIS and oC10 as servers. You can start both of them by running `docker-compose up ocis oc10`.
You can start the server by running `docker-compose up ocis`.

Note that `ocis` needs a short while to start because it is waiting for `tika` to be initialized. This is the case as soon as the `tika-service` container has stopped running.
Note that the container needs a short while to start because it is waiting for `tika` to be initialized. This is the case as soon as the `tika-service` container has stopped running.

### Building and Accessing Web

After the docker containers are running (and `tika` is being initialized), run `pnpm build:w` to build Web. This also includes hot-reloading after changes you make, although it will take a while to rebuild the project. See down below for some details on how to enable instant hot-reloading.

Now you can access Web via https://host.docker.internal:9200 (oCIS) and http://host.docker.internal:8080 (OC10).
Now you can access Web via https://host.docker.internal:9200.

### Using Instant Hot-Reload via Vite

To work with instant hot-reloading, you can also build Web by running `pnpm vite`. The ports to access Web are slightly different then: https://host.docker.internal:9201 (oCIS) and http://host.docker.internal:8081 (OC10). Also note that the initial page load may take a bit longer than usual. This is normal and to be expected.
To work with instant hot-reloading, you can also build Web by running `pnpm vite`. The port to access Web is slightly different then: https://host.docker.internal:9201. Also note that the initial page load may take a bit longer than usual. This is normal and to be expected.

### Running Web with oC10

Older versions of Web (< 7.1.0) also support running oC10 as server. The development setup is nearly the same as mentioned above, the only differences are:

* The server can be started via `docker-compose up oc10`
* The server port is `8080` (`8081` when running Web via `pnpm vite:oc10`)
10 changes: 5 additions & 5 deletions getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ This setup currently doesn't work on Windows out of the box.

After cloning the [source code](https://github.com/owncloud/web), install the dependencies via `pnpm install` and bundle the frontend code by running `pnpm build:w`.

Then, you can start the backends by running `docker-compose up oc10 ocis` and access them via [https://host.docker.internal:9200](https://host.docker.internal:9200) (oCIS) and [http://host.docker.internal:8080](http://host.docker.internal:8080) (OC10). If you're not using Docker Desktop, you might have to modify your `/etc/hosts` and add `127.0.0.1 host.docker.internal` to make the `host.docker.internal` links work.
Then, you can start the server by running `docker-compose up ocis` and access it via [https://host.docker.internal:9200](https://host.docker.internal:9200). If you're not using Docker Desktop, you might have to modify your `/etc/hosts` and add `127.0.0.1 host.docker.internal` to make the `host.docker.internal` links work.

The bundled frontend code automatically gets mounted into the Docker containers, recompiles on changes and you can log in using the demo user (admin/admin) and take a look around!

Expand Down Expand Up @@ -90,7 +90,7 @@ Web supports [Sentry](https://sentry.io/welcome/) to provide monitoring and erro
To enable sending data to a Sentry instance, you can use the following configuration keys:

- `sentry.dsn` Should contain the DSN for your sentry project.
- `sentry.environment`: Lets you specify the enviroment to use in Sentry. Defaults to `production`.
- `sentry.environment`: Lets you specify the environment to use in Sentry. Defaults to `production`.

Any other key under `sentry` will be forwarded to the Sentry initialization. You can find out more
settings in the [Sentry docs](https://docs.sentry.io/platforms/javascript/configuration/).
Expand All @@ -102,13 +102,13 @@ integration libraries.

## Setting up backend and running

Web can run against either [ownCloud 10](https://github.com/owncloud/core/) as backend or [oCIS](https://github.com/owncloud/ocis).
Newer versions of Web (> 7.0.2) can only run against [oCIS](https://github.com/owncloud/ocis), whereas older versions (< 7.1.0) can run against [ownCloud 10](https://github.com/owncloud/core/) as well.
Depending which one you chose, please check the matching section:

- [Setting up with ownCloud as backend]({{< ref "backend-oc10.md" >}})
- [Setting up with oCIS as backend]({{< ref "backend-ocis.md" >}})
- [Setting up with ownCloud as backend]({{< ref "backend-oc10.md" >}})

## Running

- [Running with ownCloud as backend]({{< ref "backend-oc10.md#running-web" >}})
- [Running with oCIS as backend]({{< ref "backend-ocis.md#running-web" >}})
- [Running with ownCloud as backend]({{< ref "backend-oc10.md#running-web" >}})
4 changes: 2 additions & 2 deletions releasing.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ geekdocFilePath: releasing.md

## Releasing ownCloud Web

OwnCloud Web can be hosted standalone, as ownCloud 10 app or as part of oCIS.
OwnCloud Web can be hosted standalone, as part of oCIS or as ownCloud 10 app (Web UI versions < 7.1.0).

### Versioning

Expand All @@ -23,7 +23,7 @@ The highest type before a new release determines the version update number, so i
1. Create a branch `release-$version` in <https://github.com/owncloud/web>.
2. Create a folder in `changelog` for the release version and date `mkdir $major.$minor.$patchVersion_YYYY-MM-DD`.
3. Move all changelog items from the `changelog/unreleased/` folder to the `$major.$minor.$patchVersion_YYYY-MM-DD` folder.
4. Update the version in `packages/web-integration-oc10/appinfo/info.xml`
4. Only Web UI versions < 7.1.0: Update the version in `packages/web-integration-oc10/appinfo/info.xml`
5. Update the version in `package.json`
6. Commit your changes.
7. After merging, wait for the CI to run on the merge commit.
Expand Down
35 changes: 5 additions & 30 deletions testing/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,27 +65,18 @@ Our compose setup automatically mounts it into an oC10 and oCIS backend, respect

#### Run E2E Tests

Depending on the backend you want to run the tests on, you can either run
The following command will run all available e2e tests:

```shell
$ pnpm test:e2e:cucumber 'tests/e2e/cucumber/**/*[!.ocis].feature'
$ pnpm test:e2e:cucumber 'tests/e2e/cucumber/**/*.feature'
```

for an **ownCloud 10** backend (filenames including `.ocis` are excluded) or

```shell
$ OCIS=true pnpm test:e2e:cucumber 'tests/e2e/cucumber/**/*[!.oc10].feature'
```

for an **oCIS** backend (filenames including `.oc10` are excluded).

#### Options

To run a particular test, simply add the feature file and line number to the test command, e.g. `pnpm test:e2e:cucumber tests/e2e/cucumber/shareFileJourney.feature:13`
To run a particular test, simply add the feature file and line number to the test command, e.g. `pnpm test:e2e:cucumber tests/e2e/cucumber/features/smoke/admin-settings/users.feature:84`

Various options are available via ENV variables, e.g.

- `OCIS=true` to run the E2E tests against an oCIS backend
- `RETRY=n` to retry failures `n` times
- `SLOW_MO=n` to slow the execution time by `n` milliseconds
- `TIMEOUT=n` to set tests to timeout after `n` milliseconds
Expand Down Expand Up @@ -134,40 +125,24 @@ $ pnpm build:w

The acceptance tests need additional docker containers to be running.

For running the test with oc10 run

```shell
$ docker compose up oc10 vnc selenium middleware-oc10
```

For running the test with ocis run

```shell
$ docker compose up ocis vnc selenium middleware-ocis
```

and make sure there are no conflicting ports and everything runs smoothly. You can check if everything has worked by opening [https://host.docker.internal:9200](https://host.docker.internal:9200) (oCIS) and [http://host.docker.internal:8080](http://host.docker.internal:8080) (OC10) and logging in using the demo user (admin/admin).
and make sure there are no conflicting ports and everything runs smoothly. You can check if everything has worked by opening [https://host.docker.internal:9200](https://host.docker.internal:9200) and logging in using the demo user (admin/admin).

If you're using a M1 Mac, you need to use `seleniarm/standalone-chromium:4.4.0-20220814`for now. To do so, export `SELENIUM_IMAGE=seleniarm/standalone-chromium:4.4.0-20220814`.

#### Run acceptance tests

- Change the directory to `tests/acceptance`
- Install all the test dependencies with `pnpm` command
- Depending on the backend you're running the tests on, you can either run

```shell
$ pnpm test:acceptance:oc10 features/path/to/test
```

for ownCloud 10.X or
- Run the tests

```shell
$ pnpm test:acceptance:ocis features/path/to/test
```

for oCIS acceptance tests.

#### Watch the Test Run

To watch the tests while running, open [http://host.docker.internal:6080/](http://host.docker.internal:6080/) in the browser to access your VNC client.
Expand Down

0 comments on commit 199dd47

Please sign in to comment.