Reputation: 35098
We are building a shop for a customer on Shopware 6.3.5.2 and want to use tests to
There is Running End-to-End Tests but this seems to be for core development and uses psh.phar
which is not available in the production template.
How should this be done?
edit This question is meant a bit broader and concerns also Unit Tests.
Upvotes: 5
Views: 516
Reputation: 276
Actually, you can use the E2E tests of the platform project - as Cypress itself doesn't care where to run the test against. However, as you already noticed you cannot use psh
commands to run them. You may run the tests though the basic Cypress commands, setting your shop's url as baseUrl
of the tests, for example via this command:
./node_modules/.bin/cypress run --config baseUrl="<your-url>"
It works with cypress open
as well.
The only thing what may become troublesome is the setToInitialState
command in most of the tests which takes care about the clean up of shopware's database using psh
scripts, unfortunately. You may need to adjust it by overriding the command in order to reset the database of the Production
template.
I hope I was able to help a bit. 🙏
Upvotes: 2
Reputation: 26370
There are actually two parts here:
re 1: For regression tests like this I would suggest end-to-end tests. Either test through the UI with tools like selenium or through the HTTP API (I don't know if the shopware API is sufficient for extensive regression tests).
re 2: Since plugins do not run on their own I would extract all relevant functionality into plain old PHP classes that are independent of shopware and test those in isolation. Explore if some of that functionality can be made visible through an API and test the plugin integration through this. Depending on the actual plugin you might have to resort to UI tests again.
Upvotes: 0