Skip to content

set correct remaining available discount amount when applying fixed p… #30953

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

Conversation

sky-hub
Copy link
Member

@sky-hub sky-hub commented Nov 17, 2020

…rice cart rules to bundle products

Description (*)

Related Pull Requests

Fixed Issues (if relevant)

  1. fixes [Cart Rule] Incorrect discount amount applied for bundle products containing more than one option #30952

Manual testing scenarios (*)

  1. Install Magento 2.4 with sample data
  2. Create cart rule with fixed discount amount for whole cart (Ex: 50$)
  3. Add a bundle product to cart (Example: http://local.magento2.com/sprite-yoga-companion-kit.html)
  4. Navigate to checkout/cart page and check discount.
  5. Expected result: 50$, actual: 18.85$

Questions or comments

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)
  • All automated tests passed successfully (all builds are green)

@m2-assistant
Copy link

m2-assistant bot commented Nov 17, 2020

Hi @sky-hub. Thank you for your contribution
Here is some useful tips 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

❗ 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

You can find more information about the builds here

ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review.

For more details, please, review the Magento Contributor Guide documentation.

⚠️ According to the Magento Contribution requirements, all Pull Requests must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of Pull Requests happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@eduard13
Copy link
Contributor

@magento run all tests

@m2-community-project m2-community-project bot added Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround. labels Nov 18, 2020
Copy link
Contributor

@eduard13 eduard13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @sky-hub, thank you for the following fix. According to the Definition of Done, all changes have to be covered by some automated tests. Would you be kind covering the fixed case by a test?
You may write a simple MFTF test that will pass through the Precondition steps and will check the cart discount.

Thank you.

@sky-hub
Copy link
Member Author

sky-hub commented Nov 19, 2020

@eduard13, sure. I will get back with a comment when tests are implemented.

Cheers

@engcom-Hotel engcom-Hotel self-assigned this Nov 20, 2020
@sky-hub
Copy link
Member Author

sky-hub commented Nov 21, 2020

@eduard13 I had a look in the MTFT testing and I ran into a dead end.

It seems there is already a MTFT Test for bundle products in app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleForBundleProductTest.xml but apparently even this test is skipped due to some issue:
<skip><issueId value="MQE-2288" /></skip>.

At this point I do not know if I should update this test, and if I do update it what is the reason behind that issue that marks the test as skipped. Do you think you can help here?

PS: Please note that my experience with MTFT is very limited.

@eduard13
Copy link
Contributor

@sky-hub ahh, got your point. Based on the commit's message, it looks like there were some issues running the test on Chrome 85 version. As far as I can see, the existing test applies on Percent of product price discount, which in my opinion should also be the case for this PR (I haven't checked this case), however you may create a new one that checks the Fixed amount discount test case (having the same test case as the issue states).

What do you think?
Thank you.

@eduard13
Copy link
Contributor

@magento run Integration Tests, Functional Tests B2B

@sky-hub
Copy link
Member Author

sky-hub commented Nov 22, 2020

@eduard13 , sounds good to me.
I'll implement a test as you suggested and get back to you when it's done

@sky-hub sky-hub force-pushed the bundle-products-fixed-cart-discount branch from abfc139 to 3332e14 Compare November 24, 2020 11:19
@sky-hub
Copy link
Member Author

sky-hub commented Nov 24, 2020

@eduard13 , test implemented.
Please let me know if there is anything else I can help with.

Copy link
Contributor

@eduard13 eduard13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @sky-hub, thank you for the test coverage. I've left couple of comments, could you please review them?
Feel free to reach me if additional questions arise.

Thanks.

@eduard13
Copy link
Contributor

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

@eduard13
Copy link
Contributor

Additionally, could you please review the failed Functional Tests, as they might be related to your changes?
Thank you.

@engcom-Hotel
Copy link
Contributor

@magento run all tests

2 similar comments
@engcom-Hotel
Copy link
Contributor

@magento run all tests

@engcom-Hotel
Copy link
Contributor

@magento run all tests

@sky-hub sky-hub force-pushed the bundle-products-fixed-cart-discount branch from 8982061 to d56db5b Compare November 26, 2020 16:20
@engcom-Hotel
Copy link
Contributor

@magento run all tests

@engcom-Hotel
Copy link
Contributor

@magento run Functional Tests B2B

# Conflicts:
#	app/code/Magento/Checkout/Test/Mftf/Test/StoreFrontFreeShippingRecalculationAfterCouponCodeAddedTest.xml
@engcom-Hotel
Copy link
Contributor

@magento run all tests

@engcom-Hotel
Copy link
Contributor

@magento run all tests

@engcom-Hotel
Copy link
Contributor

@magento run all tests

@engcom-Hotel
Copy link
Contributor

@magento run Functional Tests CE

@m2-assistant
Copy link

m2-assistant bot commented Dec 10, 2020

Hi @sky-hub, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@sky-hub sky-hub deleted the bundle-products-fixed-cart-discount branch December 11, 2020 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests Award: bug fix Component: Checkout Component: SalesRule Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: accept QA: Added to Regression Scope Scenario was analysed and added to Regression Testing Scope Release Line: 2.4 Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Cart Rule] Incorrect discount amount applied for bundle products containing more than one option
6 participants