Skip to content
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

MC-30152: Bundle Product / Create / Price validation for dynamic price #31501

Merged
merged 1 commit into from
Jan 20, 2021

Conversation

engcom-Echo
Copy link
Contributor

@engcom-Echo engcom-Echo commented Jan 4, 2021

Description (*)

Disappear error message after disabled field.

Related Pull Requests

Fixed Issues (if relevant)

  1. Fixes Bundle Product / Create / Price validation for dynamic price #26214

Manual testing scenarios (*)

See: #26214

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 Jan 4, 2021

Hi @engcom-Echo. 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

@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: S2 Major restrictions or short-term circumventions are required until a fix is available. labels Jan 4, 2021
@engcom-Echo
Copy link
Contributor Author

@magento run all tests

1 similar comment
@engcom-Echo
Copy link
Contributor Author

@magento run all tests

@eduard13
Copy link
Contributor

eduard13 commented Jan 5, 2021

@magento run WebAPI Tests

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 @engcom-Echo, thank you for the fix and test coverage. Could you please review the minor suggestions from my side?


<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AssertAdminErrorMessageDisappearDisabledFieldActionGroup">
Copy link
Contributor

Choose a reason for hiding this comment

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

The ActionGroup does too many things and I don't think it's a reusable one. I would split it in at least into the following ones:

  • AdminTogglePriceSwitcherActionGroup
  • AdminFocusAndFillElementActionGroup
  • AdminAssertErrorIsVisibleActionGroup / AdminAssertErrorIsNotVisibleActionGroup

What do you think about a such refactoring?
Thank you.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. Good idea.

-->
<!-- Test XML Example -->
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdminDisappearErrorValidateMessageFieldTest">
Copy link
Contributor

Choose a reason for hiding this comment

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

I would rather move this test under Magento_Bundle module, as the test is more related to Bundle product. What do you think?

Copy link
Contributor Author

@engcom-Echo engcom-Echo Jan 5, 2021

Choose a reason for hiding this comment

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

Hi, @eduard13
We change UI component and I think a test must be in module Ui. The test scenario is related to an issue. Maybe there are other places where the issue is reproduced but I didn't find them.

Copy link
Contributor

Choose a reason for hiding this comment

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

Generally, a non written rule says that we shouldn't be using ActionGroups/Entities, etc. for modules that we don't have in dependencies. But seeing that Ui > Sales > Bundle, most likely we should be fine here.

Comment on lines 12 to 15
<features value="Ui component"/>
<stories value="Error message"/>
<title value="Assert disappear error message."/>
<description value="Verify disappear error message when disabled field."/>
Copy link
Contributor

Choose a reason for hiding this comment

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

If moving it to Bundle module, these tags should also reflect what actually the test does.

@eduard13
Copy link
Contributor

eduard13 commented Jan 6, 2021

@magento run WebAPI Tests

@engcom-Echo
Copy link
Contributor Author

@magento run all tests

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.

Good job on refactoring that ActionGroup. May you also address the below small suggestions?

Thank you.


<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AssertAdminErrorIsNotVisibleActionGroup">
Copy link
Contributor

Choose a reason for hiding this comment

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

Lets also add a better name: AssertAdminErrorIsNotVisibleForProductFieldActionGroup.

Suggested change
<actionGroup name="AssertAdminErrorIsNotVisibleActionGroup">
<actionGroup name="AssertAdminErrorIsNotVisibleForProductFieldActionGroup">


<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AssertAdminErrorIsVisibleActionGroup">
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<actionGroup name="AssertAdminErrorIsVisibleActionGroup">
<actionGroup name="AssertAdminErrorIsVisibleForProductFieldActionGroup">

@@ -69,6 +69,7 @@
<element name="priceField" type="input" selector="//div[@data-index='price']//input"/>
<element name="listedBundleItem" type="text" selector="//tr[@data-repeat-index='0']//div"/>
<element name="listedBundleItem2" type="text" selector="//tr[@data-repeat-index='2']//div"/>
<element name="fieldError" type="text" selector="//div[@data-index='{{fieldIndex}}']//following-sibling::label[@class='admin__field-error']" parameterized="true"/>
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this selector also applicable for all the product types? If yes, let's move it to AdminProductFormSection.

<argument name="fieldIndex" type="string"/>
</arguments>

<seeElement selector="{{AdminProductFormBundleSection.fieldError(fieldIndex)}}" stepKey="seeError"/>
Copy link
Contributor

Choose a reason for hiding this comment

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

In case the selector applies to all products.

Suggested change
<seeElement selector="{{AdminProductFormBundleSection.fieldError(fieldIndex)}}" stepKey="seeError"/>
<seeElement selector="{{AdminProductFormSection.fieldError(fieldIndex)}}" stepKey="seeError"/>

<argument name="fieldIndex" type="string"/>
</arguments>

<dontSeeElement selector="{{AdminProductFormBundleSection.fieldError(fieldIndex)}}" stepKey="seeError"/>
Copy link
Contributor

Choose a reason for hiding this comment

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

In case the selector applies to all products.

Suggested change
<dontSeeElement selector="{{AdminProductFormBundleSection.fieldError(fieldIndex)}}" stepKey="seeError"/>
<dontSeeElement selector="{{AdminProductFormSection.fieldError(fieldIndex)}}" stepKey="seeError"/>

@zakdma
Copy link
Contributor

zakdma commented Jan 19, 2021

@magento-engcom-team
Copy link
Contributor

@zakdma, an error occurred during the Pull Request import.

@magento-engcom-team
Copy link
Contributor

@zakdma the branch with code successfully imported intomagento-tsg/magento2ce repository. Branch name: imported-magento-magento2-31501.

@magento-engcom-team magento-engcom-team merged commit d5d5372 into magento:2.4-develop Jan 20, 2021
@m2-assistant
Copy link

m2-assistant bot commented Jan 20, 2021

Hi @engcom-Echo, 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Frontend Auto-Tests: Covered All changes in Pull Request is covered by auto-tests Award: bug fix Component: Bundle Component: Catalog Component: Ui 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: S2 Major restrictions or short-term circumventions are required until a fix is available. Type: Bug Fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bundle Product / Create / Price validation for dynamic price
6 participants