Skip to content

Commit 354ec22

Browse files
committed
Fix #29971 - cover changes with mftf test
1 parent 7722d58 commit 354ec22

13 files changed

+213
-130
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminAssignCategoryToProductActionGroup">
12+
<arguments>
13+
<argument name="categoryName" type="string"/>
14+
</arguments>
15+
<!-- on edit Product page catalog/product/edit/id/{{product_id}}/ -->
16+
<click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="openDropDown"/>
17+
<checkOption selector="{{AdminProductFormSection.selectCategory(categoryName)}}" stepKey="selectCategory"/>
18+
<click selector="{{AdminProductFormSection.done}}" stepKey="clickDone"/>
19+
<waitForPageLoad stepKey="waitForApplyCategory"/>
20+
</actionGroup>
21+
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAssignCategoryToProductAndSaveActionGroup.xml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,9 @@
88

99
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11-
<actionGroup name="AdminAssignCategoryToProductAndSaveActionGroup">
12-
<arguments>
13-
<argument name="categoryName" type="string"/>
14-
</arguments>
15-
<!-- on edit Product page catalog/product/edit/id/{{product_id}}/ -->
16-
<click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="openDropDown"/>
17-
<checkOption selector="{{AdminProductFormSection.selectCategory(categoryName)}}" stepKey="selectCategory"/>
18-
<click selector="{{AdminProductFormSection.done}}" stepKey="clickDone"/>
19-
<waitForPageLoad stepKey="waitForApplyCategory"/>
11+
<actionGroup name="AdminAssignCategoryToProductAndSaveActionGroup" extends="AdminAssignCategoryToProductActionGroup">
2012
<click selector="{{AdminProductFormSection.save}}" stepKey="clickSave"/>
2113
<waitForPageLoad stepKey="waitForSavingProduct"/>
2214
<see userInput="You saved the product." selector="{{CatalogProductsSection.messageSuccessSavedProduct}}" stepKey="seeSuccessMessage"/>
2315
</actionGroup>
24-
</actionGroups>
16+
</actionGroups>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminSaveProductWithNewAttributeActionGroup">
12+
<annotations>
13+
<description>Clicks on the Save button. If popup related to new attribute appears, clicks on the Confirm button to close it. Validates that the Success Message is present and correct.</description>
14+
</annotations>
15+
16+
<scrollToTopOfPage stepKey="scrollTopPageProduct"/>
17+
<waitForElementVisible selector="{{AdminProductFormActionSection.saveButton}}" stepKey="waitForSaveProductButton"/>
18+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveProduct"/>
19+
<wait time="1" stepKey="waitForPopup"/>
20+
<conditionalClick selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}"
21+
dependentSelector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" visible="true"
22+
stepKey="clickOnConfirmInPopup"/>
23+
<waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitProductSaveSuccessMessage"/>
24+
<see selector="{{AdminMessagesSection.success}}" userInput="You saved the product." stepKey="seeSaveConfirmation"/>
25+
</actionGroup>
26+
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategorySidebarSection/StorefrontCategorySidebarSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<element name="filterOptionByLabel" type="button" selector=" div.filter-options-item div[data-option-label='{{optionLabel}}']" parameterized="true"/>
1717
<element name="removeFilter" type="button" selector="div.filter-current .remove"/>
1818
<element name="activeFilterOptions" type="text" selector=".filter-options-item.active .items"/>
19+
<element name="activeFilterOptionsByTitle" type="text" selector="//div[@class='filter-options-title' and contains(text(), '{{var1}}')]/following-sibling::*[@class='filter-options-item active'][1]/*[@class='items']" parameterized="true"/>
1920
<element name="activeFilterOptionItemByPosition" type="text" selector=".filter-options-item.active .items li:nth-child({{itemPosition}}) a" parameterized="true"/>
2021
<element name="enabledFilterOptionItemByLabel" type="text" selector="//div[@class='filter-options']//li[@class='item']//a[contains(text(), '{{optionLabel}}')]" parameterized="true"/>
2122
<element name="disabledFilterOptionItemByLabel" type="text" selector="//div[@class='filter-options']//li[@class='item' and contains(text(), '{{optionLabel}}')]" parameterized="true"/>

app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/GenerateConfigurationsByAttributeCodeActionGroup.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
</arguments>
1818

1919
<click selector="{{AdminProductFormConfigurationsSection.createConfigurations}}" stepKey="clickCreateConfigurations"/>
20+
<waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.createNewAttribute}}" time="30" stepKey="waitForConfigurationModalOpen"/>
2021
<click selector="{{AdminCreateProductConfigurationsPanel.filters}}" stepKey="clickFilters"/>
2122
<fillField selector="{{AdminCreateProductConfigurationsPanel.attributeCode}}" userInput="{{attributeCode}}" stepKey="fillFilterAttributeCodeField"/>
2223
<click selector="{{AdminCreateProductConfigurationsPanel.applyFilters}}" stepKey="clickApplyFiltersButton"/>
@@ -28,5 +29,6 @@
2829
<fillField selector="{{AdminCreateProductConfigurationsPanel.quantity}}" userInput="99" stepKey="enterAttributeQuantity"/>
2930
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton3"/>
3031
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton4"/>
32+
<waitForElementVisible selector="{{AdminProductFormActionSection.saveButton}}" stepKey="waitForSaveBtnVisible"/>
3133
</actionGroup>
3234
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="StorefrontExpandFilterInLayeredNavigationActionGroup">
12+
<annotations>
13+
<description>Expands the filter on a Storefront layered navigation if it is not expanded.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="filterLabel"/>
17+
</arguments>
18+
19+
<conditionalClick selector="{{StorefrontCategorySidebarSection.filterOptionsTitle(filterLabel)}}" dependentSelector="{{StorefrontCategorySidebarSection.activeFilterOptionsByTitle(filterLabel)}}" visible="false" stepKey="expandFilterOptions"/>
20+
</actionGroup>
21+
</actionGroups>

app/code/Magento/LayeredNavigation/Test/Mftf/Section/LayeredNavigationSection/StorefrontLayeredNavigationSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@
99
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1010
<section name="StorefrontLayeredNavigationSection">
1111
<element name="shoppingOptionsByName" type="button" selector="//*[text()='Shopping Options']/..//*[contains(text(),'{{arg}}')]" parameterized="true"/>
12+
<element name="nthSwatchOption" type="button" selector="div#layered-filter-block div.swatch-option:nth-of-type({{var}})" parameterized="true"/>
1213
</section>
1314
</sections>

app/code/Magento/Swatches/Model/Plugin/FilterRenderer.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
use Closure;
1111
use Magento\Catalog\Model\Layer\Filter\FilterInterface;
12-
use Magento\Framework\App\ObjectManager;
1312
use Magento\Framework\Exception\LocalizedException;
1413
use Magento\Framework\View\LayoutInterface;
1514
use Magento\LayeredNavigation\Block\Navigation\FilterRenderer as Subject;
@@ -22,12 +21,12 @@ class FilterRenderer
2221
/**
2322
* @var LayoutInterface
2423
*/
25-
protected $layout;
24+
private $layout;
2625

2726
/**
2827
* @var Data
2928
*/
30-
protected $swatchHelper;
29+
private $swatchHelper;
3130

3231
/**
3332
* @var ConfigurableViewModel|null
@@ -37,22 +36,21 @@ class FilterRenderer
3736
/**
3837
* @var string
3938
*/
40-
protected $block = RenderLayered::class;
39+
private $block = RenderLayered::class;
4140

4241
/**
4342
* @param LayoutInterface $layout
4443
* @param Data $swatchHelper
45-
* @param ConfigurableViewModel|null $configurableViewModel
44+
* @param ConfigurableViewModel $configurableViewModel
4645
*/
4746
public function __construct(
4847
LayoutInterface $layout,
4948
Data $swatchHelper,
50-
?ConfigurableViewModel $configurableViewModel = null
49+
ConfigurableViewModel $configurableViewModel
5150
) {
5251
$this->layout = $layout;
5352
$this->swatchHelper = $swatchHelper;
54-
$this->configurableViewModel = $configurableViewModel
55-
?? ObjectManager::getInstance()->get(ConfigurableViewModel::class);
53+
$this->configurableViewModel = $configurableViewModel;
5654
}
5755

5856
/**
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AssertLayeredNavigationSwatchTooltipHiddenActionGroup" extends="AssertLayeredNavigationSwatchTooltipVisibleActionGroup">
12+
<annotations>
13+
<description>Validates that the swatch tooltip doesn't appear on layered navigation after hovering swatch.</description>
14+
</annotations>
15+
16+
<remove keyForRemoval="swatchTooltipVisible"/>
17+
<dontSeeElement selector="{{StorefrontProductInfoMainSection.swatchOptionTooltip}}" stepKey="swatchTooltipHidden"/>
18+
</actionGroup>
19+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AssertLayeredNavigationSwatchTooltipVisibleActionGroup">
12+
<annotations>
13+
<description>Validates that the swatch tooltip appears on layered navigation after hovering swatch.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="nthSwatch" type="string" defaultValue="1"/>
17+
</arguments>
18+
19+
<moveMouseOver selector="{{StorefrontLayeredNavigationSection.nthSwatchOption(nthSwatch)}}" stepKey="hoverSwatch"/>
20+
<wait time="1" stepKey="waitForTooltip"/>
21+
<seeElement selector="{{StorefrontProductInfoMainSection.swatchOptionTooltip}}" stepKey="swatchTooltipVisible"/>
22+
</actionGroup>
23+
</actionGroups>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AssertProductPageSwatchTooltipHiddenActionGroup" extends="AssertProductPageSwatchTooltipVisibleActionGroup">
12+
<annotations>
13+
<description>Validates that the swatch tooltip doesn't appear on product page after hovering swatch.</description>
14+
</annotations>
15+
16+
<remove keyForRemoval="swatchTooltipVisible"/>
17+
<dontSeeElement selector="{{StorefrontProductInfoMainSection.swatchOptionTooltip}}" stepKey="swatchTooltipHidden"/>
18+
</actionGroup>
19+
</actionGroups>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AssertProductPageSwatchTooltipVisibleActionGroup">
12+
<annotations>
13+
<description>Validates that the swatch tooltip appears on product page after hovering swatch.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="nthSwatch" type="string" defaultValue="1"/>
17+
</arguments>
18+
19+
<waitForElementVisible selector="{{StorefrontProductInfoMainSection.nthSwatchOption(nthSwatch)}}" stepKey="waitForSwatchVisible"/>
20+
<moveMouseOver selector="{{StorefrontProductInfoMainSection.nthSwatchOption(nthSwatch)}}" stepKey="hoverSwatch"/>
21+
<wait time="1" stepKey="waitForTooltip"/>
22+
<seeElement selector="{{StorefrontProductInfoMainSection.swatchOptionTooltip}}" stepKey="swatchTooltipVisible"/>
23+
</actionGroup>
24+
</actionGroups>

0 commit comments

Comments
 (0)