Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: E2E Tests

on:
workflow_dispatch:

jobs:
e2e:
runs-on: ubuntu-latest
strategy:
matrix:
shopware-version: ['6.6.10.4', '6.7.2.2']
php-version: ['8.3']
node-version: [22]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Get Plugin Name
id: plugin_name
run: echo "PLUGIN_NAME=$(jq -r '.extra."shopware-plugin-class" | split("\\\\") | .[0]' composer.json)" >> $GITHUB_ENV

- name: Install shopware-cli
run: npm i -g @shopware-ag/shopware-cli

- name: Build plugin zip
run: shopware-cli extension zip . --disable-git

- name: Get zip file name
id: zip_name
run: echo "ZIP_NAME=$(ls *.zip)" >> $GITHUB_ENV

- name: Start Shopware
run: |
docker-compose -f tests/e2e/docker-compose.yml up -d --wait
env:
SHOPWARE_VERSION: ${{ matrix.shopware-version }}

- name: Copy plugin to container
run: docker cp ${{ env.ZIP_NAME }} shopware:/tmp/${{ env.ZIP_NAME }}

- name: Unzip plugin in container
run: docker-compose -f tests/e2e/docker-compose.yml exec -T shopware unzip /tmp/${{ env.ZIP_NAME }} -d /var/www/html/custom/plugins/

- name: Install Plugin
run: |
docker-compose -f tests/e2e/docker-compose.yml exec -T shopware bin/console plugin:install --activate ${{ env.PLUGIN_NAME }}
docker-compose -f tests/e2e/docker-compose.yml exec -T shopware bin/console theme:change Storefront

- name: Install Playwright dependencies
run: |
cd tests/e2e
npm install

- name: Run Playwright tests
run: |
cd tests/e2e
npx playwright test

- name: Upload Playwright Report
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-report-${{ matrix.shopware-version }}
path: tests/e2e/playwright-report/
retention-days: 30
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
src/Resources/public/administration
src/Resources/public/static
/tests/e2e/node_modules
/tests/e2e/package-lock.json
13 changes: 13 additions & 0 deletions tests/e2e/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
services:
shopware:
image: dockware/dev:${SHOPWARE_VERSION}
container_name: shopware
ports:
- "80:80"
environment:
- SHOPWARE_URL=http://localhost
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost"]
interval: 10s
timeout: 5s
retries: 12
7 changes: 7 additions & 0 deletions tests/e2e/example.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// @ts-check
const { test, expect } = require('@playwright/test');

test('homepage loads successfully', async ({ page }) => {
const response = await page.goto('http://localhost:80');
expect(response.status()).toBe(200);
});
16 changes: 16 additions & 0 deletions tests/e2e/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "e2e",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "playwright test"
},
"keywords": [],
"author": "",
"license": "ISC",
"type": "commonjs",
"devDependencies": {
"@playwright/test": "latest"
}
}