Skip to content
This repository has been archived by the owner on Mar 31, 2021. It is now read-only.

Commit

Permalink
Fix tests to work with the new version of `cy.selectRowByColumnAndVal…
Browse files Browse the repository at this point in the history
…ue`.

#341
  • Loading branch information
TheBestPessimist committed Aug 28, 2019
1 parent c64121e commit c485678
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 47 deletions.
33 changes: 15 additions & 18 deletions cypress/integration/picking/pick_HUs_and_create_shipment.js
Expand Up @@ -18,13 +18,10 @@ let shipmentNotificationModalText;
let expectedPackingStatus;

// test columns
// todo @kuba: these should be somehow made translation independent!
// eg. add the columnId as a data object in the table header (data object instead of class coz it's free form text so it may contains spaces and periods);
// ref: https://docs.cypress.io/guides/references/best-practices.html#Selecting-Elements
// or something else?
const pickingOrderColumn = 'Order';
const huCodeColumn = 'Code';
const productPartnerColumn = 'Product / Partner';
const orderColumn = 'order';
const huSelectionHuCodeColumn = 'Value';
const pickingHuCodeColumn = 'huCode';
const productPartnerColumn = 'ProductOrBPartner';

// test
let soDocNumber;
Expand Down Expand Up @@ -137,47 +134,47 @@ describe('Pick the SO', function() {
});

it('Select first row and run action Pick', function() {
cy.selectRowByColumnAndValue(productPartnerColumn, productName);
cy.selectRowByColumnAndValue({ column: productPartnerColumn, value: productName });
cy.executeQuickAction('WEBUI_Picking_Launcher');
});

it('Pick first HU', function() {
cy.selectLeftTable().within(() => {
cy.selectRowByColumnAndValue(pickingOrderColumn, soDocNumber, false, true);
cy.selectRowByColumnAndValue({ column: orderColumn, value: soDocNumber }, false, true);
});
cy.openPickingHUSelectionWindow();
cy.selectRightTable().within(() => {
cy.selectRowByColumnAndValue(huCodeColumn, huValue1, false, true);
cy.selectRowByColumnAndValue({ column: huSelectionHuCodeColumn, value: huValue1 }, false, true);
});
cy.executeQuickAction('WEBUI_Picking_HUEditor_PickHU', true, false);
});

it('Pick second HU', function() {
cy.selectLeftTable().within(() => {
cy.selectRowByColumnAndValue(pickingOrderColumn, soDocNumber, false, true);
cy.selectRowByColumnAndValue({ column: orderColumn, value: soDocNumber }, false, true);
});
cy.openPickingHUSelectionWindow();
cy.selectRightTable().within(() => {
cy.selectRowByColumnAndValue(huCodeColumn, huValue2, false, true);
cy.selectRowByColumnAndValue({ column: huSelectionHuCodeColumn, value: huValue2 }, false, true);
});
cy.executeQuickAction('WEBUI_Picking_HUEditor_PickHU', true, false);
});

it('Confirm Picks', function() {
cy.selectLeftTable().within(() => {
cy.selectRowByColumnAndValue(pickingOrderColumn, soDocNumber, false, true);
cy.selectRowByColumnAndValue({ column: orderColumn, value: soDocNumber }, false, true);
});
cy.selectRightTable().within(() => {
cy.selectRowByColumnAndValue(huCodeColumn, huValue2, false, true);
cy.selectRowByColumnAndValue({ column: pickingHuCodeColumn, value: huValue2 }, false, true);
});
cy.executeQuickAction('WEBUI_Picking_M_Picking_Candidate_Process', true, false);
cy.waitForSaveIndicator();

cy.selectLeftTable().within(() => {
cy.selectRowByColumnAndValue(pickingOrderColumn, soDocNumber, false, true);
cy.selectRowByColumnAndValue({ column: orderColumn, value: soDocNumber }, false, true);
});
cy.selectRightTable().within(() => {
cy.selectRowByColumnAndValue(huCodeColumn, huValue1, false, true);
cy.selectRowByColumnAndValue({ column: pickingHuCodeColumn, value: huValue1 }, false, true);
});
cy.executeQuickAction('WEBUI_Picking_M_Picking_Candidate_Process', true, false);
cy.waitForSaveIndicator();
Expand Down Expand Up @@ -224,8 +221,8 @@ describe('Generate the Shipment', function() {
cy.getStringFieldValue('C_BPartner_ID').should('contain', businessPartnerName);
cy.selectTab('M_HU_Assignment');
cy.expectNumberOfRows(2);
cy.selectRowByColumnAndValue('Handling Units', huValue1);
cy.selectRowByColumnAndValue('Handling Units', huValue2);
cy.selectRowByColumnAndValue({ Column: 'Handling Units', value: huValue1 });
cy.selectRowByColumnAndValue({ Column: 'Handling Units', value: huValue2 });
});

it('Visit HU Editor and expect the 2 HUs have Packing Status Shipped', function() {
Expand Down
32 changes: 17 additions & 15 deletions cypress/integration/picking/pick_in_a_new_HU.js
Expand Up @@ -50,18 +50,16 @@ let bPartnerName;
// SO/HU
let productQty;
let soProductQuantity;
// eslint-disable-next-line
let expectedProductQtyAfterPicking;
let locatorId;

// test columns
// todo @kuba: these should be somehow made translation independent!
// eg. add the columnId as a data object in the table header (data object instead of class coz it's free form text so it may contains spaces and periods);
// ref: https://docs.cypress.io/guides/references/best-practices.html#Selecting-Elements
// or something else?
const pickingOrderColumn = 'Order';
const huCodeColumn = 'Code';
const qtyCUColumn = 'Qty CU';
const productPartnerColumn = 'Product / Partner';
const orderColumn = 'order';
const huSelectionHuCodeColumn = 'Value';
const productPartnerColumn = 'ProductOrBPartner';
const pickingQtyCUColumn = 'huQtyCU';
const pickingPackingInfoColumn = 'huPackingInfo';

// test
let soDocNumber;
Expand Down Expand Up @@ -189,28 +187,28 @@ describe('Pick the SO', function() {
});

it('Select first row and run action Pick', function() {
cy.selectRowByColumnAndValue(productPartnerColumn, productName);
cy.selectRowByColumnAndValue({ column: productPartnerColumn, value: productName });
cy.executeQuickAction('WEBUI_Picking_Launcher');
});

it('Mark the HU as source', function() {
cy.selectLeftTable().within(() => {
cy.selectRowByColumnAndValue(pickingOrderColumn, soDocNumber, false, true);
cy.selectRowByColumnAndValue({ column: orderColumn, value: soDocNumber }, false, true);
});
cy.openPickingHUSelectionWindow();
cy.selectRightTable().within(() => {
cy.selectRowByColumnAndValue(huCodeColumn, huValue, false, true);
cy.selectRowByColumnAndValue({ column: huSelectionHuCodeColumn, value: huValue }, false, true);
});
cy.executeQuickAction('WEBUI_Picking_HUEditor_Create_M_Source_HUs', true, false);
cy.selectRightTable().within(() => {
// expecting the HU to be here
cy.selectRowByColumnAndValue(huCodeColumn, huValue, false, true);
cy.selectRowByColumnAndValue({ column: huSelectionHuCodeColumn, value: huValue }, false, true);
});
});

it('Run quick-action "Pick to new HU"', function() {
cy.selectLeftTable().within(() => {
cy.selectRowByColumnAndValue(pickingOrderColumn, soDocNumber, false, true);
cy.selectRowByColumnAndValue({ column: orderColumn, value: soDocNumber }, false, true);
});
cy.selectRightTable().within(() => {
cy.selectNthRow(0, false, true);
Expand All @@ -225,10 +223,14 @@ describe('Pick the SO', function() {

it('Confirm Pick', function() {
cy.selectLeftTable().within(() => {
cy.selectRowByColumnAndValue(pickingOrderColumn, soDocNumber, false, true);
cy.selectRowByColumnAndValue({ column: orderColumn, value: soDocNumber }, false, true);
});
cy.selectRightTable().within(() => {
cy.selectRowByColumnAndValue(qtyCUColumn, soProductQuantity, false, true);
const columnAndValue = [
{ column: pickingPackingInfoColumn, value: packingInstructionsName },
{ column: pickingQtyCUColumn, value: soProductQuantity },
];
cy.selectRowByColumnAndValue(columnAndValue, false, true);
});
cy.executeQuickAction('WEBUI_Picking_M_Picking_Candidate_Process', true, false);
cy.waitForSaveIndicator();
Expand Down
26 changes: 12 additions & 14 deletions cypress/integration/returns/create_customer_return_from_shipment.js
Expand Up @@ -41,13 +41,11 @@ let shipmentNotificationModalText;
let warehouseName;

// test columns
// todo @kuba: these should be somehow made translation independent!
// eg. add the columnId as a data object in the table header (data object instead of class coz it's free form text so it may contains spaces and periods);
// ref: https://docs.cypress.io/guides/references/best-practices.html#Selecting-Elements
// or something else?
const pickingOrderColumn = 'Order';
const huCodeColumn = 'Code';
const productPartnerColumn = 'Product / Partner';
const orderColumn = 'order';
const huSelectionHuCodeColumn = 'Value';
const pickingHuCodeColumn = 'huCode';
const productPartnerColumn = 'ProductOrBPartner';
const shipmentHandlingUnitsColumn = 'M_HU_ID';

// test
const expectedCustomerReturnDocType = 'Kundenwarenrückgabe';
Expand Down Expand Up @@ -138,27 +136,27 @@ describe('Pick the SO', function() {
});

it('Select first row and run action Pick', function() {
cy.selectRowByColumnAndValue(productPartnerColumn, productName);
cy.selectRowByColumnAndValue({ column: productPartnerColumn, value: productName });
cy.executeQuickAction('WEBUI_Picking_Launcher');
});

it('Pick first HU', function() {
cy.selectLeftTable().within(() => {
cy.selectRowByColumnAndValue(pickingOrderColumn, soDocNumber, false, true);
cy.selectRowByColumnAndValue({ column: orderColumn, value: soDocNumber }, false, true);
});
cy.openPickingHUSelectionWindow();
cy.selectRightTable().within(() => {
cy.selectRowByColumnAndValue(huCodeColumn, huValue, false, true);
cy.selectRowByColumnAndValue({ column: huSelectionHuCodeColumn, value: huValue }, false, true);
});
cy.executeQuickAction('WEBUI_Picking_HUEditor_PickHU', true, false);
});

it('Confirm Picks', function() {
cy.selectLeftTable().within(() => {
cy.selectRowByColumnAndValue(pickingOrderColumn, soDocNumber, false, true);
cy.selectRowByColumnAndValue({ column: orderColumn, value: soDocNumber }, false, true);
});
cy.selectRightTable().within(() => {
cy.selectRowByColumnAndValue(huCodeColumn, huValue, false, true);
cy.selectRowByColumnAndValue({ column: pickingHuCodeColumn, value: huValue }, false, true);
});
cy.executeQuickAction('WEBUI_Picking_M_Picking_Candidate_Process', true, false);
cy.waitForSaveIndicator();
Expand Down Expand Up @@ -194,7 +192,7 @@ describe('Generate the Shipment', function() {
cy.getStringFieldValue('C_BPartner_ID').should('contain', businessPartnerName);
cy.selectTab('M_HU_Assignment');
cy.expectNumberOfRows(1);
cy.selectRowByColumnAndValue('Handling Units', huValue);
cy.selectRowByColumnAndValue({ column: shipmentHandlingUnitsColumn, value: huValue });
cy.getCurrentWindowRecordId().then(id => (shipmentRecordID = id));
});
});
Expand All @@ -203,7 +201,7 @@ describe('Create Customer return from Shipment', function() {
it('Go to Shipment and create customer return', function() {
cy.visitWindow(169, shipmentRecordID);
cy.executeHeaderActionWithDialog('WEBUI_M_InOut_Shipment_SelectHUs');
cy.selectRowByColumnAndValue(huCodeColumn, huValue);
cy.selectRowByColumnAndValue({ column: huSelectionHuCodeColumn, value: huValue });
cy.executeQuickAction('WEBUI_M_HU_ReturnFromCustomer', true, false);
cy.pressDoneButton();
});
Expand Down

0 comments on commit c485678

Please sign in to comment.