magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

Fix issues with Customer Data when form contains element with name `method`

Open lbajsarowicz opened this issue 1 year ago • 15 comments

Description (*)

The path to verify <form method=""> value in customer-data.js (Magento_Customer) is glitchy and when there's an element with name="method" in the submitted form, the event.target.method refers to element, not attribute.

image

Related Pull Requests

Fixed Issues (if relevant)

Please create one.

Manual testing scenarios (*)

  1. Open any form (e.g. Customer Registration form),
  2. Open Browser console and replace name="" of any element (e.g. "Remember me") to name="method".
  3. Set breakpoint at customer-data.min.js line after $(document).on('submit', function(event) {.
  4. Expect that if () section (1 line below) uses <form method=""> - not just created element.

Questions or comments

We noticed the issue while troubleshooting Paradoxlabs Firstdata extension issues.

image

CC @rhoerr

Contribution checklist (*)

  • [ ] Pull request has a meaningful description of its purpose
  • [ ] All commits are accompanied by meaningful commit messages
  • [ ] All new or changed code is covered with unit/integration tests (if applicable)
  • [ ] README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • [ ] All automated tests passed successfully (all builds are green)

Resolved issues:

  1. [x] resolves magento/magento2#38484: Fix issues with Customer Data when form contains element with name method

lbajsarowicz avatar Feb 16 '24 19:02 lbajsarowicz

Hi @lbajsarowicz. Thank you for your contribution! Here are some useful tips on how you can test your changes using Magento test environment.

Add the comment under your pull request to deploy test or vanilla Magento instance:
  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

:exclamation: Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s) For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names.

Allowed build names are:
  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests
  13. Semantic Version Checker

You can find more information about the builds here :information_source: Run only required test builds during development. Run all test builds before sending your pull request for review.


For more details, review the Code Contributions documentation. Join Magento Community Engineering Slack and ask your questions in #github channel.

m2-assistant[bot] avatar Feb 16 '24 19:02 m2-assistant[bot]

@magento run all tests

@ihor-sviziev Would you mind performing Code Review?

lbajsarowicz avatar Feb 16 '24 19:02 lbajsarowicz

@magento run all tests

ihor-sviziev avatar Feb 18 '24 09:02 ihor-sviziev

@magento run Functional Tests B2B, Functional Tests CE, Functional Tests EE, WebAPI Tests

lbajsarowicz avatar Feb 19 '24 08:02 lbajsarowicz

@magento run Sample Data Tests B2B, Sample Data Tests CE, Sample Data Tests EE

lbajsarowicz avatar Feb 19 '24 08:02 lbajsarowicz

Failed to run the builds. Please try to re-run them later.

@magento run all tests

Here we go again with tests, as I added extra file responsible for the issue.

lbajsarowicz avatar Feb 19 '24 16:02 lbajsarowicz

@magento run Functional Tests B2B, Functional Tests CE, Functional Tests EE

lbajsarowicz avatar Feb 20 '24 09:02 lbajsarowicz

@magento run Functional Tests B2B, Functional Tests EE, Sample Data Tests CE, Sample Data Tests B2B, Sample Data Tests EE

lbajsarowicz avatar Feb 20 '24 11:02 lbajsarowicz

Hello @lbajsarowicz It is not required to run the Sample Data tests. It doesn't work now ))

andrewbess avatar Feb 20 '24 13:02 andrewbess

Oh, thanks @andrewbess, I wasn't aware

lbajsarowicz avatar Feb 20 '24 13:02 lbajsarowicz

The functional test failures look like flaky:

  1. Functional Tests EE
  • https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/38449/874e87d7857268893f2d57c5bb4bdc74/Functional/allure-report-ee/index.html
  • https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/38449/346231f14634050a4357fbc39ce5f780/Functional/allure-report-ee/index.html
  1. Functional Tests B2B
  • https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/38449/677d7063c8cb647019915e0bcaf30db8/Functional/allure-report-b2b/index.html

andrewbess avatar Feb 20 '24 13:02 andrewbess

Oh, thanks @andrewbess, I wasn't aware

Happy return on board @lbajsarowicz

andrewbess avatar Feb 20 '24 13:02 andrewbess

@magento run Functional Tests B2B, Functional Tests EE

andrewbess avatar Feb 20 '24 13:02 andrewbess

@magento create issue

engcom-Delta avatar Feb 29 '24 13:02 engcom-Delta

:heavy_check_mark: QA Passed

Preconditions:

  • Install fresh Magento 2.4-develop

Manual testing scenario: We have followed steps from comment

Before: :heavy_multiplication_x:  Screenshot 2024-03-06 at 11 11 47 AM

After: :heavy_check_mark:   Screenshot 2024-03-06 at 11 21 58 AM

Builds are failed. Hence, moving this PR to Extended Testing.

engcom-Echo avatar Mar 06 '24 07:03 engcom-Echo

@magento run all tests

engcom-Echo avatar Mar 06 '24 07:03 engcom-Echo

@magento run Functional Tests EE,Functional Tests CE

engcom-Echo avatar Mar 06 '24 09:03 engcom-Echo

@magento run Functional Tests B2B

engcom-Echo avatar Mar 06 '24 09:03 engcom-Echo

Functional Tests CE,Functional Tests B2B failure are different on last two run on same commit. Functional Tests CE Run1 Screenshot 2024-03-06 at 4 13 49 PM

Run2 Screenshot 2024-03-06 at 4 13 53 PM

Functional Tests B2B Run1 Screenshot 2024-03-06 at 5 24 40 PM

Run2 Screenshot 2024-03-06 at 5 24 45 PM

Hence Moving it to Merge in progress.

engcom-Echo avatar Mar 06 '24 10:03 engcom-Echo

@magento run Functional Tests CE,Functional Tests B2B

engcom-Echo avatar Mar 11 '24 04:03 engcom-Echo