Skip to content

Commit 3795a32

Browse files
committed
fixup! fixup! Add writing-tests-guidelines.md (#612)
1 parent 0cfa555 commit 3795a32

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

src/docs/contribute/writing-tests-guidelines.md

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Playwright Testing Structure
1+
# Playwright Testing Structure
22

33
This document outlines the structure and guidelines for writing Playwright
44
tests, ensuring consistency and maintainability throughout the codebase.
@@ -32,7 +32,7 @@ described below.
3232
in tests. These components should be functional without requiring any
3333
properties to be passed from the tests.
3434

35-
## File Structure of `<ComponentName>.spec.tsx`
35+
## File Structure of `<ComponentName>.spec.tsx`
3636

3737
Playwright tests follow a structured format to ensure readability
3838
and scalability. Each displayed level represents a `test.describe(...)` block.
@@ -65,7 +65,7 @@ Test block categories can be expanded or removed depending on the nature
6565
of the tested component and whether a predefined test block is applicable
6666
in a specific case.
6767

68-
## File Structure of `<ComponentName>.story.tsx`
68+
## File Structure of `<ComponentName>.story.tsx`
6969

7070
The `<ComponentName>.story.tsx` file should include all component variants
7171
tested in `<ComponentName>.spec.tsx`. Components should be organized
@@ -93,9 +93,22 @@ test scenario.
9393

9494
## Formatting and code style
9595

96-
- When writing visual tests, the test for the default component properties
97-
should always be placed first. This test is always represented by
98-
`propTests.defaultComponentPropTest`, defined in the global `propTests`.
96+
### Rules
97+
98+
- Test for the default component properties should always be placed first.
99+
This test is always represented by `propTests.defaultComponentPropTest`,
100+
defined in the global `propTests`.
101+
102+
- When possible, try to re-use globally defined `propTests`
103+
for visual tests, located in `tests/playwright/propTests`.
104+
105+
- It is essential to test all combinations of props that have a significant
106+
visual impact on the appearance of the component.
107+
108+
- For all possible combinations of multiple `propTests` should be used
109+
function `mixPropTests`.
110+
111+
### Formate
99112

100113
- Prop test variants should be sorted alphabetically. If there are multiple
101114
prop tests like `feedbackColor`, `neutralColor`, etc., they should still be
@@ -119,9 +132,6 @@ ordered alphabetically under the category of color.
119132

120133
```
121134

122-
- When possible, try to re-use globally defined `propTests`
123-
for visual tests, located in `tests/playwright/propTests`.
124-
125135
- Naming convention for propTests `name` property should follow this pattern:
126136

127137
```text
@@ -132,9 +142,6 @@ for visual tests, located in `tests/playwright/propTests`.
132142
someProp:shape[nested]
133143
```
134144

135-
- For all possible combinations of multiple `propTests` should be used
136-
function `mixPropTests`.
137-
138145
## Templates
139146

140147
### Template for `<ComponentName>.story.tsx`

0 commit comments

Comments
 (0)