Headless E2E tests for Adyen Shopware Plugin #667
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: E2E Test | |
run-name: Headless E2E tests for Adyen Shopware Plugin | |
on: | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
e2e: | |
name: Shopware 6 E2E | |
runs-on: | |
group: larger-runners | |
labels: ubuntu-latest-8-cores | |
timeout-minutes: 20 | |
strategy: | |
fail-fast: false | |
if: ${{ github.actor != 'renovate[bot]' && github.actor != 'lgtm-com[bot]' }} | |
# Prevent bots from initiating E2E pipeline | |
steps: | |
- name: Clone Code | |
uses: actions/checkout@v2 | |
- name: Initiate Dockware | |
run: | | |
docker pull dockware/dev:6.5.3.0 | |
docker run --rm -p 443:443 --name shopware6 \ | |
--mount type=bind,source="$(pwd)",target=/data/extensions/workdir \ | |
--env PHP_VERSION=8.2 -d dockware/dev:6.5.3.0 | |
sleep 30 | |
docker logs shopware6 | |
docker exec shopware6 bash -c "sudo mysql -u root -proot shopware -e \"UPDATE sales_channel_domain SET url='https://local.shopware.shop' WHERE url NOT LIKE 'default.%';\"" | |
docker exec shopware6 bash -c \ | |
"sudo mysql -u root -proot shopware -e \"SELECT @RULE_ID := id FROM rule WHERE name = 'All customers'; UPDATE shipping_method SET availability_rule_id = @RULE_ID;\"" | |
docker exec shopware6 bash -c "sudo mysql -u root -proot shopware -e \"UPDATE system_config SET configuration_value='{\"enabled\": false}' WHERE configuration_key='core.basicInformation.cookieConsent';\"" | |
docker network create localnetwork | |
docker network connect --alias local.shopware.shop localnetwork shopware6 | |
- name: Install/Configure Plugin | |
run: | | |
docker exec shopware6 bash -c "composer config --json repositories.local '{\"type\": \"path\", \"url\": \"/data/extensions/workdir\", \"options\": { \"symlink\": false } }'" | |
docker exec shopware6 bash -c 'composer require adyen/adyen-shopware6:*@RC' | |
docker exec shopware6 bash -c 'php bin/console plugin:refresh' | |
docker exec shopware6 bash -c 'php bin/console plugin:install AdyenPaymentShopware6 --activate' | |
docker exec shopware6 bash -c 'php bin/console cache:clear' | |
docker exec shopware6 bash -c 'php bin/console system:config:set AdyenPaymentShopware6.config.apiKeyTest "${{secrets.ADYEN_API_KEY}}"' | |
docker exec shopware6 bash -c 'php bin/console system:config:set AdyenPaymentShopware6.config.merchantAccount "${{secrets.ADYEN_MERCHANT}}"' | |
docker exec shopware6 bash -c 'php bin/console system:config:set AdyenPaymentShopware6.config.clientKeyTest "${{secrets.ADYEN_CLIENT_KEY}}"' | |
docker exec shopware6 bash -c 'php bin/console system:config:set AdyenPaymentShopware6.config.adyenGivingCharityMerchantAccount "${{secrets.DONATION_ACCOUNT}}"' | |
docker exec shopware6 bash -c 'php bin/console system:config:set AdyenPaymentShopware6.config.adyenGivingEnabled true' | |
docker exec shopware6 bash -c 'php bin/console system:config:set AdyenPaymentShopware6.config.adyenGivingDonationAmounts "1,5,10"' | |
docker exec shopware6 bash -c 'php bin/console adyen:payment-method:enable --all' | |
docker exec shopware6 bash -c 'php bin/console adyen:fetch-logos' | |
- name: Run E2E Tests | |
run: docker compose -f .github/workflows/templates/docker-compose.playwright.yml run --rm playwright /e2e.sh | |
env: | |
SHOPWARE_BASE_URL: ${{secrets.SHOPWARE_BASE_URL}} | |
PAYPAL_USERNAME: ${{secrets.PLAYWRIGHT_PAYPAL_USERNAME}} | |
PAYPAL_PASSWORD: ${{secrets.PLAYWRIGHT_PAYPAL_PASSWORD}} | |
- name: Archive test result artifacts | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: html-report | |
path: test-report | |
- name: Copy Adyen api logs from container if available | |
if: always() | |
run: | | |
# Create a local directory for logs | |
mkdir -p logs | |
# Check if the log file exists in the container | |
if docker exec shopware6 test -f /var/www/html/var/log/adyen/api.log; then | |
echo "Log file exists. Copying..." | |
docker cp shopware6:/var/www/html/var/log/adyen/api.log logs | |
else | |
echo "Log file does not exist. Skipping copy." | |
fi | |
shell: bash | |
- name: Upload Adyen api Logs | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: adyen-api-logs | |
path: logs/* |