Demo TYPO3 instance for visual regression testing with BackstopJS
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
-
Create a new project directory - e.g. in your home directory
- run
mkdir ~/t3cmd24
- run
-
Clone the project in the newly created project directory
- change into your created project directory - e.g.
cd ~/t3cmd24
- clone the repository
- via
git clone https://github.com/portrino/t3cmd24.git .
- via
- change into your created project directory - e.g.
-
Start the project using DDEV
- run
ddev start
to start the project- HINT: If you haven't downloaded the backstopjs base image before, then it will be downloaded when ddev is (re)started. The backstopjs/backstopjs is about 2.6GB, so this may take some time.
- run
-
Run the project using
composer
- first, run
ddev composer install
to install all required packages- this will force an unattended TYPO3 installation based on the
TYPO3_INSTALL_*
variables set in.ddev/config.yaml
- this will force an unattended TYPO3 installation based on the
- afterward, run
ddev composer install
so that the configured composer scripts are executed as defined
- first, run
-
Open the project using
ddev launch
or manually via:- Backend: https://t3cmd24.ddev.site/typo3/
- Frontend: https://t3cmd24.ddev.site/
-
Generate reference images
ddev backstop reference --config=backstop.js --id=introduction
- this will execute the
backstop reference
command for theintroduction
site/scenario processed in thetests/backstop/backstop.js
file
- this will execute the
-
Generate test images and compare them with the reference images
ddev backstop test --config=backstop.js --id=introduction
- this will execute the
backstop test
command for theintroduction
site/scenario processed in thetests/backstop/backstop.js
file
- this will execute the
-
Open results html report
ddev backstop-results --id introduction
- this wraps the
backstop openReport
command and opens the html report for theintroduction
site/scenario in your default browser
- this wraps the
-
Play with the configs and/ or change some content in the TYPO3 backend and re-run the backstop test
- by default the "scenarios" list defined in
the
tests/backstop/sites/introduction/config.js
file contains only the startpage- you can add more scenarios to test by adding them to the
scenarios
array in theconfig.js
file manually OR - you require the the
scenarios.js
file in theconfig.js
file- the
scenarios.js
file can be filled/generated by utilizing the TYPO3 sitemap via:ddev execute php tests/backstop/sitemap-loader.php introduction https://t3cmd24.ddev.site/sitemap.xml
- the
- you can add more scenarios to test by adding them to the
- by default the "scenarios" list defined in
the