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

Fix issue when can't remove layout update after add during new widget creation #29991

Merged
merged 20 commits into from
Dec 21, 2020

Conversation

saphaljha
Copy link
Contributor

@saphaljha saphaljha commented Sep 11, 2020

Description (*)

Related Pull Requests

Fixed Issues (if relevant)

  1. Fixes item layout updates can't remove after add when create new widget #29936

Manual testing scenarios (*)

  1. Manually tested by adding and removing the elements in new widget as well as in old widget

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 Sep 11, 2020

Hi @saphaljha. 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

@saphaljha
Copy link
Contributor Author

@magento run all tests

@ihor-sviziev ihor-sviziev changed the title Fixed issue 29936 Fix can't remove layout update after add when create new widget Sep 11, 2020
@ihor-sviziev ihor-sviziev changed the title Fix can't remove layout update after add when create new widget Fix issue when can't remove layout update after add during new widget creation Sep 11, 2020
@saphaljha
Copy link
Contributor Author

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

targetElement = event.target;
var {$elementName}Array = document.querySelectorAll("{$elementSelector}");

{$elementName}Array.forEach(function(element){
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to make sure that document.querySelectorAll will return an empty node list if there's no {$elementSelector} on the page. @saphaljha have you tested this scenario?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rogyar , Thank you for suggestion, I have updated the code for validate empty nodeList. Also, covered MFTF.

@rogyar rogyar self-assigned this Sep 11, 2020
@rogyar rogyar added Award: bug fix Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests labels Sep 11, 2020
@rogyar
Copy link
Contributor

rogyar commented Sep 11, 2020

Hi @saphaljha. Thank you for your collaboration. Please, check my comment above. Also, I would ask you to cover your fix with an MFTF test. The MFTF test should basically emulate all the steps from "steps to reproduce" and check if it is possible to remove items other than the first one.

Thank you!

@sidolov sidolov added Priority: P3 May be fixed according to the position in the backlog. Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. and removed Priority: P3 May be fixed according to the position in the backlog. labels Sep 11, 2020
@saphaljha
Copy link
Contributor Author

@magento run all tests

@ghost ghost assigned saphaljha Sep 12, 2020
<actionGroups
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminCreateAndDeleteMultipleLayoutWidgetActionGroup">
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @saphaljha. Great work! Thank you for the coverage.
We may improve this action group by splitting it into more atomic action groups. The main reason of it is the following. The purpose of the current action group is very specific and it might not be reused in many cases. In the meantime, we could split this huge action group into pieces like action group that creates widget, action group that deletes widget, action group that asserts number elements. In this case the smaller action groups will be much more reusable. Also, it's a good idea to double-check if we could reuse the existing action groups for adding/removing widgets.

Hope it makes sense.

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.

Thank you @rogyar ,
I have updated it MFTF as per your suggestions, Please check and let me know if there is anything.

@rogyar rogyar added Award: MFTF test coverage Auto-Tests: Covered All changes in Pull Request is covered by auto-tests and removed Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests labels Sep 15, 2020
@mrtuvn mrtuvn mentioned this pull request Sep 30, 2020
5 tasks
@magento-engcom-team
Copy link
Contributor

Hi @rogyar, thank you for the review.
ENGCOM-8514 has been created to process this Pull Request

@m2-community-project m2-community-project bot added the Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. label Dec 4, 2020
@engcom-Bravo engcom-Bravo self-assigned this Dec 4, 2020
@engcom-Bravo engcom-Bravo added the QA: Added to Regression Scope Scenario was analysed and added to Regression Testing Scope label Dec 4, 2020
@engcom-Bravo
Copy link
Contributor

✔️ QA Passed

Manual testing scenario

  1. From Admin, go to Content - Widget click Add Widget
  2. Select, for example,
  • Type - CMS Page Link
  • Design Theme - Magento Luma
    Click Continue
  1. Using Add Layout Update button, Add 3 Layout Updates, for example
  2. Try to remove the added Layouts using the Remove Layout Update (basket)

BEFORE applying changes provided in this PR, only the first Layout Update could be removed
Peek 2020-12-01 15-23

AFTER switching to the PR, all the Layout Updates can be removed
Peek 2020-12-01 15-43_after

The Widget can be saved successfully
widget_save

@saphaljha
Copy link
Contributor Author

@magento Hello

@m2-assistant
Copy link

m2-assistant bot commented Dec 21, 2020

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

This pull request was closed.
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 Award: MFTF test coverage Component: View Component: Widget Partner: Krish TechnoLabs partners-contribution Pull Request is created by Magento Partner Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Priority: P3 May be fixed according to the position in the backlog. Progress: accept Progress: testing in progress 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

item layout updates can't remove after add when create new widget
9 participants