Skip to content

Commit

Permalink
Merge pull request PrestaShop#36971 from Progi1984/TEST-3989
Browse files Browse the repository at this point in the history
Functional Tests : New products block module: Upgrade module
  • Loading branch information
nesrineabdmouleh authored Sep 19, 2024
2 parents 5b57131 + 06b7eb4 commit 5541617
Show file tree
Hide file tree
Showing 19 changed files with 665 additions and 662 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -15,6 +14,7 @@ import type {BrowserContext, Page} from 'playwright';
import {
boDashboardPage,
boProductsPage,
boShopParametersPage,
dataProducts,
foClassicProductPage,
utilsPlaywright,
Expand Down Expand Up @@ -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 () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -15,6 +14,7 @@ import type {BrowserContext, Page} from 'playwright';
import {
boDashboardPage,
boProductsPage,
boShopParametersPage,
FakerProduct,
foClassicHomePage,
foClassicProductPage,
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
});
});
});
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
});
});
});
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -16,6 +15,7 @@ import {expect} from 'chai';
import type {BrowserContext, Page} from 'playwright';
import {
boDashboardPage,
boShopParametersPage,
foClassicHomePage,
utilsPlaywright,
} from '@prestashop-core/ui-testing';
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
});
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ 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';

import {expect} from 'chai';
import type {BrowserContext, Page} from 'playwright';
import {
boDashboardPage,
boShopParametersPage,
foClassicHomePage,
utilsPlaywright,
} from '@prestashop-core/ui-testing';
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ 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';

import {expect} from 'chai';
import type {BrowserContext, Page} from 'playwright';
import {
boDashboardPage,
boShopParametersPage,
foClassicHomePage,
utilsPlaywright,
} from '@prestashop-core/ui-testing';
Expand Down Expand Up @@ -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');

Expand Down Expand Up @@ -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);
});
});
});
Expand Down
Loading

0 comments on commit 5541617

Please sign in to comment.