You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
minor #3086 Add doc for E2E steps + minor modifications (raphael-geffroy)
This PR was merged into the 2.x branch.
Discussion
----------
Add doc for E2E steps + minor modifications
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | no
| Docs? | yes
| Issues | Fix#3039
| License | MIT
Commits
-------
ceefa1d [Docs] Add doc for E2E steps + minor modifications
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+48-2Lines changed: 48 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -83,18 +83,64 @@ To help you with assets, you can run the following commands in a specific packag
83
83
-`pnpm run watch`: watch for modifications and rebuild assets from the package,
84
84
-`pnpm run test`: run the tests from the package,
85
85
-`pnpm run test:unit`: run the Unit tests from the package,
86
-
-`pnpm run test:browser`: run the Browser tests from the package,
86
+
-`pnpm run test:browser`: run the Browser tests from the package, in a headless browser
87
+
-`pnpm run test:browser:ui`: run the Browser tests from the package in interactive mode, allowing you to see the tests running in a browser window and debug them if needed
87
88
-`pnpm run check`: run the formatter, linter, and sort imports, and fails if any modifications
88
89
-`pnpm run check --write`: run the formatter, linter, imports sorting, and write modifications
89
90
90
91
Thanks to [PNPM Workspaces](https://pnpm.io/workspaces), you can also run these commands from the root directory of the project:
91
92
-`pnpm run build`: build (compile) assets from **all** packages,
92
93
-`pnpm run test`: run the tests from **all** packages,
93
94
-`pnpm run test:unit`: run the Unit tests from **all** packages,
94
-
-`pnpm run test:browser`: run the Browser tests from **all** packages,
95
+
-`pnpm run test:browser`: run the Browser tests from **all** packages, in a headless browser
95
96
-`pnpm run check`: run the formatter, linter, and sort imports for **all** packages, and fails if any modifications
96
97
-`pnpm run check --write`: run the formatter, linter, imports sorting for **all** packages, and write modifications
97
98
99
+
#### Working with Unit tests
100
+
101
+
We use [Vitest](https://vitest.dev/) for unit testing of the assets,
102
+
and tests files are located in the `assets/test/unit/` directory of each UX package,
103
+
for example: `src/Vue/assets/test/unit/render_controller.test.ts`.
104
+
105
+
**Running tests:**
106
+
- At the project's root, you can run the following commands:
107
+
-`pnpm run test:unit`: runs the unit tests for **all** UX packages
108
+
- Inside the `assets/` directory of each UX package, you can run the following commands:
109
+
-`pnpm run test:unit`: runs the unit tests for the package
110
+
111
+
> [!IMPORTANT]
112
+
> The command `pnpm run test:unit` ensure that each possible combination of dependencies is tested
113
+
> (e.g., `"chart.js": "^3.4.1 || ^4.0"` for UX Chartjs).
114
+
> Thus it may take some time to run, and it may be not recommended to use watch mode.
115
+
116
+
#### Working with End-to-End (E2E) tests
117
+
118
+
> [!NOTE]
119
+
> E2E tests simulate real user interactions in a browser, to ensure that the
120
+
> UX packages work as expected in a real-world scenario.
121
+
122
+
Symfony UX use [Playwright](https://playwright.dev/) for browser automation and testing,
123
+
and a dedicated Symfony application located in the [`apps/e2e/`](./apps/e2e/) directory,
124
+
which contains many examples of Symfony UX packages usage.
125
+
126
+
Tests files are located in the `assets/test/browser/` directory of each UX package,
127
+
for example: `src/Vue/assets/test/browser/vue.test.ts`.
128
+
129
+
**Setup:**
130
+
1. Ensure to have followed the steps in the [Setting up the development environment](#setting-up-the-development-environment) section
131
+
2. Read and follow the instructions in the [`apps/e2e/README.md`](./apps/e2e/README.md) file,
132
+
133
+
**Running tests:**
134
+
- At the project's root, you can run the following commands:
135
+
-`pnpm run test:browser`: runs the browser tests for **all** UX packages, using a headless browser
136
+
- Inside the `assets/` directory of each UX package, you can run the following commands:
137
+
-`pnpm run test:browser`: runs browser tests for the package, using a headless browser
138
+
-`pnpm run test:browser:ui`: runs the browser tests in interactive mode, allowing you to see the tests running in a browser window and debug them if needed
139
+
140
+
> [!IMPORTANT]
141
+
> Due to their nature, E2E tests may be slower to run than unit tests.
142
+
> During the development, we recommend to run `pnpm run test:browser` or `pnpm run test:browser:ui` for a specific UX package.
143
+
98
144
### Working on documentation
99
145
100
146
Symfony UX documentation is written in ReStructuredText (`.rst`) and is located in the `docs/` directory
0 commit comments