Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .batchfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Usage: <RepoUrl>;branch;TargetFolder

https://github.com/opencloud-eu/web;design-system-docs;static/design-system
https://github.com/opencloud-eu/web;web-testing-docs;docs/dev/web/testing/running-tests
https://github.com/opencloud-eu/opencloud;server-testing-docs;docs/dev/server/testing
https://github.com/opencloud-eu/cdperf;cdperf-docs;static/cdperf
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
/static/cdperf
/static/design-system

# docs pulled from other repos at build time (git-batch)
/docs/dev/web/testing/running-tests
/docs/dev/server/testing

# Generated files
.docusaurus
.cache-loader
Expand Down
4 changes: 3 additions & 1 deletion .markdownlint-cli2.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"CHANGELOG.md",
"CONTRIBUTING.md",
"README.md",
"**/_static/env-vars"
"**/_static/env-vars",
"docs/dev/web/testing/running-tests",
"docs/dev/server/testing"
Comment thread
v-scharf marked this conversation as resolved.
]
}
4 changes: 3 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ static/**
README.md
CHANGELOG.md
CONTRIBUTING.md
**/_static/env-vars
**/_static/env-vars
docs/dev/web/testing/running-tests/**
docs/dev/server/testing/**
80 changes: 40 additions & 40 deletions docs/dev/web/testing/e2e-testing-standards.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,40 +18,40 @@ Here are the test standards and guidelines we adhere to when creating Playwright

## Folder Structure

- `tests/:`
- `e2e/`: Main folder containing all (end-to-end) E2E test-related files.
- `cucumber/`: Main folder containing all Cucumber(BDD) test-related files.
- `features/`: Contains Gherkin feature files.
- `<test-suite-folder>/`: Collection house for "**related"** feature files.
- `<aFeatureFile>.feature`: A feature file.
- `tests/`
- `e2e/`: Main folder containing all end-to-end (E2E) test-related files.
- `features/`: Contains Gherkin feature files.
- `<test-suite-folder>/`: Collection house for **related** feature files.
- `<aFeatureFile>.feature`: A feature file.

- `steps/`: Holds the step definition files for mapping Gherkin steps to code.
- `<stepDefinition>.ts`: Step definitions for each feature.
- `steps/`: Step definitions that map Gherkin steps to code. They are compiled into Playwright specs by [playwright-bdd](https://github.com/vitalets/playwright-bdd).
- `<stepDefinition>.ts`: Step definitions.
- `ui/`: UI-related step definitions.

- `hooks/`: Cucumber hooks for setting up and tearing down test environments.
- `hooks.ts`: Contains `Before`, `After`, and other lifecycle hooks.
- `environment/`: playwright-bdd test setup.
- `fixtures.ts`: Custom fixtures and the `createBdd()` instance exporting `Given`, `When`, `Then`, `Before`, `After`.
- `world.ts`: The custom `World` shared across the steps of a scenario.
- `hooks.ts`: `Before`/`After` lifecycle hooks.

- `support/`: Playwright (Test implementation)
- `api/`: Contains API-related test files and configurations.
- `<api-folder>/`: Specific API tests for a particular service.
- `support/`: Test implementation and helpers.
- `api/`: API clients used to arrange state (e.g. LibreGraph, WebDAV, shares, Keycloak).
- `<api-folder>/`: Client for a particular service.

- `objects/`: Contains the Page Object classes.
- `<specific-page-object-folder>/`: Collection house for related page objects for each webpage or component.
- `<individualPageObject>.ts`: Page Object for each webpage or component.

- `utils/`: Utility functions and common helpers.
- `helpers.ts`: Common utility functions (e.g., date formatting, data generation).
- `utils/`: Utility functions and common helpers (e.g. accessibility checks, locator and date helpers).

- `test-data/`: Static test data files or folders for upload.
- `filesForUpload/`: Static test data files for upload.
- `filesForUpload/`: Static test data files for upload.

- `config/`: Configuration files for Playwright and other tools.
- `playwright.config.ts`: Playwright configuration.
- `playwright.config.ts`: Playwright configuration (browser projects, timeouts, `appConfig`).

- `reports/`: Generated test reports (e.g., HTML, JSON).
- `screenshots/`: Captured screenshots during test execution.
- `.features-gen/`: Playwright specs generated from the feature files by playwright-bdd (gitignored).

- `videos/`: Recorded videos of test runs.
- `playwright-report/`: HTML report of the last test run.

- `test-results/`: Traces, screenshots and videos recorded from (failed) runs.

## Test Structure - Arrange, Act, Assert

Expand Down Expand Up @@ -84,40 +84,40 @@ All assertions should be in your test, no assertion in the POM
DO 👍

```typescript
// POM file './pageOobjects/foo/'
// add all locators and functions related to the page.
// allowing all tests to reuse
// POM file './support/objects/foo/index.ts'
// add all locators and functions related to the page,
// allowing all tests to reuse them

import { expect, Locator, Page } from '@playwright/test';
import { Locator, Page } from '@playwright/test';

export class FooPage {
readonly errorMessage: Locator;
#page: Page;

constructor(page: Page) {
this.page = page;
this.errorMessage = page.locator('.error-message');
constructor({ page }: { page: Page }) {
this.#page = page;
}
Comment thread
v-scharf marked this conversation as resolved.
}

// test file './steps/foo.ts'
import { FooPage } from './pageObjects/foo';
// step definition file './steps/ui/foo.ts'
import { expect } from '@playwright/test';
import { Then } from '../../environment/fixtures';
import { FooPage } from '../../support/objects/foo';

let fooPage: FooPage;

Then('error message should be visible', async function ({ page }) {
const fooPage = new FooPage({ page });
Then('the error message should be visible', async ({ page }) => {
const fooPage = new FooPage(page);
await expect(fooPage.errorMessage).toBeVisible();
});
```

DO NOT ⚔️

```typescript
// test file './steps/foo.ts'
// include locators directly in test
import { Locator, Page } from '@playwright/test';
// step definition file './steps/ui/foo.ts'
// include locators directly in the step
import { expect } from '@playwright/test';
import { Then } from '../../environment/fixtures';

Then('error message should be visible', async function ({ page }) {
Then('the error message should be visible', async ({ page }) => {
await expect(page.locator('.error-message')).toBeVisible();
});
```
Expand Down
146 changes: 0 additions & 146 deletions docs/dev/web/testing/running-tests.md

This file was deleted.