From b362d484fc3e92c1b7d4a9be3d76aa186952f7be 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 | 444 ++++++++++++++++++ ..._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 | 161 ++++--- tests/UI/package.json | 2 +- tests/UI/playwright.config.ts | 2 + 9 files changed, 572 insertions(+), 100 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..9d146da55c --- /dev/null +++ b/tests/UI/campaigns/01_installation/01_upgradeModule.spec.ts @@ -0,0 +1,444 @@ +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 }, testInfo) => { + browserContext = await browser.newContext(); + page = await browser.newPage({ + recordVideo: { + dir: testInfo.outputPath('videos'), + } + }); + }); + test.afterAll(async ({}, testInfo) => { + const videoPath = testInfo.outputPath('my-video.webm'); + await Promise.all([ + page.video()!.saveAs(videoPath), + page.close() + ]); + testInfo.attachments.push({ + name: 'video', + path: videoPath, + contentType: 'video/webm' + }); + 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); + + // Go back to BO + page = await foClassicCheckoutPage.closePage(browserContext, page, 0); + 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); + + // Go back to BO + page = await foClassicCheckoutPage.closePage(browserContext, page, 0); + 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 () { + 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..611818d715 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", @@ -17,9 +17,9 @@ } }, "node_modules/@faker-js/faker": { - "version": "8.4.1", - "resolved": "https://registry.npmjs.org/@faker-js/faker/-/faker-8.4.1.tgz", - "integrity": "sha512-XQ3cU+Q8Uqmrbf2e0cIC/QN43sTBSC8KF12u29Mb47tWrt2hAgBXSgpZMj4Ao8Uk0iJcU99QsOCaIL8934obCg==", + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/@faker-js/faker/-/faker-9.2.0.tgz", + "integrity": "sha512-ulqQu4KMr1/sTFIYvqSdegHT8NIkt66tFAkugGnHA+1WAfEn6hMzNR+svjXGFRVLnapxvej67Z/LwchFrnLBUg==", "dev": true, "funding": [ { @@ -27,21 +27,22 @@ "url": "https://opencollective.com/fakerjs" } ], + "license": "MIT", "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0", - "npm": ">=6.14.13" + "node": ">=18.0.0", + "npm": ">=9.0.0" } }, "node_modules/@keycloak/keycloak-admin-client": { - "version": "22.0.1", - "resolved": "https://registry.npmjs.org/@keycloak/keycloak-admin-client/-/keycloak-admin-client-22.0.1.tgz", - "integrity": "sha512-/eKzNzT2hW/tRQd8/33dX1dfRU4xBsd3/30bL2OFF5+J+1UUmRYM2klYcFhdIkFX3P9/ptqH+vHpqCusdMcSCw==", + "version": "26.0.5", + "resolved": "https://registry.npmjs.org/@keycloak/keycloak-admin-client/-/keycloak-admin-client-26.0.5.tgz", + "integrity": "sha512-5AxA5e/RL7fzQ7j84t2T18ghv0Ge12q2RtwLlO0GwPv9IikBqx4s8e3Klo6shjGtVd7nvhj2GDjoyXtSnXYp9A==", "dev": true, + "license": "Apache-2.0", "dependencies": { "camelize-ts": "^3.0.0", - "lodash-es": "^4.17.21", "url-join": "^5.0.0", - "url-template": "^3.1.0" + "url-template": "^3.1.1" }, "engines": { "node": ">=18" @@ -69,30 +70,31 @@ } }, "node_modules/@playwright/test": { - "version": "1.41.2", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.41.2.tgz", - "integrity": "sha512-qQB9h7KbibJzrDpkXkYvsmiDJK14FULCCZgEcoe2AvFAS64oCirWTwzTlAYEbKaRxWs5TFesE1Na6izMv3HfGg==", + "version": "1.48.2", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.48.2.tgz", + "integrity": "sha512-54w1xCWfXuax7dz4W2M9uw0gDyh+ti/0K/MxcCUxChFh37kkdxPdfZDw5QBbuPUJHr1CiHJ1hXgSs+GgeQc5Zw==", "dev": true, + "license": "Apache-2.0", "dependencies": { - "playwright": "1.41.2" + "playwright": "1.48.2" }, "bin": { "playwright": "cli.js" }, "engines": { - "node": ">=16" + "node": ">=18" } }, "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#b2148d52568abf7a558425a8b4b041cd19921e5d", "dev": true, "license": "MIT", "dependencies": { - "@faker-js/faker": "^8.3.1", - "@playwright/test": "^1.40.1", - "@s3pweb/keycloak-admin-client-cjs": "^22.0.1", - "@xmldom/xmldom": "^0.8.10", + "@faker-js/faker": "^9.0.3", + "@playwright/test": "^1.48.1", + "@s3pweb/keycloak-admin-client-cjs": "^26.0.0", + "@xmldom/xmldom": "^0.9.5", "csv-writer": "^1.6.0", "fast-xml-parser": "^4.4.0", "gunzip-file": "^0.1.1", @@ -107,12 +109,13 @@ } }, "node_modules/@s3pweb/keycloak-admin-client-cjs": { - "version": "22.0.1", - "resolved": "https://registry.npmjs.org/@s3pweb/keycloak-admin-client-cjs/-/keycloak-admin-client-cjs-22.0.1.tgz", - "integrity": "sha512-F8zr13/rR3QcDzKEty541rXaubU6+Yn/5aMzmSy6in5TeUL3FLqF0QmuW3g1xrgABywcGopew2sEq0X3qJfRUw==", + "version": "26.0.5", + "resolved": "https://registry.npmjs.org/@s3pweb/keycloak-admin-client-cjs/-/keycloak-admin-client-cjs-26.0.5.tgz", + "integrity": "sha512-/dEyIgVbo3OaKVsLbyDOBm+XbtP2PTkkSHHEwbp69gPMaQHoVnMsyv4IaObrQUu6WKzl6E4HDiiFeeudaakA6w==", "dev": true, + "license": "MIT", "dependencies": { - "@keycloak/keycloak-admin-client": "22.0.1" + "@keycloak/keycloak-admin-client": "26.0.5" } }, "node_modules/@socket.io/component-emitter": { @@ -161,12 +164,13 @@ "dev": true }, "node_modules/@xmldom/xmldom": { - "version": "0.8.10", - "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.10.tgz", - "integrity": "sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw==", + "version": "0.9.5", + "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.9.5.tgz", + "integrity": "sha512-6g1EwSs8cr8JhP1iBxzyVAWM6BIDvx9Y3FZRIQiMDzgG43Pxi8YkWOZ0nQj2NHgNzgXDZbJewFx/n+YAvMZrfg==", "dev": true, + "license": "MIT", "engines": { - "node": ">=10.0.0" + "node": ">=14.6" } }, "node_modules/abab": { @@ -457,6 +461,7 @@ "resolved": "https://registry.npmjs.org/camelize-ts/-/camelize-ts-3.0.0.tgz", "integrity": "sha512-cgRwKKavoDKLTjO4FQTs3dRBePZp/2Y9Xpud0FhuCOTE86M2cniKN4CCXgRnsyXNMmQMifVHcv6SPaMtTx6ofQ==", "dev": true, + "license": "MIT", "engines": { "node": "^12.20.0 || ^14.13.1 || >=16.0.0" } @@ -1231,6 +1236,7 @@ "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", "dev": true, "hasInstallScript": true, + "license": "MIT", "optional": true, "os": [ "darwin" @@ -1620,12 +1626,6 @@ "libsodium": "^0.7.15" } }, - "node_modules/lodash-es": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz", - "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==", - "dev": true - }, "node_modules/lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -2057,33 +2057,35 @@ } }, "node_modules/playwright": { - "version": "1.41.2", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.41.2.tgz", - "integrity": "sha512-v0bOa6H2GJChDL8pAeLa/LZC4feoAMbSQm1/jF/ySsWWoaNItvrMP7GEkvEEFyCTUYKMxjQKaTSg5up7nR6/8A==", + "version": "1.48.2", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.48.2.tgz", + "integrity": "sha512-NjYvYgp4BPmiwfe31j4gHLa3J7bD2WiBz8Lk2RoSsmX38SVIARZ18VYjxLjAcDsAhA+F4iSEXTSGgjua0rrlgQ==", "dev": true, + "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.41.2" + "playwright-core": "1.48.2" }, "bin": { "playwright": "cli.js" }, "engines": { - "node": ">=16" + "node": ">=18" }, "optionalDependencies": { "fsevents": "2.3.2" } }, "node_modules/playwright-core": { - "version": "1.41.2", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.41.2.tgz", - "integrity": "sha512-VaTvwCA4Y8kxEe+kfm2+uUUw5Lubf38RxF7FpBxLPmGe5sdNkSg5e3ChEigaGrX7qdqT3pt2m/98LiyvU2x6CA==", + "version": "1.48.2", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.48.2.tgz", + "integrity": "sha512-sjjw+qrLFlriJo64du+EK0kJgZzoQPsabGF4lBvsid+3CNIZIYLgnMj9V6JY5VhM2Peh20DJWIVpVljLLnlawA==", "dev": true, + "license": "Apache-2.0", "bin": { "playwright-core": "cli.js" }, "engines": { - "node": ">=16" + "node": ">=18" } }, "node_modules/proxy-addr": { @@ -2774,6 +2776,7 @@ "resolved": "https://registry.npmjs.org/url-join/-/url-join-5.0.0.tgz", "integrity": "sha512-n2huDr9h9yzd6exQVnH/jU5mr+Pfx08LRXXZhkLLetAMESRj+anQsTAh940iMrIetKAmry9coFuZQ2jY8/p3WA==", "dev": true, + "license": "MIT", "engines": { "node": "^12.20.0 || ^14.13.1 || >=16.0.0" } @@ -2793,6 +2796,7 @@ "resolved": "https://registry.npmjs.org/url-template/-/url-template-3.1.1.tgz", "integrity": "sha512-4oszoaEKE/mQOtAmdMWqIRHmkxWkUZMnXFnjQ5i01CuRSK3uluxcH1MRVVVWmhlnzT1SCDfKxxficm2G37qzCA==", "dev": true, + "license": "BSD-3-Clause", "engines": { "node": "^12.20.0 || ^14.13.1 || >=16.0.0" } @@ -3024,21 +3028,20 @@ }, "dependencies": { "@faker-js/faker": { - "version": "8.4.1", - "resolved": "https://registry.npmjs.org/@faker-js/faker/-/faker-8.4.1.tgz", - "integrity": "sha512-XQ3cU+Q8Uqmrbf2e0cIC/QN43sTBSC8KF12u29Mb47tWrt2hAgBXSgpZMj4Ao8Uk0iJcU99QsOCaIL8934obCg==", + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/@faker-js/faker/-/faker-9.2.0.tgz", + "integrity": "sha512-ulqQu4KMr1/sTFIYvqSdegHT8NIkt66tFAkugGnHA+1WAfEn6hMzNR+svjXGFRVLnapxvej67Z/LwchFrnLBUg==", "dev": true }, "@keycloak/keycloak-admin-client": { - "version": "22.0.1", - "resolved": "https://registry.npmjs.org/@keycloak/keycloak-admin-client/-/keycloak-admin-client-22.0.1.tgz", - "integrity": "sha512-/eKzNzT2hW/tRQd8/33dX1dfRU4xBsd3/30bL2OFF5+J+1UUmRYM2klYcFhdIkFX3P9/ptqH+vHpqCusdMcSCw==", + "version": "26.0.5", + "resolved": "https://registry.npmjs.org/@keycloak/keycloak-admin-client/-/keycloak-admin-client-26.0.5.tgz", + "integrity": "sha512-5AxA5e/RL7fzQ7j84t2T18ghv0Ge12q2RtwLlO0GwPv9IikBqx4s8e3Klo6shjGtVd7nvhj2GDjoyXtSnXYp9A==", "dev": true, "requires": { "camelize-ts": "^3.0.0", - "lodash-es": "^4.17.21", "url-join": "^5.0.0", - "url-template": "^3.1.0" + "url-template": "^3.1.1" } }, "@mapbox/node-pre-gyp": { @@ -3060,23 +3063,23 @@ } }, "@playwright/test": { - "version": "1.41.2", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.41.2.tgz", - "integrity": "sha512-qQB9h7KbibJzrDpkXkYvsmiDJK14FULCCZgEcoe2AvFAS64oCirWTwzTlAYEbKaRxWs5TFesE1Na6izMv3HfGg==", + "version": "1.48.2", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.48.2.tgz", + "integrity": "sha512-54w1xCWfXuax7dz4W2M9uw0gDyh+ti/0K/MxcCUxChFh37kkdxPdfZDw5QBbuPUJHr1CiHJ1hXgSs+GgeQc5Zw==", "dev": true, "requires": { - "playwright": "1.41.2" + "playwright": "1.48.2" } }, "@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#b2148d52568abf7a558425a8b4b041cd19921e5d", "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", - "@s3pweb/keycloak-admin-client-cjs": "^22.0.1", - "@xmldom/xmldom": "^0.8.10", + "@faker-js/faker": "^9.0.3", + "@playwright/test": "^1.48.1", + "@s3pweb/keycloak-admin-client-cjs": "^26.0.0", + "@xmldom/xmldom": "^0.9.5", "csv-writer": "^1.6.0", "fast-xml-parser": "^4.4.0", "gunzip-file": "^0.1.1", @@ -3091,12 +3094,12 @@ } }, "@s3pweb/keycloak-admin-client-cjs": { - "version": "22.0.1", - "resolved": "https://registry.npmjs.org/@s3pweb/keycloak-admin-client-cjs/-/keycloak-admin-client-cjs-22.0.1.tgz", - "integrity": "sha512-F8zr13/rR3QcDzKEty541rXaubU6+Yn/5aMzmSy6in5TeUL3FLqF0QmuW3g1xrgABywcGopew2sEq0X3qJfRUw==", + "version": "26.0.5", + "resolved": "https://registry.npmjs.org/@s3pweb/keycloak-admin-client-cjs/-/keycloak-admin-client-cjs-26.0.5.tgz", + "integrity": "sha512-/dEyIgVbo3OaKVsLbyDOBm+XbtP2PTkkSHHEwbp69gPMaQHoVnMsyv4IaObrQUu6WKzl6E4HDiiFeeudaakA6w==", "dev": true, "requires": { - "@keycloak/keycloak-admin-client": "22.0.1" + "@keycloak/keycloak-admin-client": "26.0.5" } }, "@socket.io/component-emitter": { @@ -3142,9 +3145,9 @@ "dev": true }, "@xmldom/xmldom": { - "version": "0.8.10", - "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.10.tgz", - "integrity": "sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw==", + "version": "0.9.5", + "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.9.5.tgz", + "integrity": "sha512-6g1EwSs8cr8JhP1iBxzyVAWM6BIDvx9Y3FZRIQiMDzgG43Pxi8YkWOZ0nQj2NHgNzgXDZbJewFx/n+YAvMZrfg==", "dev": true }, "abab": { @@ -4235,12 +4238,6 @@ "libsodium": "^0.7.15" } }, - "lodash-es": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz", - "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==", - "dev": true - }, "lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -4561,19 +4558,19 @@ } }, "playwright": { - "version": "1.41.2", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.41.2.tgz", - "integrity": "sha512-v0bOa6H2GJChDL8pAeLa/LZC4feoAMbSQm1/jF/ySsWWoaNItvrMP7GEkvEEFyCTUYKMxjQKaTSg5up7nR6/8A==", + "version": "1.48.2", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.48.2.tgz", + "integrity": "sha512-NjYvYgp4BPmiwfe31j4gHLa3J7bD2WiBz8Lk2RoSsmX38SVIARZ18VYjxLjAcDsAhA+F4iSEXTSGgjua0rrlgQ==", "dev": true, "requires": { "fsevents": "2.3.2", - "playwright-core": "1.41.2" + "playwright-core": "1.48.2" } }, "playwright-core": { - "version": "1.41.2", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.41.2.tgz", - "integrity": "sha512-VaTvwCA4Y8kxEe+kfm2+uUUw5Lubf38RxF7FpBxLPmGe5sdNkSg5e3ChEigaGrX7qdqT3pt2m/98LiyvU2x6CA==", + "version": "1.48.2", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.48.2.tgz", + "integrity": "sha512-sjjw+qrLFlriJo64du+EK0kJgZzoQPsabGF4lBvsid+3CNIZIYLgnMj9V6JY5VhM2Peh20DJWIVpVljLLnlawA==", "dev": true }, "proxy-addr": { 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", diff --git a/tests/UI/playwright.config.ts b/tests/UI/playwright.config.ts index 1619bfed62..10c4409199 100644 --- a/tests/UI/playwright.config.ts +++ b/tests/UI/playwright.config.ts @@ -106,7 +106,9 @@ export default defineConfig({ use: { /* Capture screenshot after each test failure */ screenshot: 'only-on-failure', + video: 'on', }, + timeout: 60000, /* Configure projects for major browsers */ projects: [