Openbravo Issue Tracking System - POS2
View Issue Details
0053412POS2POSpublic2023-09-07 12:022023-09-15 11:41
andre_montenegro 
andre_montenegro 
normalminorhave not tried
closedfixed 
5
 
 
No
0053412: Modify ProductButtonContentName data-testid to be unique
As some performance degradation has been observed in Cypress tests when adding a product to the ticket several times, by reviewing Cypress documentation I found out that one of the reasons could be that “cy.get()” receives more than 1 value, which is actually our case as all product buttons have the same data-testid value and the one is desired, is filtered by it’s content text.

After testing this change as a draft and by reverting some workarounds to some of this performance degradation failures, results are that job execution time does not improve, but degradation in tests is decreased as no test failed anymore.

It has been tested more than 15 times.
Replace productT3 test (from product.spec.js) by this tests steps:
"
      cy.changeProductCategory(this.testData.productCategory2);
      cy.addProduct(this.testData.product4);
      cy.paginateProductVertical(1);
      cy.addProduct(this.testData.product5);
      cy.paginateProductVertical(0);
      cy.addProduct(this.testData.product6);
      cy.assertNumLines(3);
      cy.addProduct(this.testData.product4);
      cy.paginateProductVerticalArrows('Down');
      cy.addProduct(this.testData.product5);
      cy.paginateProductVerticalArrows('Up');
      cy.addProduct(this.testData.product6);
      cy.assertNumLines(3);
      cy.window().should(win => {
        expect(win.OB.App.State.getState().Ticket.lines[0].qty).to.equal(2);
        expect(win.OB.App.State.getState().Ticket.lines[1].qty).to.equal(2);
        expect(win.OB.App.State.getState().Ticket.lines[2].qty).to.equal(2);
      });
"
Which can easily reproduce this degradation in the performance and will fail when trying to add a product to the ticket.

Launch a try-pos2 execution with the mentioned change and observe the degradation in the video and the failure.
Use an unique data-testid for each product button (ProductButtonContentName.jsx):

For example: data-testid={`${testId}-${payload.identifier}`}
instead data-testid={`${testId}-identifier`}


This will also require to fix Jest and Cypress tests which can be affected by the change.
No tags attached.
Issue History
2023-09-07 12:02andre_montenegroNew Issue
2023-09-07 12:02andre_montenegroAssigned To => andre_montenegro
2023-09-07 12:02andre_montenegroTriggers an Emergency Pack => No
2023-09-07 12:06andre_montenegroProposed Solution updated
2023-09-13 10:47hgbotNote Added: 0154771
2023-09-13 11:03hgbotNote Added: 0154772
2023-09-15 11:37hgbotNote Added: 0154889
2023-09-15 11:37hgbotNote Added: 0154890
2023-09-15 11:37hgbotNote Added: 0154891
2023-09-15 11:37hgbotNote Added: 0154892
2023-09-15 11:37hgbotNote Added: 0154893
2023-09-15 11:39hgbotNote Added: 0154894
2023-09-15 11:39hgbotNote Added: 0154895
2023-09-15 11:41andre_montenegroStatusnew => scheduled
2023-09-15 11:41andre_montenegroStatusscheduled => resolved
2023-09-15 11:41andre_montenegroResolutionopen => fixed
2023-09-15 11:41andre_montenegroStatusresolved => closed

Notes
(0154771)
hgbot   
2023-09-13 10:47   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2/-/merge_requests/2084 [^]
(0154772)
hgbot   
2023-09-13 11:03   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2.restaurant/-/merge_requests/248 [^]
(0154889)
hgbot   
2023-09-15 11:37   
Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2 [^]
Changeset: 7dbb99d3e7e0699326654b47e4964766c6e1fcee
Author: André Montenegro <andre.montenegro@openbravo.com>
Date: 14-09-2023 15:41:39
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2/-/commit/7dbb99d3e7e0699326654b47e4964766c6e1fcee [^]

Related to ISSUE-53412: created unique data-testid for each productButtonContentName

---
M web-jspack/org.openbravo.pos2/src/components/ProductButton/ProductButtonContentName/ProductButtonContentName.jsx
---
(0154890)
hgbot   
2023-09-15 11:37   
Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2 [^]
Changeset: 03c3a9b20d57e53780c95b3f888360b00e14fddd
Author: André Montenegro <andre.montenegro@openbravo.com>
Date: 15-09-2023 11:02:42
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2/-/commit/03c3a9b20d57e53780c95b3f888360b00e14fddd [^]

Related to ISSUE-53412: cypress tests adapted to unique data-testid for product button

---
M web-jspack/org.openbravo.pos2/src-test/cypress/e2e/Features/initial.spec.js
M web-jspack/org.openbravo.pos2/src-test/cypress/e2e/Features/productSearch.spec.js
M web-jspack/org.openbravo.pos2/src-test/cypress/functions/logins.js
M web-jspack/org.openbravo.pos2/src-test/cypress/functions/schema.js
M web-jspack/org.openbravo.pos2/src-test/cypress/functions/ticket.js
---
(0154891)
hgbot   
2023-09-15 11:37   
Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2 [^]
Changeset: 0460708379530150c956c5dbfb1cf1c716a8c270
Author: André Montenegro <andre.montenegro@openbravo.com>
Date: 15-09-2023 11:03:00
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2/-/commit/0460708379530150c956c5dbfb1cf1c716a8c270 [^]

Related to ISSUE-53412: ProductButton & ProductContentName Jest tests fixed

---
M web-jspack/org.openbravo.pos2/src/components/ProductButton/ProductButtonContent/__test__/ProductButtonContent.test.jsx
M web-jspack/org.openbravo.pos2/src/components/ProductButton/__test__/ProductButton.test.jsx
---
(0154892)
hgbot   
2023-09-15 11:37   
Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2 [^]
Changeset: 47514743a1fa1781713edf1a89d1e783b294e600
Author: André Montenegro <andre.montenegro@openbravo.com>
Date: 15-09-2023 11:03:00
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2/-/commit/47514743a1fa1781713edf1a89d1e783b294e600 [^]

Related to ISSUE-53412: productKeymap Jest test fixed

---
M web-jspack/org.openbravo.pos2/src/components/ProductKeymap/__mock__/ProductKeymap.mock1.json
M web-jspack/org.openbravo.pos2/src/components/ProductKeymap/__test__/ProductKeymap.test.jsx
---
(0154893)
hgbot   
2023-09-15 11:37   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2/-/merge_requests/2084 [^]
(0154894)
hgbot   
2023-09-15 11:39   
Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2.restaurant [^]
Changeset: 8037f40bdfea75799e577e94c20e07a989d3fe1e
Author: André Montenegro <andre.montenegro@openbravo.com>
Date: 13-09-2023 10:54:00
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2.restaurant/-/commit/8037f40bdfea75799e577e94c20e07a989d3fe1e [^]

Related to ISSUE-53412: adapted test to new unique data-testid for each product

---
M web-jspack/org.openbravo.pos2.restaurant/src-test/cypress/e2e/Features/menus.spec.js
M web-jspack/org.openbravo.pos2.restaurant/src-test/cypress/functions/menu.js
---
(0154895)
hgbot   
2023-09-15 11:39   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2.restaurant/-/merge_requests/248 [^]