Web Acceptance tests work by controlling a browser and using the web interface as a real user.
We use Page Object Pattern to distinguish the test logic from the web page logic.
The goal is to have only test-related logic in everything test-related, and all the low-level interactions with the webpage are delegated to page objects, containing everything from selectors to functions in order to work on tables, forms, etc.
You can see the page objects in
The master class is
commonPage.js. All pages are then represented by their own class in both the
folders. There is a second level of inheritance with
This organization allows you to let the FO or BO logic to be accessible by all objects.
Tests files are located in
tests/puppeteer/campaigns. There are a few special folders:
commonTestscontains reutilizable test logic (like the BO
datacontains all data used by tests: new products/categories/customers to be and existing ones (from fixtures), etc
upgradecontains everything related to the upgrade test scenario. This is still a WIP project as it’s really complicated to make it work
utilscontains some helpers: working with files, use of global variables, and random functions for puppeteer itself
Tests are located in the
The sanity campaign is a collection of basic tests which are ensuring that critical functionalities of PrestaShop are working: installation, CRUD of Products in BO, CRUD of Orders in BO, Crawling the catalog in FO, Modifying data in the cart and completing the checkout process.
At PrestaShop, the Sanity campaign is run for every Pull Request.
The functional campaign is a collection of low level functional tests: the goal is to test each feature of all functionalities. We go through all BO pages and test everything: filters on tables, searching, modifying data via shortcuts, CRUD (when applicable).
The End to end campaign tries to reproduce real user paths. It’s a WIP.
Everything is explained in README in the
You’ll need a working installation of PrestaShop in order to run the tests.
The most important thing to remember is separation of concerns: you cannot have test logic in your page objects, and you cannot have use of page logic in your tests. For example:
expectis possible only in your test files, never in your page objects
The goal is to write your test code once, and only change things (by following the evolution of the application) in your page objects.
If you want your tests to be accepted in the PrestaShop repository, make sure to read the
CONVENTIONS.md file in