Skip to content

Commit e041473

Browse files
committed
Merge branch 'develop' of github.com:magento-pangolin/magento2-functional-testing-framework into sprint-develop
2 parents 5ad6d90 + 42b677d commit e041473

21 files changed

+554
-141
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace tests\unit\Magento\FunctionalTestFramework\Test\Util;
8+
9+
use Magento\FunctionalTestingFramework\Exceptions\XmlException;
10+
use Magento\FunctionalTestingFramework\Test\Util\TestNameValidationUtil;
11+
use PHPUnit\Framework\TestCase;
12+
13+
class TestNameValidationUtilTest extends TestCase
14+
{
15+
/**
16+
* Validate name with curly braces throws exception
17+
*/
18+
public function testCurlyBracesInTestName()
19+
{
20+
$this->validateBlacklistedTestName("{{curlyBraces}}");
21+
}
22+
23+
/**
24+
* Validate name with quotation marks throws exception
25+
*/
26+
public function testQuotesInTestName()
27+
{
28+
$this->validateBlacklistedTestName("\"quotes\"");
29+
}
30+
31+
/**
32+
* Validate name with single quotes throws exception
33+
*/
34+
public function testSingleQuotesInTestName()
35+
{
36+
$this->validateBlacklistedTestName("'singleQuotes'");
37+
}
38+
39+
/**
40+
* Validate name with parenthesis throws execption
41+
*/
42+
public function testParenthesesInTestName()
43+
{
44+
$this->validateBlacklistedTestName("(parenthesis)");
45+
}
46+
47+
/**
48+
* Validate name with dollar signs throws exception
49+
*/
50+
public function testDollarSignInTestName()
51+
{
52+
$this->validateBlacklistedTestName("\$dollarSign\$");
53+
}
54+
55+
/**
56+
* Validate name with spaces throws exception
57+
*/
58+
public function testSpacesInTestName()
59+
{
60+
$this->validateBlacklistedTestName("Test Name With Spaces");
61+
}
62+
63+
/**
64+
* Method which takes the name of the test expecting an invalid char. Runs the validation method against name.
65+
*
66+
* @param string $testName
67+
* @return void
68+
*/
69+
private function validateBlacklistedTestName($testName)
70+
{
71+
$this->expectException(XmlException::class);
72+
TestNameValidationUtil::validateName($testName);
73+
}
74+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
namespace Magento\AcceptanceTest\_generated\Backend;
3+
4+
use Magento\FunctionalTestingFramework\AcceptanceTester;
5+
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\DataObjectHandler;
6+
use Magento\FunctionalTestingFramework\DataGenerator\Persist\DataPersistenceHandler;
7+
use Magento\FunctionalTestingFramework\DataGenerator\Objects\EntityDataObject;
8+
use Yandex\Allure\Adapter\Annotation\Features;
9+
use Yandex\Allure\Adapter\Annotation\Stories;
10+
use Yandex\Allure\Adapter\Annotation\Title;
11+
use Yandex\Allure\Adapter\Annotation\Description;
12+
use Yandex\Allure\Adapter\Annotation\Parameter;
13+
use Yandex\Allure\Adapter\Annotation\Severity;
14+
use Yandex\Allure\Adapter\Model\SeverityLevel;
15+
use Yandex\Allure\Adapter\Annotation\TestCaseId;
16+
17+
/**
18+
*/
19+
class DataReplacementCest
20+
{
21+
/**
22+
* @Parameter(name = "AcceptanceTester", value="$I")
23+
* @param AcceptanceTester $I
24+
* @return void
25+
*/
26+
public function DataReplacementTest(AcceptanceTester $I)
27+
{
28+
$I->fillField("#selector", "StringBefore John StringAfter");
29+
$I->fillField("#John", "input");
30+
$I->dragAndDrop("#John", "Doe");
31+
$I->conditionalClick("Doe", "#John", true);
32+
$I->amOnUrl("John.html");
33+
$I->searchAndMultiSelectOption("#selector", ["John", "Doe"]);
34+
$I->fillField("#selector", "StringBefore ".msq("uniqueData")."John StringAfter");
35+
$I->fillField("#".msq("uniqueData")."John", "input");
36+
$I->dragAndDrop("#".msq("uniqueData")."John", msq("uniqueData")."John");
37+
$I->conditionalClick(msq("uniqueData")."John", "#".msq("uniqueData")."John", true);
38+
$I->amOnUrl(msq("uniqueData")."John.html");
39+
$I->searchAndMultiSelectOption("#selector", [msq("uniqueData")."John", "Doe"]);
40+
$I->fillField("#selector", "StringBefore Doe".msq("uniqueData")." StringAfter");
41+
$I->fillField("#Doe".msq("uniqueData"), "input");
42+
$I->dragAndDrop("#Doe".msq("uniqueData"), "Doe".msq("uniqueData"));
43+
$I->conditionalClick("Doe".msq("uniqueData"), "#Doe".msq("uniqueData"), true);
44+
$I->amOnUrl("Doe".msq("uniqueData").".html");
45+
$I->searchAndMultiSelectOption("#selector", ["John", "Doe".msq("uniqueData")]);
46+
$I->searchAndMultiSelectOption("#selector", [msq("uniqueData")."John", "Doe".msq("uniqueData")]);
47+
}
48+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
namespace Magento\AcceptanceTest\_generated\Backend;
3+
4+
use Magento\FunctionalTestingFramework\AcceptanceTester;
5+
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\DataObjectHandler;
6+
use Magento\FunctionalTestingFramework\DataGenerator\Persist\DataPersistenceHandler;
7+
use Magento\FunctionalTestingFramework\DataGenerator\Objects\EntityDataObject;
8+
use Yandex\Allure\Adapter\Annotation\Features;
9+
use Yandex\Allure\Adapter\Annotation\Stories;
10+
use Yandex\Allure\Adapter\Annotation\Title;
11+
use Yandex\Allure\Adapter\Annotation\Description;
12+
use Yandex\Allure\Adapter\Annotation\Parameter;
13+
use Yandex\Allure\Adapter\Annotation\Severity;
14+
use Yandex\Allure\Adapter\Model\SeverityLevel;
15+
use Yandex\Allure\Adapter\Annotation\TestCaseId;
16+
17+
/**
18+
*/
19+
class PageReplacementCest
20+
{
21+
/**
22+
* @Parameter(name = "AcceptanceTester", value="$I")
23+
* @param AcceptanceTester $I
24+
* @return void
25+
*/
26+
public function PageReplacementTest(AcceptanceTester $I)
27+
{
28+
$I->amGoingTo("create entity that has the mergeKey: datakey");
29+
$simpleData = DataObjectHandler::getInstance()->getObject("simpleData");
30+
$datakey = new DataPersistenceHandler($simpleData);
31+
$datakey->createEntity();
32+
$I->amOnPage("/page.html");
33+
$I->amOnPage("/StringLiteral/page.html");
34+
$I->amOnPage("/John/page.html");
35+
$I->amOnPage("/" . $datakey->getCreatedDataByName('firstname') . "/page.html");
36+
$I->amOnPage("/StringLiteral1/StringLiteral2.html");
37+
$I->amOnPage("/John/StringLiteral2.html");
38+
$I->amOnPage("/John/" . $datakey->getCreatedDataByName('firstname') . ".html");
39+
$I->amOnPage("/" . $datakey->getCreatedDataByName('firstname') . "/StringLiteral2.html");
40+
}
41+
}

dev/tests/verification/Resources/PersistedReplacementCest.txt

Lines changed: 12 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -38,34 +38,17 @@ class PersistedReplacementCest
3838
*/
3939
public function PersistedReplacementTest(AcceptanceTester $I)
4040
{
41-
$I->amGoingTo("create entity that has the mergeKey: testScopeData");
42-
$ReplacementPerson = DataObjectHandler::getInstance()->getObject("ReplacementPerson");
43-
$testScopeData = new DataPersistenceHandler($ReplacementPerson);
44-
$testScopeData->createEntity();
45-
$I->amGoingTo("create entity that has the mergeKey: uniqueData");
46-
$UniquePerson = DataObjectHandler::getInstance()->getObject("UniquePerson");
47-
$uniqueData = new DataPersistenceHandler($UniquePerson);
48-
$uniqueData->createEntity();
49-
$I->amOnPage("/success/success2.html");
50-
$I->amOnPage($testScopeData->getCreatedDataByName('firstname') . ".html");
51-
$I->amOnPage($this->createData1->getCreatedDataByName('firstname') . ".html");
52-
$I->amOnPage("/" . $testScopeData->getCreatedDataByName('firstname') . "/" . $testScopeData->getCreatedDataByName('lastname') . ".html");
53-
$I->amOnPage("/" . $this->createData1->getCreatedDataByName('firstname') . "/" . $this->createData1->getCreatedDataByName('lastname') . ".html");
54-
$I->click("#element ." . $testScopeData->getCreatedDataByName('firstname'));
55-
$I->click("#" . $testScopeData->getCreatedDataByName('firstname') . " .success");
56-
$I->click("#John-Doe ." . $testScopeData->getCreatedDataByName('lastname'));
57-
$I->click("#" . $testScopeData->getCreatedDataByName('firstname') . " ." . $testScopeData->getCreatedDataByName('lastname'));
58-
$I->click("#" . $this->createData1->getCreatedDataByName('firstname') . " ." . $this->createData1->getCreatedDataByName('lastname'));
59-
$I->fillField("#sample", "Hello " . $testScopeData->getCreatedDataByName('firstname') . " " . $testScopeData->getCreatedDataByName('lastname'));
60-
$I->fillField("#sample", "Hello " . $this->createData1->getCreatedDataByName('firstname') . " " . $this->createData1->getCreatedDataByName('lastname'));
61-
$I->searchAndMultiSelectOption("#selector", [$testScopeData->getCreatedDataByName('lastname')]);
62-
$I->searchAndMultiSelectOption("#selector", [$this->createData1->getCreatedDataByName('lastname')]);
63-
$I->amOnPage($uniqueData->getCreatedDataByName('firstname') . ".html");
64-
$I->amOnPage("/" . $uniqueData->getCreatedDataByName('firstname') . "/" . $uniqueData->getCreatedDataByName('lastname') . ".html");
65-
$I->click("#element ." . $uniqueData->getCreatedDataByName('firstname'));
66-
$I->click("#" . $uniqueData->getCreatedDataByName('firstname') . " .success");
67-
$I->click("#" . $uniqueData->getCreatedDataByName('firstname'));
68-
$I->dragAndDrop($uniqueData->getCreatedDataByName('firstname'), $uniqueData->getCreatedDataByName('firstname'));
69-
$I->dragAndDrop("#element ." . $uniqueData->getCreatedDataByName('firstname'), "#" . $uniqueData->getCreatedDataByName('firstname') . " .success");
41+
$I->amGoingTo("create entity that has the mergeKey: createdData");
42+
$simpleData = DataObjectHandler::getInstance()->getObject("simpleData");
43+
$createdData = new DataPersistenceHandler($simpleData);
44+
$createdData->createEntity();
45+
$I->fillField("#selector", "StringBefore " . $createdData->getCreatedDataByName('firstname') . " StringAfter");
46+
$I->fillField("#" . $createdData->getCreatedDataByName('firstname'), "input");
47+
$I->dragAndDrop("#" . $createdData->getCreatedDataByName('firstname'), $createdData->getCreatedDataByName('lastname'));
48+
$I->conditionalClick($createdData->getCreatedDataByName('lastname'), "#" . $createdData->getCreatedDataByName('firstname'), true);
49+
$I->amOnUrl($createdData->getCreatedDataByName('firstname') . ".html");
50+
$I->searchAndMultiSelectOption("#selector", [$createdData->getCreatedDataByName('firstname') . "", "" . $createdData->getCreatedDataByName('lastname')]);
51+
$I->fillField("#selector", "John " . $createdData->getCreatedDataByName('firstname') . " stringLiteral");
52+
$I->searchAndMultiSelectOption("#selector", [$createdData->getCreatedDataByName('firstname') . "", "John", "stringLiteral"]);
7053
}
7154
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
namespace Magento\AcceptanceTest\_generated\Backend;
3+
4+
use Magento\FunctionalTestingFramework\AcceptanceTester;
5+
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\DataObjectHandler;
6+
use Magento\FunctionalTestingFramework\DataGenerator\Persist\DataPersistenceHandler;
7+
use Magento\FunctionalTestingFramework\DataGenerator\Objects\EntityDataObject;
8+
use Yandex\Allure\Adapter\Annotation\Features;
9+
use Yandex\Allure\Adapter\Annotation\Stories;
10+
use Yandex\Allure\Adapter\Annotation\Title;
11+
use Yandex\Allure\Adapter\Annotation\Description;
12+
use Yandex\Allure\Adapter\Annotation\Parameter;
13+
use Yandex\Allure\Adapter\Annotation\Severity;
14+
use Yandex\Allure\Adapter\Model\SeverityLevel;
15+
use Yandex\Allure\Adapter\Annotation\TestCaseId;
16+
17+
/**
18+
*/
19+
class SectionReplacementCest
20+
{
21+
/**
22+
* @Parameter(name = "AcceptanceTester", value="$I")
23+
* @param AcceptanceTester $I
24+
* @return void
25+
*/
26+
public function SectionReplacementTest(AcceptanceTester $I)
27+
{
28+
$I->click("#element");
29+
$I->click("#foo");
30+
$I->waitForPageLoad(30);
31+
$I->click("#element .stringLiteral");
32+
$I->click("#stringLiteral1 .stringLiteral2");
33+
$I->click("#stringLiteral1-stringLiteral2 .stringLiteral3");
34+
$I->click("#stringLiteral1-stringLiteral2 .stringLiteral1 [stringLiteral3]");
35+
$I->click("#element .John");
36+
$I->click("#John .Doe");
37+
$I->click("#John-Doe .Tiberius");
38+
$I->click("#John-Doe .John [Tiberius]");
39+
$I->click("#element .".msq("uniqueData")."John");
40+
$I->click("#".msq("uniqueData")."John .stringLiteral2");
41+
$I->click("#".msq("uniqueData")."John-stringLiteral2 .stringLiteral3");
42+
$I->click("#".msq("uniqueData")."John-stringLiteral2 .");
43+
$I->click("#element .Doe".msq("uniqueData"));
44+
$I->click("#Doe".msq("uniqueData")." .stringLiteral2");
45+
$I->click("#Doe".msq("uniqueData")."-stringLiteral2 .stringLiteral3");
46+
$I->click("#Doe".msq("uniqueData")."-stringLiteral2 .Doe");
47+
$I->amGoingTo("create entity that has the mergeKey: createdData");
48+
$simpleData = DataObjectHandler::getInstance()->getObject("simpleData");
49+
$createdData = new DataPersistenceHandler($simpleData);
50+
$createdData->createEntity();
51+
$I->click("#element ." . $createdData->getCreatedDataByName('firstname'));
52+
$I->click("#" . $createdData->getCreatedDataByName('firstname') . " .stringLiteral2");
53+
$I->click("#" . $createdData->getCreatedDataByName('firstname') . "-stringLiteral2 .stringLiteral3");
54+
$I->click("#" . $createdData->getCreatedDataByName('firstname') . "-stringLiteral2 ." . $createdData->getCreatedDataByName('firstname') . " [stringLiteral3]");
55+
$I->click("#stringLiteral1-" . $createdData->getCreatedDataByName('firstname') . " .John");
56+
$I->click("#stringLiteral1-" . $createdData->getCreatedDataByName('firstname') . " .".msq("uniqueData")."John");
57+
$I->click("#stringLiteral1-" . $createdData->getCreatedDataByName('firstname') . " .Doe".msq("uniqueData"));
58+
}
59+
}

dev/tests/verification/TestModule/Cest/PersistedReplacementCest.xml

Lines changed: 0 additions & 67 deletions
This file was deleted.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
11+
<cest name="DataReplacementCest">
12+
<test name="DataReplacementTest">
13+
<fillField mergeKey="inputReplace" selector="#selector" userInput="StringBefore {{simpleData.firstname}} StringAfter"/>
14+
<fillField mergeKey="selectorReplace" selector="#{{simpleData.firstname}}" userInput="input"/>
15+
<dragAndDrop mergeKey="selector12Replace" selector1="#{{simpleData.firstname}}" selector2="{{simpleData.lastname}}"/>
16+
<conditionalClick mergeKey="dependentSelectorReplace" dependentSelector="#{{simpleData.firstname}}" selector="{{simpleData.lastname}}" visible="true"/>
17+
<amOnUrl mergeKey="urlReplace" url="{{simpleData.firstname}}.html"/>
18+
<searchAndMultiSelectOption mergeKey="parameterArrayReplacement" selector="#selector" parameterArray="[{{simpleData.firstname}}, {{simpleData.lastname}}]"/>
19+
20+
<fillField mergeKey="inputPrefixReplaceMSQPrefix" selector="#selector" userInput="StringBefore {{uniqueData.firstname}} StringAfter"/>
21+
<fillField mergeKey="selectorReplaceMSQPrefix" selector="#{{uniqueData.firstname}}" userInput="input"/>
22+
<dragAndDrop mergeKey="selector12ReplaceMSQPrefix" selector1="#{{uniqueData.firstname}}" selector2="{{uniqueData.firstname}}"/>
23+
<conditionalClick mergeKey="dependentSelectorReplaceMSQPrefix" dependentSelector="#{{uniqueData.firstname}}" selector="{{uniqueData.firstname}}" visible="true"/>
24+
<amOnUrl mergeKey="urlReplaceMSQPrefix" url="{{uniqueData.firstname}}.html"/>
25+
<searchAndMultiSelectOption mergeKey="parameterArrayReplacementMSQPrefix" selector="#selector" parameterArray="[{{uniqueData.firstname}}, {{simpleData.lastname}}]"/>
26+
27+
<fillField mergeKey="inputReplaceMSQSuffix" selector="#selector" userInput="StringBefore {{uniqueData.lastname}} StringAfter"/>
28+
<fillField mergeKey="selectorReplaceMSQSuffix" selector="#{{uniqueData.lastname}}" userInput="input"/>
29+
<dragAndDrop mergeKey="selector12ReplaceMSQSuffix" selector1="#{{uniqueData.lastname}}" selector2="{{uniqueData.lastname}}"/>
30+
<conditionalClick mergeKey="dependentSelectorReplaceMSQSuffix" dependentSelector="#{{uniqueData.lastname}}" selector="{{uniqueData.lastname}}" visible="true"/>
31+
<amOnUrl mergeKey="urlReplaceMSQSuffix" url="{{uniqueData.lastname}}.html"/>
32+
<searchAndMultiSelectOption mergeKey="parameterArrayReplacementMSQSuffix" selector="#selector" parameterArray="[{{simpleData.firstname}}, {{uniqueData.lastname}}]"/>
33+
<searchAndMultiSelectOption mergeKey="parameterArrayReplacementMSQBoth" selector="#selector" parameterArray="[{{uniqueData.firstname}}, {{uniqueData.lastname}}]"/>
34+
</test>
35+
</cest>
36+
</config>

0 commit comments

Comments
 (0)