9 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductEdit;
10 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex;
11 use Magento\Mtf\Fixture\FixtureInterface;
28 CatalogProductIndex $productGrid,
29 CatalogProductEdit $productPage
31 $expectedCustomOptions = $this->arguments[
'expectedCustomOptions'];
32 $filter = [
'sku' =>
$product->getSku()];
34 $productGrid->getProductGrid()->searchAndOpen($filter);
36 if (
$product->hasData(
'custom_options')) {
53 private function addExpectedOptionValues(FixtureInterface
$product, array $expectedCustomOptions)
56 $customOptionsSource =
$product->getDataFieldConfig(
'custom_options')[
'source']->getCustomOptions();
57 foreach (array_keys($customOptionsSource) as $optionKey) {
58 foreach ($expectedCustomOptions as $expectedCustomOption) {
59 if ($customOptionsSource[$optionKey][
'type'] === $expectedCustomOption[
'optionType']) {
60 $options = array_keys($customOptionsSource[$optionKey][
'options']);
61 $optionField = $expectedCustomOption[
'optionField'];
64 $customOptionsSource[$optionKey][
'options'][$optionsKey][$optionField] =
$optionValue;
70 return [
'custom_options' => $customOptionsSource];
80 return 'Custom option values are same as expected.';
processAssert(FixtureInterface $product, CatalogProductIndex $productGrid, CatalogProductEdit $productPage)