Skip to content

Commit

Permalink
Merge pull request #30380 from Progi1984/issue29894
Browse files Browse the repository at this point in the history
Fixes #29894
  • Loading branch information
Pablo Borowicz committed Nov 30, 2022
2 parents 9950675 + af92c09 commit 7480b69
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 32 deletions.
1 change: 1 addition & 0 deletions controllers/admin/AdminCartsController.php
Expand Up @@ -980,6 +980,7 @@ public function renderList()
} else {
$helper->list_skip_actions['delete'] = (array) $skip_list;
}
$helper->force_show_bulk_actions = true;

return $helper->generateList($this->_list, $this->fields_list);
}
Expand Down
Expand Up @@ -114,7 +114,7 @@ describe('BO - Orders - Create Order : Select Previous Carts', async () => {
numberOfShoppingCarts -= numberOfNonOrderedShoppingCarts;

for (let row = 1; row <= numberOfNonOrderedShoppingCarts; row++) {
const textColumn = await shoppingCartsPage.getTextColumn(page, row, 'c!lastname');
const textColumn = await shoppingCartsPage.getTextColumn(page, row, 'status');
await expect(textColumn).to.contains('Non ordered');
}
});
Expand Down Expand Up @@ -228,7 +228,7 @@ describe('BO - Orders - Create Order : Select Previous Carts', async () => {
numberOfShoppingCarts -= numberOfNonOrderedShoppingCarts;

for (let row = 1; row <= numberOfNonOrderedShoppingCarts; row++) {
const textColumn = await shoppingCartsPage.getTextColumn(page, row, 'c!lastname');
const textColumn = await shoppingCartsPage.getTextColumn(page, row, 'status');
await expect(textColumn).to.contains('Non ordered');
}
});
Expand Down Expand Up @@ -333,7 +333,7 @@ describe('BO - Orders - Create Order : Select Previous Carts', async () => {
await expect(pageTitle).to.contains(shoppingCartsPage.pageTitle);

await shoppingCartsPage.reloadPage(page);
lastShoppingCartId = await shoppingCartsPage.getTextColumn(page, 1, 'status');
lastShoppingCartId = await shoppingCartsPage.getTextColumn(page, 1, 'id_cart');
});
});

Expand Down
Expand Up @@ -76,7 +76,7 @@ describe('BO - Orders - Shopping carts : Filter the Shopping carts table', async
numberOfShoppingCarts -= numberOfShoppingCartsAfterFilter;

for (let row = 1; row <= numberOfShoppingCartsAfterFilter; row++) {
const textColumn = await shoppingCartsPage.getTextColumn(page, row, 'c!lastname');
const textColumn = await shoppingCartsPage.getTextColumn(page, row, 'status');
await expect(textColumn).to.contains('Non ordered');
}

Expand All @@ -99,7 +99,7 @@ describe('BO - Orders - Shopping carts : Filter the Shopping carts table', async
let paginationNumber = 0;

if (numberOfShoppingCarts >= 21) {
paginationNumber = await shoppingCartsPage.selectPaginationLimit(page, '300');
paginationNumber = await shoppingCartsPage.selectPaginationLimit(page, 300);
}

await expect(paginationNumber).to.equal('1');
Expand Down
Expand Up @@ -116,7 +116,7 @@ describe('BO - Orders - Shopping carts : View carts', async () => {
const numberOfShoppingCartsAfterFilter = await shoppingCartsPage.getNumberOfElementInGrid(page);
await expect(numberOfShoppingCartsAfterFilter).to.be.at.equal(1);

const textColumn = await shoppingCartsPage.getTextColumn(page, 1, 'c!lastname');
const textColumn = await shoppingCartsPage.getTextColumn(page, 1, 'status');
await expect(textColumn).to.contains('Non ordered');
});

Expand Down Expand Up @@ -239,8 +239,7 @@ describe('BO - Orders - Shopping carts : View carts', async () => {
await expect(textColumn).to.contains(orderId);
});

// @todo : https://github.com/PrestaShop/PrestaShop/issues/29894
it.skip('should go the Shopping Cart details page', async function () {
it('should go the Shopping Cart details page', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'goToShoppingCartDetailPage2', baseContext);

await shoppingCartsPage.goToViewPage(page, 1);
Expand All @@ -249,7 +248,7 @@ describe('BO - Orders - Shopping carts : View carts', async () => {
await expect(pageTitle).to.contains(shoppingCartViewPage.pageTitle);
});

it.skip('should check the customer Information Block', async function () {
it('should check the customer Information Block', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'checkCustomerInformationBlock2', baseContext);

const customerInformation = await shoppingCartViewPage.getCustomerInformation(page);
Expand All @@ -259,7 +258,7 @@ describe('BO - Orders - Shopping carts : View carts', async () => {
.and.to.contains(todayCartFormat);
});

it.skip('should check the order Information Block', async function () {
it('should check the order Information Block', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'checkOrderInformationBlock2', baseContext);

const orderInformation = await shoppingCartViewPage.getOrderInformation(page);
Expand All @@ -278,7 +277,7 @@ describe('BO - Orders - Shopping carts : View carts', async () => {
{args: {columnName: 'total_cost_products', result: `€${Products.demo_1.finalPrice}`}},
{args: {columnName: 'total_cart', result: `€${(Products.demo_1.finalPrice).toFixed(2)}`, row: 0}},
].forEach((test) => {
it.skip(`should check the product's ${test.args.columnName} in cart Summary Block`, async function () {
it(`should check the product's ${test.args.columnName} in cart Summary Block`, async function () {
await testContext
.addContextItem(
this,
Expand All @@ -300,7 +299,7 @@ describe('BO - Orders - Shopping carts : View carts', async () => {
});
});

it.skip('should click on the order Link in the order Information Block', async function () {
it('should click on the order Link in the order Information Block', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'clickOrderLink', baseContext);

await shoppingCartViewPage.goToOrderPage(page);
Expand Down
Expand Up @@ -423,16 +423,16 @@ describe('FO - Account : Get GDPR data in PDF', async () => {
const numberOfShoppingCartsAfterFilter = await shoppingCartsPage.getNumberOfElementInGrid(page);
await expect(numberOfShoppingCartsAfterFilter).to.equal(1);

const textColumn = await shoppingCartsPage.getTextColumn(page, 1, 'total');
const textColumn = await shoppingCartsPage.getTextColumn(page, 1, 'c!lastname');
await expect(textColumn).to.contains(customerData.lastName);
});

it('should get shopping cart ID and Date', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'getShoppingCartIDAndDate', baseContext);

shoppingCartDate = await shoppingCartsPage.getTextColumn(page, 1, 'id_guest');
shoppingCartDate = await shoppingCartsPage.getTextColumn(page, 1, 'date');

shoppingCartID = await shoppingCartsPage.getTextColumn(page, 1, 'status');
shoppingCartID = await shoppingCartsPage.getTextColumn(page, 1, 'id_cart');
await expect(parseInt(shoppingCartID, 10)).to.be.greaterThan(5);
});
});
Expand Down
Expand Up @@ -464,18 +464,18 @@ describe('FO - Account : Get GDPR data in CSV', async () => {
const numberOfShoppingCartsAfterFilter = await shoppingCartsPage.getNumberOfElementInGrid(page);
await expect(numberOfShoppingCartsAfterFilter).to.equal(1);

const textColumn = await shoppingCartsPage.getTextColumn(page, 1, 'total');
const textColumn = await shoppingCartsPage.getTextColumn(page, 1, 'c!lastname');
await expect(textColumn).to.contains(customerData.lastName);
});

it('should get shopping cart ID and Date', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'getShoppingCartIDAndDate', baseContext);

shoppingCartDate = await shoppingCartsPage.getTextColumn(page, 1, 'id_guest');
shoppingCartDate = await shoppingCartsPage.getTextColumn(page, 1, 'date');
shoppingCartDate = `${shoppingCartDate.substr(6, 4)}-${shoppingCartDate.substr(0, 2)}-`
+ `${shoppingCartDate.substr(3, 2)}${shoppingCartDate.substr(11, 8)}`;

shoppingCartID = await shoppingCartsPage.getTextColumn(page, 1, 'status');
shoppingCartID = await shoppingCartsPage.getTextColumn(page, 1, 'id_cart');
await expect(parseInt(shoppingCartID, 10)).to.be.greaterThan(5);
});
});
Expand Down
2 changes: 1 addition & 1 deletion tests/UI/commonTests/BO/orders/shoppingCarts.js
Expand Up @@ -71,7 +71,7 @@ function deleteNonOrderedShoppingCarts(baseContext = 'commonTests-deleteNonOrder
numberOfShoppingCarts -= numberOfNonOrderedShoppingCarts;

for (let row = 1; row <= numberOfNonOrderedShoppingCarts; row++) {
const textColumn = await shoppingCartsPage.getTextColumn(page, row, 'c!lastname');
const textColumn = await shoppingCartsPage.getTextColumn(page, row, 'status');
await expect(textColumn).to.contains('Non ordered');
}
});
Expand Down
26 changes: 13 additions & 13 deletions tests/UI/pages/BO/orders/shoppingCarts/index.js
Expand Up @@ -40,13 +40,13 @@ class ShoppingCarts extends BOBasePage {
this.tableBodyColumn = (row) => `${this.tableBodyRow(row)} td`;

// Columns selectors
this.tableColumnId = (row) => `${this.tableBodyColumn(row)}:nth-child(1)`;
this.tableColumnOrderId = (row) => `${this.tableBodyColumn(row)}:nth-child(2)`;
this.tableColumnCustomer = (row) => `${this.tableBodyColumn(row)}:nth-child(3)`;
this.tableColumnTotal = (row) => `${this.tableBodyColumn(row)}:nth-child(4)`;
this.tableColumnCarrier = (row) => `${this.tableBodyColumn(row)}:nth-child(5)`;
this.tableColumnDate = (row) => `${this.tableBodyColumn(row)}:nth-child(6)`;
this.tableColumnOnline = (row) => `${this.tableBodyColumn(row)}:nth-child(7)`;
this.tableColumnId = (row) => `${this.tableBodyColumn(row)}:nth-child(2)`;
this.tableColumnOrderId = (row) => `${this.tableBodyColumn(row)}:nth-child(3)`;
this.tableColumnCustomer = (row) => `${this.tableBodyColumn(row)}:nth-child(4)`;
this.tableColumnTotal = (row) => `${this.tableBodyColumn(row)}:nth-child(5)`;
this.tableColumnCarrier = (row) => `${this.tableBodyColumn(row)}:nth-child(6)`;
this.tableColumnDate = (row) => `${this.tableBodyColumn(row)}:nth-child(7)`;
this.tableColumnOnline = (row) => `${this.tableBodyColumn(row)}:nth-child(8)`;
this.tableColumnActions = (row) => `${this.tableBodyColumn(row)}:nth-child(9)`;
this.tableColumnActionsViewLink = (row) => `${this.tableColumnActions(row)} a.btn-default`;

Expand Down Expand Up @@ -299,27 +299,27 @@ class ShoppingCarts extends BOBasePage {

switch (sortBy) {
case 'id_cart':
columnSelector = this.sortColumnDiv(1);
columnSelector = this.sortColumnDiv(2);
break;

case 'status':
columnSelector = this.sortColumnDiv(2);
columnSelector = this.sortColumnDiv(3);
break;

case 'c!lastname':
columnSelector = this.sortColumnDiv(3);
columnSelector = this.sortColumnDiv(4);
break;

case 'ca!name':
columnSelector = this.sortColumnDiv(5);
columnSelector = this.sortColumnDiv(6);
break;

case 'date':
columnSelector = this.sortColumnDiv(6);
columnSelector = this.sortColumnDiv(7);
break;

case 'id_guest':
columnSelector = this.sortColumnDiv(7);
columnSelector = this.sortColumnDiv(8);
break;

default:
Expand Down

0 comments on commit 7480b69

Please sign in to comment.