Skip to content

Commit 0ad28aa

Browse files
committed
Contribute to UI Tests
1 parent 67ced70 commit 0ad28aa

File tree

1 file changed

+138
-32
lines changed
  • content/project-organization/quality-council/processes/contribute-ui-tests

1 file changed

+138
-32
lines changed

content/project-organization/quality-council/processes/contribute-ui-tests/_index.md

Lines changed: 138 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,150 @@ title: How to contribute to UI tests
44

55
# How to contribute to UI tests
66

7-
## Introduction
7+
## Overview
88

9-
### Branches
9+
Contributing to UI tests involves the following steps:
1010

11-
The first question to ask when making a contribution is "Which branch should I target?".
11+
1. Selecting a scenario
12+
2. Setting up your environment
13+
3. Writing the test
14+
4. Submitting a Pull Request (PR)
15+
5. Getting it reviewed and merged
1216

13-
The rules are as follows:
14-
* The development branch for UI testing is the current development branch.
15-
* The branch changes as soon as the final release is out.
17+
---
1618

17-
### Differences between scenarios & tests
19+
## Introduction
1820

19-
Scenarios are the base of UI Tests. They are available on the [PrestaShop Tests Documentation](https://build.prestashop-project.org/test-scenarios/).
21+
Scenarios are the basis of UI tests. They describe expected behaviors in a human-readable format and are available in the [PrestaShop Tests Documentation](https://build.prestashop-project.org/test-scenarios/).
2022

21-
Tests are the code based on scenarios. They are available on the main repository [in the tests/UI directory](https://github.com/PrestaShop/PrestaShop/tree/develop/tests/UI).
23+
Tests are the automated implementations of these scenarios. They are located in the [tests/UI directory of the PrestaShop Core repository](https://github.com/PrestaShop/PrestaShop/tree/develop/tests/UI).
24+
25+
---
2226

2327
## Contribute to UI tests
2428

25-
### Choose a scenario to automate
26-
27-
_**This part is only available for PrestaShopCorp employees.**_
28-
* Go to the PrestaShop Forge
29-
* Access to the Test Repositoy
30-
* Find a test in the directory `Core` or `Modules` with the state "TO BE AUTOMATED"
31-
32-
### Create the PR
33-
* The contributor create a PR targetting the development branch for UI tests.
34-
* The contributor can check that the PR works with the [Github Action `ga.tests.ui.pr`](https://github.com/PrestaShop/ga.tests.ui.pr).
35-
36-
### Review the PR
37-
* The review is done by [Software Developers in Tests of the project](/project-organization/people-and-roles/#software-developers-in-test).
38-
* Some checks are done :
39-
* The PR complies with [contribution guidelines](https://devdocs.prestashop-project.org/9/contribute/contribution-guidelines/);
40-
* The CI is green (lint, typescript check);
41-
* The scenario is followed;
42-
* The test is executed without errors in the [nightly](https://github.com/PrestaShop/ga.tests.ui.pr);
43-
* The test use the Page Object Model pattern.
44-
45-
### Merge of the PR
46-
* The merge is done after two approvals of [Software Developers in Tests of the project](/project-organization/people-and-roles/#software-developers-in-test) including a maintainer.
47-
* After that, the contribution will be executed every night in the [nightly of the project](https://nightly.prestashop-project.org/) to ensure continuity and stability of the project.
29+
### 1. Choose a scenario to automate
30+
31+
* Go to the [`test-scenarios` repository](https://github.com/PrestaShop/test-scenarios/issues?q=is%3Aissue%20state%3Aopen%20label%3A%22STATE%20%3A%20To%20Be%20Automated%22)
32+
* Find an open issue labeled **"STATE : To Be Automated"**
33+
* Select a scenario from the `Core` or `Modules` scope
34+
35+
---
36+
37+
### 2. Setup your environment
38+
39+
#### Prerequisites
40+
41+
* Node.js (recommended LTS version)
42+
* npm
43+
* Git
44+
45+
#### Project setup
46+
47+
* Checkout your fork of PrestaShop on the `develop` branch
48+
* Follow the [installation guide](https://devdocs.prestashop-project.org/9/basics/installation/)
49+
* Install your shop with:
50+
51+
* Language: **English**
52+
* Country: **France**
53+
54+
#### UI test setup
55+
56+
```bash
57+
cd tests/UI/
58+
npm install
59+
cp .env.local .env
60+
```
61+
62+
Update the `.env` file to match your local environment. Make sure to configure:
63+
64+
* `BASE_URL`
65+
* Browser settings
66+
* Credentials if required
67+
68+
#### Run a test
69+
70+
You can run a specific E2E test using:
71+
72+
```bash
73+
TEST_PATH="functional/BO/00_login/02_login.ts" npm run test:specific:fast-fail
74+
```
75+
76+
---
77+
78+
### 3. Create the test
79+
80+
You can now start writing your test.
81+
82+
* The directory structure mirrors the scenario structure
83+
* Place your test in the corresponding folder
84+
* Follow existing naming conventions
85+
86+
#### Tech stack
87+
88+
* **Mocha**: test framework
89+
* **Playwright**: browser automation
90+
* **@prestashop-core/ui-testing**: utilities and Page Object Models
91+
92+
#### Guidelines
93+
94+
* Follow the scenario strictly
95+
* Use the Page Object Model pattern
96+
* Reuse existing utilities and helpers
97+
* Avoid hardcoded values
98+
* Ensure your test is stable and deterministic
99+
100+
---
101+
102+
### 4. Create the Pull Request
103+
104+
Once your test runs successfully locally:
105+
106+
* Push your branch
107+
* Open a Pull Request targeting the `develop` branch
108+
* Trigger a run from your fork of the GitHub Action `ga.tests.ui.pr`
109+
110+
Make sure all checks pass before requesting a review.
111+
112+
---
113+
114+
### 5. Review process
115+
116+
The review is performed by [Software Developers in Test](/project-organization/people-and-roles/#software-developers-in-test).
117+
118+
During the review, the following checks are performed:
119+
120+
* Compliance with contribution guidelines
121+
* CI status (lint, TypeScript checks, tests)
122+
* Respect of the original scenario
123+
* Test stability in CI
124+
* Proper use of the Page Object Model pattern
125+
126+
---
127+
128+
### 6. Merge
129+
130+
The PR is merged after two approvals from [Software Developers in Test](/project-organization/people-and-roles/#software-developers-in-test), including at least one maintainer.
131+
132+
Once merged, the test is executed nightly to ensure ongoing stability of the project:
133+
134+
* [https://nightly.prestashop-project.org/](https://nightly.prestashop-project.org/)
135+
136+
---
137+
138+
## Best practices
139+
140+
* Keep tests independent
141+
* Avoid shared state between tests
142+
* Use Page Object Models consistently
143+
* Prefer reusable helpers from `@prestashop-core/ui-testing`
144+
* Keep tests readable and maintainable
145+
146+
---
147+
148+
## Troubleshooting
149+
150+
* Ensure your `.env` file is correctly configured
151+
* Verify that your shop is properly installed
152+
* Run tests in headed mode for debugging if needed
153+
* Check CI logs if tests fail on the pipeline

0 commit comments

Comments
 (0)