/** * Delete product attribute step. * * @return void */ public function run() { $filter = $this->attribute->hasData('attribute_code') ? ['attribute_code' => $this->attribute->getAttributeCode()] : ['frontend_label' => $this->attribute->getFrontendLabel()]; $this->catalogProductAttributeIndex->open(); if ($this->catalogProductAttributeIndex->getGrid()->isRowVisible($filter)) { $this->catalogProductAttributeIndex->getGrid()->searchAndOpen($filter); $this->catalogProductAttributeNew->getPageActions()->delete(); $this->catalogProductAttributeNew->getModalBlock()->acceptAlert(); } }
/** * Run Delete used in configurable product attribute test * * @param ConfigurableProduct $product * @return array */ public function test(ConfigurableProduct $product) { // Precondition $product->persist(); /** @var CatalogProductAttribute $attribute */ $attribute = $product->getDataFieldConfig('configurable_attributes_data')['source']->getAttributes()['attribute_key_0']; // Steps $this->attributeIndex->open(); $this->attributeIndex->getGrid()->searchAndOpen(['attribute_code' => $attribute->getAttributeCode()]); $this->attributeNew->getPageActions()->delete(); $this->attributeNew->getModalBlock()->acceptAlert(); return ['attribute' => $attribute]; }
/** * Run test. * * @param CatalogAttributeSet $attributeSet * @return array */ public function test(CatalogAttributeSet $attributeSet) { // Precondition $attributeSet->persist(); $attribute = $attributeSet->getDataFieldConfig('assigned_attributes')['source']->getAttributes()[0]; // Steps $filter = ['attribute_code' => $attribute->getAttributeCode()]; $this->attributeIndex->open(); $this->attributeIndex->getGrid()->searchAndOpen($filter); $this->attributeNew->getPageActions()->delete(); $this->attributeNew->getModalBlock()->acceptAlert(); return ['attributeSet' => $attributeSet, 'attribute' => $attribute]; }
/** * Run DeleteProductAttributeEntity test. * * @param CatalogProductAttribute $attribute * @param CatalogProductAttributeIndex $attributeIndex * @param CatalogProductAttributeNew $attributeNew * @return void */ public function testDeleteProductAttribute(CatalogProductAttribute $attribute, CatalogProductAttributeIndex $attributeIndex, CatalogProductAttributeNew $attributeNew) { //Precondition $attribute->persist(); //Steps $attributeIndex->open(); $attributeIndex->getGrid()->searchAndOpen(['frontend_label' => $attribute->getFrontendLabel()]); $attributeNew->getPageActions()->delete(); $attributeNew->getModalBlock()->acceptAlert(); }