Skip to content

Commit 0b98f21

Browse files
Manjusha.SManjusha.S
authored andcommitted
Merge branch 'MQE-3576_CE' into functional--test--automation
update commits
2 parents 0d8bb09 + 3c94baa commit 0b98f21

File tree

5 files changed

+41
-3
lines changed

5 files changed

+41
-3
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
<argument name="option3" defaultValue="colorProductAttribute3"/>
2020
</arguments>
2121

22+
<scrollTo selector="//div/strong[@class='admin__collapsible-title']/span[contains(text(),'Configurations')]" stepKey="scrollToConfigurableProductButton"/>
23+
<waitForElementVisible selector="button[data-index='create_configurable_products_button']" time="30" stepKey="waitForELementVisible"/>
2224
<click selector="{{AdminProductFormConfigurationsSection.createConfigurations}}" stepKey="clickOnCreateConfigurations"/>
2325
<click selector="{{AdminCreateProductConfigurationsPanel.createNewAttribute}}" stepKey="clickOnNewAttribute"/>
2426
<waitForPageLoad stepKey="waitForIFrame"/>

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
<arguments>
1717
<argument name="defaultLabelAttribute" type="string" defaultValue="{{colorProductAttribute.default_label}}"/>
1818
</arguments>
19-
19+
<switchToIFrame stepKey="switchOutOfIFrame"/>
20+
<waitForPageLoad stepKey="waitForFilters"/>
2021
<click selector="{{AdminCreateProductConfigurationsPanel.filters}}" stepKey="clickOnFilters"/>
2122
<fillField selector="{{AdminCreateProductConfigurationsPanel.attributeCode}}" userInput="{{defaultLabelAttribute}}" stepKey="fillFilterAttributeCodeField"/>
2223
<click selector="{{AdminCreateProductConfigurationsPanel.applyFilters}}" stepKey="clickApplyFiltersButton"/>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
<!--Click Save Attribute button-->
5050
<click selector="{{NewProduct.saveAttributeButton}}" stepKey="clickSaveAttributeButton"/>
5151
<waitForPageLoad stepKey="waitForSavingSettings"/>
52-
52+
<switchToIFrame stepKey="switchOutOfIFrame"/>
5353
<!--Select created Attribute -->
5454
<click selector="{{ConfigurableProductSection.selectCreatedAttribute}}" stepKey="selectCreatedAttribute"/>
5555

app/code/Magento/Swatches/Test/Mftf/ActionGroup/AssertSwatchColorActionGroup.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@
1818
</arguments>
1919

2020
<grabAttributeFrom selector="{{AdminManageSwatchSection.nthSwatch(nthSwatch)}}" userInput="style" stepKey="grabStyle1"/>
21+
<helper class="Magento\Swatches\Test\Mftf\Helper\ColorCode" method="colorCode" stepKey="colorCode">
22+
<argument name="colorCode">{$grabStyle1}</argument>
23+
</helper>
2124
<assertEquals stepKey="assertStyle1">
22-
<actualResult type="string">{$grabStyle1}</actualResult>
25+
<actualResult type="string">{$colorCode}</actualResult>
2326
<expectedResult type="string">{{expectedStyle}}</expectedResult>
2427
</assertEquals>
2528
</actionGroup>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
namespace Magento\Swatches\Test\Mftf\Helper;
4+
5+
use Magento\FunctionalTestingFramework\Helper\Helper;
6+
7+
/**
8+
* Class ColorCode provides an ability to color code manipulation.
9+
*/
10+
class ColorCode extends Helper
11+
{
12+
/**
13+
* Color code check.
14+
*
15+
* @param string $colorCode
16+
* @return string
17+
*/
18+
public function colorCode(string $colorCode): string
19+
{
20+
$colorCode = str_replace('background: #', '', $colorCode);
21+
if (!preg_match('/^[a-f0-9]{6}$/i', $colorCode) ) {
22+
return $colorCode;
23+
}
24+
25+
$length = strlen($colorCode);
26+
$rgbColorCode['r'] = hexdec($length == 6 ? substr($colorCode, 0, 2) : ($length == 3 ? str_repeat(substr($colorCode, 0, 1), 2) : 0));
27+
$rgbColorCode['g'] = hexdec($length == 6 ? substr($colorCode, 2, 2) : ($length == 3 ? str_repeat(substr($colorCode, 1, 1), 2) : 0));
28+
$rgbColorCode['b'] = hexdec($length == 6 ? substr($colorCode, 4, 2) : ($length == 3 ? str_repeat(substr($colorCode, 2, 1), 2) : 0));
29+
30+
return 'background: rgb('.implode(', ', $rgbColorCode).');';
31+
}
32+
}

0 commit comments

Comments
 (0)