-
Notifications
You must be signed in to change notification settings - Fork 3
Home
This elgentos testing suite contains (mostly) end-to-end tests for Magento 2 webshops using a Hyvä theme, powered by Playwright! It enables you to quickly set up, run, and extend automated browsers tests for your Magento 2 store. Installation is simple through npm, allowing you to seamlessly integrate robust testing into your development workflow.
Caution
Please note: if you’re not sure what each test does, then you should only run this in a testing environment! Some tests alter the database or important settings in your webshop, such as disabling the CATPCHA of your webshop.
The elgentos testing suite has been designed to work for Magento 2 webshops using a Hyvä theme. All tests are designed with the demo website offered by elgentos: https://hyva-demo.elgentos.io/, meaning the suite should always pass if you use a vanilla Magento 2 installation and the default Hyvä theme. We're always happy to help, but cannot guarantee our tests work for other webshops or themes.
Here are some other points that are important to know:
- Installing the testing suite includes copying specific files the suite needs. Please read Setting Up Your Testing Suite for more information.
- Please ensure you've read and followed the installation instructions. More often than not, you likely just missed a step. It happens - our testing suite can be a fickle friend.
If you’ve read the instructions before, or just want to get started and play around with the suite, you can use these steps to quickly get started. Please note that we do really encourage you to read the wiki.
Navigate to the web folder of your theme. This is usually located in app/design/frontend/{vendor}/{theme}/web. Within this folder, create a playwright folder, then navigate to it:
cd app/design/frontend/demo-store/demo-theme/web
mkdir playwright
cd playwrightnpm init -yLastly, simply run the command to install the elgentos Magento2 Playwright package, and the installation script will set things up for you! You will be prompted to input values for the .env variables, but these also come with default values.
npm install @elgentos/magento2-playwrightAfter the installation, a variety of folders will have been created. base-tests contain all pre-made tests. You can create your own tests in the tests folder, and even rewrite this suite’s tests within that tests folder.
We advise you check out or run setup.spec.ts first, as this will set up the necessary settings for your Magento 2 webshop - but you can also simply read what steps it performs and set these yourself! You can run the setup only with this command:
npx playwright test --grep "@setup" --trace onOr you can run all tests except the setup with this command:
npx playwright test --grep-invert "@setup" --trace on