Skip to content

MQE-1150: Test generation fails for arguments containing hyphen character #231

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
namespace Magento\AcceptanceTest\_default\Backend;

use Magento\FunctionalTestingFramework\AcceptanceTester;
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\CredentialStore;
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\PersistedObjectHandler;
use \Codeception\Util\Locator;
use Yandex\Allure\Adapter\Annotation\Features;
use Yandex\Allure\Adapter\Annotation\Stories;
use Yandex\Allure\Adapter\Annotation\Title;
use Yandex\Allure\Adapter\Annotation\Description;
use Yandex\Allure\Adapter\Annotation\Parameter;
use Yandex\Allure\Adapter\Annotation\Severity;
use Yandex\Allure\Adapter\Model\SeverityLevel;
use Yandex\Allure\Adapter\Annotation\TestCaseId;

/**
*/
class ActionGroupWithParameterizedElementWithHyphenCest
{
/**
* @Features({"TestModule"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
* @return void
* @throws \Exception
*/
public function ActionGroupWithParameterizedElementWithHyphen(AcceptanceTester $I)
{
$keyoneActionGroup = $I->executeJS("#element .full-width");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,10 @@
</arguments>
<seeInCurrentUrl url="/{{persistedData.urlKey}}.html?___store={{xmlData.firstname}}" stepKey="checkUrl"/>
</actionGroup>
<actionGroup name="SectionArgumentWithParameterizedSelector">
<arguments>
<argument name="section" defaultValue="SampleSection"/>
</arguments>
<executeJS function="{{section.oneParamElement('full-width')}}" stepKey="keyone"/>
</actionGroup>
</actionGroups>
5 changes: 5 additions & 0 deletions dev/tests/verification/TestModule/Test/ActionGroupTest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,9 @@
<argument name="sameStepKeyAsArg" value="arg1"/>
</actionGroup>
</test>
<test name="ActionGroupWithParameterizedElementWithHyphen">
<actionGroup ref="SectionArgumentWithParameterizedSelector" stepKey="actionGroup">
<argument name="section" value="SampleSection"/>
</actionGroup>
</test>
</tests>
11 changes: 11 additions & 0 deletions dev/tests/verification/Tests/ActionGroupGenerationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,4 +195,15 @@ public function testActionGroupWithSkipReadiness()
{
$this->generateAndCompareTest('ActionGroupSkipReadiness');
}

/**
* Test an action group with an arg that resolves into section.element with a hyphen in the parameter
*
* @throws \Exception
* @throws \Magento\FunctionalTestingFramework\Exceptions\TestReferenceException
*/
public function testActionGroupWithHyphen()
{
$this->generateAndCompareTest('ActionGroupWithParameterizedElementWithHyphen');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ public function waitForPageLoad($timeout = null)
* @throws \Exception
* @return void
*/
public function waitForLoadingMaskToDisappear($timeout)
public function waitForLoadingMaskToDisappear($timeout = null)
{
foreach (self::$loadingMasksLocators as $maskLocator) {
// Get count of elements found for looping.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ private function resolveAttributesWithArguments($arguments, $attributes)
// $regexPattern match on: $matches[0] {{section.element(arg.field)}}
// $matches[1] = section.element
// $matches[2] = arg.field
$regexPattern = '/{{([\w.\[\]]+)\(*([\w.$\',\s\[\]]+)*\)*}}/';
$regexPattern = '/{{([^(}]+)\(*([^)}]+)*\)*}}/';

$newActionAttributes = [];
foreach ($attributes as $attributeKey => $attributeValue) {
Expand Down