This is a subproject of My-Skoob. While it can serve as a base for other projects, it was structured to be executed specifically alongside the system.
This project uses Python 3 with Pytest, Selenium, and Docker to run tests in parallel and in isolation.
It leverages superclasses and an intermediate class before Selenium commands so that tests inherit reusable and simplified standard methods, making development and maintenance easier.
There are also report files (where the test name is added when it fails) and data.json, which serves to standardize the information filled in during tests.
Whenever a test fails, it is re-executed once to avoid tracking tests that failed due to random simple errors.
In the teardown method, if a test fails, it takes a screenshot and saves it in the corresponding module folder under the prints directory. The test's module and name are also added to the report.txt file. Tests that succeeded on re-run will have their name listed only once, while tests that failed (error on normal execution and on re-run) will have their name twice in the file.
Rules to follow to ensure a consistent standard of quality and development:
-
To find an element with Selenium, use:
- element ID;
- element name;
- XPATH;
- full XPATH;
- CSS Selector.
-
Inside the main test method, only call functions;
-
Use variables for values filled in during tests;
-
Use values from data.json whenever possible;
-
Write intuitive and clear comments and modularized functions;
-
Follow the structure and comments of the example tests.
Tool | Version |
---|---|
Docker | 28.0.4 |
Docker Compose | 2.34.0 |
Tool | Version |
---|---|
RealVNC | LTS |
VSCode Black Formatter Extension | Auto |
VSCode Prettier Formatter Extension | Auto |
Follow the .env_sample file to run the project locally.
In RealVNC, register the Chrome nodes to view the test executions. Save the following addresses:
- localhost:5900
- localhost:5901
- localhost:5902
And use the default password: secret
.
It is necessary to allow the execution of scripts menu by running:
chmod +x ./menu.sh
Now, just run:
./scripts/menu.sh
some commands will ask for sudo permission
And you will see:
A set of useful options
- Configurar gitlab runner;
- Configurar github workflow;
- Add tests;
- Add Option in Menu to run tests set.
- Add Option in Menu to run tests by module.
- Add Selenium Debug.
- Add Selenium Video.