Skip to content

Commit bf42a7d

Browse files
committed
docs: add docs on using web-packages.txt
Signed-off-by: Saw-jan <[email protected]>
1 parent 43bb06c commit bf42a7d

File tree

1 file changed

+36
-14
lines changed

1 file changed

+36
-14
lines changed

docs/testing/testing.md

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ $ cd web
2222
$ pnpm install
2323
```
2424

25-
### Unit Tests
25+
## Unit Tests
2626

2727
We have a steadily growing coverage of unit tests. You can run them locally via
2828

@@ -34,7 +34,7 @@ $ pnpm -r test:unit
3434
You can also specify which package to run the test on, such as: `pnpm --filter @ownclouders/web-pkg test:unit`.
3535
Alternatively, tests can also be run by navigating to the package name and then running `pnpm test:unit`.
3636

37-
#### Unit Test File Structure
37+
### Unit Test File Structure
3838

3939
Our unit tests spec files follow a simple structure:
4040

@@ -46,16 +46,16 @@ We usually organize tests with nested `describe` blocks. If you would like to ge
4646
the structure, scope and goals of your unit tests before actually writing some, we invite you to make a pull request
4747
with only `describe` blocks and nested `it.todo("put your test description here")` lines.
4848

49-
### E2E Tests (Playwright)
49+
## E2E Tests (Playwright)
5050

5151
Our end-to-end test suite is built upon the [Playwright Framework](https://github.com/microsoft/playwright),
5252
which makes it easy to write tests, debug them and have them run cross-browser with minimal overhead.
5353

54-
#### Preparation
54+
### Preparation
5555

5656
Please make sure you have installed all dependencies and started the server(s) as described in [tooling]({{< ref "tooling.md#development-setup" >}}).
5757

58-
#### Prepare Web
58+
### Prepare Web
5959

6060
Bundle the web frontend with the following command:
6161

@@ -65,7 +65,7 @@ $ pnpm build
6565

6666
Our compose setup automatically mounts it into an oCIS backend, respectively. Web also gets recompiled on changes.
6767

68-
#### Start Web
68+
### Start Web
6969

7070
Start the web with the following command:
7171

@@ -75,15 +75,15 @@ docker compose up
7575

7676
This will start all the services. The ENV variables specific to each services are defined in the `docker-compose.yml` file.
7777

78-
#### Run E2E Tests
78+
### Run E2E Tests
7979

8080
The following command will run all available e2e tests:
8181

8282
```shell
8383
$ pnpm test:e2e:cucumber 'tests/e2e/cucumber/**/*.feature'
8484
```
8585

86-
#### Options
86+
### Options
8787

8888
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`
8989

@@ -111,7 +111,7 @@ To then open e.g. the tracing from the `REPORT_DIR`, run
111111
$ npx playwright show-trace path/to/file.zip
112112
```
113113

114-
#### Lint E2E Test Code
114+
### Lint E2E Test Code
115115

116116
Run the following command to find out the lint issues early in the test codes:
117117

@@ -127,7 +127,7 @@ $ pnpm lint --fix
127127

128128
If the lint problems are not fixed by `--fix` option, we have to manually fix the code.
129129

130-
### Analyze the Test Report
130+
## Analyze the Test Report
131131

132132
The cucumber library is used as the test runner for e2e tests. The report generator script lives inside the `tests/e2e/cucumber/report` folder. If you want to create a report after the tests are done, run the command:
133133

@@ -144,15 +144,15 @@ To see all available options run
144144
node tests/e2e/cucumber/report --help
145145
```
146146

147-
### E2E Tests on oCIS With Keycloak
147+
## E2E Tests on oCIS With Keycloak
148148

149149
We can run some of the e2e tests on oCIS setup with Keycloak as an external idp. To run tests against locally, please follow the steps below:
150150

151-
#### Run oCIS With Keycloak
151+
### Run oCIS With Keycloak
152152

153153
There's a documentation to serve [oCIS with Keycloak](https://owncloud.dev/ocis/deployment/ocis_keycloak/). Please follow each step to run **oCIS with Keycloak**.
154154

155-
#### Run E2E Tests
155+
### Run E2E Tests
156156

157157
```bash
158158
KEYCLOAK=true \
@@ -167,7 +167,7 @@ Following environment variables come in use while running e2e tests on oCIS with
167167
- `KEYCLOAK=true` runs the tests with Keycloak
168168
- `KEYCLOAK_REALM` sets oCIS realm name used on Keycloak
169169

170-
### E2E Tests With Predefiend Users (`@predefined-users`)
170+
## E2E Tests With Predefiend Users (`@predefined-users`)
171171

172172
It is possible to run e2e tests with predefined users. This is useful for running tests in a production-like environment.
173173
The following environment variables are used to run the tests with predefined users:
@@ -242,3 +242,25 @@ All tests which are related to:
242242
- Features enabled/disabled
243243
- Running latest tests against an older version of oCIS/Web
244244
- Large file uploads may take longer time
245+
246+
## Usage of `web-packages.txt` In the Test Suite
247+
248+
Test suites may include the `web-packages.txt` file to denote which web packages changes affect the defined test scenarios. This information is used in CI pipelines to determine which test suites to run based on the changed web packages.
249+
250+
The `web-packages.txt` file should be included within the test suite directory as shown below:
251+
252+
```
253+
└── tests/e2e/cucumber/features
254+
└── admin-settings
255+
├── users.feature
256+
└── web-packages.txt
257+
```
258+
259+
And the `web-packages.txt` file should list the dependent web packages, one per line, for example:
260+
261+
NOTE: The package name should start with `web-` in order to be recognized correctly, if not, the line will be ignored.
262+
263+
```
264+
web-app-files
265+
web-app-admin-settings
266+
```

0 commit comments

Comments
 (0)