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

26827 Added improvements to product attribute repository (save method) #27191

Conversation

sergiy-v
Copy link
Contributor

@sergiy-v sergiy-v commented Mar 6, 2020

Description

Added improvements to product attribute repository (save method) to convert frontend input and add swatch input type.

Fixed Issues (if relevant)

#26827

Manual testing scenarios

See #26827 issue description for details.

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 Mar 6, 2020

Hi @sergiy-v. 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

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

@magento-engcom-team magento-engcom-team added Component: Catalog Component: Swatches Release Line: 2.4 Partner: Atwix Pull Request is created by partner Atwix partners-contribution Pull Request is created by Magento Partner labels Mar 6, 2020
@rogyar rogyar self-assigned this Mar 6, 2020
@rogyar rogyar added Award: bug fix Award: MFTF test coverage Auto-Tests: Covered All changes in Pull Request is covered by auto-tests labels Mar 6, 2020
Copy link
Contributor

@rogyar rogyar left a comment

Choose a reason for hiding this comment

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

Hi @sergiy-v . Thank you for the great fix. Please, check my comments below for minor adjustments. Also, it looks like we need to adjust the existing integration tests. Please, check the following report for details

https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/27191/f9276c561e4d64b00e72a15aa03e847d/Integration/allure-report-ce/index.html#

Thank you


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

Choose a reason for hiding this comment

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

Please, rename the action group as the following example

Suggested change
<actionGroup name="AdminAssertProductAttributeByCodeOnProductFormActionGroup">
<actionGroup name="AssertAdminProductAttributeByCodeOnProductFormActionGroup">

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed, thanks.

/**
* Performs the conversion of the frontend input value for attribute data
*/
class SwatchAttributeFrontendInputConversion
Copy link
Contributor

Choose a reason for hiding this comment

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

If we are talking about service, I would rename this class. So, the good practice is to start a service name with a verb. By following this practice we will get something like ConvertSwatchAttributeFrontendInput. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right, I renamed the class.
The reason why I used such name - I tried to keep the same class name convent (if it's exists) for the module, like: SwatchAttributeCodes, SwatchAttributesProvider, SwatchAttributeType.

…onvert frontend input and add swatch input type for rest area
@sergiy-v sergiy-v force-pushed the 26827-product-attribute-repository-swatches-improvements branch from c9e4f39 to acfc589 Compare March 10, 2020 15:03
@sergiy-v
Copy link
Contributor Author

Hi @sergiy-v . Thank you for the great fix. Please, check my comments below for minor adjustments. Also, it looks like we need to adjust the existing integration tests. Please, check the following report for details

https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/27191/f9276c561e4d64b00e72a15aa03e847d/Integration/allure-report-ce/index.html#

Thank you

@rogyar I have added the changes. The functional tests runs with errors at the current moment, but I believe it's not related to the issue/PR.

Thanks.

@sergiy-v sergiy-v requested a review from rogyar March 11, 2020 06:57
*
* @return array|null
*/
public function execute(?array $data): ?array
Copy link
Contributor

Choose a reason for hiding this comment

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

I was thinking about the implementation for some time. Must admit that the service should not receive null as the argument since it breaks the implementation consistency. We shall try to be as more specific as possible in the types of accepting/returning in order to make the logic transparent.
From my point of view, if don't have the $data, we should not call the service. On the other hand, the service should know what's the structure of the data and then make the decision regarding the conversion process. So, let's leave it as it is.

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 for your thoughts. Just to clarify, in this case this part of the logic was copied from existing logic with unit test which covers the case with NULL for some reason, that's why I decided to leave it as it was.

@rogyar
Copy link
Contributor

rogyar commented Mar 12, 2020

@sergiy-v could you double-check the fact that the failing tests are not related to your change, please?

We have failed tests on creating an attribute with swatch for all 3 instances:

https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/27191/c90269c0e285fa870d2cb35408e6fc63/Functional/allure-report-ee/index.html#suites/8187718e2fd144987673ef34ee62b41b/3627bf02af52559e/

Thank you

@sergiy-v
Copy link
Contributor Author

@sergiy-v could you double-check the fact that the failing tests are not related to your change, please?

We have failed tests on creating an attribute with swatch for all 3 instances:

https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/27191/c90269c0e285fa870d2cb35408e6fc63/Functional/allure-report-ee/index.html#suites/8187718e2fd144987673ef34ee62b41b/3627bf02af52559e/

Thank you

I see the same errors for few latest PRs which are not related to swatches, for example: #27246, #27248.
So, more likely the PR changes are not related to the errors.
Please let me know in case you see some points for double checking.

Thank you.

@rogyar
Copy link
Contributor

rogyar commented Mar 12, 2020

You are right. Most likely they are just fluky tests.

@magento-engcom-team
Copy link
Contributor

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

@engcom-Alfa
Copy link
Contributor

engcom-Alfa commented Mar 17, 2020

✔️ QA Passed

Before:
Screenshot from 2020-03-17 11-04-47

After:
Screenshot from 2020-03-17 11-13-05

@engcom-Charlie
Copy link
Contributor

Failed functional tests not related to the changes in this PR.

@m2-assistant
Copy link

m2-assistant bot commented Mar 19, 2020

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

@sdzhepa sdzhepa mentioned this pull request May 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants