10 use Magento\Mtf\Client\ElementInterface;
11 use Magento\Mtf\Fixture\InjectableFixture;
23 private $swatchAttributesSelector =
'.swatch-attribute';
30 private $swatchAttributesLabelSelector =
'.swatch-attribute-label';
37 private $swatchAttributeOptionsSelector =
'.swatch-option';
44 private $selectedSwatchAttributeSelector =
'.swatch-attribute.%s .swatch-attribute-selected-option';
53 $this->waitForElementVisible($this->swatchAttributesSelector);
55 $swatchAttributesData = [];
56 $swatchAttributes = $this->_rootElement->getElements($this->swatchAttributesSelector);
57 foreach ($swatchAttributes as $swatchAttribute) {
61 'attribute_id' => $swatchAttribute->getAttribute(
'attribute-id'),
62 'label' => $swatchAttribute->find($this->swatchAttributesLabelSelector)->getText(),
63 'options' => $this->getSwatchAttributeOptionsData($swatchAttribute),
66 return $swatchAttributesData;
75 private function getSwatchAttributeOptionsData(ElementInterface $swatchAttribute)
78 $options = $swatchAttribute->getElements($this->swatchAttributeOptionsSelector);
97 $checkoutData =
$product->getCheckoutData();
98 $availableAttributes =
$product->getConfigurableAttributesData();
101 foreach ($checkoutData[
'options'][
'configurable_options'] as
$item) {
103 $this->selectedSwatchAttributeSelector,
106 $this->waitForElementVisible($selector);
107 $selected = $this->_rootElement->find($selector)->getText();
108 $formData[
$item[
'title']] = $selected;
getSwatchAttributesData()
getSelectedSwatchOptions(InjectableFixture $product)