diff --git a/tests/UI/campaigns/functional/API/01_clientCredentialGrantFlow/02_externalAuthServer/02_resourceEndpoint.ts b/tests/UI/campaigns/functional/API/01_clientCredentialGrantFlow/02_externalAuthServer/02_resourceEndpoint.ts index 433a5ec2895d5..073d6aa962bf3 100644 --- a/tests/UI/campaigns/functional/API/01_clientCredentialGrantFlow/02_externalAuthServer/02_resourceEndpoint.ts +++ b/tests/UI/campaigns/functional/API/01_clientCredentialGrantFlow/02_externalAuthServer/02_resourceEndpoint.ts @@ -67,7 +67,7 @@ describe('API : External Auth Server - Resource Endpoint', async () => { } }); - installModule(dataModules.keycloak, `${baseContext}_preTest_1`); + installModule(dataModules.keycloak, true, `${baseContext}_preTest_1`); describe('Resource Endpoint', async () => { it('should login in BO', async function () { diff --git a/tests/UI/campaigns/functional/BO/07_modules/01_moduleManager/01_modules/08_uploadModule.ts b/tests/UI/campaigns/functional/BO/07_modules/01_moduleManager/01_modules/08_uploadModule.ts index 545e6a5b7182e..fd6a9df6551ca 100644 --- a/tests/UI/campaigns/functional/BO/07_modules/01_moduleManager/01_modules/08_uploadModule.ts +++ b/tests/UI/campaigns/functional/BO/07_modules/01_moduleManager/01_modules/08_uploadModule.ts @@ -38,7 +38,7 @@ describe('BO - Modules - Module Manager : Upload module', async () => { it(`should download the zip of the module '${dataModules.keycloak.name}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'downloadModule', baseContext); - await utilsFile.downloadFile(dataModules.keycloak.releaseZip, 'module.zip'); + await utilsFile.downloadFile(dataModules.keycloak.releaseZip(dataModules.keycloak.versionCurrent), 'module.zip'); const found = await utilsFile.doesFileExist('module.zip'); expect(found).to.eq(true); diff --git a/tests/UI/campaigns/functional/BO/13_shopParameters/01_general/general/03_allowIframes.ts b/tests/UI/campaigns/functional/BO/13_shopParameters/01_general/general/03_allowIframes.ts index 5965e7118f969..fab56a7aa8bb0 100644 --- a/tests/UI/campaigns/functional/BO/13_shopParameters/01_general/general/03_allowIframes.ts +++ b/tests/UI/campaigns/functional/BO/13_shopParameters/01_general/general/03_allowIframes.ts @@ -6,7 +6,6 @@ import loginCommon from '@commonTests/BO/loginBO'; // Import pages // Import BO pages -import generalPage from '@pages/BO/shopParameters/general'; import addProductPage from '@pages/BO/catalog/products/add'; import descriptionTab from '@pages/BO/catalog/products/add/descriptionTab'; @@ -15,6 +14,7 @@ import type {BrowserContext, Page} from 'playwright'; import { boDashboardPage, boProductsPage, + boShopParametersPage, dataProducts, foClassicProductPage, utilsPlaywright, @@ -64,17 +64,17 @@ describe('BO - Shop Parameters - General : Enable/Disable Allow iframes on HTML boDashboardPage.shopParametersParentLink, boDashboardPage.shopParametersGeneralLink, ); - await generalPage.closeSfToolBar(page); + await boShopParametersPage.closeSfToolBar(page); - const pageTitle = await generalPage.getPageTitle(page); - expect(pageTitle).to.contains(generalPage.pageTitle); + const pageTitle = await boShopParametersPage.getPageTitle(page); + expect(pageTitle).to.contains(boShopParametersPage.pageTitle); }); it(`should ${test.args.action} allow iframes`, async function () { await testContext.addContextItem(this, 'testIdentifier', `${test.args.action}AllowIframes`, baseContext); - const result = await generalPage.setAllowIframes(page, test.args.exist); - expect(result).to.contains(generalPage.successfulUpdateMessage); + const result = await boShopParametersPage.setAllowIframes(page, test.args.exist); + expect(result).to.contains(boShopParametersPage.successfulUpdateMessage); }); it('should go to Products page', async function () { diff --git a/tests/UI/campaigns/functional/BO/13_shopParameters/01_general/general/05_roundMode.ts b/tests/UI/campaigns/functional/BO/13_shopParameters/01_general/general/05_roundMode.ts index 841b301b1cc79..bb7e4881238dc 100644 --- a/tests/UI/campaigns/functional/BO/13_shopParameters/01_general/general/05_roundMode.ts +++ b/tests/UI/campaigns/functional/BO/13_shopParameters/01_general/general/05_roundMode.ts @@ -6,7 +6,6 @@ import loginCommon from '@commonTests/BO/loginBO'; import {createProductTest, deleteProductTest} from '@commonTests/BO/catalog/product'; // Import BO pages -import generalPage from '@pages/BO/shopParameters/general'; import pricingTab from '@pages/BO/catalog/products/add/pricingTab'; import createProductsPage from '@pages/BO/catalog/products/add'; @@ -15,6 +14,7 @@ import type {BrowserContext, Page} from 'playwright'; import { boDashboardPage, boProductsPage, + boShopParametersPage, FakerProduct, foClassicHomePage, foClassicProductPage, @@ -78,24 +78,24 @@ describe('BO - Shop Parameters - General : Round mode', async () => { boDashboardPage.shopParametersParentLink, boDashboardPage.shopParametersGeneralLink, ); - await generalPage.closeSfToolBar(page); + await boShopParametersPage.closeSfToolBar(page); - const pageTitle = await generalPage.getPageTitle(page); - expect(pageTitle).to.contains(generalPage.pageTitle); + const pageTitle = await boShopParametersPage.getPageTitle(page); + expect(pageTitle).to.contains(boShopParametersPage.pageTitle); }); it(`should select the round mode '${test.args.roundMode}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', `selectRoundMode${index}`, baseContext); - const result = await generalPage.selectRoundMode(page, test.args.roundMode); - expect(result).to.contains(generalPage.successfulUpdateMessage); + const result = await boShopParametersPage.selectRoundMode(page, test.args.roundMode); + expect(result).to.contains(boShopParametersPage.successfulUpdateMessage); }); it('should view my shop', async function () { await testContext.addContextItem(this, 'testIdentifier', `viewMyShop${index}`, baseContext); // View shop - page = await generalPage.viewMyShop(page); + page = await boShopParametersPage.viewMyShop(page); await foClassicHomePage.changeLanguage(page, 'en'); const isHomePage = await foClassicHomePage.isHomePage(page); @@ -132,8 +132,8 @@ describe('BO - Shop Parameters - General : Round mode', async () => { page = await foClassicProductPage.closePage(browserContext, page, 0); - const pageTitle = await generalPage.getPageTitle(page); - expect(pageTitle).to.contains(generalPage.pageTitle); + const pageTitle = await boShopParametersPage.getPageTitle(page); + expect(pageTitle).to.contains(boShopParametersPage.pageTitle); }); }); }); @@ -197,24 +197,24 @@ describe('BO - Shop Parameters - General : Round mode', async () => { boDashboardPage.shopParametersParentLink, boDashboardPage.shopParametersGeneralLink, ); - await generalPage.closeSfToolBar(page); + await boShopParametersPage.closeSfToolBar(page); - const pageTitle = await generalPage.getPageTitle(page); - expect(pageTitle).to.contains(generalPage.pageTitle); + const pageTitle = await boShopParametersPage.getPageTitle(page); + expect(pageTitle).to.contains(boShopParametersPage.pageTitle); }); it(`should select the round mode '${test.args.roundMode}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', `selectRoundMode2${index}`, baseContext); - const result = await generalPage.selectRoundMode(page, test.args.roundMode); - expect(result).to.contains(generalPage.successfulUpdateMessage); + const result = await boShopParametersPage.selectRoundMode(page, test.args.roundMode); + expect(result).to.contains(boShopParametersPage.successfulUpdateMessage); }); it('should view my shop', async function () { await testContext.addContextItem(this, 'testIdentifier', `viewMyShop2${index}`, baseContext); // View shop - page = await generalPage.viewMyShop(page); + page = await boShopParametersPage.viewMyShop(page); await foClassicHomePage.changeLanguage(page, 'en'); const isHomePage = await foClassicHomePage.isHomePage(page); @@ -251,8 +251,8 @@ describe('BO - Shop Parameters - General : Round mode', async () => { page = await foClassicProductPage.closePage(browserContext, page, 0); - const pageTitle = await generalPage.getPageTitle(page); - expect(pageTitle).to.contains(generalPage.pageTitle); + const pageTitle = await boShopParametersPage.getPageTitle(page); + expect(pageTitle).to.contains(boShopParametersPage.pageTitle); }); }); }); @@ -316,24 +316,24 @@ describe('BO - Shop Parameters - General : Round mode', async () => { boDashboardPage.shopParametersParentLink, boDashboardPage.shopParametersGeneralLink, ); - await generalPage.closeSfToolBar(page); + await boShopParametersPage.closeSfToolBar(page); - const pageTitle = await generalPage.getPageTitle(page); - expect(pageTitle).to.contains(generalPage.pageTitle); + const pageTitle = await boShopParametersPage.getPageTitle(page); + expect(pageTitle).to.contains(boShopParametersPage.pageTitle); }); it(`should select the round mode '${test.args.roundMode}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', `selectRoundMode3${index}`, baseContext); - const result = await generalPage.selectRoundMode(page, test.args.roundMode); - expect(result).to.contains(generalPage.successfulUpdateMessage); + const result = await boShopParametersPage.selectRoundMode(page, test.args.roundMode); + expect(result).to.contains(boShopParametersPage.successfulUpdateMessage); }); it('should view my shop', async function () { await testContext.addContextItem(this, 'testIdentifier', `viewMyShop3${index}`, baseContext); // View shop - page = await generalPage.viewMyShop(page); + page = await boShopParametersPage.viewMyShop(page); await foClassicHomePage.changeLanguage(page, 'en'); const isHomePage = await foClassicHomePage.isHomePage(page); @@ -370,8 +370,8 @@ describe('BO - Shop Parameters - General : Round mode', async () => { page = await foClassicProductPage.closePage(browserContext, page, 0); - const pageTitle = await generalPage.getPageTitle(page); - expect(pageTitle).to.contains(generalPage.pageTitle); + const pageTitle = await boShopParametersPage.getPageTitle(page); + expect(pageTitle).to.contains(boShopParametersPage.pageTitle); }); }); }); diff --git a/tests/UI/campaigns/functional/BO/13_shopParameters/01_general/general/08_enableDisableSuppliers.ts b/tests/UI/campaigns/functional/BO/13_shopParameters/01_general/general/08_enableDisableSuppliers.ts index 92e3d1582f0ba..75ece15c3782f 100644 --- a/tests/UI/campaigns/functional/BO/13_shopParameters/01_general/general/08_enableDisableSuppliers.ts +++ b/tests/UI/campaigns/functional/BO/13_shopParameters/01_general/general/08_enableDisableSuppliers.ts @@ -6,7 +6,6 @@ import loginCommon from '@commonTests/BO/loginBO'; // Import pages // Import BO pages -import generalPage from '@pages/BO/shopParameters/general'; import brandsPage from '@pages/BO/catalog/brands'; import suppliersPage from '@pages/BO/catalog/suppliers'; // Import FO pages @@ -16,6 +15,7 @@ import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; import { boDashboardPage, + boShopParametersPage, foClassicHomePage, utilsPlaywright, } from '@prestashop-core/ui-testing'; @@ -60,27 +60,27 @@ describe('BO - Shop Parameters - General : Enable/Disable display suppliers', as boDashboardPage.shopParametersParentLink, boDashboardPage.shopParametersGeneralLink, ); - await generalPage.closeSfToolBar(page); + await boShopParametersPage.closeSfToolBar(page); - const pageTitle = await generalPage.getPageTitle(page); - expect(pageTitle).to.contains(generalPage.pageTitle); + const pageTitle = await boShopParametersPage.getPageTitle(page); + expect(pageTitle).to.contains(boShopParametersPage.pageTitle); }); it(`should ${test.args.action} display suppliers`, async function () { await testContext.addContextItem(this, 'testIdentifier', `${test.args.action}DisplaySuppliers`, baseContext); - const result = await generalPage.setDisplaySuppliers(page, test.args.exist); - expect(result).to.contains(generalPage.successfulUpdateMessage); + const result = await boShopParametersPage.setDisplaySuppliers(page, test.args.exist); + expect(result).to.contains(boShopParametersPage.successfulUpdateMessage); }); if (test.args.action === 'Disable') { it('should go to \'Brands & Suppliers\' page', async function () { await testContext.addContextItem(this, 'testIdentifier', `goToBrandsPage_${index}`, baseContext); - await generalPage.goToSubMenu( + await boShopParametersPage.goToSubMenu( page, - generalPage.catalogParentLink, - generalPage.brandsAndSuppliersLink, + boShopParametersPage.catalogParentLink, + boShopParametersPage.brandsAndSuppliersLink, ); const pageTitle = await brandsPage.getPageTitle(page); @@ -134,8 +134,8 @@ describe('BO - Shop Parameters - General : Enable/Disable display suppliers', as page = await siteMapPage.closePage(browserContext, page, 0); - const pageTitle = await generalPage.getPageTitle(page); - expect(pageTitle).to.contains(generalPage.pageTitle); + const pageTitle = await boShopParametersPage.getPageTitle(page); + expect(pageTitle).to.contains(boShopParametersPage.pageTitle); }); } }); diff --git a/tests/UI/campaigns/functional/BO/13_shopParameters/01_general/general/09_enableDisableBrands.ts b/tests/UI/campaigns/functional/BO/13_shopParameters/01_general/general/09_enableDisableBrands.ts index 43fae4e9407a4..28b35a6b52e6b 100644 --- a/tests/UI/campaigns/functional/BO/13_shopParameters/01_general/general/09_enableDisableBrands.ts +++ b/tests/UI/campaigns/functional/BO/13_shopParameters/01_general/general/09_enableDisableBrands.ts @@ -5,7 +5,6 @@ import testContext from '@utils/testContext'; import loginCommon from '@commonTests/BO/loginBO'; // Import BO pages -import generalPage from '@pages/BO/shopParameters/general'; import brandsPage from '@pages/BO/catalog/brands'; import {siteMapPage} from '@pages/FO/classic/siteMap'; @@ -13,6 +12,7 @@ import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; import { boDashboardPage, + boShopParametersPage, foClassicHomePage, utilsPlaywright, } from '@prestashop-core/ui-testing'; @@ -57,27 +57,27 @@ describe('BO - Shop Parameters - General : Enable/Disable display brands', async boDashboardPage.shopParametersParentLink, boDashboardPage.shopParametersGeneralLink, ); - await generalPage.closeSfToolBar(page); + await boShopParametersPage.closeSfToolBar(page); - const pageTitle = await generalPage.getPageTitle(page); - expect(pageTitle).to.contains(generalPage.pageTitle); + const pageTitle = await boShopParametersPage.getPageTitle(page); + expect(pageTitle).to.contains(boShopParametersPage.pageTitle); }); it(`should ${test.args.action} display brands`, async function () { await testContext.addContextItem(this, 'testIdentifier', `${test.args.action}DisplayBrands`, baseContext); - const result = await generalPage.setDisplayBrands(page, test.args.exist); - expect(result).to.contains(generalPage.successfulUpdateMessage); + const result = await boShopParametersPage.setDisplayBrands(page, test.args.exist); + expect(result).to.contains(boShopParametersPage.successfulUpdateMessage); }); if (test.args.action === 'Disable') { it('should go to \'Brands & Suppliers\' page', async function () { await testContext.addContextItem(this, 'testIdentifier', `goToBrandsPage_${index}`, baseContext); - await generalPage.goToSubMenu( + await boShopParametersPage.goToSubMenu( page, - generalPage.catalogParentLink, - generalPage.brandsAndSuppliersLink, + boShopParametersPage.catalogParentLink, + boShopParametersPage.brandsAndSuppliersLink, ); const pageTitle = await brandsPage.getPageTitle(page); diff --git a/tests/UI/campaigns/functional/BO/13_shopParameters/01_general/general/10_enableDisableBestSellers.ts b/tests/UI/campaigns/functional/BO/13_shopParameters/01_general/general/10_enableDisableBestSellers.ts index 9257f29d9fc7a..b61780d8645db 100644 --- a/tests/UI/campaigns/functional/BO/13_shopParameters/01_general/general/10_enableDisableBestSellers.ts +++ b/tests/UI/campaigns/functional/BO/13_shopParameters/01_general/general/10_enableDisableBestSellers.ts @@ -5,8 +5,6 @@ import testContext from '@utils/testContext'; import loginCommon from '@commonTests/BO/loginBO'; // Import pages -// Import BO pages -import generalPage from '@pages/BO/shopParameters/general'; // Import FO pages import {siteMapPage} from '@pages/FO/classic/siteMap'; @@ -14,6 +12,7 @@ import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; import { boDashboardPage, + boShopParametersPage, foClassicHomePage, utilsPlaywright, } from '@prestashop-core/ui-testing'; @@ -57,24 +56,24 @@ describe('BO - Shop Parameters - General : Enable/Disable display best sellers', boDashboardPage.shopParametersParentLink, boDashboardPage.shopParametersGeneralLink, ); - await generalPage.closeSfToolBar(page); + await boShopParametersPage.closeSfToolBar(page); - const pageTitle = await generalPage.getPageTitle(page); - expect(pageTitle).to.contains(generalPage.pageTitle); + const pageTitle = await boShopParametersPage.getPageTitle(page); + expect(pageTitle).to.contains(boShopParametersPage.pageTitle); }); it(`should ${test.args.action} display best sellers`, async function () { await testContext.addContextItem(this, 'testIdentifier', `${test.args.action}DisplayBestSellers`, baseContext); - const result = await generalPage.setDisplayBestSellers(page, test.args.exist); - expect(result).to.contains(generalPage.successfulUpdateMessage); + const result = await boShopParametersPage.setDisplayBestSellers(page, test.args.exist); + expect(result).to.contains(boShopParametersPage.successfulUpdateMessage); }); it('should go to FO', async function () { await testContext.addContextItem(this, 'testIdentifier', `goToFO_${test.args.action}`, baseContext); // View shop - page = await generalPage.viewMyShop(page); + page = await boShopParametersPage.viewMyShop(page); // Change shop language await foClassicHomePage.changeLanguage(page, 'en'); @@ -103,8 +102,8 @@ describe('BO - Shop Parameters - General : Enable/Disable display best sellers', page = await siteMapPage.closePage(browserContext, page, 0); - const pageTitle = await generalPage.getPageTitle(page); - expect(pageTitle).to.contains(generalPage.pageTitle); + const pageTitle = await boShopParametersPage.getPageTitle(page); + expect(pageTitle).to.contains(boShopParametersPage.pageTitle); }); }); }); diff --git a/tests/UI/campaigns/functional/BO/13_shopParameters/01_general/general/11_enableDisableMultistore.ts b/tests/UI/campaigns/functional/BO/13_shopParameters/01_general/general/11_enableDisableMultistore.ts index eb48e00565995..1878243628104 100644 --- a/tests/UI/campaigns/functional/BO/13_shopParameters/01_general/general/11_enableDisableMultistore.ts +++ b/tests/UI/campaigns/functional/BO/13_shopParameters/01_general/general/11_enableDisableMultistore.ts @@ -4,13 +4,11 @@ import testContext from '@utils/testContext'; // Import login steps import loginCommon from '@commonTests/BO/loginBO'; -// Import pages -import generalPage from '@pages/BO/shopParameters/general'; - import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; import { boDashboardPage, + boShopParametersPage, utilsPlaywright, } from '@prestashop-core/ui-testing'; @@ -46,10 +44,10 @@ describe('BO - Shop Parameters - General : Enable/Disable multi store', async () boDashboardPage.shopParametersParentLink, boDashboardPage.shopParametersGeneralLink, ); - await generalPage.closeSfToolBar(page); + await boShopParametersPage.closeSfToolBar(page); - const pageTitle = await generalPage.getPageTitle(page); - expect(pageTitle).to.contains(generalPage.pageTitle); + const pageTitle = await boShopParametersPage.getPageTitle(page); + expect(pageTitle).to.contains(boShopParametersPage.pageTitle); }); const tests = [ @@ -62,17 +60,17 @@ describe('BO - Shop Parameters - General : Enable/Disable multi store', async () it(`should ${test.args.action} multi store`, async function () { await testContext.addContextItem(this, 'testIdentifier', `${test.args.action}MultiStore`, baseContext); - const result = await generalPage.setMultiStoreStatus(page, test.args.exist); - expect(result).to.contains(generalPage.successfulUpdateMessage); + const result = await boShopParametersPage.setMultiStoreStatus(page, test.args.exist); + expect(result).to.contains(boShopParametersPage.successfulUpdateMessage); }); it('should check the existence of \'Advanced Parameters > Multistore\' page', async function () { await testContext.addContextItem(this, 'testIdentifier', `goToMultiStorePage_${index}`, baseContext); - const result = await generalPage.isSubmenuVisible( + const result = await boShopParametersPage.isSubmenuVisible( page, - generalPage.advancedParametersLink, - generalPage.multistoreLink, + boShopParametersPage.advancedParametersLink, + boShopParametersPage.multistoreLink, ); expect(result).to.be.equal(test.args.exist); }); diff --git a/tests/UI/campaigns/functional/BO/13_shopParameters/01_general/maintenance/01_enableDisableShop.ts b/tests/UI/campaigns/functional/BO/13_shopParameters/01_general/maintenance/01_enableDisableShop.ts index beb8e8a85829b..a7132aea3cb34 100644 --- a/tests/UI/campaigns/functional/BO/13_shopParameters/01_general/maintenance/01_enableDisableShop.ts +++ b/tests/UI/campaigns/functional/BO/13_shopParameters/01_general/maintenance/01_enableDisableShop.ts @@ -6,13 +6,13 @@ import loginCommon from '@commonTests/BO/loginBO'; // Import pages // Import BO pages -import generalPage from '@pages/BO/shopParameters/general'; import maintenancePage from '@pages/BO/shopParameters/general/maintenance'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; import { boDashboardPage, + boShopParametersPage, foClassicHomePage, utilsPlaywright, } from '@prestashop-core/ui-testing'; @@ -53,16 +53,16 @@ describe('BO - Shop Parameters - General - Maintenance : Enable/Disable shop', a boDashboardPage.shopParametersParentLink, boDashboardPage.shopParametersGeneralLink, ); - await generalPage.closeSfToolBar(page); + await boShopParametersPage.closeSfToolBar(page); - const pageTitle = await generalPage.getPageTitle(page); - expect(pageTitle).to.contains(generalPage.pageTitle); + const pageTitle = await boShopParametersPage.getPageTitle(page); + expect(pageTitle).to.contains(boShopParametersPage.pageTitle); }); it('should go to \'Maintenance\' tab', async function () { await testContext.addContextItem(this, 'testIdentifier', 'goToMaintenancePage', baseContext); - await generalPage.goToSubTabMaintenance(page); + await boShopParametersPage.goToSubTabMaintenance(page); const pageTitle = await maintenancePage.getPageTitle(page); expect(pageTitle).to.contains(maintenancePage.pageTitle); diff --git a/tests/UI/campaigns/modules/blockwishlist/01_installation/05_uninstallAndDeleteModule.ts b/tests/UI/campaigns/modules/blockwishlist/01_installation/05_uninstallAndDeleteModule.ts index 7f7cb901f2f25..e15624ae2bde9 100644 --- a/tests/UI/campaigns/modules/blockwishlist/01_installation/05_uninstallAndDeleteModule.ts +++ b/tests/UI/campaigns/modules/blockwishlist/01_installation/05_uninstallAndDeleteModule.ts @@ -16,145 +16,110 @@ import { utilsFile, utilsPlaywright, } from '@prestashop-core/ui-testing'; +import {installModule} from '@commonTests/BO/modules/moduleManager'; const baseContext: string = 'modules_blockwishlist_installation_uninstallAndDeleteModule'; describe('Wishlist module - Uninstall and delete module', async () => { - let browserContext: BrowserContext; - let page: Page; + describe('Uninstall and delete module', async () => { + let browserContext: BrowserContext; + let page: Page; - // before and after functions - before(async function () { - browserContext = await utilsPlaywright.createBrowserContext(this.browser); - page = await utilsPlaywright.newTab(browserContext); - }); - - after(async () => { - await utilsPlaywright.closeBrowserContext(browserContext); - await utilsFile.deleteFile('module.zip'); - }); - - it('should login in BO', async function () { - await loginCommon.loginBO(this, page); - }); - - it('should go to \'Modules > Module Manager\' page', async function () { - await testContext.addContextItem(this, 'testIdentifier', 'goToModuleManagerPage', baseContext); - - await boDashboardPage.goToSubMenu( - page, - boDashboardPage.modulesParentLink, - boDashboardPage.moduleManagerLink, - ); - await boModuleManagerPage.closeSfToolBar(page); - - const pageTitle = await boModuleManagerPage.getPageTitle(page); - expect(pageTitle).to.contains(boModuleManagerPage.pageTitle); - }); - - it(`should search the module ${dataModules.blockwishlist.name}`, async function () { - await testContext.addContextItem(this, 'testIdentifier', 'searchModule', baseContext); - - const isModuleVisible = await boModuleManagerPage.searchModule(page, dataModules.blockwishlist); - expect(isModuleVisible).to.eq(true); - }); - - it('should display the uninstall modal and cancel it', async function () { - await testContext.addContextItem(this, 'testIdentifier', 'resetModuleAndCancel', baseContext); - - const textResult = await boModuleManagerPage.setActionInModule(page, dataModules.blockwishlist, 'uninstall', true); - expect(textResult).to.eq(''); - - const isModuleVisible = await boModuleManagerPage.isModuleVisible(page, dataModules.blockwishlist); - expect(isModuleVisible).to.eq(true); - - const isModalVisible = await boModuleManagerPage.isModalActionVisible(page, dataModules.blockwishlist, 'uninstall'); - expect(isModalVisible).to.eq(false); + before(async function () { + browserContext = await utilsPlaywright.createBrowserContext(this.browser); + page = await utilsPlaywright.newTab(browserContext); + }); - const dirExists = await utilsFile.doesFileExist(`${utilsFile.getRootPath()}/modules/${dataModules.blockwishlist.tag}/`); - expect(dirExists).to.eq(true); - }); + after(async () => { + await utilsPlaywright.closeBrowserContext(browserContext); + await utilsFile.deleteFile('module.zip'); + }); - it('should uninstall the module', async function () { - await testContext.addContextItem(this, 'testIdentifier', 'resetModule', baseContext); + it('should login in BO', async function () { + await loginCommon.loginBO(this, page); + }); - const successMessage = await boModuleManagerPage.setActionInModule(page, dataModules.blockwishlist, 'uninstall', false, true); - expect(successMessage).to.eq(boModuleManagerPage.uninstallModuleSuccessMessage(dataModules.blockwishlist.tag)); + it('should go to \'Modules > Module Manager\' page', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'goToModuleManagerPage', baseContext); - // Check the directory `modules/dataModules.blockwishlist.tag` - const dirExists = await utilsFile.doesFileExist(`${utilsFile.getRootPath()}/modules/${dataModules.blockwishlist.tag}/`); - expect(dirExists).to.eq(false); - }); + await boDashboardPage.goToSubMenu( + page, + boDashboardPage.modulesParentLink, + boDashboardPage.moduleManagerLink, + ); + await boModuleManagerPage.closeSfToolBar(page); - it('should view my shop', async function () { - await testContext.addContextItem(this, 'testIdentifier', 'viewMyShop', baseContext); + const pageTitle = await boModuleManagerPage.getPageTitle(page); + expect(pageTitle).to.contains(boModuleManagerPage.pageTitle); + }); - page = await boModuleManagerPage.viewMyShop(page); - await foClassicHomePage.changeLanguage(page, 'en'); + it(`should search the module ${dataModules.blockwishlist.name}`, async function () { + await testContext.addContextItem(this, 'testIdentifier', 'searchModule', baseContext); - const isHomePage = await foClassicHomePage.isHomePage(page); - expect(isHomePage).to.eq(true); - }); + const isModuleVisible = await boModuleManagerPage.searchModule(page, dataModules.blockwishlist); + expect(isModuleVisible).to.eq(true); + }); - it('should go the product page', async function () { - await testContext.addContextItem(this, 'testIdentifier', 'goToProductPage', baseContext); + it('should display the uninstall modal and cancel it', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'resetModuleAndCancel', baseContext); - await foClassicHomePage.goToProductPage(page, 1); + const textResult = await boModuleManagerPage.setActionInModule(page, dataModules.blockwishlist, 'uninstall', true); + expect(textResult).to.eq(''); - const productInformations = await foClassicProductPage.getProductInformation(page); - expect(productInformations.name).to.eq(dataProducts.demo_1.name); - }); + const isModuleVisible = await boModuleManagerPage.isModuleVisible(page, dataModules.blockwishlist); + expect(isModuleVisible).to.eq(true); - it('should check if the button "Add to wishlist" is present', async function () { - await testContext.addContextItem(this, 'testIdentifier', 'checkButtonAddToWoshlist', baseContext); + const isModalVisible = await boModuleManagerPage.isModalActionVisible(page, dataModules.blockwishlist, 'uninstall'); + expect(isModalVisible).to.eq(false); - const hasAddToWishlistButton = await foClassicProductPage.hasAddToWishlistButton(page); - expect(hasAddToWishlistButton).to.equal(false); - }); + const dirExists = await utilsFile.doesFileExist(`${utilsFile.getRootPath()}/modules/${dataModules.blockwishlist.tag}/`); + expect(dirExists).to.eq(true); + }); - describe(`POST-CONDITION : Install the module ${dataModules.blockwishlist.name}`, async () => { - it('should go back to Back Office', async function () { - await testContext.addContextItem(this, 'testIdentifier', 'returnToModulesManager', baseContext); + it('should uninstall the module', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'resetModule', baseContext); - page = await foClassicProductPage.closePage(browserContext, page, 0); - await boDashboardPage.goToSubMenu( + const successMessage = await boModuleManagerPage.setActionInModule( page, - boDashboardPage.modulesParentLink, - boDashboardPage.moduleManagerLink, + dataModules.blockwishlist, + 'uninstall', + false, + true, ); + expect(successMessage).to.eq(boModuleManagerPage.uninstallModuleSuccessMessage(dataModules.blockwishlist.tag)); - const pageTitle = await boModuleManagerPage.getPageTitle(page); - expect(pageTitle).to.contains(boModuleManagerPage.pageTitle); + // Check the directory `modules/dataModules.blockwishlist.tag` + const dirExists = await utilsFile.doesFileExist(`${utilsFile.getRootPath()}/modules/${dataModules.blockwishlist.tag}/`); + expect(dirExists).to.eq(false); }); - it(`should download the zip of the module '${dataModules.blockwishlist.name}'`, async function () { - await testContext.addContextItem(this, 'testIdentifier', 'downloadModule', baseContext); + it('should view my shop', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'viewMyShop', baseContext); - await utilsFile.downloadFile(dataModules.blockwishlist.releaseZip, 'module.zip'); + page = await boModuleManagerPage.viewMyShop(page); + await foClassicHomePage.changeLanguage(page, 'en'); - const found = await utilsFile.doesFileExist('module.zip'); - expect(found).to.eq(true); + const isHomePage = await foClassicHomePage.isHomePage(page); + expect(isHomePage).to.eq(true); }); - it(`should upload the module '${dataModules.blockwishlist.name}'`, async function () { - await testContext.addContextItem(this, 'testIdentifier', 'uploadModule', baseContext); - - const successMessage = await boModuleManagerPage.uploadModule(page, 'module.zip'); - expect(successMessage).to.eq(boModuleManagerPage.uploadModuleSuccessMessage); - }); + it('should go the product page', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'goToProductPage', baseContext); - it('should close upload module modal', async function () { - await testContext.addContextItem(this, 'testIdentifier', 'closeModal', baseContext); + await foClassicHomePage.goToProductPage(page, 1); - const isModalNotVisible = await boModuleManagerPage.closeUploadModuleModal(page); - expect(isModalNotVisible).to.eq(true); + const productInformations = await foClassicProductPage.getProductInformation(page); + expect(productInformations.name).to.eq(dataProducts.demo_1.name); }); - it(`should search the module '${dataModules.blockwishlist.name}'`, async function () { - await testContext.addContextItem(this, 'testIdentifier', 'checkModulePresent', baseContext); + it('should check if the button "Add to wishlist" is present', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'checkButtonAddToWoshlist', baseContext); - const isModuleVisible = await boModuleManagerPage.searchModule(page, dataModules.blockwishlist); - expect(isModuleVisible, 'Module is not visible!').to.eq(true); + const hasAddToWishlistButton = await foClassicProductPage.hasAddToWishlistButton(page); + expect(hasAddToWishlistButton).to.equal(false); }); }); + + // POST-TEST: Install module + installModule(dataModules.blockwishlist, true, `${baseContext}_postTest_0`); }); diff --git a/tests/UI/campaigns/modules/ps_emailalerts/01_installation/03_uninstallAndDeleteModule.ts b/tests/UI/campaigns/modules/ps_emailalerts/01_installation/03_uninstallAndDeleteModule.ts index 9025e5a84775f..3487c75ade2b4 100644 --- a/tests/UI/campaigns/modules/ps_emailalerts/01_installation/03_uninstallAndDeleteModule.ts +++ b/tests/UI/campaigns/modules/ps_emailalerts/01_installation/03_uninstallAndDeleteModule.ts @@ -180,7 +180,7 @@ describe('Mail alerts module - Uninstall and delete module', async () => { }); }); - installModule(dataModules.psEmailAlerts, `${baseContext}_postTest_0`); + installModule(dataModules.psEmailAlerts, true, `${baseContext}_postTest_0`); deleteProductTest(productOutOfStockNotAllowed, `${baseContext}_postTest_1`); }); diff --git a/tests/UI/campaigns/modules/ps_facetedsearch/01_installation/04_uninstallAndDeleteModule.ts b/tests/UI/campaigns/modules/ps_facetedsearch/01_installation/04_uninstallAndDeleteModule.ts index 03c236f0b1905..e168ff4c7507e 100644 --- a/tests/UI/campaigns/modules/ps_facetedsearch/01_installation/04_uninstallAndDeleteModule.ts +++ b/tests/UI/campaigns/modules/ps_facetedsearch/01_installation/04_uninstallAndDeleteModule.ts @@ -16,146 +16,111 @@ import { utilsFile, utilsPlaywright, } from '@prestashop-core/ui-testing'; +import {installModule} from '@commonTests/BO/modules/moduleManager'; const baseContext: string = 'modules_ps_facetedsearch_installation_uninstallAndDeleteModule'; describe('Faceted search module - Uninstall and delete module', async () => { - let browserContext: BrowserContext; - let page: Page; - - // before and after functions - before(async function () { - browserContext = await utilsPlaywright.createBrowserContext(this.browser); - page = await utilsPlaywright.newTab(browserContext); - }); - - after(async () => { - await utilsPlaywright.closeBrowserContext(browserContext); - await utilsFile.deleteFile('module.zip'); - }); - - it('should login in BO', async function () { - await loginCommon.loginBO(this, page); - }); - - it('should go to \'Modules > Module Manager\' page', async function () { - await testContext.addContextItem(this, 'testIdentifier', 'goToModuleManagerPage', baseContext); - - await boDashboardPage.goToSubMenu( - page, - boDashboardPage.modulesParentLink, - boDashboardPage.moduleManagerLink, - ); - await boModuleManagerPage.closeSfToolBar(page); - - const pageTitle = await boModuleManagerPage.getPageTitle(page); - expect(pageTitle).to.contains(boModuleManagerPage.pageTitle); - }); - - it(`should search the module ${dataModules.psFacetedSearch.name}`, async function () { - await testContext.addContextItem(this, 'testIdentifier', 'searchModule', baseContext); - - const isModuleVisible = await boModuleManagerPage.searchModule(page, dataModules.psFacetedSearch); - expect(isModuleVisible).to.eq(true); - }); - - it('should display the uninstall modal and cancel it', async function () { - await testContext.addContextItem(this, 'testIdentifier', 'resetModuleAndCancel', baseContext); - - const textResult = await boModuleManagerPage.setActionInModule(page, dataModules.psFacetedSearch, 'uninstall', true); - expect(textResult).to.eq(''); - - const isModuleVisible = await boModuleManagerPage.isModuleVisible(page, dataModules.psFacetedSearch); - expect(isModuleVisible).to.eq(true); - - const isModalVisible = await boModuleManagerPage.isModalActionVisible(page, dataModules.psFacetedSearch, 'uninstall'); - expect(isModalVisible).to.eq(false); + describe('Uninstall and delete module', async () => { + let browserContext: BrowserContext; + let page: Page; + + // before and after functions + before(async function () { + browserContext = await utilsPlaywright.createBrowserContext(this.browser); + page = await utilsPlaywright.newTab(browserContext); + }); - const dirExists = await utilsFile.doesFileExist(`${utilsFile.getRootPath()}/modules/${dataModules.psFacetedSearch.tag}/`); - expect(dirExists).to.eq(true); - }); + after(async () => { + await utilsPlaywright.closeBrowserContext(browserContext); + await utilsFile.deleteFile('module.zip'); + }); - it('should uninstall the module', async function () { - await testContext.addContextItem(this, 'testIdentifier', 'resetModule', baseContext); - - const successMessage = await boModuleManagerPage.setActionInModule( - page, - dataModules.psFacetedSearch, - 'uninstall', - false, - true, - ); - expect(successMessage).to.eq(boModuleManagerPage.uninstallModuleSuccessMessage(dataModules.psFacetedSearch.tag)); - - // Check the directory `modules/dataModules.psFacetedSearch.tag` - const dirExists = await utilsFile.doesFileExist(`${utilsFile.getRootPath()}/modules/${dataModules.psFacetedSearch.tag}/`); - expect(dirExists).to.eq(false); - }); + it('should login in BO', async function () { + await loginCommon.loginBO(this, page); + }); - it('should go to Front Office', async function () { - await testContext.addContextItem(this, 'testIdentifier', 'goToFo', baseContext); + it('should go to \'Modules > Module Manager\' page', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'goToModuleManagerPage', baseContext); - page = await boModuleManagerPage.viewMyShop(page); - await foClassicHomePage.changeLanguage(page, 'en'); + await boDashboardPage.goToSubMenu( + page, + boDashboardPage.modulesParentLink, + boDashboardPage.moduleManagerLink, + ); + await boModuleManagerPage.closeSfToolBar(page); - const isHomePage = await foClassicHomePage.isHomePage(page); - expect(isHomePage).to.eq(true); - }); + const pageTitle = await boModuleManagerPage.getPageTitle(page); + expect(pageTitle).to.contains(boModuleManagerPage.pageTitle); + }); - it('should go to the category Page', async function () { - await testContext.addContextItem(this, 'testIdentifier', 'goToCategoryPage', baseContext); + it(`should search the module ${dataModules.psFacetedSearch.name}`, async function () { + await testContext.addContextItem(this, 'testIdentifier', 'searchModule', baseContext); - await foClassicHomePage.goToCategory(page, dataCategories.clothes.id); + const isModuleVisible = await boModuleManagerPage.searchModule(page, dataModules.psFacetedSearch); + expect(isModuleVisible).to.eq(true); + }); - const pageTitle = await foClassicHomePage.getPageTitle(page); - expect(pageTitle).to.equal(dataCategories.clothes.name); - }); + it('should display the uninstall modal and cancel it', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'resetModuleAndCancel', baseContext); - it(`should check that ${dataModules.psFacetedSearch.name} is not present`, async function () { - await testContext.addContextItem(this, 'testIdentifier', 'checkModuleNotPresent', baseContext); + const textResult = await boModuleManagerPage.setActionInModule(page, dataModules.psFacetedSearch, 'uninstall', true); + expect(textResult).to.eq(''); - const hasFilters = await foClassicCategoryPage.hasSearchFilters(page); - expect(hasFilters).to.eq(false); - }); + const isModuleVisible = await boModuleManagerPage.isModuleVisible(page, dataModules.psFacetedSearch); + expect(isModuleVisible).to.eq(true); - describe(`POST-CONDITION : Install the module ${dataModules.psFacetedSearch.name}`, async () => { - it('should go back to Back Office', async function () { - await testContext.addContextItem(this, 'testIdentifier', 'returnToBo', baseContext); + const isModalVisible = await boModuleManagerPage.isModalActionVisible(page, dataModules.psFacetedSearch, 'uninstall'); + expect(isModalVisible).to.eq(false); - page = await foClassicCategoryPage.closePage(browserContext, page, 0); + const dirExists = await utilsFile.doesFileExist(`${utilsFile.getRootPath()}/modules/${dataModules.psFacetedSearch.tag}/`); + expect(dirExists).to.eq(true); + }); - const pageTitle = await boModuleManagerPage.getPageTitle(page); - expect(pageTitle).to.contains(boModuleManagerPage.pageTitle); + it('should uninstall the module', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'resetModule', baseContext); + + const successMessage = await boModuleManagerPage.setActionInModule( + page, + dataModules.psFacetedSearch, + 'uninstall', + false, + true, + ); + expect(successMessage).to.eq(boModuleManagerPage.uninstallModuleSuccessMessage(dataModules.psFacetedSearch.tag)); + + // Check the directory `modules/dataModules.psFacetedSearch.tag` + const dirExists = await utilsFile.doesFileExist(`${utilsFile.getRootPath()}/modules/${dataModules.psFacetedSearch.tag}/`); + expect(dirExists).to.eq(false); }); - it(`should download the zip of the module '${dataModules.psFacetedSearch.name}'`, async function () { - await testContext.addContextItem(this, 'testIdentifier', 'downloadModule', baseContext); + it('should go to Front Office', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'goToFo', baseContext); - await utilsFile.downloadFile(dataModules.psFacetedSearch.releaseZip, 'module.zip'); + page = await boModuleManagerPage.viewMyShop(page); + await foClassicHomePage.changeLanguage(page, 'en'); - const found = await utilsFile.doesFileExist('module.zip'); - expect(found).to.eq(true); + const isHomePage = await foClassicHomePage.isHomePage(page); + expect(isHomePage).to.eq(true); }); - it(`should upload the module '${dataModules.psFacetedSearch.name}'`, async function () { - await testContext.addContextItem(this, 'testIdentifier', 'uploadModule', baseContext); + it('should go to the category Page', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'goToCategoryPage', baseContext); - const successMessage = await boModuleManagerPage.uploadModule(page, 'module.zip'); - expect(successMessage).to.eq(boModuleManagerPage.uploadModuleSuccessMessage); - }); - - it('should close upload module modal', async function () { - await testContext.addContextItem(this, 'testIdentifier', 'closeModal', baseContext); + await foClassicHomePage.goToCategory(page, dataCategories.clothes.id); - const isModalNotVisible = await boModuleManagerPage.closeUploadModuleModal(page); - expect(isModalNotVisible).to.eq(true); + const pageTitle = await foClassicHomePage.getPageTitle(page); + expect(pageTitle).to.equal(dataCategories.clothes.name); }); - it(`should search the module '${dataModules.psFacetedSearch.name}'`, async function () { - await testContext.addContextItem(this, 'testIdentifier', 'checkModulePresent', baseContext); + it(`should check that ${dataModules.psFacetedSearch.name} is not present`, async function () { + await testContext.addContextItem(this, 'testIdentifier', 'checkModuleNotPresent', baseContext); - const isModuleVisible = await boModuleManagerPage.searchModule(page, dataModules.psFacetedSearch); - expect(isModuleVisible, 'Module is not visible!').to.eq(true); + const hasFilters = await foClassicCategoryPage.hasSearchFilters(page); + expect(hasFilters).to.eq(false); }); }); + + // POST-TEST: Install module + installModule(dataModules.psFacetedSearch, true, `${baseContext}_postTest_0`); }); diff --git a/tests/UI/campaigns/modules/ps_newproducts/01_installation/01_upgradeModule.ts b/tests/UI/campaigns/modules/ps_newproducts/01_installation/01_upgradeModule.ts new file mode 100644 index 0000000000000..8b4d1df2573fb --- /dev/null +++ b/tests/UI/campaigns/modules/ps_newproducts/01_installation/01_upgradeModule.ts @@ -0,0 +1,277 @@ +// Import utils +import testContext from '@utils/testContext'; + +// Import commonTests +import loginCommon from '@commonTests/BO/loginBO'; +import {installModule, uninstallModule} from '@commonTests/BO/modules/moduleManager'; +// Import BO pages +import maintenancePage from '@pages/BO/shopParameters/general/maintenance'; + +import {expect} from 'chai'; +import type {BrowserContext, Page} from 'playwright'; +import { + boDashboardPage, + boModuleManagerPage, + boShopParametersPage, + dataModules, + foClassicHomePage, + utilsFile, + utilsPlaywright, +} from '@prestashop-core/ui-testing'; + +const baseContext: string = 'modules_ps_newproducts_installation_upgradeModule'; + +describe('New products block module: Upgrade module', async () => { + let browserContext: BrowserContext; + let page: Page; + + // PRE-TEST : Uninstall ps_newproducts + uninstallModule(dataModules.psNewProducts, `${baseContext}_preTest_0`); + // PRE-TEST : Install ps_newproducts (old version) + installModule(dataModules.psNewProducts, false, `${baseContext}_preTest_1`); + + describe('Upgrade with shop on maintenance', async () => { + before(async function () { + browserContext = await utilsPlaywright.createBrowserContext(this.browser); + page = await utilsPlaywright.newTab(browserContext); + }); + + after(async () => { + await utilsPlaywright.closeBrowserContext(browserContext); + await utilsFile.deleteFile('module.zip'); + }); + + it('should login in BO', async function () { + await loginCommon.loginBO(this, page); + }); + + it('should go to \'Shop parameters > General\' page', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'goToShopParamsPage', baseContext); + + await boDashboardPage.goToSubMenu( + page, + boDashboardPage.shopParametersParentLink, + boDashboardPage.shopParametersGeneralLink, + ); + await boShopParametersPage.closeSfToolBar(page); + + const pageTitle = await boShopParametersPage.getPageTitle(page); + expect(pageTitle).to.contains(boShopParametersPage.pageTitle); + }); + + it('should go to \'Maintenance\' tab', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'goToMaintenancePage', baseContext); + + await boShopParametersPage.goToSubTabMaintenance(page); + + const pageTitle = await maintenancePage.getPageTitle(page); + expect(pageTitle).to.contains(maintenancePage.pageTitle); + }); + + it('should disable the shop', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'disableShop', baseContext); + + const resultStatus = await maintenancePage.changeShopStatus(page, false); + expect(resultStatus).to.contains(maintenancePage.successfulUpdateMessage); + + const resultLoggedInEmployees = await maintenancePage.changeStoreForLoggedInEmployees(page, false); + expect(resultLoggedInEmployees).to.contains(maintenancePage.successfulUpdateMessage); + }); + + it('should verify the existence of the maintenance text', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'verifyMaintenanceText', baseContext); + + page = await maintenancePage.viewMyShop(page); + + const pageContent = await foClassicHomePage.getTextContent(page, foClassicHomePage.content); + expect(pageContent).to.equal(maintenancePage.maintenanceText); + }); + + it('should go to \'Modules > Module Manager\' page', async function () { + await testContext.addContextItem(this, '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).to.contains(boModuleManagerPage.pageTitle); + }); + + it(`should search the module ${dataModules.psNewProducts.name}`, async function () { + await testContext.addContextItem(this, 'testIdentifier', 'searchModule', baseContext); + + const isModuleVisible = await boModuleManagerPage.searchModule(page, dataModules.psNewProducts); + expect(isModuleVisible).to.eq(true); + + const moduleInfo = await boModuleManagerPage.getModuleInformationNth(page, 1); + expect(dataModules.psNewProducts.versionOld).to.contains(moduleInfo.version); + }); + + it('should display the upgrade modal and cancel it', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'resetModuleAndCancel', baseContext); + + const textResult = await boModuleManagerPage.setActionInModule(page, dataModules.psNewProducts, 'upgrade', true); + expect(textResult).to.eq(''); + + const isModuleVisible = await boModuleManagerPage.isModuleVisible(page, dataModules.psNewProducts); + expect(isModuleVisible).to.eq(true); + + const isModalVisible = await boModuleManagerPage.isModalActionVisible(page, dataModules.psNewProducts, 'upgrade'); + expect(isModalVisible).to.eq(false); + }); + + it('should upgrade the module', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'resetModule', baseContext); + + const successMessage = await boModuleManagerPage.setActionInModule(page, dataModules.psNewProducts, 'upgrade', false, true); + expect(successMessage).to.eq(boModuleManagerPage.updateModuleSuccessMessage(dataModules.psNewProducts.tag)); + }); + + it('should reload the page', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'checkModule', baseContext); + + await boModuleManagerPage.reloadPage(page); + + const isModuleVisible = await boModuleManagerPage.searchModule(page, dataModules.psNewProducts); + expect(isModuleVisible).to.eq(true); + + const moduleInfo = await boModuleManagerPage.getModuleInformationNth(page, 1); + expect(dataModules.psNewProducts.versionCurrent).to.contains(moduleInfo.version); + }); + + it('should go to \'Shop parameters > General\' page', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'returnToShopParamsPage', baseContext); + + await boDashboardPage.goToSubMenu( + page, + boDashboardPage.shopParametersParentLink, + boDashboardPage.shopParametersGeneralLink, + ); + await boShopParametersPage.closeSfToolBar(page); + + const pageTitle = await boShopParametersPage.getPageTitle(page); + expect(pageTitle).to.contains(boShopParametersPage.pageTitle); + }); + + it('should go to \'Maintenance\' tab', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'returnToMaintenancePage', baseContext); + + await boShopParametersPage.goToSubTabMaintenance(page); + + const pageTitle = await maintenancePage.getPageTitle(page); + expect(pageTitle).to.contains(maintenancePage.pageTitle); + }); + + it('should enable the shop', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'enableShop', baseContext); + + const result = await maintenancePage.changeShopStatus(page, true); + expect(result).to.contains(maintenancePage.successfulUpdateMessage); + }); + + it('should go to the front office', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'goToTheFo', baseContext); + + page = await boModuleManagerPage.viewMyShop(page); + await foClassicHomePage.changeLanguage(page, 'en'); + + const isHomePage = await foClassicHomePage.isHomePage(page); + expect(isHomePage).to.equal(true); + }); + + it('should check if the "New Products" block is visible', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'checkVisible', baseContext); + + const hasProductsBlock = await foClassicHomePage.hasProductsBlock(page, 'newproducts'); + expect(hasProductsBlock).to.eq(true); + }); + }); + + // PRE-TEST : Uninstall ps_newproducts + uninstallModule(dataModules.psNewProducts, `${baseContext}_middleTest_0`); + // PRE-TEST : Install ps_newproducts (old version) + installModule(dataModules.psNewProducts, false, `${baseContext}_middleTest_1`); + + describe('Upgrade without shop on maintenance', async () => { + before(async function () { + browserContext = await utilsPlaywright.createBrowserContext(this.browser); + page = await utilsPlaywright.newTab(browserContext); + }); + + after(async () => { + await utilsPlaywright.closeBrowserContext(browserContext); + await utilsFile.deleteFile('module.zip'); + }); + + it('should login in BO', async function () { + await loginCommon.loginBO(this, page); + }); + + it('should go to \'Modules > Module Manager\' page', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'goToModuleManagerPageWoMaintenance', baseContext); + + // Go back to BO + await boDashboardPage.goToSubMenu( + page, + boDashboardPage.modulesParentLink, + boDashboardPage.moduleManagerLink, + ); + await boModuleManagerPage.closeSfToolBar(page); + + const pageTitle = await boModuleManagerPage.getPageTitle(page); + expect(pageTitle).to.contains(boModuleManagerPage.pageTitle); + }); + + it(`should search the module ${dataModules.psNewProducts.name}`, async function () { + await testContext.addContextItem(this, 'testIdentifier', 'searchModuleWoMaintenance', baseContext); + + const isModuleVisible = await boModuleManagerPage.searchModule(page, dataModules.psNewProducts); + expect(isModuleVisible).to.eq(true); + + const moduleInfo = await boModuleManagerPage.getModuleInformationNth(page, 1); + expect(dataModules.psNewProducts.versionOld).to.contains(moduleInfo.version); + }); + + it('should upgrade the module', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'upgradeModuleWoMaintenance', baseContext); + + const successMessage = await boModuleManagerPage.setActionInModule(page, dataModules.psNewProducts, 'upgrade', false, true); + expect(successMessage).to.eq(boModuleManagerPage.updateModuleSuccessMessage(dataModules.psNewProducts.tag)); + }); + + it('should reload the page', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'checkModuleWoMaintenance', baseContext); + + await boModuleManagerPage.reloadPage(page); + + const isModuleVisible = await boModuleManagerPage.searchModule(page, dataModules.psNewProducts); + expect(isModuleVisible).to.eq(true); + + const moduleInfo = await boModuleManagerPage.getModuleInformationNth(page, 1); + expect(dataModules.psNewProducts.versionCurrent).to.contains(moduleInfo.version); + }); + + it('should go to the front office', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'goToTheFoWoMaintenance', baseContext); + + page = await boModuleManagerPage.viewMyShop(page); + await foClassicHomePage.changeLanguage(page, 'en'); + + const isHomePage = await foClassicHomePage.isHomePage(page); + expect(isHomePage).to.equal(true); + }); + + it('should check if the "New Products" block is visible', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'checkVisibleWoMaintenance', baseContext); + + const hasProductsBlock = await foClassicHomePage.hasProductsBlock(page, 'newproducts'); + expect(hasProductsBlock).to.eq(true); + }); + }); +}); diff --git a/tests/UI/campaigns/modules/ps_newproducts/01_installation/03_uninstallAndDeleteModule.ts b/tests/UI/campaigns/modules/ps_newproducts/01_installation/03_uninstallAndDeleteModule.ts index 728fc705c47c4..23a35e92084f8 100644 --- a/tests/UI/campaigns/modules/ps_newproducts/01_installation/03_uninstallAndDeleteModule.ts +++ b/tests/UI/campaigns/modules/ps_newproducts/01_installation/03_uninstallAndDeleteModule.ts @@ -14,136 +14,102 @@ import { utilsFile, utilsPlaywright, } from '@prestashop-core/ui-testing'; +import {installModule} from '@commonTests/BO/modules/moduleManager'; const baseContext: string = 'modules_ps_newproducts_installation_uninstallAndDeleteModule'; describe('New products block module - Uninstall and delete module', async () => { - let browserContext: BrowserContext; - let page: Page; - - // before and after functions - before(async function () { - browserContext = await utilsPlaywright.createBrowserContext(this.browser); - page = await utilsPlaywright.newTab(browserContext); - }); - - after(async () => { - await utilsPlaywright.closeBrowserContext(browserContext); - await utilsFile.deleteFile('module.zip'); - }); - - it('should login in BO', async function () { - await loginCommon.loginBO(this, page); - }); - - it('should go to \'Modules > Module Manager\' page', async function () { - await testContext.addContextItem(this, 'testIdentifier', 'goToModuleManagerPage', baseContext); - - await boDashboardPage.goToSubMenu( - page, - boDashboardPage.modulesParentLink, - boDashboardPage.moduleManagerLink, - ); - await boModuleManagerPage.closeSfToolBar(page); - - const pageTitle = await boModuleManagerPage.getPageTitle(page); - expect(pageTitle).to.contains(boModuleManagerPage.pageTitle); - }); - - it(`should search the module ${dataModules.psNewProducts.name}`, async function () { - await testContext.addContextItem(this, 'testIdentifier', 'searchModule', baseContext); - - const isModuleVisible = await boModuleManagerPage.searchModule(page, dataModules.psNewProducts); - expect(isModuleVisible).to.eq(true); - }); - - it('should display the uninstall modal and cancel it', async function () { - await testContext.addContextItem(this, 'testIdentifier', 'resetModuleAndCancel', baseContext); - - const textResult = await boModuleManagerPage.setActionInModule(page, dataModules.psNewProducts, 'uninstall', true); - expect(textResult).to.eq(''); - - const isModuleVisible = await boModuleManagerPage.isModuleVisible(page, dataModules.psNewProducts); - expect(isModuleVisible).to.eq(true); - - const isModalVisible = await boModuleManagerPage.isModalActionVisible(page, dataModules.psNewProducts, 'uninstall'); - expect(isModalVisible).to.eq(false); - - const dirExists = await utilsFile.doesFileExist(`${utilsFile.getRootPath()}/modules/${dataModules.psNewProducts.tag}/`); - expect(dirExists).to.eq(true); - }); - - it('should uninstall the module', async function () { - await testContext.addContextItem(this, 'testIdentifier', 'resetModule', baseContext); - - const successMessage = await boModuleManagerPage.setActionInModule(page, dataModules.psNewProducts, 'uninstall', false, true); - expect(successMessage).to.eq(boModuleManagerPage.uninstallModuleSuccessMessage(dataModules.psNewProducts.tag)); - - // Check the directory `modules/dataModules.psNewProducts.tag` - const dirExists = await utilsFile.doesFileExist(`${utilsFile.getRootPath()}/modules/${dataModules.psNewProducts.tag}/`); - expect(dirExists).to.eq(false); - }); - - it('should go to the front office', async function () { - await testContext.addContextItem(this, 'testIdentifier', 'goToTheFo', baseContext); - - page = await boModuleManagerPage.viewMyShop(page); - await foClassicHomePage.changeLanguage(page, 'en'); - - const isHomePage = await foClassicHomePage.isHomePage(page); - expect(isHomePage).to.equal(true); - }); + describe('Uninstall and delete module', async () => { + let browserContext: BrowserContext; + let page: Page; + + // before and after functions + before(async function () { + browserContext = await utilsPlaywright.createBrowserContext(this.browser); + page = await utilsPlaywright.newTab(browserContext); + }); - it('should check if the "New Products" block is not visible', async function () { - await testContext.addContextItem(this, 'testIdentifier', 'checkNotVisible', baseContext); + after(async () => { + await utilsPlaywright.closeBrowserContext(browserContext); + await utilsFile.deleteFile('module.zip'); + }); - const hasProductsBlock = await foClassicHomePage.hasProductsBlock(page, 'newproducts'); - expect(hasProductsBlock).to.eq(false); - }); + it('should login in BO', async function () { + await loginCommon.loginBO(this, page); + }); - describe(`POST-CONDITION : Install the module ${dataModules.psNewProducts.name}`, async () => { - it('should go back to Back Office', async function () { - await testContext.addContextItem(this, 'testIdentifier', 'returnToModulesManager', baseContext); + it('should go to \'Modules > Module Manager\' page', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'goToModuleManagerPage', baseContext); - page = await foClassicHomePage.changePage(browserContext, 0); await boDashboardPage.goToSubMenu( page, boDashboardPage.modulesParentLink, boDashboardPage.moduleManagerLink, ); + await boModuleManagerPage.closeSfToolBar(page); const pageTitle = await boModuleManagerPage.getPageTitle(page); expect(pageTitle).to.contains(boModuleManagerPage.pageTitle); }); - it(`should download the zip of the module '${dataModules.psNewProducts.name}'`, async function () { - await testContext.addContextItem(this, 'testIdentifier', 'downloadModule', baseContext); + it(`should search the module ${dataModules.psNewProducts.name}`, async function () { + await testContext.addContextItem(this, 'testIdentifier', 'searchModule', baseContext); - await utilsFile.downloadFile(dataModules.psNewProducts.releaseZip, 'module.zip'); + const isModuleVisible = await boModuleManagerPage.searchModule(page, dataModules.psNewProducts); + expect(isModuleVisible).to.eq(true); + }); - const found = await utilsFile.doesFileExist('module.zip'); - expect(found).to.eq(true); + it('should display the uninstall modal and cancel it', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'resetModuleAndCancel', baseContext); + + const textResult = await boModuleManagerPage.setActionInModule(page, dataModules.psNewProducts, 'uninstall', true); + expect(textResult).to.eq(''); + + const isModuleVisible = await boModuleManagerPage.isModuleVisible(page, dataModules.psNewProducts); + expect(isModuleVisible).to.eq(true); + + const isModalVisible = await boModuleManagerPage.isModalActionVisible(page, dataModules.psNewProducts, 'uninstall'); + expect(isModalVisible).to.eq(false); + + const dirExists = await utilsFile.doesFileExist(`${utilsFile.getRootPath()}/modules/${dataModules.psNewProducts.tag}/`); + expect(dirExists).to.eq(true); }); - it(`should upload the module '${dataModules.psNewProducts.name}'`, async function () { - await testContext.addContextItem(this, 'testIdentifier', 'uploadModule', baseContext); + it('should uninstall the module', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'resetModule', baseContext); + + const successMessage = await boModuleManagerPage.setActionInModule( + page, + dataModules.psNewProducts, + 'uninstall', + false, + true, + ); + expect(successMessage).to.eq(boModuleManagerPage.uninstallModuleSuccessMessage(dataModules.psNewProducts.tag)); - const successMessage = await boModuleManagerPage.uploadModule(page, 'module.zip'); - expect(successMessage).to.eq(boModuleManagerPage.uploadModuleSuccessMessage); + // Check the directory `modules/dataModules.psNewProducts.tag` + const dirExists = await utilsFile.doesFileExist(`${utilsFile.getRootPath()}/modules/${dataModules.psNewProducts.tag}/`); + expect(dirExists).to.eq(false); }); - it('should close upload module modal', async function () { - await testContext.addContextItem(this, 'testIdentifier', 'closeModal', baseContext); + it('should go to the front office', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'goToTheFo', baseContext); + + page = await boModuleManagerPage.viewMyShop(page); + await foClassicHomePage.changeLanguage(page, 'en'); - const isModalNotVisible = await boModuleManagerPage.closeUploadModuleModal(page); - expect(isModalNotVisible).to.eq(true); + const isHomePage = await foClassicHomePage.isHomePage(page); + expect(isHomePage).to.equal(true); }); - it(`should search the module '${dataModules.psNewProducts.name}'`, async function () { - await testContext.addContextItem(this, 'testIdentifier', 'checkModulePresent', baseContext); + it('should check if the "New Products" block is not visible', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'checkNotVisible', baseContext); - const isModuleVisible = await boModuleManagerPage.searchModule(page, dataModules.psNewProducts); - expect(isModuleVisible, 'Module is not visible!').to.eq(true); + const hasProductsBlock = await foClassicHomePage.hasProductsBlock(page, 'newproducts'); + expect(hasProductsBlock).to.eq(false); }); }); + + // POST-TEST: Install module + installModule(dataModules.psNewProducts, true, `${baseContext}_postTest_0`); }); diff --git a/tests/UI/campaigns/modules/ps_themecusto/01_installation/03_uninstallAndDeleteModule.ts b/tests/UI/campaigns/modules/ps_themecusto/01_installation/03_uninstallAndDeleteModule.ts index 618fa05260269..22f7eb02c1f5b 100644 --- a/tests/UI/campaigns/modules/ps_themecusto/01_installation/03_uninstallAndDeleteModule.ts +++ b/tests/UI/campaigns/modules/ps_themecusto/01_installation/03_uninstallAndDeleteModule.ts @@ -14,144 +14,111 @@ import { utilsFile, utilsPlaywright, } from '@prestashop-core/ui-testing'; +import {installModule} from '@commonTests/BO/modules/moduleManager'; const baseContext: string = 'modules_ps_themecusto_installation_uninstallAndDeleteModule'; describe('Theme Customization module - Uninstall and delete module', async () => { - let browserContext: BrowserContext; - let page: Page; - - // before and after functions - before(async function () { - browserContext = await utilsPlaywright.createBrowserContext(this.browser); - page = await utilsPlaywright.newTab(browserContext); - }); - - after(async () => { - await utilsPlaywright.closeBrowserContext(browserContext); - await utilsFile.deleteFile('module.zip'); - }); - - it('should login in BO', async function () { - await loginCommon.loginBO(this, page); - }); - - it('should go to \'Modules > Module Manager\' page', async function () { - await testContext.addContextItem(this, 'testIdentifier', 'goToModuleManagerPage', baseContext); - - await boDashboardPage.goToSubMenu( - page, - boDashboardPage.modulesParentLink, - boDashboardPage.moduleManagerLink, - ); - await boModuleManagerPage.closeSfToolBar(page); - - const pageTitle = await boModuleManagerPage.getPageTitle(page); - expect(pageTitle).to.contains(boModuleManagerPage.pageTitle); - }); - - it(`should search the module ${dataModules.psThemeCusto.name}`, async function () { - await testContext.addContextItem(this, 'testIdentifier', 'searchModule', baseContext); - - const isModuleVisible = await boModuleManagerPage.searchModule(page, dataModules.psThemeCusto); - expect(isModuleVisible).to.eq(true); - }); - - it('should display the uninstall modal and cancel it', async function () { - await testContext.addContextItem(this, 'testIdentifier', 'resetModuleAndCancel', baseContext); - - const textResult = await boModuleManagerPage.setActionInModule(page, dataModules.psThemeCusto, 'uninstall', true); - expect(textResult).to.eq(''); - - const isModuleVisible = await boModuleManagerPage.isModuleVisible(page, dataModules.psThemeCusto); - expect(isModuleVisible).to.eq(true); - - const isModalVisible = await boModuleManagerPage.isModalActionVisible(page, dataModules.psThemeCusto, 'uninstall'); - expect(isModalVisible).to.eq(false); - - const dirExists = await utilsFile.doesFileExist(`${utilsFile.getRootPath()}/modules/${dataModules.psThemeCusto.tag}/`); - expect(dirExists).to.eq(true); - }); - - it('should uninstall the module', async function () { - await testContext.addContextItem(this, 'testIdentifier', 'resetModule', baseContext); - - const successMessage = await boModuleManagerPage.setActionInModule(page, dataModules.psThemeCusto, 'uninstall', false, true); - expect(successMessage).to.eq(boModuleManagerPage.uninstallModuleSuccessMessage(dataModules.psThemeCusto.tag)); - - // Check the directory `modules/dataModules.psThemeCusto.tag` - const dirExists = await utilsFile.doesFileExist(`${utilsFile.getRootPath()}/modules/${dataModules.psThemeCusto.tag}/`); - expect(dirExists).to.eq(false); - }); - - it('should go to \'Design > Theme & Logo\' page', async function () { - await testContext.addContextItem(this, 'testIdentifier', 'goToThemeAndLogoPage', baseContext); - - // Reload => The "Theme & Logo" link identifier changes - await boModuleManagerPage.reloadPage(page); - await boDashboardPage.goToSubMenu( - page, - boDashboardPage.designParentLink, - boDashboardPage.themeAndLogoLink, - ); - await boThemeAndLogoPage.closeSfToolBar(page); - - const pageTitle = await boThemeAndLogoPage.getPageTitle(page); - expect(pageTitle).to.equal(boThemeAndLogoPage.pageTitle); - }); - - it('should check that tabs are not present', async function () { - await testContext.addContextItem(this, 'testIdentifier', 'checkTabsNotPresent', baseContext); + describe('Uninstall and delete module', async () => { + let browserContext: BrowserContext; + let page: Page; + + // before and after functions + before(async function () { + browserContext = await utilsPlaywright.createBrowserContext(this.browser); + page = await utilsPlaywright.newTab(browserContext); + }); - const hasSubTabAdvancedCustomization = await boThemeAndLogoPage.hasSubTabAdvancedCustomization(page); - expect(hasSubTabAdvancedCustomization).to.equal(false); + after(async () => { + await utilsPlaywright.closeBrowserContext(browserContext); + await utilsFile.deleteFile('module.zip'); + }); - const hasSubTabPagesConfiguration = await boThemeAndLogoPage.hasSubTabPagesConfiguration(page); - expect(hasSubTabPagesConfiguration).to.equal(false); - }); + it('should login in BO', async function () { + await loginCommon.loginBO(this, page); + }); - describe(`POST-CONDITION : Install the module ${dataModules.psThemeCusto.name}`, async () => { - it('should go back to Back Office', async function () { - await testContext.addContextItem(this, 'testIdentifier', 'returnToModulesManager', baseContext); + it('should go to \'Modules > Module Manager\' page', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'goToModuleManagerPage', baseContext); await boDashboardPage.goToSubMenu( page, boDashboardPage.modulesParentLink, boDashboardPage.moduleManagerLink, ); + await boModuleManagerPage.closeSfToolBar(page); const pageTitle = await boModuleManagerPage.getPageTitle(page); expect(pageTitle).to.contains(boModuleManagerPage.pageTitle); }); - it(`should download the zip of the module '${dataModules.psThemeCusto.name}'`, async function () { - await testContext.addContextItem(this, 'testIdentifier', 'downloadModule', baseContext); + it(`should search the module ${dataModules.psThemeCusto.name}`, async function () { + await testContext.addContextItem(this, 'testIdentifier', 'searchModule', baseContext); + + const isModuleVisible = await boModuleManagerPage.searchModule(page, dataModules.psThemeCusto); + expect(isModuleVisible).to.eq(true); + }); + + it('should display the uninstall modal and cancel it', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'resetModuleAndCancel', baseContext); - await utilsFile.downloadFile(dataModules.psThemeCusto.releaseZip, 'module.zip'); + const textResult = await boModuleManagerPage.setActionInModule(page, dataModules.psThemeCusto, 'uninstall', true); + expect(textResult).to.eq(''); - const found = await utilsFile.doesFileExist('module.zip'); - expect(found).to.eq(true); + const isModuleVisible = await boModuleManagerPage.isModuleVisible(page, dataModules.psThemeCusto); + expect(isModuleVisible).to.eq(true); + + const isModalVisible = await boModuleManagerPage.isModalActionVisible(page, dataModules.psThemeCusto, 'uninstall'); + expect(isModalVisible).to.eq(false); + + const dirExists = await utilsFile.doesFileExist(`${utilsFile.getRootPath()}/modules/${dataModules.psThemeCusto.tag}/`); + expect(dirExists).to.eq(true); }); - it(`should upload the module '${dataModules.psThemeCusto.name}'`, async function () { - await testContext.addContextItem(this, 'testIdentifier', 'uploadModule', baseContext); + it('should uninstall the module', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'resetModule', baseContext); + + const successMessage = await boModuleManagerPage.setActionInModule( + page, + dataModules.psThemeCusto, + 'uninstall', + false, + true, + ); + expect(successMessage).to.eq(boModuleManagerPage.uninstallModuleSuccessMessage(dataModules.psThemeCusto.tag)); - const successMessage = await boModuleManagerPage.uploadModule(page, 'module.zip'); - expect(successMessage).to.eq(boModuleManagerPage.uploadModuleSuccessMessage); + // Check the directory `modules/dataModules.psThemeCusto.tag` + const dirExists = await utilsFile.doesFileExist(`${utilsFile.getRootPath()}/modules/${dataModules.psThemeCusto.tag}/`); + expect(dirExists).to.eq(false); }); - it('should close upload module modal', async function () { - await testContext.addContextItem(this, 'testIdentifier', 'closeModal', baseContext); + it('should go to \'Design > Theme & Logo\' page', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'goToThemeAndLogoPage', baseContext); + + // Reload => The "Theme & Logo" link identifier changes + await boModuleManagerPage.reloadPage(page); + await boDashboardPage.goToSubMenu( + page, + boDashboardPage.designParentLink, + boDashboardPage.themeAndLogoLink, + ); + await boThemeAndLogoPage.closeSfToolBar(page); - const isModalNotVisible = await boModuleManagerPage.closeUploadModuleModal(page); - expect(isModalNotVisible).to.eq(true); + const pageTitle = await boThemeAndLogoPage.getPageTitle(page); + expect(pageTitle).to.equal(boThemeAndLogoPage.pageTitle); }); - it(`should search the module '${dataModules.psThemeCusto.name}'`, async function () { - await testContext.addContextItem(this, 'testIdentifier', 'checkModulePresent', baseContext); + it('should check that tabs are not present', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'checkTabsNotPresent', baseContext); - const isModuleVisible = await boModuleManagerPage.searchModule(page, dataModules.psThemeCusto); - expect(isModuleVisible, 'Module is not visible!').to.eq(true); + const hasSubTabAdvancedCustomization = await boThemeAndLogoPage.hasSubTabAdvancedCustomization(page); + expect(hasSubTabAdvancedCustomization).to.equal(false); + + const hasSubTabPagesConfiguration = await boThemeAndLogoPage.hasSubTabPagesConfiguration(page); + expect(hasSubTabPagesConfiguration).to.equal(false); }); }); + + // POST-TEST: Install module + installModule(dataModules.psThemeCusto, true, `${baseContext}_postTest_0`); }); diff --git a/tests/UI/commonTests/BO/advancedParameters/multistore.ts b/tests/UI/commonTests/BO/advancedParameters/multistore.ts index 0c5b4cbbd1cc6..1252d89adcd31 100644 --- a/tests/UI/commonTests/BO/advancedParameters/multistore.ts +++ b/tests/UI/commonTests/BO/advancedParameters/multistore.ts @@ -4,13 +4,11 @@ import testContext from '@utils/testContext'; // Import commonTests import loginCommon from '@commonTests/BO/loginBO'; -// Import BO pages -import generalPage from '@pages/BO/shopParameters/general'; - import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; import { boDashboardPage, + boShopParametersPage, utilsPlaywright, } from '@prestashop-core/ui-testing'; @@ -46,17 +44,17 @@ function setMultiStoreStatus(status: boolean, baseContext: string = 'commonTests boDashboardPage.shopParametersParentLink, boDashboardPage.shopParametersGeneralLink, ); - await generalPage.closeSfToolBar(page); + await boShopParametersPage.closeSfToolBar(page); - const pageTitle = await generalPage.getPageTitle(page); - expect(pageTitle).to.contains(generalPage.pageTitle); + const pageTitle = await boShopParametersPage.getPageTitle(page); + expect(pageTitle).to.contains(boShopParametersPage.pageTitle); }); it(`should ${status ? 'enable' : 'disable'} the multistore`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'setMultiStoreStatus', baseContext); - const result = await generalPage.setMultiStoreStatus(page, status); - expect(result).to.contains(generalPage.successfulUpdateMessage); + const result = await boShopParametersPage.setMultiStoreStatus(page, status); + expect(result).to.contains(boShopParametersPage.successfulUpdateMessage); }); }); } diff --git a/tests/UI/commonTests/BO/modules/moduleManager.ts b/tests/UI/commonTests/BO/modules/moduleManager.ts index 11cd55a3b79c6..ecdddded54c61 100644 --- a/tests/UI/commonTests/BO/modules/moduleManager.ts +++ b/tests/UI/commonTests/BO/modules/moduleManager.ts @@ -13,12 +13,21 @@ import { import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; -function installModule(module: FakerModule, baseContext: string = 'commonTests-installModule'): void { +/** + * + * @param module {FakerModule} + * @param versionCurrent {boolean} + * @param baseContext {string} + */ +function installModule( + module: FakerModule, + versionCurrent: boolean = true, + baseContext: string = 'commonTests-installModule', +): void { describe(`Install module ${module.name}`, async () => { let browserContext: BrowserContext; let page: Page; - // before and after functions before(async function () { browserContext = await utilsPlaywright.createBrowserContext(this.browser); page = await utilsPlaywright.newTab(browserContext); @@ -36,7 +45,7 @@ function installModule(module: FakerModule, baseContext: string = 'commonTests-i it(`should download the zip of the module '${module.name}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'downloadModule', baseContext); - await utilsFile.downloadFile(module.releaseZip, 'module.zip'); + await utilsFile.downloadFile(module.releaseZip(versionCurrent ? module.versionCurrent : module.versionOld), 'module.zip'); const found = await utilsFile.doesFileExist('module.zip'); expect(found).to.eq(true); diff --git a/tests/UI/package-lock.json b/tests/UI/package-lock.json index b81180fe81713..7afdf994608b7 100644 --- a/tests/UI/package-lock.json +++ b/tests/UI/package-lock.json @@ -431,7 +431,7 @@ }, "node_modules/@prestashop-core/ui-testing": { "version": "0.0.12", - "resolved": "git+ssh://git@github.com/PrestaShop/ui-testing-library.git#d1614987ffb45735b4d7e76db6a4d162c3defc13", + "resolved": "git+ssh://git@github.com/PrestaShop/ui-testing-library.git#ec8ca442757eba67346a66f75f49379583f90dd7", "license": "MIT", "dependencies": { "@faker-js/faker": "^8.3.1", @@ -8430,7 +8430,7 @@ } }, "@prestashop-core/ui-testing": { - "version": "git+ssh://git@github.com/PrestaShop/ui-testing-library.git#d1614987ffb45735b4d7e76db6a4d162c3defc13", + "version": "git+ssh://git@github.com/PrestaShop/ui-testing-library.git#ec8ca442757eba67346a66f75f49379583f90dd7", "from": "@prestashop-core/ui-testing@https://github.com/PrestaShop/ui-testing-library#main", "requires": { "@faker-js/faker": "^8.3.1", diff --git a/tests/UI/pages/BO/shopParameters/general/index.ts b/tests/UI/pages/BO/shopParameters/general/index.ts deleted file mode 100644 index 16536d3a04efe..0000000000000 --- a/tests/UI/pages/BO/shopParameters/general/index.ts +++ /dev/null @@ -1,141 +0,0 @@ -import BOBasePage from '@pages/BO/BObasePage'; - -import type {Page} from 'playwright'; - -/** - * General page, contains selectors and functions for the page - * @class - * @extends BOBasePage - */ -class ShopParamsGeneral extends BOBasePage { - public readonly pageTitle: string; - - private readonly maintenanceNavItemLink: string; - - private readonly roundModeSelect: string; - - private readonly displaySuppliersToggleInput: (toggle: number) => string; - - private readonly allowIframesToggleInput: (toggle: number) => string; - - private readonly displayBrandsToggleInput: (toggle: number) => string; - - private readonly displayBestSellersToggleInput: (toggle: number) => string; - - private readonly enableMultiStoreToggleInput: (toggle: number) => string; - - private readonly saveFormButton: string; - - /** - * @constructs - * Setting up titles and selectors to use on general page - */ - constructor() { - super(); - - this.pageTitle = 'Preferences •'; - - // Selectors - this.maintenanceNavItemLink = '#subtab-AdminMaintenance'; - this.roundModeSelect = '#form_price_round_mode'; - this.allowIframesToggleInput = (toggle: number) => `#form_allow_html_iframes_${toggle}`; - this.displaySuppliersToggleInput = (toggle: number) => `#form_display_suppliers_${toggle}`; - this.displayBrandsToggleInput = (toggle: number) => `#form_display_manufacturers_${toggle}`; - this.displayBestSellersToggleInput = (toggle: number) => `#form_display_best_sellers_${toggle}`; - this.enableMultiStoreToggleInput = (toggle: number) => `#form_multishop_feature_active_${toggle}`; - this.saveFormButton = '#form-preferences-save-button'; - } - - /* - Methods - */ - - /** - * Change Tab to Maintenance in Shop Parameters General Page - * @param page {Page} Browser tab - * @return {Promise} - */ - async goToSubTabMaintenance(page: Page): Promise { - await this.clickAndWaitForURL(page, this.maintenanceNavItemLink); - } - - /** - * Select round mode - * @param page {Page} Browser tab - * @param roundMode {string} Round mode to select - * @return {Promise} - */ - async selectRoundMode(page: Page, roundMode: string): Promise { - await this.selectByVisibleText(page, this.roundModeSelect, roundMode); - await this.clickAndWaitForLoadState(page, this.saveFormButton); - - return this.getAlertSuccessBlockParagraphContent(page); - } - - /** - * Enable/Disable display suppliers - * @param page {Page} Browser tab - * @param toEnable {boolean} Status to set to enable/disable suppliers - * @returns {Promise} - */ - async setAllowIframes(page: Page, toEnable: boolean = true): Promise { - await this.setChecked(page, this.allowIframesToggleInput(toEnable ? 1 : 0)); - await this.clickAndWaitForLoadState(page, this.saveFormButton); - - return this.getAlertSuccessBlockParagraphContent(page); - } - - /** - * Enable/Disable display suppliers - * @param page {Page} Browser tab - * @param toEnable {boolean} Status to set to enable/disable suppliers - * @returns {Promise} - */ - async setDisplaySuppliers(page: Page, toEnable: boolean = true): Promise { - await this.setChecked(page, this.displaySuppliersToggleInput(toEnable ? 1 : 0)); - await this.clickAndWaitForLoadState(page, this.saveFormButton); - - return this.getAlertSuccessBlockParagraphContent(page); - } - - /** - * Enable/Disable best sellers - * @param page {Page} Browser tab - * @param toEnable {boolean} Status to set to enable/disable suppliers - * @returns {Promise} - */ - async setDisplayBestSellers(page: Page, toEnable: boolean = true): Promise { - await this.setChecked(page, this.displayBestSellersToggleInput(toEnable ? 1 : 0)); - await this.clickAndWaitForLoadState(page, this.saveFormButton); - - return this.getAlertSuccessBlockParagraphContent(page); - } - - /** - * Enable/Disable display brands - * @param page {Page} Browser tab - * @param toEnable {boolean} Status to set to enable/disable brands - * @returns {Promise} - */ - async setDisplayBrands(page: Page, toEnable: boolean = true): Promise { - await this.setChecked(page, this.displayBrandsToggleInput(toEnable ? 1 : 0)); - await this.clickAndWaitForLoadState(page, this.saveFormButton); - - return this.getAlertSuccessBlockParagraphContent(page); - } - - /** - * Enable/Disable multi store - * @param page {Page} Browser tab - * @param toEnable {boolean} Status to set to enable/disable multistore - * @returns {Promise} - */ - async setMultiStoreStatus(page: Page, toEnable: boolean = true): Promise { - await this.setChecked(page, this.enableMultiStoreToggleInput(toEnable ? 1 : 0)); - await this.clickAndWaitForLoadState(page, this.saveFormButton); - - return this.getAlertSuccessBlockParagraphContent(page); - } -} - -export default new ShopParamsGeneral();