magento / magento/magento2-functional-testing-framework
Set custom product attributes
Open
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 154
- Forks
- 134
- PR merge metrics
- No merged PRs in 30d
Description
There seems to be no documentation on how to set custom product attributes through entity data. I searched through the example tests and tried a few things to no avail.
Preconditions
- MFTF v3
Steps to reproduce
- Create custom attribute entity
<entity name="SubscriptionIsEnabled" type="custom_attribute">
<data key="attribute_code">sub_enabled</data>
<data key="value">1</data>
</entity>
- Create a product entity
<entity name="SubscriptionProduct" extends="SimpleProduct">
<data key="name">Simple Subscription</data>
<data key="sku" unique="suffix">simple-trial-2</data>
<data key="urlKey" unique="suffix">simple-trial-2</data>
<requiredEntity type="custom_attribute">SubscriptionIsEnabled</requiredEntity>
</entity>
- Create the product in a
<before>block of a Suite
<createData entity="SubscriptionProduct" stepKey="createSubscriptionProduct">
<requiredEntity createDataKey="createCategory"/>
</createData>
Expected result
- The product's sub_enabled custom attribute should be set
Actual result
- The attribute is not set
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the MFTF v3 entity examples and tests for custom_attribute entities, then trace how the createData step in a Suite before block applies product data. Document the working syntax for setting a product custom attribute through entity data, including the requiredEntity relationship, and verify that the sub_enabled attribute is set on the created product.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100