diff --git a/tests/UI/campaigns/functional/BO/01_dashboard/02_activityOverview.ts b/tests/UI/campaigns/functional/BO/01_dashboard/02_activityOverview.ts index c5bf195ff6463..2eccee7c0e321 100644 --- a/tests/UI/campaigns/functional/BO/01_dashboard/02_activityOverview.ts +++ b/tests/UI/campaigns/functional/BO/01_dashboard/02_activityOverview.ts @@ -354,7 +354,7 @@ describe('BO - Dashboard : Activity overview', async () => { expect(pageTitle).to.contains(boDashboardPage.pageTitle); }); - // @todo https://github.com/PrestaShop/PrestaShop/issues/34321 + // @todo : https://github.com/PrestaShop/PrestaShop/issues/34321 it('should check Return/Exchange number', async function () { await testContext.addContextItem(this, 'testIdentifier', 'checkReturnExchangeNumber', baseContext); @@ -711,7 +711,7 @@ describe('BO - Dashboard : Activity overview', async () => { expect(isConfigureFormVisible).to.eq(true); }); - // @todo https://github.com/PrestaShop/PrestaShop/issues/34326 + // @todo : https://github.com/PrestaShop/PrestaShop/issues/34326 }); // Post-condition : Delete created customer diff --git a/tests/UI/campaigns/functional/BO/01_dashboard/03_productsAndSales.ts b/tests/UI/campaigns/functional/BO/01_dashboard/03_productsAndSales.ts index e8e5e9c162a5e..8976935e82418 100644 --- a/tests/UI/campaigns/functional/BO/01_dashboard/03_productsAndSales.ts +++ b/tests/UI/campaigns/functional/BO/01_dashboard/03_productsAndSales.ts @@ -124,7 +124,7 @@ describe('BO - Dashboard : Products and sales', async () => { expect(isConfigureFormVisible).to.eq(true); }); - // @todo https://github.com/PrestaShop/PrestaShop/issues/34326 + // @todo : https://github.com/PrestaShop/PrestaShop/issues/34326 }); }); }); diff --git a/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/04_selectPreviousCarts.ts b/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/04_selectPreviousCarts.ts index cbdb4dab69bd3..42b8bc5e4b208 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/04_selectPreviousCarts.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/04_selectPreviousCarts.ts @@ -196,7 +196,8 @@ describe('BO - Orders - Create Order : Select Previous Carts', async () => { }); }); - // To delete when this issue: https://github.com/PrestaShop/PrestaShop/issues/9589 is fixed + // @todo : https://github.com/PrestaShop/PrestaShop/issues/9589 + // Delete when fixed describe('Delete the Non ordered shopping carts', async () => { it('should go to \'Orders > Shopping carts\' page', async function () { await testContext.addContextItem(this, 'testIdentifier', 'goToShoppingCartsPage2', baseContext); diff --git a/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/07_messagesBlock.ts b/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/07_messagesBlock.ts index d21ff635f3cb2..5ee7e2b2c9c01 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/07_messagesBlock.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/07_messagesBlock.ts @@ -41,7 +41,7 @@ Pre-condition : Scenario : - Go to view order page - Send message and check message block( messages number, employee icon, date, sender) -- Check message in FO -> Issue https://github.com/PrestaShop/PrestaShop/issues/26532 +- Check message in FO - Uncheck display to customer and send message then check( messages number, message text, employee icon, date, sender) - Check that the message is not visible in FO - Send message from FO and check it on BO ( messages number, Message text, employee icon, date, sender) diff --git a/tests/UI/campaigns/functional/BO/11_international/04_translations/01_modifyTranslation.ts b/tests/UI/campaigns/functional/BO/11_international/04_translations/01_modifyTranslation.ts index d111758ddde5d..67f2209393dfe 100644 --- a/tests/UI/campaigns/functional/BO/11_international/04_translations/01_modifyTranslation.ts +++ b/tests/UI/campaigns/functional/BO/11_international/04_translations/01_modifyTranslation.ts @@ -265,7 +265,7 @@ describe('BO - International - Translation : Modify translation', async () => { await foHummingbirdHomePage.clickAddWishListProduct(page, 1); - //@todo : Move to foHummingbirdModalWishlistPage + // @todo : Move to foHummingbirdModalWishlistPage const wishlistModalTitle = await foClassicModalWishlistPage.getModalAddToTitle(page); expect(wishlistModalTitle).to.equal('Add to wishlist now'); }); diff --git a/tests/UI/campaigns/functional/BO/15_header/07_myProfile.ts b/tests/UI/campaigns/functional/BO/15_header/07_myProfile.ts index ad599877e70b0..64da40e64ad7e 100644 --- a/tests/UI/campaigns/functional/BO/15_header/07_myProfile.ts +++ b/tests/UI/campaigns/functional/BO/15_header/07_myProfile.ts @@ -12,11 +12,11 @@ import loginCommon from '@commonTests/BO/loginBO'; // Import pages import creditSlipsPage from '@pages/BO/orders/creditSlips'; import employeesPage from '@pages/BO/advancedParameters/team'; -import myProfilePage from '@pages/BO/advancedParameters/team/myProfile'; import { boDashboardPage, boLoginPage, + boMyProfilePage, boProductsPage, type EmployeePermission, FakerEmployee, @@ -81,10 +81,10 @@ describe('BO - Header : My profile', async () => { await testContext.addContextItem(this, 'testIdentifier', 'goToMyProfilePage', baseContext); await boDashboardPage.goToMyProfile(page); - await myProfilePage.closeSfToolBar(page); + await boMyProfilePage.closeSfToolBar(page); - const pageTitle = await myProfilePage.getPageTitle(page); - expect(pageTitle).to.contains(myProfilePage.pageTitleEdit(employeeData.lastName, employeeData.firstName)); + const pageTitle = await boMyProfilePage.getPageTitle(page); + expect(pageTitle).to.contains(boMyProfilePage.pageTitleEdit(employeeData.lastName, employeeData.firstName)); }); }); @@ -95,15 +95,15 @@ describe('BO - Header : My profile', async () => { employeeData.firstName = 'Hello222'; employeeData.lastName = 'World333'; - await myProfilePage.updateEditEmployee(page, employeeData.password, employeeData); + await boMyProfilePage.updateEditEmployee(page, employeeData.password, employeeData); - const textResult = await myProfilePage.getAlertError(page); - expect(textResult).to.equal(myProfilePage.errorInvalidFirstNameMessage); + const textResult = await boMyProfilePage.getAlertError(page); + expect(textResult).to.equal(boMyProfilePage.errorInvalidFirstNameMessage); - const lastNameResult = await myProfilePage.getInputValue(page, 'lastname'); + const lastNameResult = await boMyProfilePage.getInputValue(page, 'lastname'); expect(lastNameResult).to.equal(employeeData.lastName); - const firstNameResult = await myProfilePage.getInputValue(page, 'firstname'); + const firstNameResult = await boMyProfilePage.getInputValue(page, 'firstname'); expect(firstNameResult).to.equal(employeeData.firstName); }); @@ -112,15 +112,15 @@ describe('BO - Header : My profile', async () => { employeeData.firstName = 'Hello man'; - await myProfilePage.updateEditEmployee(page, employeeData.password, employeeData); + await boMyProfilePage.updateEditEmployee(page, employeeData.password, employeeData); - const textResult = await myProfilePage.getAlertError(page); - expect(textResult).to.equal(myProfilePage.errorInvalidLastNameMessage); + const textResult = await boMyProfilePage.getAlertError(page); + expect(textResult).to.equal(boMyProfilePage.errorInvalidLastNameMessage); - const lastNameResult = await myProfilePage.getInputValue(page, 'lastname'); + const lastNameResult = await boMyProfilePage.getInputValue(page, 'lastname'); expect(lastNameResult).to.equal(employeeData.lastName); - const firstNameResult = await myProfilePage.getInputValue(page, 'firstname'); + const firstNameResult = await boMyProfilePage.getInputValue(page, 'firstname'); expect(firstNameResult).to.equal(employeeData.firstName); }); @@ -130,19 +130,19 @@ describe('BO - Header : My profile', async () => { employeeData.firstName = 'Hello'; employeeData.lastName = 'World'; - await myProfilePage.updateEditEmployee(page, employeeData.password, employeeData); + await boMyProfilePage.updateEditEmployee(page, employeeData.password, employeeData); - const textResult = await myProfilePage.getAlertSuccess(page); - expect(textResult).to.equal(myProfilePage.successfulUpdateMessage); + const textResult = await boMyProfilePage.getAlertSuccess(page); + expect(textResult).to.equal(boMyProfilePage.successfulUpdateMessage); - const lastNameResult = await myProfilePage.getInputValue(page, 'lastname'); + const lastNameResult = await boMyProfilePage.getInputValue(page, 'lastname'); expect(lastNameResult).to.equal(employeeData.lastName); - const firstNameResult = await myProfilePage.getInputValue(page, 'firstname'); + const firstNameResult = await boMyProfilePage.getInputValue(page, 'firstname'); expect(firstNameResult).to.equal(employeeData.firstName); - const pageTitle = await myProfilePage.getPageTitle(page); - expect(pageTitle).to.contains(myProfilePage.pageTitleEdit(employeeData.lastName, employeeData.firstName)); + const pageTitle = await boMyProfilePage.getPageTitle(page); + expect(pageTitle).to.contains(boMyProfilePage.pageTitleEdit(employeeData.lastName, employeeData.firstName)); }); it('should upload an invalid format image and check error message', async function () { @@ -151,10 +151,10 @@ describe('BO - Header : My profile', async () => { employeeData.avatarFile = 'image.svg'; - await myProfilePage.updateEditEmployee(page, employeeData.password, employeeData); + await boMyProfilePage.updateEditEmployee(page, employeeData.password, employeeData); - const textResult = await myProfilePage.getAlertError(page); - expect(textResult).to.contains(myProfilePage.errorInvalidFormatImageMessage); + const textResult = await boMyProfilePage.getAlertError(page); + expect(textResult).to.contains(boMyProfilePage.errorInvalidFormatImageMessage); // Delete created file await utilsFile.deleteFile('image.svg'); @@ -166,10 +166,10 @@ describe('BO - Header : My profile', async () => { employeeData.avatarFile = 'image.jpg'; - await myProfilePage.updateEditEmployee(page, employeeData.password, employeeData); + await boMyProfilePage.updateEditEmployee(page, employeeData.password, employeeData); - const textResult = await myProfilePage.getAlertSuccess(page); - expect(textResult).to.equal(myProfilePage.successfulUpdateMessage); + const textResult = await boMyProfilePage.getAlertSuccess(page); + expect(textResult).to.equal(boMyProfilePage.successfulUpdateMessage); // Delete created file await utilsFile.deleteFile('image.jpg'); @@ -181,15 +181,15 @@ describe('BO - Header : My profile', async () => { await testContext.addContextItem(this, 'testIdentifier', 'checkGravatar', baseContext); employeeData.enableGravatar = true; - await myProfilePage.updateEditEmployee(page, employeeData.password, employeeData); + await boMyProfilePage.updateEditEmployee(page, employeeData.password, employeeData); - const textResult = await myProfilePage.getAlertSuccess(page); - expect(textResult).to.equal(myProfilePage.successfulUpdateMessage); + const textResult = await boMyProfilePage.getAlertSuccess(page); + expect(textResult).to.equal(boMyProfilePage.successfulUpdateMessage); - const isChecked = await myProfilePage.isGravatarEnabled(page); + const isChecked = await boMyProfilePage.isGravatarEnabled(page); expect(isChecked).to.eq(true); - const avatarURL = await myProfilePage.getCurrentEmployeeAvatar(page); + const avatarURL = await boMyProfilePage.getCurrentEmployeeAvatar(page); expect(avatarURL).to.contains('https://www.gravatar.com/avatar/'); // Reset value @@ -203,10 +203,10 @@ describe('BO - Header : My profile', async () => { employeeData.language = 'English (English)'; employeeData.defaultPage = 'Credit Slips'; - await myProfilePage.updateEditEmployee(page, employeeData.password, employeeData); + await boMyProfilePage.updateEditEmployee(page, employeeData.password, employeeData); - const textResult = await myProfilePage.getAlertSuccess(page); - expect(textResult).to.equal(myProfilePage.successfulUpdateMessage); + const textResult = await boMyProfilePage.getAlertSuccess(page); + expect(textResult).to.equal(boMyProfilePage.successfulUpdateMessage); }); it('should logout from BO', async function () { @@ -230,10 +230,10 @@ describe('BO - Header : My profile', async () => { employeeData.language = 'English (English)'; - await myProfilePage.updateEditEmployee(page, employeeData.password, employeeData); + await boMyProfilePage.updateEditEmployee(page, employeeData.password, employeeData); - const textResult = await myProfilePage.getAlertSuccess(page); - expect(textResult).to.equal(myProfilePage.successfulUpdateMessage); + const textResult = await boMyProfilePage.getAlertSuccess(page); + expect(textResult).to.equal(boMyProfilePage.successfulUpdateMessage); }); }); diff --git a/tests/UI/campaigns/functional/FO/classic/08_menuAndNavigation/02_sortAndFilter/01_sortProducts.ts b/tests/UI/campaigns/functional/FO/classic/08_menuAndNavigation/02_sortAndFilter/01_sortProducts.ts index 0768dba1a9f93..f891819f8371f 100644 --- a/tests/UI/campaigns/functional/FO/classic/08_menuAndNavigation/02_sortAndFilter/01_sortProducts.ts +++ b/tests/UI/campaigns/functional/FO/classic/08_menuAndNavigation/02_sortAndFilter/01_sortProducts.ts @@ -156,7 +156,7 @@ describe('FO - Menu and navigation : Sort products', async () => { sortDirection: 'asc', }, }, - // @todo https://github.com/PrestaShop/PrestaShop/issues/19810 + // @todo : https://github.com/PrestaShop/PrestaShop/issues/19810 /* { args: { testIdentifier: 'sortByPriceDesc', diff --git a/tests/UI/campaigns/functional/FO/hummingbird/06_homePage/05_selectColor.ts b/tests/UI/campaigns/functional/FO/hummingbird/06_homePage/05_selectColor.ts index 696c1b29eee25..704b528bbcbaf 100644 --- a/tests/UI/campaigns/functional/FO/hummingbird/06_homePage/05_selectColor.ts +++ b/tests/UI/campaigns/functional/FO/hummingbird/06_homePage/05_selectColor.ts @@ -56,7 +56,7 @@ describe('FO - Home Page : Select color', async () => { const pageURL = await foHummingbirdProductPage.getCurrentURL(page); expect(pageURL).to.contains('color-white'); - // @todo https://github.com/PrestaShop/PrestaShop/issues/35481 + // @todo : https://github.com/PrestaShop/PrestaShop/issues/35481 // .and.to.contains('size-m'); }); @@ -83,7 +83,7 @@ describe('FO - Home Page : Select color', async () => { const pageURL = await foHummingbirdProductPage.getCurrentURL(page); expect(pageURL).to.contains('color-black'); - // @todo https://github.com/PrestaShop/PrestaShop/issues/35481 + // @todo : https://github.com/PrestaShop/PrestaShop/issues/35481 // .and.to.contains('size-m'); }); }); diff --git a/tests/UI/campaigns/functional/FO/hummingbird/08_menuAndNavigation/02_sortAndFilter/01_sortProducts.ts b/tests/UI/campaigns/functional/FO/hummingbird/08_menuAndNavigation/02_sortAndFilter/01_sortProducts.ts index e934a88196c92..b742f8ae67909 100644 --- a/tests/UI/campaigns/functional/FO/hummingbird/08_menuAndNavigation/02_sortAndFilter/01_sortProducts.ts +++ b/tests/UI/campaigns/functional/FO/hummingbird/08_menuAndNavigation/02_sortAndFilter/01_sortProducts.ts @@ -162,7 +162,7 @@ describe('FO - Menu and navigation : Sort products', async () => { sortDirection: 'asc', }, }, - // @todo https://github.com/PrestaShop/PrestaShop/issues/19810 + // @todo : https://github.com/PrestaShop/PrestaShop/issues/19810 /*{ args: { testIdentifier: 'sortByPriceDesc', diff --git a/tests/UI/campaigns/modules/psgdpr/02_configuration/05_help.ts b/tests/UI/campaigns/modules/psgdpr/02_configuration/05_help.ts new file mode 100644 index 0000000000000..543133729bbc5 --- /dev/null +++ b/tests/UI/campaigns/modules/psgdpr/02_configuration/05_help.ts @@ -0,0 +1,215 @@ +// Import utils +import testContext from '@utils/testContext'; + +// Import commonTests +import loginCommon from '@commonTests/BO/loginBO'; + +import {expect} from 'chai'; +import type {BrowserContext, Page} from 'playwright'; +import { + boDashboardPage, + boModuleManagerPage, + boMyProfilePage, + dataEmployees, + dataModules, + FakerEmployee, + modPsGdprBoMain, + modPsGdprBoTabHelp, + utilsFile, + utilsPlaywright, +} from '@prestashop-core/ui-testing'; + +const baseContext: string = 'modules_psgdpr_configuration_help'; + +describe('BO - Modules - GDPR: Help', async () => { + let browserContext: BrowserContext; + let page: Page; + const employeeData: FakerEmployee = {...dataEmployees.defaultEmployee}; + + before(async function () { + browserContext = await utilsPlaywright.createBrowserContext(this.browser); + page = await utilsPlaywright.newTab(browserContext); + }); + + after(async () => { + await utilsPlaywright.closeBrowserContext(browserContext); + }); + + 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.psGdpr.name}`, async function () { + await testContext.addContextItem(this, 'testIdentifier', 'searchModule', baseContext); + + const isModuleVisible = await boModuleManagerPage.searchModule(page, dataModules.psGdpr); + expect(isModuleVisible).to.eq(true); + }); + + it(`should go to the configuration page of the module '${dataModules.psGdpr.name}'`, async function () { + await testContext.addContextItem(this, 'testIdentifier', 'goToConfigurationPage', baseContext); + + await boModuleManagerPage.goToConfigurationPage(page, dataModules.psGdpr.tag); + + const pageTitle = await modPsGdprBoMain.getPageSubtitle(page); + expect(pageTitle).to.eq(modPsGdprBoMain.pageSubTitle); + }); + + it('should display the tab "Help"', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'displayTabHelp', baseContext); + + const isTabVisible = await modPsGdprBoMain.goToTab(page, 5); + expect(isTabVisible).to.be.equals(true); + }); + + [ + 'Data accessibility', + 'Customer consent', + 'Data erasure', + ].forEach((test: string, index: number) => { + it(`should expand/shrink questions of the group "${test}"`, async function () { + await testContext.addContextItem(this, 'testIdentifier', `expandShrinkQuestions${index}`, baseContext); + + const numQuestions = await modPsGdprBoTabHelp.getCountQuestions(page, test); + expect(numQuestions).to.gt(0); + + for (let numQuestion = 1; numQuestion <= numQuestions; numQuestion++) { + const isQuestionVisibleAfterOpen = await modPsGdprBoTabHelp.clickQuestion(page, test, numQuestion); + expect(isQuestionVisibleAfterOpen).to.be.equals(true); + + const isQuestionVisibleAfterClose = await modPsGdprBoTabHelp.clickQuestion(page, test, numQuestion); + expect(isQuestionVisibleAfterClose).to.be.equals(false); + } + }); + }); + + it('should download the documentation in English', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'downloadDocEn', baseContext); + + const filePath = await modPsGdprBoTabHelp.downloadDocumentation(page); + expect(filePath).to.not.eq(null); + + const doesFileExist = await utilsFile.doesFileExist(filePath, 5000); + expect(doesFileExist).to.eq(true); + + const hasTitle = await utilsFile.isTextInPDF(filePath, 'User guide'); + expect(hasTitle).to.eq(true); + + const hasSubTitle = await utilsFile.isTextInPDF(filePath, 'OFFICIAL GDPR COMPLIANCE BY PRESTASHOP'); + expect(hasSubTitle).to.eq(true); + + await utilsFile.deleteFile(filePath); + }); + + it('should go to \'Your profile\' page', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'goToMyProfilePage', baseContext); + + await boDashboardPage.goToMyProfile(page); + await boMyProfilePage.closeSfToolBar(page); + + const pageTitle = await boMyProfilePage.getPageTitle(page); + expect(pageTitle).to.contains( + boMyProfilePage.pageTitleEdit(dataEmployees.defaultEmployee.lastName, dataEmployees.defaultEmployee.firstName), + ); + }); + + it('should update the language in French', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'updateLanguage', baseContext); + + employeeData.language = 'Français (French)'; + await boMyProfilePage.updateEditEmployee(page, employeeData.password, employeeData); + + const textResult = await boMyProfilePage.getAlertSuccess(page); + expect(textResult).to.equal(boMyProfilePage.successfulUpdateMessage); + }); + + it('should go to \'Modules > Module Manager\' page', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'returnToModuleManagerPage', baseContext); + + await boDashboardPage.goToSubMenu( + page, + boDashboardPage.modulesParentLink, + boDashboardPage.moduleManagerLink, + ); + await boModuleManagerPage.closeSfToolBar(page); + + const pageTitle = await boModuleManagerPage.getPageTitle(page); + expect(pageTitle).to.contains(boModuleManagerPage.pageTitleFr); + }); + + it(`should search the module ${dataModules.psGdpr.name}`, async function () { + await testContext.addContextItem(this, 'testIdentifier', 'returnSearchModule', baseContext); + + const isModuleVisible = await boModuleManagerPage.searchModule(page, dataModules.psGdpr); + expect(isModuleVisible).to.eq(true); + }); + + it(`should go to the configuration page of the module '${dataModules.psGdpr.name}'`, async function () { + await testContext.addContextItem(this, 'testIdentifier', 'returnToConfigurationPage', baseContext); + + await boModuleManagerPage.goToConfigurationPage(page, dataModules.psGdpr.tag); + + const pageTitle = await modPsGdprBoMain.getPageSubtitle(page); + expect(pageTitle).to.eq(modPsGdprBoMain.pageSubTitleFr); + }); + + it('should display the tab "Help"', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'returnTabHelp', baseContext); + + const isTabVisible = await modPsGdprBoMain.goToTab(page, 5); + expect(isTabVisible).to.be.equals(true); + }); + + it('should download the documentation in French', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'downloadDocFr', baseContext); + + const filePath = await modPsGdprBoTabHelp.downloadDocumentation(page); + expect(filePath).to.not.eq(null); + + const doesFileExist = await utilsFile.doesFileExist(filePath, 5000); + expect(doesFileExist).to.eq(true); + + const hasTitle = await utilsFile.isTextInPDF(filePath, 'Guide d’utilisation'); + expect(hasTitle).to.eq(true); + + const hasSubTitle = await utilsFile.isTextInPDF(filePath, 'RGPD OFFICIEL, ,PAR PRESTASHOP'); + expect(hasSubTitle).to.eq(true); + + await utilsFile.deleteFile(filePath); + }); + + it('should return to \'Your profile\' page', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'returnToMyProfilePage', baseContext); + + await boDashboardPage.goToMyProfile(page); + await boMyProfilePage.closeSfToolBar(page); + + const pageTitle = await boMyProfilePage.getPageTitle(page); + expect(pageTitle).to.contains( + boMyProfilePage.pageTitleEditFr(dataEmployees.defaultEmployee.lastName, dataEmployees.defaultEmployee.firstName), + ); + }); + + it('should reset the language', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'resetLanguage', baseContext); + + await boMyProfilePage.updateEditEmployee(page, dataEmployees.defaultEmployee.password, dataEmployees.defaultEmployee); + + const textResult = await boMyProfilePage.getAlertSuccess(page); + expect(textResult).to.equal(boMyProfilePage.successfulUpdateMessageFR); + }); +}); diff --git a/tests/UI/campaigns/modules/psgdpr/02_configuration/08_personalDataManagerForGuest.ts b/tests/UI/campaigns/modules/psgdpr/02_configuration/08_personalDataManagerForGuest.ts index e87088bb038eb..52bee9c9c598d 100644 --- a/tests/UI/campaigns/modules/psgdpr/02_configuration/08_personalDataManagerForGuest.ts +++ b/tests/UI/campaigns/modules/psgdpr/02_configuration/08_personalDataManagerForGuest.ts @@ -126,7 +126,7 @@ describe('BO - Modules - GDPR: Personal data manager for guest', async () => { expect(numCustomerDataResults).to.equal(1); }); - //@todo : https://github.com/PrestaShop/PrestaShop/issues/36848 + // @todo : https://github.com/PrestaShop/PrestaShop/issues/36848 it('should click on the card', async function () { await testContext.addContextItem(this, 'testIdentifier', 'clickResultCard', baseContext); @@ -146,7 +146,7 @@ describe('BO - Modules - GDPR: Personal data manager for guest', async () => { */ }); - //@todo : https://github.com/PrestaShop/PrestaShop/issues/36848 + // @todo : https://github.com/PrestaShop/PrestaShop/issues/36848 it('should click on details', async function () { await testContext.addContextItem(this, 'testIdentifier', 'clickDetails', baseContext); @@ -236,7 +236,7 @@ describe('BO - Modules - GDPR: Personal data manager for guest', async () => { expect(numCustomerDataResults).to.equal(1); }); - //@todo : https://github.com/PrestaShop/PrestaShop/issues/36848 + // @todo : https://github.com/PrestaShop/PrestaShop/issues/36848 it('should click on the card', async function () { await testContext.addContextItem(this, 'testIdentifier', 'clickResultCardAfterOrder', baseContext); @@ -256,7 +256,7 @@ describe('BO - Modules - GDPR: Personal data manager for guest', async () => { */ }); - //@todo : https://github.com/PrestaShop/PrestaShop/issues/36848 + // @todo : https://github.com/PrestaShop/PrestaShop/issues/36848 it('should click on Download Invoices', async function () { await testContext.addContextItem(this, 'testIdentifier', 'clickDownloadInvoices', baseContext); @@ -282,7 +282,7 @@ describe('BO - Modules - GDPR: Personal data manager for guest', async () => { expect(textResult).to.equal(modPsGdprBoTabDataConfig.messageCustomerDataDeleted); }); - //@todo : https://github.com/PrestaShop/PrestaShop/issues/36865 + // @todo : https://github.com/PrestaShop/PrestaShop/issues/36865 it(`should return if there is a customer named "${customerData.email}"`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'searchCustomerGuestAfterDelete', baseContext); diff --git a/tests/UI/package-lock.json b/tests/UI/package-lock.json index 7b09a2b322e99..514bef631ba5e 100644 --- a/tests/UI/package-lock.json +++ b/tests/UI/package-lock.json @@ -433,7 +433,7 @@ }, "node_modules/@prestashop-core/ui-testing": { "version": "0.0.12", - "resolved": "git+ssh://git@github.com/PrestaShop/ui-testing-library.git#025c1a9bf99025f999a129c767734205bb9fa5be", + "resolved": "git+ssh://git@github.com/PrestaShop/ui-testing-library.git#9d3f2f273cbc4048400b388a66a0681b7bec6285", "license": "MIT", "dependencies": { "@faker-js/faker": "^8.3.1", @@ -8432,7 +8432,7 @@ } }, "@prestashop-core/ui-testing": { - "version": "git+ssh://git@github.com/PrestaShop/ui-testing-library.git#025c1a9bf99025f999a129c767734205bb9fa5be", + "version": "git+ssh://git@github.com/PrestaShop/ui-testing-library.git#9d3f2f273cbc4048400b388a66a0681b7bec6285", "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/advancedParameters/team/employeeBasePage.ts b/tests/UI/pages/BO/advancedParameters/team/employeeBasePage.ts index c957162d0b460..ad49ddbabf42e 100644 --- a/tests/UI/pages/BO/advancedParameters/team/employeeBasePage.ts +++ b/tests/UI/pages/BO/advancedParameters/team/employeeBasePage.ts @@ -10,6 +10,8 @@ import type {Page} from 'playwright'; export default class EmployeeBasePage extends BOBasePage { public readonly pageTitleEdit: (firstName: string, lastName: string) => string; + public readonly pageTitleEditFr: (firstName: string, lastName: string) => string; + protected readonly firstNameInput: string; protected readonly lastNameInput: string; @@ -37,8 +39,10 @@ export default class EmployeeBasePage extends BOBasePage { constructor() { super(); - this.pageTitleEdit = (firstName: string, lastName: string) => `Editing ${firstName} ${lastName}'s profile • ` - + `${global.INSTALL.SHOP_NAME}`; + this.pageTitleEdit = (firstName: string, lastName: string) => `Editing ${firstName} ${lastName}'s profile` + + ` • ${global.INSTALL.SHOP_NAME}`; + this.pageTitleEditFr = (firstName: string, lastName: string) => `Modification du profil de ${firstName} ${lastName}` + + ` • ${global.INSTALL.SHOP_NAME}`; // Selectors this.firstNameInput = '#employee_firstname'; diff --git a/tests/UI/pages/BO/advancedParameters/team/myProfile.ts b/tests/UI/pages/BO/advancedParameters/team/myProfile.ts deleted file mode 100644 index 1f4da4128c8de..0000000000000 --- a/tests/UI/pages/BO/advancedParameters/team/myProfile.ts +++ /dev/null @@ -1,135 +0,0 @@ -import EmployeeBasePage from '@pages/BO/advancedParameters/team/employeeBasePage'; - -import type {Page} from 'playwright'; -import { - type FakerEmployee, -} from '@prestashop-core/ui-testing'; - -/** - * Add employee page, contains functions that can be used on the page - * @class - * @extends EmployeeBasePage - */ -class MyProfile extends EmployeeBasePage { - public readonly successfulUpdateMessageFR: string; - - public readonly errorInvalidFirstNameMessage: string; - - public readonly errorInvalidLastNameMessage: string; - - public readonly errorInvalidFormatImageMessage: string; - - private readonly passwordButton: string; - - private readonly currentPasswordInput: string; - - private readonly newPasswordInput: string; - - private readonly confirmPasswordInput: string; - - private readonly avatarFileInput: string; - - private readonly enableGravatarInput: (toggle: number) => string; - - /** - * @constructs - * Setting up texts and selectors to use on add employee page - */ - constructor() { - super(); - - this.successfulUpdateMessageFR = 'Mise à jour réussie'; - this.errorInvalidFirstNameMessage = 'The "First name" field is invalid.'; - this.errorInvalidLastNameMessage = 'The "Last name" field is invalid.'; - this.errorInvalidFormatImageMessage = 'Image format not recognized, allowed formats are: image/gif, image/jpg, ' - + 'image/jpeg, image/pjpeg, image/png, image/x-png, image/webp, image/svg+xml, image/svg'; - - // Selectors - this.passwordButton = '#employee_change_password_change_password_button'; - this.currentPasswordInput = '#employee_change_password_old_password'; - this.newPasswordInput = '#employee_change_password_new_password_first'; - this.confirmPasswordInput = '#employee_change_password_new_password_second'; - this.avatarFileInput = '#employee_avatarUrl'; - this.enableGravatarInput = (toggle: number) => `#employee_has_enabled_gravatar_${toggle}`; - } - - /* - Methods - */ - - /** - * Fill form for update My Profile page - * @param page {Page} Browser tab - * @param currentPassword {string} Data to set on add/edit employee form - * @param newEmployeeData {FakerEmployee} Data to set on add/edit employee form - * @returns {Promise} - */ - async updateEditEmployee(page: Page, currentPassword: string, newEmployeeData: FakerEmployee): Promise { - await this.setValue(page, this.firstNameInput, newEmployeeData.firstName); - await this.setValue(page, this.lastNameInput, newEmployeeData.lastName); - if (newEmployeeData.avatarFile) { - await this.uploadOnFileChooser(page, this.avatarFileInput, [newEmployeeData.avatarFile]); - } - await this.setChecked(page, this.enableGravatarInput(newEmployeeData.enableGravatar ? 1 : 0)); - await this.setValue(page, this.emailInput, newEmployeeData.email); - await page.locator(this.passwordButton).click(); - await this.setValue(page, this.currentPasswordInput, currentPassword); - await this.setValue(page, this.newPasswordInput, newEmployeeData.password); - await this.setValue(page, this.confirmPasswordInput, newEmployeeData.password); - await this.selectByVisibleText(page, this.languageSelect, newEmployeeData.language); - await this.selectDefaultPage(page, newEmployeeData.defaultPage); - await this.clickAndWaitForLoadState(page, this.saveButton); - } - - /** - * Get the value of an input - * @override - * @param page {Page} Browser tab - * @param input {string} ID of the input - * @returns {Promise} - */ - async getInputValue(page: Page, input: string): Promise { - let inputSelector: string; - - switch (input) { - case 'firstname': - inputSelector = this.firstNameInput; - break; - case 'lastname': - inputSelector = this.lastNameInput; - break; - default: - throw new Error(`Field ${input} was not found`); - } - - return super.getInputValue(page, inputSelector); - } - - /** - * Get login error - * @param page {Page} Browser tab - * @return {Promise} - */ - async getAlertSuccess(page: Page): Promise { - return this.getAlertSuccessBlockParagraphContent(page); - } - - /** - * Get login error - * @param page {Page} Browser tab - * @return {Promise} - */ - async getAlertError(page: Page): Promise { - return this.getAlertDangerBlockParagraphContent(page); - } - - /** - * @param page {Page} Browser tab - * @return {Promise} - */ - async isGravatarEnabled(page: Page): Promise { - return this.isChecked(page, this.enableGravatarInput(1)); - } -} - -export default new MyProfile();