Skip to content
This repository was archived by the owner on Nov 23, 2026. It is now read-only.

Commit 9bd7e30

Browse files
[tests-only][full-ci] Remove gherkin step definition and put all test related codes in e2e directory (#13768)
* test: remove gherkin step definitions Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com> * test: move test code from e2e to e2e-playwright Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com> * docs: update docs with playwright test Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com> * test: rename playwright test directory to e2e Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com> --------- Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com>
1 parent 9350e5f commit 9bd7e30

158 files changed

Lines changed: 275 additions & 5486 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/test.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
path: dist
6868
if-no-files-found: error
6969

70-
e2e-playwright:
70+
e2e:
7171
needs: build
7272
runs-on: ubuntu-latest
7373
name: e2e-tests-${{ matrix.suites.suite }}
@@ -214,7 +214,7 @@ jobs:
214214
retention-days: 7
215215

216216
check-tests-passed:
217-
needs: [ e2e-playwright ]
217+
needs: [ e2e ]
218218
runs-on: ubuntu-latest
219219
if: always()
220220
steps:

‎cucumber.mjs‎

Lines changed: 0 additions & 24 deletions
This file was deleted.

‎docs/testing/accesibility.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ We use [@axe-core/playwright](https://github.com/dequelabs/axe-core-npm) to auto
2828
To run the accessibility tests, you can simply run our existing E2E tests using the following command:
2929

3030
```bash
31-
pnpm test:e2e:cucumber
31+
pnpm test:e2e:playwright
3232
```
3333

3434
#### Skipping Accessibility Tests Locally
3535

3636
If you want to skip the accessibility tests, you can add the `SKIP_A11Y_TESTS` environment variable to your command.
3737

3838
```bash
39-
SKIP_A11Y_TESTS=true pnpm test:e2e:cucumber
39+
SKIP_A11Y_TESTS=true pnpm test:e2e:playwright
4040
```
4141

4242
#### Skipping Accessibility Tests in CI

‎docs/testing/e2e-testing-standards.md‎

Lines changed: 12 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,15 @@ Here are the test standards and guidelines we adhere to when creating Playwright
2626

2727
- `e2e/`: Main folder containing all (end-to-end) E2E test-related files.
2828

29-
- `cucumber/`: Main folder containing all Cucumber(BDD) test-related files.
29+
- `specs/`: Main folder containing all test-related files.
3030

31-
- `features/`: Contains Gherkin feature files.
31+
- `<test-suite-folder>/`: Collection house for "**related"** spec files.
3232

33-
- `<test-suite-folder>/`: Collection house for "**related"** feature files.
33+
- `<aSpecFile>.spec.ts`: A spec file.
3434

35-
- `<aFeatureFile>.feature`: A feature file.
35+
- `steps/`: Holds the files that defines actions of user.
3636

37-
- `steps/`: Holds the step definition files for mapping Gherkin steps to code.
38-
39-
- `<stepDefinition>.ts`: Step definitions for each feature.
40-
41-
- `hooks/`: Cucumber hooks for setting up and tearing down test environments.
37+
- `hooks/`: Test hooks for setting up and tearing down test environments.
4238
- `hooks.ts`: Contains `Before`, `After`, and other lifecycle hooks.
4339

4440
- `support/`: Playwright (Test implementation)
@@ -122,13 +118,10 @@ import {FooPage} from './pageObjects/foo';
122118

123119
let fooPage: FooPage;
124120

125-
Then(
126-
'error message should be visible',
127-
async function ({page}) {
128-
const fooPage = new FooPage({page});
129-
await expect(fooPage.errorMessage).toBeVisible();
130-
}
131-
)
121+
await errorMessageShouldBeVisible({page}) {
122+
const fooPage = new FooPage({page});
123+
await expect(fooPage.errorMessage).toBeVisible();
124+
}
132125
```
133126

134127
DO NOT ⚔️
@@ -137,12 +130,9 @@ DO NOT ⚔️
137130
// include locators directly in test
138131
import { Locator, Page } from '@playwright/test';
139132

140-
Then(
141-
'error message should be visible',
142-
async function ({page}) {
143-
await expect(page.locator('.error-message')).toBeVisible();
144-
}
145-
)
133+
await errorMessageShouldBeVisible({page}) {
134+
await expect(page.locator('.error-message')).toBeVisible();
135+
}
146136
```
147137

148138
## Waiting:
@@ -274,48 +264,3 @@ getWorksOrder()
274264
printTransactions()
275265
deleteProperty()
276266
```
277-
278-
## Gherkin Best Practices: Do's and Don'ts for Effective Features & Scenarios
279-
### Writing Features
280-
DO 👍
281-
- **Be Descriptive:** Use clear and descriptive language that accurately reflects the functionality.
282-
- **Keep It Concise:** Avoid overly long titles or descriptions. Aim for brevity while maintaining clarity.
283-
- **Use Active Voice:** Write in an active voice to make it clear who is performing the action.
284-
- **Contextual Information:** If applicable, provide context about the user role or the scenario to clarify who benefits from the feature.
285-
286-
DO NOT ⚔️
287-
- **Avoid Vague Titles:** Titles like "Test Feature" or "Feature 1" do not provide meaningful information.
288-
- **Neglect User Perspective:** Failing to mention the user role can make it unclear who the feature is intended for.
289-
290-
Example of a well-written feature:
291-
```gherkin
292-
Feature: Password Management for Registered Users
293-
As a registered user
294-
I want to set a new password
295-
So that I can secure my account
296-
```
297-
298-
### Writing Scenarios
299-
- **Use Clear and Descriptive Scenario Titles:** Ensure that each scenario title clearly conveys the action being tested and the expected outcome.
300-
```gherkin
301-
Scenario: User successfully registers with valid details
302-
```
303-
- **Use Clear Given/When/Then Steps:** Clearly define the context, action, and expected outcome(success or error messages if any).
304-
```gherkin
305-
Given the user is on the registration page
306-
When the user enters valid details
307-
Then the user should see a confirmation message "Registration successful! Welcome to our platform."
308-
```
309-
- **Use "tries to" for Negation:** This syntax is effective for scenarios where an action is expected to fail.
310-
```gherkin
311-
Scenario: User tries to log in with incorrect credentials
312-
Given the user is on the registration page
313-
When the user tries to log in with username "Alice" and password "wrongPassword"
314-
Then the user should see an error message
315-
"""
316-
Incorrect username or password.
317-
"""
318-
```
319-
320-
## Broad Gherkin Guidelines
321-
This [ownCloud developer manual](https://doc.owncloud.com/server/next/developer_manual/testing/acceptance-tests.html#how-to-write-acceptance-tests) provides comprehensive guidelines and best practices for writing acceptance tests using the Gherkin syntax, a widely adopted language for defining test scenarios in a human-readable format. The manual outlines the specific syntax and structure required when crafting feature files and scenarios to ensure consistency and maintainability within the ownCloud testing framework.

‎docs/testing/testing.md‎

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ This will start all the services. The ENV variables specific to each services ar
8080
The following command will run all available e2e tests:
8181

8282
```shell
83-
$ pnpm test:e2e:cucumber 'tests/e2e/cucumber/**/*.feature'
83+
$ pnpm test:e2e:playwright 'tests/e2e/specs/**/*.spec.ts'
8484
```
8585

8686
### Options
8787

88-
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`
88+
To run a particular test, simply add the spec file and line number to the test command, e.g. `pnpm test:e2e:playwright tests/e2e/specs/admin-settings/users.feature:14`
8989

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

@@ -129,19 +129,23 @@ If the lint problems are not fixed by `--fix` option, we have to manually fix th
129129

130130
## Analyze the Test Report
131131

132-
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:
132+
After running tests, report artifacts are written under `REPORT_DIR` (defaults to `reports/e2e`).
133+
134+
- Accessibility report: `reports/e2e/a11y-report.json`
135+
- Traces (when `REPORT_TRACING=true`): `reports/e2e/playwright/tracing/*.zip`
136+
- Optional videos/HAR files (when enabled via `REPORT_VIDEO=true` or `REPORT_HAR=true`) are also stored in the report directory.
137+
138+
To inspect a trace file:
133139

134140
```bash
135-
node tests/e2e/cucumber/report --report-input=tests/e2e/cucumber/report/report.json
141+
npx playwright show-trace reports/e2e/playwright/tracing/<trace-file>.zip
136142
```
137143

138-
By default, the report gets generated to reports/e2e/cucumber/releaseReport/cucumber_report.html.
139-
The location can be changed by adding the `--report-location` flag.
140-
141-
To see all available options run
144+
If you want an HTML Playwright report for a run, execute tests with the HTML reporter enabled and then open it:
142145

143146
```bash
144-
node tests/e2e/cucumber/report --help
147+
pnpm test:e2e:playwright -- --reporter=html
148+
npx playwright show-report
145149
```
146150

147151
## E2E Tests on oCIS With Keycloak
@@ -157,7 +161,7 @@ There's a documentation to serve [oCIS with Keycloak](https://owncloud.dev/ocis/
157161
```bash
158162
KEYCLOAK=true \
159163
BASE_URL_OCIS=ocis.owncloud.test \
160-
pnpm run test:e2e:cucumber tests/e2e/cucumber/features/journeys
164+
pnpm run test:e2e:playwright tests/e2e/specs/journeys
161165
```
162166

163167
Following environment variables come in use while running e2e tests on oCIS with Keycloak:
@@ -226,7 +230,7 @@ The test scenarios that can run with predefined users are marked with the `@pred
226230
```bash
227231
PREDEFINED_USERS=true \
228232
PREDEFINED_USERS_FILE='<path-to>/users.json' \
229-
pnpm test:e2e:cucumber tests/e2e/cucumber/features/file-action/rename.feature --tags '@predefined-users'
233+
pnpm test:e2e:playwright tests/e2e/specs/file-action/rename.feature --tags '@predefined-users'
230234
```
231235

232236
**The following tests cannot be run with predefined users:**
@@ -250,7 +254,7 @@ Test suites may include the `web-packages.txt` file to denote which web packages
250254
The `web-packages.txt` file should be included within the test suite directory as shown below:
251255

252256
```
253-
└── tests/e2e/cucumber/features
257+
└── tests/e2e/specs
254258
└── admin-settings
255259
├── users.feature
256260
└── web-packages.txt

‎package.json‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
"build:tokens": "pnpm --filter @ownclouders/design-system tokens",
1212
"lint": "eslint vite.config.ts '{packages,tests}/**/*.{js,ts,vue}' --color",
1313
"serve": "SERVER=true pnpm build:w",
14-
"test:e2e:cucumber": "NODE_TLS_REJECT_UNAUTHORIZED=0 TS_NODE_PROJECT=./tests/e2e/cucumber/tsconfig.json cucumber-js --profile=e2e -f json:tests/e2e/cucumber/report/cucumber_report.json",
15-
"test:e2e:playwright": "NODE_TLS_REJECT_UNAUTHORIZED=0 npx playwright test --config=tests/e2e-playwright/",
14+
"test:e2e:playwright": "NODE_TLS_REJECT_UNAUTHORIZED=0 npx playwright test --config=tests/e2e/",
1615
"test:unit": "NODE_OPTIONS=--unhandled-rejections=throw vitest",
1716
"licenses:check": "license-checker-rseidelsohn --summary --relativeLicensePath --onlyAllow 'Python-2.0;Apache*;Apache License, Version 2.0;Apache-2.0;Apache 2.0;Artistic-2.0;BSD;BSD-3-Clause;CC-BY-3.0;CC-BY-4.0;CC0-1.0;ISC;MIT;MPL-2.0;Public Domain;Unicode-TOU;Unlicense;WTFPL;BlueOak-1.0.0' --excludePackages '@ownclouders/babel-preset;@ownclouders/eslint-config;@ownclouders/prettier-config;@ownclouders/tsconfig;@ownclouders/web-client;@ownclouders/web-pkg;external;web-app-files;text-editor;preview;web-app-ocm;@ownclouders/design-system;pdf-viewer;web-app-search;admin-settings;webfinger;web-runtime;@ownclouders/web-test-helpers'",
1817
"licenses:csv": "license-checker-rseidelsohn --relativeLicensePath --csv --out ./third-party-licenses/third-party-licenses.csv",
@@ -38,9 +37,6 @@
3837
"@babel/core": "7.28.5",
3938
"@babel/preset-env": "7.28.5",
4039
"@babel/register": "7.28.3",
41-
"@cucumber/cucumber": "12.2.0",
42-
"@cucumber/messages": "32.2.0",
43-
"@cucumber/pretty-formatter": "2.4.1",
4440
"@noble/hashes": "2.0.1",
4541
"@ownclouders/babel-preset": "workspace:*",
4642
"@ownclouders/eslint-config": "workspace:*",
@@ -71,7 +67,6 @@
7167
"jsdom": "^27.2.0",
7268
"jsqr": "^1.4.0",
7369
"license-checker-rseidelsohn": "4.4.2",
74-
"multiple-cucumber-html-reporter": "^3.9.3",
7570
"node-fetch": "3.3.2",
7671
"pino": "10.1.0",
7772
"pino-pretty": "13.1.2",

0 commit comments

Comments
 (0)