From 1238792b639560c6b2043be371bfc9fca2ebf3ed Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 27 Sep 2024 10:33:43 +0200 Subject: [PATCH] Functional Tests : Cash on delivery (COD) module: Upgrade module --- .github/workflows/ui-test.yml | 37 +- .../01_installation/01_upgradeModule.spec.ts | 427 ++++++++++++++++++ ..._resetModule.spec.ts => 04_resetModule.ts} | 0 ...rWithIt.spec.ts => 01_placeOrderWithIt.ts} | 2 +- tests/UI/docker-compose.yml | 9 +- .../1-install_ps_cashondelivery.sh | 15 + tests/UI/package-lock.json | 8 +- tests/UI/package.json | 2 +- 8 files changed, 478 insertions(+), 22 deletions(-) create mode 100644 tests/UI/campaigns/01_installation/01_upgradeModule.spec.ts rename tests/UI/campaigns/01_installation/{04_resetModule.spec.ts => 04_resetModule.ts} (100%) rename tests/UI/campaigns/02_configuration/{01_placeOrderWithIt.spec.ts => 01_placeOrderWithIt.ts} (100%) create mode 100755 tests/UI/docker-scripts/1-install_ps_cashondelivery.sh diff --git a/.github/workflows/ui-test.yml b/.github/workflows/ui-test.yml index 510e58020f..cf04b6ead8 100644 --- a/.github/workflows/ui-test.yml +++ b/.github/workflows/ui-test.yml @@ -13,7 +13,7 @@ on: schedule: - cron: '0 0 * * *' env: - CAMPAIGN: 'ps_cashondelivery' + MODULE_NAME: 'ps_cashondelivery' jobs: ui_test: name: UI Tests @@ -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 }} @@ -35,12 +35,24 @@ jobs: - name: Checkout uses: actions/checkout@v3.1.0 + ## Create ZIP file + - name: Install composer dependencies + run: composer install --no-dev -o + + - name: Build ZIP file + run: | + cd .. + zip -r ${{ github.event.repository.name }}.zip ${{ github.event.repository.name }} + cd ${{ github.event.repository.name }} + + ## Docker - 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' + ## UI Tests - name: Install dependencies working-directory: tests/UI/ run: npm ci @@ -52,7 +64,10 @@ jobs: - name: Run Playwright tests working-directory: tests/UI/ run: npx playwright test + env: + URL_ZIP: http://localhost/${{ github.event.repository.name }}.zip + ## Errors - name: Export Docker errors working-directory: tests/UI/ if: always() @@ -106,7 +121,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 @@ -128,5 +143,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" diff --git a/tests/UI/campaigns/01_installation/01_upgradeModule.spec.ts b/tests/UI/campaigns/01_installation/01_upgradeModule.spec.ts new file mode 100644 index 0000000000..2467031d7e --- /dev/null +++ b/tests/UI/campaigns/01_installation/01_upgradeModule.spec.ts @@ -0,0 +1,427 @@ +import { + boDashboardPage, + boLoginPage, + boMaintenancePage, + boModuleManagerPage, + boShopParametersPage, + dataCustomers, + dataModules, + foClassicCartPage, + foClassicCheckoutPage, + foClassicHomePage, + foClassicLoginPage, + foClassicModalQuickViewPage, + opsBOModules, + utilsTest, + foClassicModalBlockCartPage, +} from '@prestashop-core/ui-testing'; +import { test, expect, Page, BrowserContext } from '@playwright/test'; + +const baseContext: string = 'modules_ps_cashondelivery_installation_upgradeModule'; + +test.describe('Cash on delivery (COD) module: Upgrade module', async () => { + let browserContext: BrowserContext; + let page: Page; + + test.beforeAll(async ({ browser }) => { + browserContext = await browser.newContext(); + page = await browserContext.newPage(); + }); + test.afterAll(async () => { + await page.close(); + }); + + test('Upgrade with shop on maintenance : should uninstall the module', async function () { + await opsBOModules.uninstallModule(page, dataModules.psCashOnDelivery, `${baseContext}_preTest_0`); + }); + + test('Upgrade with shop on maintenance : should install the module in previous version', async function () { + await opsBOModules.installModule(page, dataModules.psCashOnDelivery, false, `${baseContext}_preTest_1`); + }); + + test('Upgrade with shop on maintenance : should login in BO', async function () { + await utilsTest.addContextItem(test.info(), 'testIdentifier', 'loginBO', baseContext); + + await boLoginPage.goTo(page, global.BO.URL); + await boLoginPage.successLogin(page, global.BO.EMAIL, global.BO.PASSWD); + + const pageTitle = await boDashboardPage.getPageTitle(page); + expect(pageTitle).toContain(boDashboardPage.pageTitle); + }); + + test('Upgrade with shop on maintenance : should go to \'Shop parameters > General\' page', async function () { + await utilsTest.addContextItem(test.info(), 'testIdentifier', 'goToShopParamsPage', baseContext); + + await boDashboardPage.goToSubMenu( + page, + boDashboardPage.shopParametersParentLink, + boDashboardPage.shopParametersGeneralLink, + ); + await boShopParametersPage.closeSfToolBar(page); + + const pageTitle = await boShopParametersPage.getPageTitle(page); + expect(pageTitle).toContain(boShopParametersPage.pageTitle); + }); + + test('Upgrade with shop on maintenance : should go to \'Maintenance\' tab', async function () { + await utilsTest.addContextItem(test.info(), 'testIdentifier', 'goToMaintenancePage', baseContext); + + await boShopParametersPage.goToSubTabMaintenance(page); + + const pageTitle = await boMaintenancePage.getPageTitle(page); + expect(pageTitle).toContain(boMaintenancePage.pageTitle); + }); + + test('Upgrade with shop on maintenance : should disable the shop', async function () { + await utilsTest.addContextItem(test.info(), 'testIdentifier', 'disableShop', baseContext); + + const resultStatus = await boMaintenancePage.changeShopStatus(page, false); + expect(resultStatus).toContain(boMaintenancePage.successfulUpdateMessage); + + const resultLoggedInEmployees = await boMaintenancePage.changeStoreForLoggedInEmployees(page, false); + expect(resultLoggedInEmployees).toContain(boMaintenancePage.successfulUpdateMessage); + }); + + test('Upgrade with shop on maintenance : should verify the existence of the maintenance text', async function () { + await utilsTest.addContextItem(test.info(), 'testIdentifier', 'verifyMaintenanceText', baseContext); + + page = await boMaintenancePage.viewMyShop(page); + + const pageContent = await foClassicHomePage.getTextContent(page, foClassicHomePage.content); + expect(pageContent).toEqual(boMaintenancePage.maintenanceText); + }); + + test('Upgrade with shop on maintenance : should go to \'Modules > Module Manager\' page', async function () { + await utilsTest.addContextItem(test.info(), 'testIdentifier', 'goToModuleManagerPage', baseContext); + + // Go back to BO + page = await foClassicHomePage.closePage(browserContext, page, 0); + await boDashboardPage.goToSubMenu( + page, + boDashboardPage.modulesParentLink, + boDashboardPage.moduleManagerLink, + ); + await boModuleManagerPage.closeSfToolBar(page); + + const pageTitle = await boModuleManagerPage.getPageTitle(page); + expect(pageTitle).toContain(boModuleManagerPage.pageTitle); + }); + + test(`Upgrade with shop on maintenance : should search the module ${dataModules.psCashOnDelivery.name}`, async function () { + await utilsTest.addContextItem(test.info(), 'testIdentifier', 'searchModule', baseContext); + + const isModuleVisible = await boModuleManagerPage.searchModule(page, dataModules.psCashOnDelivery); + expect(isModuleVisible).toBeTruthy(); + + const moduleInfo = await boModuleManagerPage.getModuleInformationNth(page, 1); + expect(dataModules.psCashOnDelivery.versionOld).toContain(moduleInfo.version); + }); + + test('Upgrade with shop on maintenance : should display the upgrade modal and cancel it', async function () { + await utilsTest.addContextItem(test.info(), 'testIdentifier', 'resetModuleAndCancel', baseContext); + + const textResult = await boModuleManagerPage.setActionInModule(page, dataModules.psCashOnDelivery, 'upgrade', true); + expect(textResult).toEqual(''); + + const isModuleVisible = await boModuleManagerPage.isModuleVisible(page, dataModules.psCashOnDelivery); + expect(isModuleVisible).toBeTruthy(); + + const isModalVisible = await boModuleManagerPage.isModalActionVisible(page, dataModules.psCashOnDelivery, 'upgrade'); + expect(isModalVisible).toBeFalsy(); + }); + + test('Upgrade with shop on maintenance : should upgrade the module', async function () { + await utilsTest.addContextItem(test.info(), 'testIdentifier', 'resetModule', baseContext); + + const successMessage = await boModuleManagerPage.setActionInModule(page, dataModules.psCashOnDelivery, 'upgrade', false, true); + expect(successMessage).toEqual(boModuleManagerPage.updateModuleSuccessMessage(dataModules.psCashOnDelivery.tag)); + }); + + test('Upgrade with shop on maintenance : should reload the page', async function () { + await utilsTest.addContextItem(test.info(), 'testIdentifier', 'checkModule', baseContext); + + await boModuleManagerPage.reloadPage(page); + + const isModuleVisible = await boModuleManagerPage.searchModule(page, dataModules.psCashOnDelivery); + expect(isModuleVisible).toBeTruthy(); + + const moduleInfo = await boModuleManagerPage.getModuleInformationNth(page, 1); + expect(dataModules.psCashOnDelivery.versionCurrent).toContain(moduleInfo.version); + }); + + test('Upgrade with shop on maintenance : should return to \'Shop parameters > General\' page', async function () { + await utilsTest.addContextItem(test.info(), 'testIdentifier', 'returnToShopParamsPage', baseContext); + + await boDashboardPage.goToSubMenu( + page, + boDashboardPage.shopParametersParentLink, + boDashboardPage.shopParametersGeneralLink, + ); + await boShopParametersPage.closeSfToolBar(page); + + const pageTitle = await boShopParametersPage.getPageTitle(page); + expect(pageTitle).toContain(boShopParametersPage.pageTitle); + }); + + test('Upgrade with shop on maintenance : should return to \'Maintenance\' tab', async function () { + await utilsTest.addContextItem(test.info(), 'testIdentifier', 'returnToMaintenancePage', baseContext); + + await boShopParametersPage.goToSubTabMaintenance(page); + + const pageTitle = await boMaintenancePage.getPageTitle(page); + expect(pageTitle).toContain(boMaintenancePage.pageTitle); + }); + + test('Upgrade with shop on maintenance : should enable the shop', async function () { + await utilsTest.addContextItem(test.info(), 'testIdentifier', 'enableShop', baseContext); + + const result = await boMaintenancePage.changeShopStatus(page, true); + expect(result).toContain(boMaintenancePage.successfulUpdateMessage); + }); + + test('Upgrade with shop on maintenance : should go to the front office', async function () { + await utilsTest.addContextItem(test.info(), 'testIdentifier', 'goToTheFo', baseContext); + + page = await boModuleManagerPage.viewMyShop(page); + await foClassicHomePage.changeLanguage(page, 'en'); + + const isHomePage = await foClassicHomePage.isHomePage(page); + expect(isHomePage).toBeTruthy(); + }); + + test('Upgrade with shop on maintenance : should go to login page', async function () { + await utilsTest.addContextItem(test.info(), 'testIdentifier', 'goToLoginPageFO', baseContext); + + await foClassicHomePage.goToLoginPage(page); + + const pageTitle = await foClassicLoginPage.getPageTitle(page); + expect(pageTitle).toContain(foClassicLoginPage.pageTitle); + }); + + test('Upgrade with shop on maintenance : should sign in with default customer', async function () { + await utilsTest.addContextItem(test.info(), 'testIdentifier', 'sighInFO', baseContext); + + await foClassicLoginPage.customerLogin(page, dataCustomers.johnDoe); + + const isCustomerConnected = await foClassicLoginPage.isCustomerConnected(page); + expect(isCustomerConnected).toBeTruthy(); + }); + + test('Upgrade with shop on maintenance : should add the first product to the cart', async function () { + await utilsTest.addContextItem(test.info(), 'testIdentifier', 'addProductToCart', baseContext); + + await foClassicLoginPage.goToHomePage(page); + + // Add first product to cart by quick view + await foClassicHomePage.quickViewProduct(page, 1); + await foClassicModalQuickViewPage.addToCartByQuickView(page); + await foClassicModalBlockCartPage.proceedToCheckout(page); + + const pageTitle = await foClassicCartPage.getPageTitle(page); + expect(pageTitle).toEqual(foClassicCartPage.pageTitle); + }); + + test('Upgrade with shop on maintenance : should proceed to checkout and check Step Address', async function () { + await utilsTest.addContextItem(test.info(), 'testIdentifier', 'checkAddressStep', baseContext); + + await foClassicCartPage.clickOnProceedToCheckout(page); + + const isCheckoutPage = await foClassicCheckoutPage.isCheckoutPage(page); + expect(isCheckoutPage).toBeTruthy(); + + const isStepPersonalInformationComplete = await foClassicCheckoutPage.isStepCompleted( + page, + foClassicCheckoutPage.personalInformationStepForm, + ); + expect(isStepPersonalInformationComplete).toBeTruthy(); + }); + + test('Upgrade with shop on maintenance : should validate Step Address and go to Delivery Step', async function () { + await utilsTest.addContextItem(test.info(), 'testIdentifier', 'checkDeliveryStep', baseContext); + + const isStepAddressComplete = await foClassicCheckoutPage.goToDeliveryStep(page); + expect(isStepAddressComplete).toBeTruthy(); + }); + + test('Upgrade with shop on maintenance : should go to payment step', async function () { + await utilsTest.addContextItem(test.info(), 'testIdentifier', 'goToPaymentStep', baseContext); + + const isStepDeliveryComplete = await foClassicCheckoutPage.goToPaymentStep(page); + expect(isStepDeliveryComplete, 'Step Address is not complete').toBeTruthy(); + }); + + test(`Upgrade with shop on maintenance : should check the '${dataModules.psCashOnDelivery.name}' payment module`, async function () { + await utilsTest.addContextItem(test.info(), 'testIdentifier', 'checkPaymentModule', baseContext); + + // Payment step - Choose payment step + const isVisible = await foClassicCheckoutPage.isPaymentMethodExist(page, dataModules.psCashOnDelivery.tag); + expect(isVisible).toBeTruthy(); + }); + + test('Upgrade with shop on maintenance: should logout', async () => { + await utilsTest.addContextItem(test.info(), 'testIdentifier', 'logoutWMaintenance', baseContext); + + await boModuleManagerPage.logoutBO(page); + + const pageTitle = await boLoginPage.getPageTitle(page); + expect(pageTitle).toContain(boLoginPage.pageTitle); + }); + + test('Upgrade without shop on maintenance : should uninstall the module', async function () { + await opsBOModules.uninstallModule(page, dataModules.psCashOnDelivery, `${baseContext}_preTest_0`); + }); + + test('Upgrade without shop on maintenance : should install the module in previous version', async function () { + await opsBOModules.installModule(page, dataModules.psCashOnDelivery, false, `${baseContext}_preTest_1`); + }); + + test('Upgrade without shop on maintenance : should login in BO', async function () { + await utilsTest.addContextItem(test.info(), 'testIdentifier', 'loginBO', baseContext); + + await boLoginPage.goTo(page, global.BO.URL); + await boLoginPage.successLogin(page, global.BO.EMAIL, global.BO.PASSWD); + + const pageTitle = await boDashboardPage.getPageTitle(page); + expect(pageTitle).toContain(boDashboardPage.pageTitle); + }); + + test('Upgrade without shop on maintenance : should go to \'Modules > Module Manager\' page', async function () { + await utilsTest.addContextItem(test.info(), 'testIdentifier', 'goToModuleManagerPageWoMaintenance', baseContext); + + await boDashboardPage.goToSubMenu( + page, + boDashboardPage.modulesParentLink, + boDashboardPage.moduleManagerLink, + ); + await boModuleManagerPage.closeSfToolBar(page); + + const pageTitle = await boModuleManagerPage.getPageTitle(page); + expect(pageTitle).toContain(boModuleManagerPage.pageTitle); + }); + + test(`Upgrade without shop on maintenance : should search the module ${dataModules.psCashOnDelivery.name}`, async function () { + await utilsTest.addContextItem(test.info(), 'testIdentifier', 'searchModuleWoMaintenance', baseContext); + + const isModuleVisible = await boModuleManagerPage.searchModule(page, dataModules.psCashOnDelivery); + expect(isModuleVisible).toBeTruthy(); + + const moduleInfo = await boModuleManagerPage.getModuleInformationNth(page, 1); + expect(dataModules.psCashOnDelivery.versionOld).toContain(moduleInfo.version); + }); + + test('Upgrade without shop on maintenance : should upgrade the module', async function () { + await utilsTest.addContextItem(test.info(), 'testIdentifier', 'upgradeModuleWoMaintenance', baseContext); + + const successMessage = await boModuleManagerPage.setActionInModule(page, dataModules.psCashOnDelivery, 'upgrade', false, true); + expect(successMessage).toEqual(boModuleManagerPage.updateModuleSuccessMessage(dataModules.psCashOnDelivery.tag)); + }); + + test('Upgrade without shop on maintenance : should reload the page', async function () { + await utilsTest.addContextItem(test.info(), 'testIdentifier', 'checkModuleWoMaintenance', baseContext); + + await boModuleManagerPage.reloadPage(page); + + const isModuleVisible = await boModuleManagerPage.searchModule(page, dataModules.psCashOnDelivery); + expect(isModuleVisible).toBeTruthy(); + + const moduleInfo = await boModuleManagerPage.getModuleInformationNth(page, 1); + expect(dataModules.psCashOnDelivery.versionCurrent).toContain(moduleInfo.version); + }); + + test('Upgrade without shop on maintenance : should go to the front office', async function () { + await utilsTest.addContextItem(test.info(), 'testIdentifier', 'goToTheFoWoMaintenance', baseContext); + + page = await boModuleManagerPage.viewMyShop(page); + await foClassicHomePage.changeLanguage(page, 'en'); + + const isHomePage = await foClassicHomePage.isHomePage(page); + expect(isHomePage).toBeTruthy(); + }); + + test('Upgrade without shop on maintenance : should go to login page', async function () { + await utilsTest.addContextItem(test.info(), 'testIdentifier', 'goToLoginPageFOWoMaintenance', baseContext); + + await foClassicHomePage.goToLoginPage(page); + + const pageTitle = await foClassicLoginPage.getPageTitle(page); + expect(pageTitle).toContain(foClassicLoginPage.pageTitle); + }); + + test('Upgrade without shop on maintenance : should sign in with default customer', async function () { + await utilsTest.addContextItem(test.info(), 'testIdentifier', 'sighInFOWoMaintenance', baseContext); + + await foClassicLoginPage.customerLogin(page, dataCustomers.johnDoe); + + const isCustomerConnected = await foClassicLoginPage.isCustomerConnected(page); + expect(isCustomerConnected).toBeTruthy(); + }); + + test('Upgrade without shop on maintenance : should add the first product to the cart', async function () { + await utilsTest.addContextItem(test.info(), 'testIdentifier', 'addProductToCartWoMaintenance', baseContext); + + await foClassicLoginPage.goToHomePage(page); + + // Add first product to cart by quick view + await foClassicHomePage.quickViewProduct(page, 1); + await foClassicModalQuickViewPage.addToCartByQuickView(page); + await foClassicModalBlockCartPage.proceedToCheckout(page); + + const pageTitle = await foClassicCartPage.getPageTitle(page); + expect(pageTitle).toEqual(foClassicCartPage.pageTitle); + }); + + test('Upgrade without shop on maintenance : should proceed to checkout and check Step Address', async function () { + await utilsTest.addContextItem(test.info(), 'testIdentifier', 'checkAddressStepWoMaintenance', baseContext); + + await foClassicCartPage.clickOnProceedToCheckout(page); + + const isCheckoutPage = await foClassicCheckoutPage.isCheckoutPage(page); + expect(isCheckoutPage).toBeTruthy(); + + const isStepPersonalInformationComplete = await foClassicCheckoutPage.isStepCompleted( + page, + foClassicCheckoutPage.personalInformationStepForm, + ); + expect(isStepPersonalInformationComplete).toBeTruthy(); + }); + + test('Upgrade without shop on maintenance : should validate Step Address and go to Delivery Step', async function () { + await utilsTest.addContextItem(test.info(), 'testIdentifier', 'checkDeliveryStepWoMaintenance', baseContext); + + const isStepAddressComplete = await foClassicCheckoutPage.goToDeliveryStep(page); + expect(isStepAddressComplete).toBeTruthy(); + }); + + test('Upgrade without shop on maintenance : should go to payment step', async function () { + await utilsTest.addContextItem(test.info(), 'testIdentifier', 'goToPaymentStepWoMaintenance', baseContext); + + const isStepDeliveryComplete = await foClassicCheckoutPage.goToPaymentStep(page); + expect(isStepDeliveryComplete, 'Step Address is not complete').toBeTruthy(); + }); + + test(`Upgrade without shop on maintenance : should check the '${dataModules.psCashOnDelivery.name}' payment module`, async function () { + await utilsTest.addContextItem(test.info(), 'testIdentifier', 'checkPaymentModuleWoMaintenance', baseContext); + + // Payment step - Choose payment step + const isVisible = await foClassicCheckoutPage.isPaymentMethodExist(page, dataModules.psCashOnDelivery.tag); + expect(isVisible).toBeTruthy(); + }); + + test('Upgrade without shop on maintenance: should logout', async () => { + await utilsTest.addContextItem(test.info(), 'testIdentifier', 'logoutWoMaintenance', baseContext); + + await boModuleManagerPage.logoutBO(page); + + const pageTitle = await boLoginPage.getPageTitle(page); + expect(pageTitle).toContain(boLoginPage.pageTitle); + }); + + test('Upgrade without shop on maintenance : should uninstall the updated module', async function () { + await opsBOModules.uninstallModule(page, dataModules.psCashOnDelivery, `${baseContext}_postTest_0`); + }); + + test('Upgrade without shop on maintenance : should reset the module to current version', async function () { + console.log(process.env.URL_ZIP); + await opsBOModules.installModule(page, dataModules.psCashOnDelivery, process.env.URL_ZIP, `${baseContext}_postTest_1`); + }); +}); diff --git a/tests/UI/campaigns/01_installation/04_resetModule.spec.ts b/tests/UI/campaigns/01_installation/04_resetModule.ts similarity index 100% rename from tests/UI/campaigns/01_installation/04_resetModule.spec.ts rename to tests/UI/campaigns/01_installation/04_resetModule.ts diff --git a/tests/UI/campaigns/02_configuration/01_placeOrderWithIt.spec.ts b/tests/UI/campaigns/02_configuration/01_placeOrderWithIt.ts similarity index 100% rename from tests/UI/campaigns/02_configuration/01_placeOrderWithIt.spec.ts rename to tests/UI/campaigns/02_configuration/01_placeOrderWithIt.ts index 12e37ac1fb..1e58d63261 100644 --- a/tests/UI/campaigns/02_configuration/01_placeOrderWithIt.spec.ts +++ b/tests/UI/campaigns/02_configuration/01_placeOrderWithIt.ts @@ -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'; diff --git a/tests/UI/docker-compose.yml b/tests/UI/docker-compose.yml index a4483e6329..6a91b8da31 100644 --- a/tests/UI/docker-compose.yml +++ b/tests/UI/docker-compose.yml @@ -21,12 +21,11 @@ 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 + - ../../../ps_cashondelivery.zip:/var/www/html/ps_cashondelivery.zip ports: - 80:80 mysql: diff --git a/tests/UI/docker-scripts/1-install_ps_cashondelivery.sh b/tests/UI/docker-scripts/1-install_ps_cashondelivery.sh new file mode 100755 index 0000000000..116c5c123b --- /dev/null +++ b/tests/UI/docker-scripts/1-install_ps_cashondelivery.sh @@ -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" \ No newline at end of file diff --git a/tests/UI/package-lock.json b/tests/UI/package-lock.json index 41bf274da0..45ddeee981 100644 --- a/tests/UI/package-lock.json +++ b/tests/UI/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0", "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", @@ -85,7 +85,7 @@ }, "node_modules/@prestashop-core/ui-testing": { "version": "0.0.12", - "resolved": "git+ssh://git@github.com/PrestaShop/ui-testing-library.git#9b51e9a6666bca695ed4714cc9a51d1c2b20fa10", + "resolved": "git+ssh://git@github.com/PrestaShop/ui-testing-library.git#d9a089e303bf2cc33d8aa0bf4bd3117c067d29ae", "dev": true, "license": "MIT", "dependencies": { @@ -3069,9 +3069,9 @@ } }, "@prestashop-core/ui-testing": { - "version": "git+ssh://git@github.com/PrestaShop/ui-testing-library.git#9b51e9a6666bca695ed4714cc9a51d1c2b20fa10", + "version": "git+ssh://git@github.com/PrestaShop/ui-testing-library.git#d9a089e303bf2cc33d8aa0bf4bd3117c067d29ae", "dev": true, - "from": "@prestashop-core/ui-testing@https://github.com/PrestaShop/ui-testing-library#main", + "from": "@prestashop-core/ui-testing@https://github.com/PrestaShop/ui-testing-library#pull/157/head", "requires": { "@faker-js/faker": "^8.3.1", "@playwright/test": "^1.40.1", diff --git a/tests/UI/package.json b/tests/UI/package.json index 196b95f9e3..9f4cb0aaf0 100644 --- a/tests/UI/package.json +++ b/tests/UI/package.json @@ -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",