144 lines
2.8 KiB
ReStructuredText
144 lines
2.8 KiB
ReStructuredText
=======================================================
|
|
Acceptance Tests for TYPO3 with help of PHP Codeception
|
|
=======================================================
|
|
|
|
They can be executed within
|
|
===========================
|
|
|
|
* a docker image
|
|
|
|
* GitHub Actions
|
|
|
|
* GitLab CI
|
|
|
|
Our goal
|
|
========
|
|
|
|
* TDD JavaScript functionality in Frontend of website
|
|
|
|
* Cover TYPO3 backend modifications for easier TYPO3 updates
|
|
|
|
* Robust, very few to none false positives
|
|
|
|
* **No** cross browser testing
|
|
|
|
* **No** visual regression testing
|
|
|
|
Used components
|
|
===============
|
|
|
|
Firefox + geckodriver
|
|
https://github.com/mozilla/geckodriver
|
|
|
|
Nix
|
|
https://nixos.org/
|
|
|
|
PHP Built-in web server
|
|
https://www.php.net/manual/en/features.commandline.webserver.php
|
|
|
|
TYPO3 Testing Framework
|
|
https://github.com/TYPO3/testing-framework
|
|
|
|
Alternatives
|
|
============
|
|
|
|
``runTests.sh``
|
|
As used and documented by TYPO3
|
|
|
|
Docker Images by SeleniumHQ
|
|
https://github.com/SeleniumHQ/docker-selenium
|
|
|
|
cypress
|
|
https://www.youtube.com/watch?v=C96MW6TcFCw&t=5553s
|
|
|
|
Concept
|
|
=======
|
|
|
|
Keep things simple to use: a single command to execute tests.
|
|
|
|
Get to know the stack: so you are free to adapt to your setup.
|
|
|
|
The Command
|
|
===========
|
|
|
|
.. code:: sh
|
|
|
|
./vendor/bin/codecept run
|
|
|
|
The Stack
|
|
=========
|
|
|
|
Browser
|
|
Firefox (could be Chrome, Chromium, Edge, …)
|
|
|
|
Driver
|
|
geckodriver (could be chromedriver, selenium, …)
|
|
|
|
Server
|
|
PHP Built-in web server (could be nginx, apache, …)
|
|
|
|
Test Runner
|
|
Codeception (could be CodeceptJS, Cypress, …)
|
|
|
|
Codeception Extensions
|
|
======================
|
|
|
|
``Codeception\Extension\RunProcess``
|
|
Used to start geckodriver and PHP server
|
|
|
|
``TYPO3\TestingFramework\Core\Acceptance\Extension\BackendEnvironment``
|
|
Used to create environment with extensions
|
|
|
|
My suggestions
|
|
==============
|
|
Use smart wait
|
|
https://codeception.com/docs/modules/WebDriver#Configuration
|
|
|
|
Use retry
|
|
``Codeception\Step\Retry``
|
|
|
|
Use a namespace
|
|
* https://codeception.com/docs/reference/Configuration#namespace
|
|
|
|
* https://getcomposer.org/doc/04-schema.md#autoload-dev
|
|
|
|
Use modules and dependencies
|
|
* https://codeception.com/docs/ModulesAndHelpers
|
|
|
|
* https://codeception.com/docs/AdvancedUsage#Dependency-Injection
|
|
|
|
|
|
Use recorder
|
|
``Codeception\Extension\Recorder``
|
|
|
|
Current Issues
|
|
==============
|
|
|
|
* https://github.com/Codeception/Codeception/issues/5246
|
|
|
|
* https://github.com/symfony/symfony/issues/34406
|
|
|
|
Sources
|
|
=======
|
|
|
|
Website
|
|
https://daniel-siepmann.de
|
|
|
|
Repository
|
|
https://github.com/werkraum-media/watchlist
|
|
|
|
TYPO3 Documentation
|
|
https://docs.typo3.org/m/typo3/reference-coreapi/11.5/en-us/Testing/WritingAcceptance.html
|
|
|
|
Sponsored by our customers
|
|
* https://werkraum-media.de/
|
|
|
|
See watchlist extension
|
|
|
|
* https://www.reuter.de/
|
|
|
|
Used for TYPO3 backend modification coverage
|
|
|
|
* https://www.sac-cas.ch/
|
|
|
|
Migrated from a SaaS to Codeception tests
|