Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI tests - Add PS versions from 1.7.2.0 ~ 1.7.2.5 to 1.7.8.11 (minor) on php 7.1 #779

Merged
merged 2 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
21 changes: 15 additions & 6 deletions tests/UI/campaigns/sanity/03_catalogFO/02_checkProduct.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,26 @@ test.describe('FO - Catalog : Check the Product page', async () => {
await foClassicHomePage.goToProductPage(page, 1);

const pageTitle = await foClassicProductPage.getPageTitle(page);
expect(pageTitle).toContain(dataProducts.demo_1.name);
expect(pageTitle).toBeDefined();
});

test('should check the product page', async () => {
await utilsTest.addContextItem(test.info(), 'testIdentifier', 'checkProductPage', baseContext);

const result = await foClassicProductPage.getProductInformation(page);
await Promise.all([
expect(result.name).toEqual(dataProducts.demo_1.name),
expect(result.price).toEqual(dataProducts.demo_1.finalPrice),
expect(result.description).toContain(dataProducts.demo_1.description),
]);

if (result.name === dataProducts.demo_1.name) {
await Promise.all([
expect(result.name).toEqual(dataProducts.demo_1.name),
expect(result.price).toEqual(dataProducts.demo_1.finalPrice),
expect(result.description).toContain(dataProducts.demo_1.description),
]);
} else {
await Promise.all([
expect(result.name).toEqual(dataProducts.old_demo_1.name),
expect(result.price).toEqual(dataProducts.old_demo_1.finalPrice),
expect(result.description).toContain(dataProducts.old_demo_1.description),
]);
}
});
});
Loading