Skip to content

Commit

Permalink
Merge pull request PrestaShop#36571 from Progi1984/test4213
Browse files Browse the repository at this point in the history
Functional Tests : Faceted search module - Edit template - Sub-categories filter
  • Loading branch information
nesrineabdmouleh authored Jul 22, 2024
2 parents 3a7f10f + 98b4cb5 commit 11ae6d7
Show file tree
Hide file tree
Showing 165 changed files with 1,221 additions and 2,466 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import newsletterSubscriptionPage from '@pages/BO/modules/psEmailSubscription';
import customersPage from '@pages/BO/customers';

// Import FO pages
import {productPage} from '@pages/FO/classic/product';
import {cartPage} from '@pages/FO/classic/cart';
import {checkoutPage} from '@pages/FO/classic/checkout';
import {orderConfirmationPage} from '@pages/FO/classic/checkout/orderConfirmation';
Expand Down Expand Up @@ -44,6 +43,7 @@ import {
foClassicHomePage,
foClassicLoginPage,
foClassicMyAccountPage,
foClassicProductPage,
utilsPlaywright,
} from '@prestashop-core/ui-testing';

Expand Down Expand Up @@ -156,7 +156,7 @@ describe('BO - Dashboard : Activity overview', async () => {
// Go to the first product page
await foClassicHomePage.goToProductPage(page, 1);
// Add the product to the cart
await productPage.addProductToTheCart(page);
await foClassicProductPage.addProductToTheCart(page);

const notificationsNumber = await cartPage.getCartNotificationsNumber(page);
expect(notificationsNumber).to.be.equal(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import orderPageTabListBlock from '@pages/BO/orders/view/tabListBlock';
import {cartPage} from '@pages/FO/classic/cart';
import {checkoutPage} from '@pages/FO/classic/checkout';
import {orderConfirmationPage} from '@pages/FO/classic/checkout/orderConfirmation';
import {productPage} from '@pages/FO/classic/product';

import {
boDashboardPage,
Expand All @@ -26,6 +25,7 @@ import {
FakerCustomer,
FakerOrderShipping,
foClassicHomePage,
foClassicProductPage,
foClassicSearchResultsPage,
utilsPlaywright,
} from '@prestashop-core/ui-testing';
Expand Down Expand Up @@ -110,17 +110,17 @@ describe('BO - Orders : Preview order', async () => {

await foClassicSearchResultsPage.goToProductPage(page, 1);
// Add the product to the cart
await productPage.addProductToTheCart(page, 1, [], false);
await foClassicProductPage.addProductToTheCart(page, 1, [], false);

const notificationsNumber = await productPage.getCartNotificationsNumber(page);
const notificationsNumber = await foClassicProductPage.getCartNotificationsNumber(page);
expect(notificationsNumber).to.be.equal(index + 1);
});
});

it('should go to shopping cart page', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'goToShoppingCart', baseContext);

await productPage.goToCartPage(page);
await foClassicProductPage.goToCartPage(page);

const pageTitle = await cartPage.getPageTitle(page);
expect(pageTitle).to.contains(cartPage.pageTitle);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import orderPageProductsBlock from '@pages/BO/orders/view/productsBlock';
// Import FO pages
import {cartPage} from '@pages/FO/classic/cart';
import {checkoutPage} from '@pages/FO/classic/checkout';
import {productPage} from '@pages/FO/classic/product';

import {
boDashboardPage,
Expand All @@ -25,6 +24,7 @@ import {
dataProducts,
foClassicHomePage,
foClassicLoginPage,
foClassicProductPage,
utilsDate,
utilsPlaywright,
} from '@prestashop-core/ui-testing';
Expand Down Expand Up @@ -297,7 +297,7 @@ describe('BO - Orders - Create Order : Select Previous Carts', async () => {
// Go to the first product page
await foClassicHomePage.goToProductPage(page, 1);
// Add the product to the cart
await productPage.addProductToTheCart(page);
await foClassicProductPage.addProductToTheCart(page);

const notificationsNumber = await cartPage.getCartNotificationsNumber(page);
expect(notificationsNumber).to.be.equal(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import orderPageTabListBlock from '@pages/BO/orders/view/tabListBlock';
// Import FO pages
import {cartPage} from '@pages/FO/classic/cart';
import {checkoutPage} from '@pages/FO/classic/checkout';
import {productPage as foProductPage} from '@pages/FO/classic/product';
import {orderConfirmationPage} from '@pages/FO/classic/checkout/orderConfirmation';

import {
Expand All @@ -29,6 +28,7 @@ import {
FakerProduct,
FakerTaxRule,
FakerTaxRulesGroup,
foClassicProductPage,
utilsFile,
utilsPlaywright,
} from '@prestashop-core/ui-testing';
Expand Down Expand Up @@ -231,17 +231,17 @@ describe('BO - Orders - Invoices : Enable/Disable tax breakdown', async () => {

// Click on preview button
page = await addProductPage.previewProduct(page);
await foProductPage.changeLanguage(page, 'en');
await foClassicProductPage.changeLanguage(page, 'en');

const pageTitle = await foProductPage.getPageTitle(page);
const pageTitle = await foClassicProductPage.getPageTitle(page);
expect(pageTitle).to.contains(productData.name);
});

it('should add product to cart', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'addProductToCart', baseContext);

// Add the created product to the cart
await foProductPage.addProductToTheCart(page);
await foClassicProductPage.addProductToTheCart(page);

const pageTitle = await cartPage.getPageTitle(page);
expect(pageTitle).to.equal(cartPage.pageTitle);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import orderPageTabListBlock from '@pages/BO/orders/view/tabListBlock';
import {cartPage} from '@pages/FO/classic/cart';
import {checkoutPage} from '@pages/FO/classic/checkout';
import {orderConfirmationPage} from '@pages/FO/classic/checkout/orderConfirmation';
import {productPage} from '@pages/FO/classic/product';

import {
boDashboardPage,
Expand All @@ -22,6 +21,7 @@ import {
dataPaymentMethods,
foClassicHomePage,
foClassicLoginPage,
foClassicProductPage,
utilsFile,
utilsPlaywright,
} from '@prestashop-core/ui-testing';
Expand Down Expand Up @@ -129,7 +129,7 @@ describe('BO - Orders - Invoices : Enable/Disable product image in invoices', as
// Go to the first product page
await foClassicHomePage.goToProductPage(page, 1);
// Add the product to the cart
await productPage.addProductToTheCart(page);
await foClassicProductPage.addProductToTheCart(page);

const notificationsNumber = await cartPage.getCartNotificationsNumber(page);
expect(notificationsNumber).to.be.equal(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import loginCommon from '@commonTests/BO/loginBO';
import {cartPage} from '@pages/FO/classic/cart';
import {checkoutPage} from '@pages/FO/classic/checkout';
import {orderConfirmationPage} from '@pages/FO/classic/checkout/orderConfirmation';
import {productPage} from '@pages/FO/classic/product';

// Import BO pages
import deliverySlipsPage from '@pages/BO/orders/deliverySlips';
Expand All @@ -22,6 +21,7 @@ import {
dataPaymentMethods,
foClassicHomePage,
foClassicLoginPage,
foClassicProductPage,
utilsFile,
utilsPlaywright,
} from '@prestashop-core/ui-testing';
Expand Down Expand Up @@ -143,7 +143,7 @@ describe('BO - Orders - Delivery slips : Enable/Disable product image', async ()
// Go to the first product page
await foClassicHomePage.goToProductPage(page, 1);
// Add the product to the cart
await productPage.addProductToTheCart(page);
await foClassicProductPage.addProductToTheCart(page);

const notificationsNumber = await cartPage.getCartNotificationsNumber(page);
expect(notificationsNumber).to.be.equal(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import loginCommon from '@commonTests/BO/loginBO';

// Import pages
import createProductsPage from '@pages/BO/catalog/products/add';
import {productPage as foProductPage} from '@pages/FO/classic/product';

import type {BrowserContext, Page} from 'playwright';
import {expect} from 'chai';
import {
boDashboardPage,
boProductsPage,
FakerProduct,
foClassicProductPage,
utilsCore,
utilsFile,
utilsPlaywright,
Expand Down Expand Up @@ -160,9 +160,9 @@ describe('BO - Catalog - Products : CRUD standard product', async () => {
// Click on preview button
page = await createProductsPage.previewProduct(page);

await foProductPage.changeLanguage(page, 'en');
await foClassicProductPage.changeLanguage(page, 'en');

const pageTitle = await foProductPage.getPageTitle(page);
const pageTitle = await foClassicProductPage.getPageTitle(page);
expect(pageTitle).to.contains(newProductData.name);
});

Expand All @@ -171,7 +171,7 @@ describe('BO - Catalog - Products : CRUD standard product', async () => {

const taxValue = await utilsCore.percentage(newProductData.priceTaxExcluded, newProductData.tax);

const result = await foProductPage.getProductInformation(page);
const result = await foClassicProductPage.getProductInformation(page);
await Promise.all([
expect(result.name).to.equal(newProductData.name),
expect(result.price.toFixed(2)).to.equal((newProductData.priceTaxExcluded + taxValue).toFixed(2)),
Expand All @@ -184,7 +184,7 @@ describe('BO - Catalog - Products : CRUD standard product', async () => {
await testContext.addContextItem(this, 'testIdentifier', 'goBackToBO', baseContext);

// Go back to BO
page = await foProductPage.closePage(browserContext, page, 0);
page = await foClassicProductPage.closePage(browserContext, page, 0);

const pageTitle = await createProductsPage.getPageTitle(page);
expect(pageTitle).to.contains(createProductsPage.pageTitle);
Expand Down Expand Up @@ -224,9 +224,9 @@ describe('BO - Catalog - Products : CRUD standard product', async () => {
// Click on preview button
page = await createProductsPage.previewProduct(page);

await foProductPage.changeLanguage(page, 'en');
await foClassicProductPage.changeLanguage(page, 'en');

const pageTitle = await foProductPage.getPageTitle(page);
const pageTitle = await foClassicProductPage.getPageTitle(page);
expect(pageTitle).to.contains(editProductData.name);
});

Expand All @@ -235,7 +235,7 @@ describe('BO - Catalog - Products : CRUD standard product', async () => {

const taxValue = await utilsCore.percentage(editProductData.priceTaxExcluded, editProductData.tax);

const result = await foProductPage.getProductInformation(page);
const result = await foClassicProductPage.getProductInformation(page);
await Promise.all([
expect(result.name).to.equal(editProductData.name),
expect(result.price.toFixed(2)).to.equal((editProductData.priceTaxExcluded + taxValue).toFixed(2)),
Expand All @@ -247,7 +247,7 @@ describe('BO - Catalog - Products : CRUD standard product', async () => {
await testContext.addContextItem(this, 'testIdentifier', 'goBackToBO2', baseContext);

// Go back to BO
page = await foProductPage.closePage(browserContext, page, 0);
page = await foClassicProductPage.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 @@ -9,14 +9,14 @@ 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 pricingTab from '@pages/BO/catalog/products/add/pricingTab';
import {productPage as foProductPage} from '@pages/FO/classic/product';

import {expect} from 'chai';
import type {BrowserContext, Page} from 'playwright';
import {
boDashboardPage,
boProductsPage,
FakerProduct,
foClassicProductPage,
type ProductAttributes,
type ProductCombinationBulk,
type ProductCombinationOptions,
Expand Down Expand Up @@ -548,9 +548,9 @@ describe('BO - Catalog - Products : CRUD product with combinations', async () =>
// Click on preview button
page = await createProductsPage.previewProduct(page);

await foProductPage.changeLanguage(page, 'en');
await foClassicProductPage.changeLanguage(page, 'en');

const pageTitle = await foProductPage.getPageTitle(page);
const pageTitle = await foClassicProductPage.getPageTitle(page);
expect(pageTitle).to.contains(newProductData.name);
});

Expand All @@ -559,15 +559,15 @@ describe('BO - Catalog - Products : CRUD product with combinations', async () =>

const taxValue = await utilsCore.percentage(pricingData.priceTaxExcluded + secondCombinationData.impactOnPriceTExc, 20);

const result = await foProductPage.getProductInformation(page);
const result = await foClassicProductPage.getProductInformation(page);
await Promise.all([
expect(result.name).to.equal(newProductData.name),
expect(result.price).to.equal(pricingData.priceTaxExcluded + secondCombinationData.impactOnPriceTExc + taxValue),
expect(result.summary).to.equal(newProductData.summary),
expect(result.description).to.equal(newProductData.description),
]);

const productAttributes = await foProductPage.getProductAttributes(page);
const productAttributes = await foClassicProductPage.getProductAttributes(page);
await Promise.all([
expect(productAttributes[0].name).to.equal(newProductData.attributes[0].name),
expect(productAttributes[0].value).to.equal(newProductData.attributes[0].values.join(' ')),
Expand All @@ -582,7 +582,7 @@ describe('BO - Catalog - Products : CRUD product with combinations', async () =>
await testContext.addContextItem(this, 'testIdentifier', 'goBackToBO1', baseContext);

// Go back to BO
page = await foProductPage.closePage(browserContext, page, 0);
page = await foClassicProductPage.closePage(browserContext, page, 0);

const pageTitle: string = await createProductsPage.getPageTitle(page);
expect(pageTitle).to.contains(createProductsPage.pageTitle);
Expand Down Expand Up @@ -634,23 +634,23 @@ describe('BO - Catalog - Products : CRUD product with combinations', async () =>
// Click on preview button
page = await createProductsPage.previewProduct(page);

await foProductPage.changeLanguage(page, 'en');
await foClassicProductPage.changeLanguage(page, 'en');

const pageTitle = await foProductPage.getPageTitle(page);
const pageTitle = await foClassicProductPage.getPageTitle(page);
expect(pageTitle).to.contains(editProductData.name);
});

it('should check all product information', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'checkEditedProductInformation', baseContext);

const result = await foProductPage.getProductInformation(page);
const result = await foClassicProductPage.getProductInformation(page);
await Promise.all([
expect(result.name).to.equal(editProductData.name),
expect(result.price).to.equal(editProductData.price + secondCombinationData.impactOnPriceTExc),
expect(result.description).to.equal(editProductData.description),
]);

const productAttributes = await foProductPage.getProductAttributes(page);
const productAttributes = await foClassicProductPage.getProductAttributes(page);
await Promise.all([
expect(productAttributes[0].name).to.equal(editProductAttributesData[0].name),
expect(productAttributes[0].value).to.equal(editProductAttributesData[0].values.join(' ')),
Expand All @@ -663,7 +663,7 @@ describe('BO - Catalog - Products : CRUD product with combinations', async () =>
await testContext.addContextItem(this, 'testIdentifier', 'goBackToBO2', baseContext);

// Go back to BO
page = await foProductPage.closePage(browserContext, page, 0);
page = await foClassicProductPage.closePage(browserContext, page, 0);

const pageTitle = await createProductsPage.getPageTitle(page);
expect(pageTitle).to.contains(createProductsPage.pageTitle);
Expand Down
Loading

0 comments on commit 11ae6d7

Please sign in to comment.