This repository contains a Shopware 6 demo project with end-to-end tests.
- PHP 8.4 with extensions required by Shopware
- Composer
- Node.js 22.x with npm
- Symfony CLI
- Docker
Install PHP dependencies:
composer installInstall end2end test suite Node.js dependencies:
(cd tests/acceptance && npm install)Create a compose.override.yml file like the following and adapt it to fit your system:
services:
###> shopware/core ###
database:
ports:
- "3306:3306"
labels:
# The following is important to avoid Symfony CLI injecting wrong DATABASE_URL for e2e env.
com.symfony.server.service-ignore: true
###< shopware/core ###
###> symfony/mailer ###
mailer:
image: axllent/mailpit
ports:
- "1025:1025"
- "8025:1025"
environment:
MP_SMTP_AUTH_ACCEPT_ANY: 1
MP_SMTP_AUTH_ALLOW_INSECURE: 1
###< symfony/mailer ###
###> shopware/elasticsearch ###
opensearch:
ports:
- "9200:9200"
###< shopware/elasticsearch ###Start development services with:
composer dev:startThis command will:
- Start Docker Compose
- Start Symfony CLI proxy
- Start a Symfony CLI server for development on port
8000 - Start a Symfony CLI server for end-to-end tests on port
8005
Create an .env.local file like the following and adapt it to fit your system:
MAILER_DSN=smpt://127.0.0.1:1025
APP_ENV=dev
APP_URL=http://127.0.0.1:8000
BLUE_GREEN_DEPLOYMENT=0
DATABASE_URL=mysql://root:[email protected]/shopware
OPENSEARCH_URL=http://127.0.0.1:9200
SHOPWARE_ES_ENABLED=1
SHOPWARE_ES_INDEXING_ENABLED=1
Install Shopware on development database with:
bin/console system:install --basic-setupCreate an .env.e2e.local file like the following and adapt it to fit your system:
DATABASE_URL=mysql://root:[email protected]:3306/shopware_e2e
The DATABASE_URL env var in this file should point to a different database to use with end-to-end tests.
Then prepare end-to-end tests database and dump with:
composer test:e2e:prepareThis command will:
- Install Shopware on end-to-end tests database
- Disable first run wizard on that database
When you have end-to-end database prepared you can run end-to-end tests with:
composer test:e2e