Skip to content

Commit

Permalink
Add some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nesrineabdmouleh committed Nov 27, 2024
1 parent 30e7a59 commit d6103ae
Show file tree
Hide file tree
Showing 14 changed files with 232 additions and 125 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/ui-test/nightly.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,44 @@
{
"include": [
{
"comment": "1.7.2.0 ~ 1.7.2.5 -> 1.7.8.11 PHP 7.1 online"
},
{
"PS_VERSION_START": "1.7.2.0",
"PS_VERSION_END": "1.7.8.11",
"PHP_VERSION": "7.1",
"UPGRADE_CHANNEL": "online"
},
{
"PS_VERSION_START": "1.7.2.1",
"PS_VERSION_END": "1.7.8.11",
"PHP_VERSION": "7.1",
"UPGRADE_CHANNEL": "online"
},
{
"PS_VERSION_START": "1.7.2.2",
"PS_VERSION_END": "1.7.8.11",
"PHP_VERSION": "7.1",
"UPGRADE_CHANNEL": "online"
},
{
"PS_VERSION_START": "1.7.2.3",
"PS_VERSION_END": "1.7.8.11",
"PHP_VERSION": "7.1",
"UPGRADE_CHANNEL": "online"
},
{
"PS_VERSION_START": "1.7.2.4",
"PS_VERSION_END": "1.7.8.11",
"PHP_VERSION": "7.1",
"UPGRADE_CHANNEL": "online"
},
{
"PS_VERSION_START": "1.7.2.5",
"PS_VERSION_END": "1.7.8.11",
"PHP_VERSION": "7.1",
"UPGRADE_CHANNEL": "online"
},
{
"comment": "1.7.3.0 ~ 1.7.3.4 -> 1.7.8.11 PHP 7.1"
},
Expand Down
48 changes: 0 additions & 48 deletions .github/workflows/ui-test/sanity.json
Original file line number Diff line number Diff line change
@@ -1,54 +1,6 @@
{
"include": [
{
"comment": "1.7.8 ~ minor PHP 7.4"
"comment": "1.7.2 ~ minor PHP 7.1"
},
{
"PS_VERSION_START": "1.7.2.0",
"PS_VERSION_END": "1.7.8.11",
"UPGRADE_CHANNEL": "minor",
"PHP_VERSION": "7.1",
"IMG_DOCKER": "1.7.2.0"
},
{
"PS_VERSION_START": "1.7.2.1",
"PS_VERSION_END": "1.7.8.11",
"UPGRADE_CHANNEL": "minor",
"PHP_VERSION": "7.1",
"IMG_DOCKER": "1.7.2.1"
},
{
"PS_VERSION_START": "1.7.2.2",
"PS_VERSION_END": "1.7.8.11",
"UPGRADE_CHANNEL": "minor",
"PHP_VERSION": "7.1",
"IMG_DOCKER": "1.7.2.2"
},
{
"PS_VERSION_START": "1.7.2.3",
"PS_VERSION_END": "1.7.8.11",
"UPGRADE_CHANNEL": "minor",
"PHP_VERSION": "7.1",
"IMG_DOCKER": "1.7.2.3"
},
{
"PS_VERSION_START": "1.7.2.4",
"PS_VERSION_END": "1.7.8.11",
"UPGRADE_CHANNEL": "minor",
"PHP_VERSION": "7.1",
"IMG_DOCKER": "1.7.2.4"
},
{
"PS_VERSION_START": "1.7.2.5",
"PS_VERSION_END": "1.7.8.11",
"UPGRADE_CHANNEL": "minor",
"PHP_VERSION": "7.1",
"IMG_DOCKER": "1.7.2.5"
},
{
"comment": "1.7.8 ~ minor PHP 7.2 ~ 7.4"
"comment": "1.7.6.0 -> 1.7.8.11 PHP 7.1"
"comment": "1.7.6.0 -> 1.7.8.11 PHP 7.1 online"
},
{
Expand Down
53 changes: 36 additions & 17 deletions tests/UI/campaigns/sanity/02_productsBO/01_filterProducts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,28 +121,25 @@ test.describe('BO - Catalog - Products : Filter the products table by ID, Name,
expect(isVisible, 'Reset button is visible!').toEqual(false);
});

if (semver.lt(psVersion, '8.1.0') || isProductPageV1) {
test('should get the number of products', async () => {
await utilsTest.addContextItem(test.info(), 'testIdentifier', 'getNumberOfProduct', baseContext);
test('should get the number of products', async () => {
await utilsTest.addContextItem(test.info(), 'testIdentifier', 'getNumberOfProduct', baseContext);

if (semver.lt(psVersion, '8.1.0') || isProductPageV1) {
numberOfProducts = await boProductsPage.getNumberOfProductsFromList(page);
expect(numberOfProducts).toBeGreaterThan(0);
});
} else {
test('should get number of products', async () => {
await utilsTest.addContextItem(test.info(), 'testIdentifier', 'getNumberOfProduct', baseContext);

} else {
numberOfProducts = await boProductsPage.getNumberOfProductsFromHeader(page);
expect(numberOfProducts).toBeGreaterThan(0);
});
}
}
expect(numberOfProducts).toBeGreaterThan(0);
});

[
{
args: {
identifier: 'filterIDMinMax',
filterBy: 'id_product',
filterValue: {min: 5, max: 10},
// For PS version <= 1.7.2
oldFilterValue: {min: 3, max: 7},
filterType: 'input',
},
},
Expand All @@ -151,6 +148,8 @@ test.describe('BO - Catalog - Products : Filter the products table by ID, Name,
identifier: 'filterName',
filterBy: 'product_name',
filterValue: dataProducts.demo_14.name,
// For PS version <= 1.7.2
oldFilterValue: dataProducts.old_demo_4.name,
filterType: 'input',
},
},
Expand All @@ -159,6 +158,8 @@ test.describe('BO - Catalog - Products : Filter the products table by ID, Name,
identifier: 'filterReference',
filterBy: 'reference',
filterValue: dataProducts.demo_14.reference,
// For PS version <= 1.7.2
oldFilterValue: dataProducts.old_demo_7.reference,
filterType: 'input',
},
},
Expand All @@ -167,6 +168,8 @@ test.describe('BO - Catalog - Products : Filter the products table by ID, Name,
identifier: 'filterCategory',
filterBy: 'category',
filterValue: dataCategories.art.name,
// For PS version <= 1.7.2
oldFilterValue: dataProducts.old_demo_3.category,
filterType: 'input',
},
},
Expand All @@ -175,6 +178,8 @@ test.describe('BO - Catalog - Products : Filter the products table by ID, Name,
identifier: 'filterPriceMinMax',
filterBy: 'price',
filterValue: {min: 5, max: 10},
// For PS version <= 1.7.2
oldFilterValue: {min: 20, max: 30},
filterType: 'input',
},
},
Expand All @@ -183,6 +188,8 @@ test.describe('BO - Catalog - Products : Filter the products table by ID, Name,
identifier: 'filterQuantityMinMax',
filterBy: 'quantity',
filterValue: {min: 1300, max: 1500},
// For PS version <= 1.7.2
oldFilterValue: {min: 900, max: 1500},
filterType: 'input',
},
},
Expand All @@ -191,17 +198,29 @@ test.describe('BO - Catalog - Products : Filter the products table by ID, Name,
identifier: 'filterStatus',
filterBy: 'active',
filterValue: 'Yes',
// For PS version <= 1.7.2
oldFilterValue: 'Yes',
filterType: 'select',
},
},
].forEach((tst) => {
test(`should filter list by '${tst.args.filterBy}' and check result`, async () => {
await utilsTest.addContextItem(test.info(), 'testIdentifier', `${tst.args.identifier}`, baseContext);

let filterValue: any = '';

if (numberOfProducts > 7) {
// For PS version > 1.7.2
filterValue = tst.args.filterValue;
} else {
// For PS version <= 1.7.2
filterValue = tst.args.oldFilterValue;
}

if (semver.lt(psVersion, '8.1.0') && tst.args.filterBy === 'active') {
await boProductsPage.filterProducts(page, tst.args.filterBy, 'Active', tst.args.filterType);
} else {
await boProductsPage.filterProducts(page, tst.args.filterBy, tst.args.filterValue, tst.args.filterType);
await boProductsPage.filterProducts(page, tst.args.filterBy, filterValue, tst.args.filterType);
}
const numberOfProductsAfterFilter = await boProductsPage.getNumberOfProductsFromList(page);

Expand All @@ -214,13 +233,13 @@ test.describe('BO - Catalog - Products : Filter the products table by ID, Name,
for (let i = 1; i <= numberOfProductsAfterFilter; i++) {
const textColumn = await boProductsPage.getTextColumn(page, tst.args.filterBy, i);

if (typeof tst.args.filterValue !== 'string') {
expect(textColumn).toBeGreaterThanOrEqual(tst.args.filterValue.min);
expect(textColumn).toBeLessThanOrEqual(tst.args.filterValue.max);
if (typeof filterValue !== 'string') {
expect(textColumn).toBeGreaterThanOrEqual(filterValue.min);
expect(textColumn).toBeLessThanOrEqual(filterValue.max);
} else if (tst.args.filterBy === 'active') {
expect(textColumn).toEqual(true);
} else {
expect(textColumn).toContain(tst.args.filterValue);
expect(textColumn).toContain(filterValue);
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ test.describe('BO - Catalog - Products : CRUD standard product', async () => {
});

// @todo : https://github.com/PrestaShop/PrestaShop/issues/36097
if (semver.lte(psVersion, '8.1.6')) {
if (semver.lte(psVersion, '8.1.6') && semver.gte(psVersion, '7.3.0')) {
test('should close the menu', async () => {
await utilsTest.addContextItem(test.info(), 'testIdentifier', 'closeMenu', baseContext);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ test.describe('BO - Catalog - Products : CRUD product with combinations', async
},
{
name: 'size',
values: ['L', 'XL'],
values: ['L'],
},
],
});
Expand Down Expand Up @@ -103,7 +103,7 @@ test.describe('BO - Catalog - Products : CRUD product with combinations', async
});

// @todo : https://github.com/PrestaShop/PrestaShop/issues/36097
if (semver.lte(psVersion, '8.1.6')) {
if (semver.lte(psVersion, '8.1.6') && semver.gte(psVersion, '7.3.0')) {
test('should close the menu', async () => {
await utilsTest.addContextItem(test.info(), 'testIdentifier', 'closeMenu', baseContext);

Expand Down Expand Up @@ -150,7 +150,7 @@ test.describe('BO - Catalog - Products : CRUD product with combinations', async
});
}

test('should create combinations and check generate combinations button', async () => {
test('should create combinations', async () => {
await utilsTest.addContextItem(test.info(), 'testIdentifier', 'createCombinations', baseContext);

const textResult = await boProductsCreateTabCombinationsPage.setProductAttributes(
Expand All @@ -160,6 +160,8 @@ test.describe('BO - Catalog - Products : CRUD product with combinations', async

if (semver.gte(psVersion, '8.1.0')) {
expect(textResult).toEqual('Generate 2 combinations');
} else if (semver.lte(psVersion, '7.2.1')) {
expect(textResult).toEqual(boProductsCreatePage.successfulUpdateMessage);
} else {
expect(textResult).toEqual(boProductsCreatePage.successfulUpdateMessage);
}
Expand Down Expand Up @@ -248,7 +250,9 @@ test.describe('BO - Catalog - Products : CRUD product with combinations', async
);

if (semver.gte(psVersion, '8.1.0')) {
expect(textResult).toEqual('Generate 6 combinations');
expect(textResult).toEqual('Generate 3 combinations');
} else if (semver.lte(psVersion, '7.2.1')) {
expect(textResult).toEqual(boProductsCreatePage.successfulUpdateMessage);
} else {
expect(textResult).toEqual(boProductsCreatePage.successfulUpdateMessage);
}
Expand All @@ -259,7 +263,7 @@ test.describe('BO - Catalog - Products : CRUD product with combinations', async
await utilsTest.addContextItem(test.info(), 'testIdentifier', 'generateCombinations2', baseContext);

const successMessage = await boProductsCreateTabCombinationsPage.generateCombinations(page);
expect(successMessage).toEqual('Successfully generated 6 combinations.');
expect(successMessage).toEqual('Successfully generated 3 combinations.');
});

test('should check that combinations generation modal is closed', async () => {
Expand Down Expand Up @@ -309,7 +313,7 @@ test.describe('BO - Catalog - Products : CRUD product with combinations', async
});

test.describe('Delete product', async () => {
test('should go back to BO to delete product', async () => {
test('should go back to BO', async () => {
await utilsTest.addContextItem(test.info(), 'testIdentifier', 'goBackToBOToDeleteProduct', baseContext);

// Go back to BO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ test.describe('BO - Catalog - Products : CRUD virtual product', async () => {
});

// @todo : https://github.com/PrestaShop/PrestaShop/issues/36097
if (semver.lte(psVersion, '8.1.6')) {
if (semver.lte(psVersion, '8.1.6') && semver.gte(psVersion, '7.3.0')) {
test('should close the menu', async () => {
await utilsTest.addContextItem(test.info(), 'testIdentifier', 'closeMenu', baseContext);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ test.describe('BO - Catalog - Products : Delete product', async () => {
});

// @todo : https://github.com/PrestaShop/PrestaShop/issues/36097
if (semver.lte(psVersion, '8.1.6')) {
if (semver.lte(psVersion, '8.1.6') && semver.gte(psVersion, '7.3.0')) {
test('should close the menu', async () => {
await utilsTest.addContextItem(test.info(), 'testIdentifier', 'closeMenu', baseContext);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ test.describe('BO - Catalog - Products : Delete products with bulk actions', asy
});

// @todo : https://github.com/PrestaShop/PrestaShop/issues/36097
if (semver.lte(psVersion, '8.1.6')) {
if (semver.lte(psVersion, '8.1.6') && semver.gte(psVersion, '7.3.0')) {
test('should close the menu', async () => {
await utilsTest.addContextItem(test.info(), 'testIdentifier', 'closeMenu', baseContext);

Expand Down
39 changes: 28 additions & 11 deletions tests/UI/campaigns/sanity/03_catalogFO/01_filterProducts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import {
import {
test, expect, Page, BrowserContext,
} from '@playwright/test';
import semver from 'semver';

const psVersion = utilsTest.getPSVersion();
const baseContext: string = 'sanity_catalogFO_filterProducts';

/*
Expand Down Expand Up @@ -52,24 +54,39 @@ test.describe('FO - Catalog : Filter Products by categories in Home page', async
expect(allProductsNumber).toBeGreaterThan(0);
});

test('should filter products by the category \'Accessories\' and check result', async () => {
await utilsTest.addContextItem(test.info(), 'testIdentifier', 'FilterProductByCategory', baseContext);
if (semver.gte(psVersion, '7.3.0')) {
test('should filter products by category and check result', async () => {
await utilsTest.addContextItem(test.info(), 'testIdentifier', 'FilterProductByCategory', baseContext);

await foClassicCategoryPage.goToCategory(page, dataCategories.accessories.id);
if (allProductsNumber > 7) {
await foClassicCategoryPage.goToCategory(page, dataCategories.accessories.id);

const pageTitle = await foClassicCategoryPage.getPageTitle(page);
expect(pageTitle).toEqual(dataCategories.accessories.name);
const pageTitle = await foClassicCategoryPage.getPageTitle(page);
expect(pageTitle).toEqual(dataCategories.accessories.name);

const numberOfProducts = await foClassicCategoryPage.getNumberOfProducts(page);
expect(numberOfProducts).toBeLessThan(allProductsNumber);
});
const numberOfProducts = await foClassicCategoryPage.getNumberOfProducts(page);
expect(numberOfProducts).toBeLessThan(allProductsNumber);
} else {
await foClassicCategoryPage.goToCategory(page, dataCategories.oldWomen.id);

test('should filter products by the subcategory \'Stationery\' and check result', async () => {
const pageTitle = await foClassicCategoryPage.getPageTitle(page);
expect(pageTitle).toEqual(dataCategories.oldWomen.name);

const numberOfProducts = await foClassicCategoryPage.getNumberOfProducts(page);
expect(numberOfProducts).toEqual(allProductsNumber);
}
});
}

test('should filter products by subcategory and check result', async () => {
await utilsTest.addContextItem(test.info(), 'testIdentifier', 'FilterProductBySubCategory', baseContext);

await foClassicCategoryPage.reloadPage(page);
await foClassicCategoryPage.goToSubCategory(page, dataCategories.accessories.id, dataCategories.stationery.id);

if (allProductsNumber > 7) {
await foClassicCategoryPage.goToSubCategory(page, dataCategories.accessories.id, dataCategories.stationery.id);
} else {
await foClassicCategoryPage.goToSubCategory(page, dataCategories.oldWomen.id, dataCategories.eveningDresses.id);
}
const numberOfProducts = await foClassicCategoryPage.getNumberOfProducts(page);
expect(numberOfProducts).toBeLessThan(allProductsNumber);
});
Expand Down
Loading

0 comments on commit d6103ae

Please sign in to comment.