Skip to content

Commit

Permalink
Merge pull request PrestaShop#36990 from Progi1984/test9807
Browse files Browse the repository at this point in the history
Functional Tests : BO - Shop Parameters - Product Settings : Display notifications
  • Loading branch information
Progi1984 authored Sep 23, 2024
2 parents d3b245c + 1ce633b commit 2a50ec0
Show file tree
Hide file tree
Showing 37 changed files with 450 additions and 844 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import loginCommon from '@commonTests/BO/loginBO';
import createProductsPage from '@pages/BO/catalog/products/add';
import combinationsTab from '@pages/BO/catalog/products/add/combinationsTab';
import attributesPage from '@pages/BO/catalog/attributes';
import productSettings from '@pages/BO/shopParameters/productSettings';

import {expect} from 'chai';
import type {BrowserContext, Page} from 'playwright';
import {
boDashboardPage,
boProductsPage,
boProductSettingsPage,
FakerProduct,
foClassicProductPage,
type ProductAttribute,
Expand Down Expand Up @@ -284,14 +284,14 @@ describe('BO - Catalog - Products : Combination tab', async () => {

page = await combinationsTab.clickOnEditDefaultBehaviourLink(page);

const pageTitle = await productSettings.getPageTitle(page);
expect(pageTitle).to.contains(productSettings.pageTitle);
const pageTitle = await boProductSettingsPage.getPageTitle(page);
expect(pageTitle).to.contains(boProductSettingsPage.pageTitle);
});

it('should close the page', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'goBackToBO3', baseContext);

page = await productSettings.closePage(browserContext, page, 0);
page = await boProductSettingsPage.closePage(browserContext, page, 0);

const pageTitle = await createProductsPage.getPageTitle(page);
expect(pageTitle).to.contains(createProductsPage.pageTitle);
Expand Down Expand Up @@ -344,7 +344,7 @@ describe('BO - Catalog - Products : Combination tab', async () => {
it('should close the page', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'goBackToBO4', baseContext);

page = await productSettings.closePage(browserContext, page, 0);
page = await boProductSettingsPage.closePage(browserContext, page, 0);

const pageTitle = await createProductsPage.getPageTitle(page);
expect(pageTitle).to.contains(createProductsPage.pageTitle);
Expand Down Expand Up @@ -402,7 +402,7 @@ describe('BO - Catalog - Products : Combination tab', async () => {
it('should close the page', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'goBackToBO5', baseContext);

page = await productSettings.closePage(browserContext, page, 0);
page = await boProductSettingsPage.closePage(browserContext, page, 0);

const pageTitle = await createProductsPage.getPageTitle(page);
expect(pageTitle).to.contains(createProductsPage.pageTitle);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import loginCommon from '@commonTests/BO/loginBO';
// Import BO pages
import createProductsPage from '@pages/BO/catalog/products/add';
import virtualProductTab from '@pages/BO/catalog/products/add/virtualProductTab';
import productSettings from '@pages/BO/shopParameters/productSettings';

// Import FO pages
import {orderHistoryPage} from '@pages/FO/classic/myAccount/orderHistory';
Expand All @@ -16,6 +15,7 @@ import {orderDetailsPage} from '@pages/FO/classic/myAccount/orderDetails';
import {
boDashboardPage,
boProductsPage,
boProductSettingsPage,
dataCustomers,
dataPaymentMethods,
FakerProduct,
Expand Down Expand Up @@ -273,14 +273,14 @@ describe('BO - Catalog - Products : Virtual tab', async () => {

page = await virtualProductTab.clickOnEditDefaultBehaviourLink(page);

const pageTitle = await productSettings.getPageTitle(page);
expect(pageTitle).to.contains(productSettings.pageTitle);
const pageTitle = await boProductSettingsPage.getPageTitle(page);
expect(pageTitle).to.contains(boProductSettingsPage.pageTitle);
});

it('should close the page', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'goBackToBO3', baseContext);

page = await productSettings.closePage(browserContext, page, 0);
page = await boProductSettingsPage.closePage(browserContext, page, 0);

const pageTitle = await createProductsPage.getPageTitle(page);
expect(pageTitle).to.contains(createProductsPage.pageTitle);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import loginCommon from '@commonTests/BO/loginBO';

// Import BO pages
import createProductPage from '@pages/BO/catalog/products/add';
import productSettingsPage from '@pages/BO/shopParameters/productSettings';

import {
boDashboardPage,
boProductsPage,
boProductsCreateTabShippingPage,
boProductsCreateTabStocksPage,
boProductSettingsPage,
dataCarriers,
dataCustomers,
FakerProduct,
Expand Down Expand Up @@ -191,14 +191,14 @@ describe('BO - Catalog - Products : Shipping tab', async () => {

page = await boProductsCreateTabShippingPage.clickOnEditDeliveryTimeLink(page);

const pageTitle = await productSettingsPage.getPageTitle(page);
expect(pageTitle).to.contains(productSettingsPage.pageTitle);
const pageTitle = await boProductSettingsPage.getPageTitle(page);
expect(pageTitle).to.contains(boProductSettingsPage.pageTitle);
});

it('should go back to BO', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'goBackToBO2', baseContext);

page = await productSettingsPage.closePage(browserContext, page, 0);
page = await boProductSettingsPage.closePage(browserContext, page, 0);

const pageTitle = await createProductPage.getPageTitle(page);
expect(pageTitle).to.contains(createProductPage.pageTitle);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@ import testContext from '@utils/testContext';
// Import commonTests
import loginCommon from '@commonTests/BO/loginBO';

// Import pages
// Import BO pages
import productSettingsPage from '@pages/BO/shopParameters/productSettings';

import {expect} from 'chai';
import type {BrowserContext, Page} from 'playwright';
import {
boDashboardPage,
boProductSettingsPage,
dataProducts,
foClassicHomePage,
foClassicProductPage,
Expand Down Expand Up @@ -53,10 +50,10 @@ describe('BO - Shop Parameters - Product Settings : Enable/Disable catalog mode'
boDashboardPage.shopParametersParentLink,
boDashboardPage.productSettingsLink,
);
await productSettingsPage.closeSfToolBar(page);
await boProductSettingsPage.closeSfToolBar(page);

const pageTitle = await productSettingsPage.getPageTitle(page);
expect(pageTitle).to.contains(productSettingsPage.pageTitle);
const pageTitle = await boProductSettingsPage.getPageTitle(page);
expect(pageTitle).to.contains(boProductSettingsPage.pageTitle);
});

const tests = [
Expand All @@ -73,8 +70,8 @@ describe('BO - Shop Parameters - Product Settings : Enable/Disable catalog mode'
baseContext,
);

const result = await productSettingsPage.changeCatalogModeStatus(page, test.args.enable);
expect(result).to.contains(productSettingsPage.successfulUpdateMessage);
const result = await boProductSettingsPage.changeCatalogModeStatus(page, test.args.enable);
expect(result).to.contains(boProductSettingsPage.successfulUpdateMessage);
});

if (test.args.enable) {
Expand Down Expand Up @@ -102,14 +99,14 @@ describe('BO - Shop Parameters - Product Settings : Enable/Disable catalog mode'
baseContext,
);

const result = await productSettingsPage.setShowPricesStatus(page, showPrices.args.enable);
expect(result).to.contains(productSettingsPage.successfulUpdateMessage);
const result = await boProductSettingsPage.setShowPricesStatus(page, showPrices.args.enable);
expect(result).to.contains(boProductSettingsPage.successfulUpdateMessage);
});

it('should view my shop', async function () {
await testContext.addContextItem(this, 'testIdentifier', `viewMyShop${index}`, baseContext);

page = await productSettingsPage.viewMyShop(page);
page = await boProductSettingsPage.viewMyShop(page);
await foClassicHomePage.changeLanguage(page, 'en');

const isHomePage = await foClassicHomePage.isHomePage(page);
Expand Down Expand Up @@ -147,15 +144,15 @@ describe('BO - Shop Parameters - Product Settings : Enable/Disable catalog mode'

page = await foClassicProductPage.closePage(browserContext, page, 0);

const pageTitle = await productSettingsPage.getPageTitle(page);
expect(pageTitle).to.contains(productSettingsPage.pageTitle);
const pageTitle = await boProductSettingsPage.getPageTitle(page);
expect(pageTitle).to.contains(boProductSettingsPage.pageTitle);
});
});
} else {
it('should view my shop', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'viewMyShop', baseContext);

page = await productSettingsPage.viewMyShop(page);
page = await boProductSettingsPage.viewMyShop(page);
await foClassicHomePage.changeLanguage(page, 'en');

const isHomePage = await foClassicHomePage.isHomePage(page);
Expand Down Expand Up @@ -193,8 +190,8 @@ describe('BO - Shop Parameters - Product Settings : Enable/Disable catalog mode'

page = await foClassicProductPage.closePage(browserContext, page, 0);

const pageTitle = await productSettingsPage.getPageTitle(page);
expect(pageTitle).to.contains(productSettingsPage.pageTitle);
const pageTitle = await boProductSettingsPage.getPageTitle(page);
expect(pageTitle).to.contains(boProductSettingsPage.pageTitle);
});
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@ import testContext from '@utils/testContext';
// Import commonTests
import loginCommon from '@commonTests/BO/loginBO';

// Import pages
// Import BO pages
import productSettingsPage from '@pages/BO/shopParameters/productSettings';

import {expect} from 'chai';
import type {BrowserContext, Page} from 'playwright';
import {
boDashboardPage,
boProductSettingsPage,
foClassicHomePage,
utilsPlaywright,
} from '@prestashop-core/ui-testing';
Expand Down Expand Up @@ -51,10 +48,10 @@ describe('BO - Shop Parameters - Product Settings : Update Number of days for wh
boDashboardPage.shopParametersParentLink,
boDashboardPage.productSettingsLink,
);
await productSettingsPage.closeSfToolBar(page);
await boProductSettingsPage.closeSfToolBar(page);

const pageTitle = await productSettingsPage.getPageTitle(page);
expect(pageTitle).to.contains(productSettingsPage.pageTitle);
const pageTitle = await boProductSettingsPage.getPageTitle(page);
expect(pageTitle).to.contains(boProductSettingsPage.pageTitle);
});

const tests = [
Expand All @@ -66,14 +63,14 @@ describe('BO - Shop Parameters - Product Settings : Update Number of days for wh
it(`should update Number of days to ${test.args.value}`, async function () {
await testContext.addContextItem(this, 'testIdentifier', `updateNumberOfDaysTo${test.args.value}`, baseContext);

const result = await productSettingsPage.updateNumberOfDays(page, test.args.value);
expect(result).to.contains(productSettingsPage.successfulUpdateMessage);
const result = await boProductSettingsPage.updateNumberOfDays(page, test.args.value);
expect(result).to.contains(boProductSettingsPage.successfulUpdateMessage);
});

it('should view my shop', async function () {
await testContext.addContextItem(this, 'testIdentifier', `viewMyShop${test.args.state}`, baseContext);

page = await productSettingsPage.viewMyShop(page);
page = await boProductSettingsPage.viewMyShop(page);
await foClassicHomePage.changeLanguage(page, 'en');

const isHomePage = await foClassicHomePage.isHomePage(page);
Expand All @@ -92,8 +89,8 @@ describe('BO - Shop Parameters - Product Settings : Update Number of days for wh

page = await foClassicHomePage.closePage(browserContext, page, 0);

const pageTitle = await productSettingsPage.getPageTitle(page);
expect(pageTitle).to.contains(productSettingsPage.pageTitle);
const pageTitle = await boProductSettingsPage.getPageTitle(page);
expect(pageTitle).to.contains(boProductSettingsPage.pageTitle);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import testContext from '@utils/testContext';
import loginCommon from '@commonTests/BO/loginBO';

// Import pages
import productSettingsPage from '@pages/BO/shopParameters/productSettings';
import addProductPage from '@pages/BO/catalog/products/add';
import descriptionTab from '@pages/BO/catalog/products/add/descriptionTab';

Expand All @@ -14,6 +13,7 @@ import type {BrowserContext, Page} from 'playwright';
import {
boDashboardPage,
boProductsPage,
boProductSettingsPage,
FakerProduct,
utilsPlaywright,
} from '@prestashop-core/ui-testing';
Expand Down Expand Up @@ -63,26 +63,26 @@ describe('BO - Shop Parameters - Product Settings : Update max size of short des
boDashboardPage.shopParametersParentLink,
boDashboardPage.productSettingsLink,
);
await productSettingsPage.closeSfToolBar(page);
await boProductSettingsPage.closeSfToolBar(page);

const pageTitle = await productSettingsPage.getPageTitle(page);
expect(pageTitle).to.contains(productSettingsPage.pageTitle);
const pageTitle = await boProductSettingsPage.getPageTitle(page);
expect(pageTitle).to.contains(boProductSettingsPage.pageTitle);
});

it(`should update max size of short description to ${test.args.descriptionSize}`, async function () {
await testContext.addContextItem(this, 'testIdentifier', `updateMaxSizeSummaryValue${index}`, baseContext);

const result = await productSettingsPage.UpdateMaxSizeOfSummary(page, test.args.descriptionSize);
expect(result).to.contains(productSettingsPage.successfulUpdateMessage);
const result = await boProductSettingsPage.setMaxSizeOfSummaryValue(page, test.args.descriptionSize);
expect(result).to.contains(boProductSettingsPage.successfulUpdateMessage);
});

it('should go to \'Catalog > Products\' page', async function () {
await testContext.addContextItem(this, 'testIdentifier', `goToCatalogProductsPage${index}`, baseContext);

await productSettingsPage.goToSubMenu(
await boProductSettingsPage.goToSubMenu(
page,
productSettingsPage.catalogParentLink,
productSettingsPage.productsLink,
boProductSettingsPage.catalogParentLink,
boProductSettingsPage.productsLink,
);

const pageTitle = await boProductsPage.getPageTitle(page);
Expand Down
Loading

0 comments on commit 2a50ec0

Please sign in to comment.