-
Notifications
You must be signed in to change notification settings - Fork 22
Add code testing via phpunit and/or cypress #167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…able two joomla extensions that could cause issues in tests
|
Hello it seems to be a big work. |
|
For phpunit:
For cypress:
|
|
@parapente for phpunit I have an error at st step 1) |
|
I fixed last error by adding link from temp\joomla\libraries\src to joomla 4.x library src path |
|
Next error is |
|
@JLTRY yes that is the error I'm getting too. The summary gives: but most of those that pass as quite trivial tests. Another thing that will be of importance if we continue to work with phpunit is that the joomla framework packages have different numbering from the joomla cms releases:
So for the packages that I have added as requirements in composer.json we should use the joomla 6 code in /temp/joomla. |
|
I have made a link to joomla_6 libraries/src. It still fails I have got this error |
and if you run I went well to step docker compose --profile testing up -d |
|
@JLTRY If you get and empty desktop in novnc there is probably an error during cypress desktop startup. You can see the logs if you run The default usernames and passwords are the ones that appear in docker-compose.yml . For joomla you should use username: joomla and password: joomla_password (it had to be 12 characters or longer unfortunately). |
Do you run cypress under windows /docker or under linux / docker ? |
|
I am using linux / docker but using docker should give you the same result both on linux and windows. On windows is a little more complicated to get started with docker and a little less performant but it should be the same. There is another way to run the cypress tests but it will require you to do some manual configuration. Instead of running Cypress has two modes of running: headless (which just runs the tests and doesn't open an application window) and desktop. For now I am using the desktop mode to write the tests and when they are ready, using the same config we could add a github action to run the tests automatically on every push we make to the repository. |

This is an effort to add automated testing of the code to ensure that the extension works whenever new patches are added to the codebase or the joomla framework changes.
There are few phpunit tests (ported from older tests that were present in the codebase) but almost all fail for now. It will need quite some effort to refactor the extension code to be able to test it effectivly using phpunit.
Cypress on the other hand can help us test the extension as it is running on an joomla instance like we would manually. I started adding some basic tests that are run in batches. I have created folders for each part of the package in /cypress/e2e that eventually will be populated with the tests.
I will add a checklist for everything that needs to be done and of course the last step would be to add github actions to run the tests whenever we push code to master.