Skip to content

Commit

Permalink
Functional Tests : Cash on delivery (COD) module: Upgrade module
Browse files Browse the repository at this point in the history
  • Loading branch information
Progi1984 committed Oct 11, 2024
1 parent 6bf8dfc commit f750dcc
Show file tree
Hide file tree
Showing 8 changed files with 436 additions and 22 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/ui-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
schedule:
- cron: '0 0 * * *'
env:
CAMPAIGN: 'ps_cashondelivery'
MODULE_NAME: 'ps_cashondelivery'
jobs:
ui_test:
name: UI Tests
Expand All @@ -22,12 +22,12 @@ jobs:
fail-fast: false
matrix:
PS_VERSION:
- '1.7.6.9'
- '1.7.7.8'
- '1.7.8.11'
- '8.0.5'
- '8.1.6'
- '8.2.0'
#- '1.7.6.9'
#- '1.7.7.8'
#- '1.7.8.11'
#- '8.0.5'
#- '8.1.6'
#- '8.2.0'
- 'nightly'
env:
PS_VERSION: ${{ matrix.PS_VERSION }}
Expand All @@ -38,7 +38,7 @@ jobs:
- name: Start containers
working-directory: tests/UI/
run: |
docker compose -f "docker-compose.yml" up -d --build
USER_ID=$(id -u) GROUP_ID=$(id -g) docker compose -f "docker-compose.yml" up -d --build
bash -c 'while [[ "$(curl -L -s -o /dev/null -w %{http_code} http://localhost/en/)" != "200" ]]; do sleep 5; done'
- name: Install dependencies
Expand Down Expand Up @@ -106,7 +106,7 @@ jobs:
working-directory: tests/UI/
run: |
mkdir -p nightly
REPORT_NAME="${{ env.CAMPAIGN }}_$(date +%Y-%m-%d)-${{ matrix.PS_VERSION }}"
REPORT_NAME="${{ env.MODULE_NAME }}_$(date +%Y-%m-%d)-${{ matrix.PS_VERSION }}"
mv report.json nightly/${REPORT_NAME}.json
# Nightly : Auth GCP
Expand All @@ -128,5 +128,5 @@ jobs:
# Nightly : Push Report
- name: "Nightly : Push Report"
run: |
REPORT_NAME="${{ env.CAMPAIGN }}_$(date +%Y-%m-%d)-${{ matrix.PS_VERSION }}"
curl -v "https://api-nightly.prestashop-project.org/import/report/playwright?token=${{ secrets.NIGHTLY_TOKEN }}&filename=${REPORT_NAME}.json&campaign=${{ env.CAMPAIGN }}&platform=chromium"
REPORT_NAME="${{ env.MODULE_NAME }}_$(date +%Y-%m-%d)-${{ matrix.PS_VERSION }}"
curl -v "https://api-nightly.prestashop-project.org/import/report/playwright?token=${{ secrets.NIGHTLY_TOKEN }}&filename=${REPORT_NAME}.json&campaign=${{ env.MODULE_NAME }}&platform=chromium"
401 changes: 401 additions & 0 deletions tests/UI/campaigns/01_installation/01_upgradeModule.spec.ts

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import {
foClassicCheckoutOrderConfirmationPage,
foClassicHomePage,
foClassicLoginPage,
utilsTest,
foClassicModalBlockCartPage,
foClassicModalQuickViewPage,
utilsTest,
} from '@prestashop-core/ui-testing';

import { test, expect, Page, BrowserContext } from '@playwright/test';
Expand Down
8 changes: 3 additions & 5 deletions tests/UI/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@ services:
- DB_USER=prestashop
- DB_PASSWD=prestashop
- DB_NAME=prestashop
- MODULE_NAME=${MODULE_NAME}
volumes:
- type: bind
# Local Path
source: ../../
# Mount Path
target: /var/www/html/modules/ps_cashondelivery
- ./docker-scripts:/tmp/post-install-scripts
- ../../:/tmp/ps_cashondelivery
ports:
- 80:80
mysql:
Expand Down
15 changes: 15 additions & 0 deletions tests/UI/docker-scripts/1-install_ps_cashondelivery.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh
set -eu

cd "$(dirname $0)" || exit 1

echo "* [$MODULE_NAME] Copying module..."
cp -r /tmp/ps_cashondelivery /var/www/html/modules/

echo "* [$MODULE_NAME] Setting permissions..."
cd /var/www/html/
chown -R www-data:www-data modules/ps_cashondelivery
chmod -R 755 modules/ps_cashondelivery

echo "* [$MODULE_NAME] Installing the module..."
runuser -g www-data -u www-data -- php -d memory_limit=-1 bin/console prestashop:module --no-interaction install "$MODULE_NAME"
8 changes: 4 additions & 4 deletions tests/UI/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/UI/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"author": "",
"license": "MIT",
"devDependencies": {
"@prestashop-core/ui-testing": "https://github.com/PrestaShop/ui-testing-library#main",
"@prestashop-core/ui-testing": "https://github.com/PrestaShop/ui-testing-library#pull/157/head",
"@types/node": "^20.11.5",
"@types/semver": "^7.5.8",
"dotenv": "^16.3.1",
Expand Down

0 comments on commit f750dcc

Please sign in to comment.