From fee5b596c75774ce2015a15615a06b77032cadca Mon Sep 17 00:00:00 2001 From: Alex Calandra Date: Tue, 7 Aug 2018 16:04:02 -0500 Subject: [PATCH 1/7] MQE-1157: Add readiness bypass to test actions - Adding skip readiness getter - Adding skip readiness attribute --- .../Test/Objects/ActionObject.php | 21 +++++++++++++++++++ .../Test/etc/Actions/commonAttributes.xsd | 8 +++++++ 2 files changed, 29 insertions(+) diff --git a/src/Magento/FunctionalTestingFramework/Test/Objects/ActionObject.php b/src/Magento/FunctionalTestingFramework/Test/Objects/ActionObject.php index f229ccf8a..5ae395232 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Objects/ActionObject.php +++ b/src/Magento/FunctionalTestingFramework/Test/Objects/ActionObject.php @@ -62,6 +62,7 @@ class ActionObject const FUNCTION_CLOSURE_ACTIONS = ['waitForElementChange', 'performOn']; const MERGE_ACTION_ORDER_AFTER = 'after'; const MERGE_ACTION_ORDER_BEFORE = 'before'; + const SKIP_READINESS_FLAG = 'skipReadiness'; const ACTION_ATTRIBUTE_URL = 'url'; const ACTION_ATTRIBUTE_SELECTOR = 'selector'; const ACTION_ATTRIBUTE_VARIABLE_REGEX_PARAMETER = '/\(.+\)/'; @@ -123,6 +124,13 @@ class ActionObject */ private $actionOrigin = []; + /** + * A boolean which represents whether the readiness check will be skipped for the test + * + * @var boolean + */ + private $skipReadiness = false; + /** * ActionObject constructor. * @@ -130,6 +138,7 @@ class ActionObject * @param string $type * @param array $actionAttributes * @param string|null $linkedAction + * @param boolean $skipReadiness * @param string $order * @param array $actionOrigin */ @@ -239,6 +248,18 @@ public function setTimeout($timeout) $this->timeout = $timeout; } + /** + * This function returns the bool for skipReadiness + * + * @return boolean + */ + public function getSkipReadinessFlag() + { + if (array_key_exists(ActionObject::SKIP_READINESS_FLAG, $this->actionAttributes)) { + return $this->actionAttributes[ActionObject::SKIP_READINESS_FLAG]; + } + } + /** * Populate the resolved custom attributes array with lookup values for the following attributes: * selector diff --git a/src/Magento/FunctionalTestingFramework/Test/etc/Actions/commonAttributes.xsd b/src/Magento/FunctionalTestingFramework/Test/etc/Actions/commonAttributes.xsd index 895936602..22c05ea7d 100644 --- a/src/Magento/FunctionalTestingFramework/Test/etc/Actions/commonAttributes.xsd +++ b/src/Magento/FunctionalTestingFramework/Test/etc/Actions/commonAttributes.xsd @@ -30,6 +30,14 @@ + + + + + Flag for skipping readiness check + + + From 1052859eff4a86c0d56309d95ee5e833012a49aa Mon Sep 17 00:00:00 2001 From: Alex Calandra Date: Wed, 8 Aug 2018 13:03:32 -0500 Subject: [PATCH 2/7] MQE-1157: Add readiness bypass to test actions - Adding setp generation to TestGeneration --- .../TestModule/Test/AssertTest.xml | 2 +- .../Util/TestGenerator.php | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/dev/tests/verification/TestModule/Test/AssertTest.xml b/dev/tests/verification/TestModule/Test/AssertTest.xml index 82f69b9b0..f1a4dc17b 100644 --- a/dev/tests/verification/TestModule/Test/AssertTest.xml +++ b/dev/tests/verification/TestModule/Test/AssertTest.xml @@ -23,7 +23,7 @@ - + apple ['orange' => 2, 'apple' => 1] diff --git a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php index be9ad9996..408a81437 100644 --- a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php +++ b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php @@ -466,6 +466,10 @@ public function generateStepsPhp($actionObjects, $hookObject = false, $actor = " foreach ($actionObjects as $actionObject) { $stepKey = $actionObject->getStepKey(); + if ($stepKey == "assertArrayHasKey") { + print("here"); + } + $customActionAttributes = $actionObject->getCustomActionAttributes(); $attribute = null; $selector = null; @@ -512,6 +516,14 @@ public function generateStepsPhp($actionObjects, $hookObject = false, $actor = " if (isset($customActionAttributes['arguments'])) { $arguments = $this->addUniquenessFunctionCall($customActionAttributes['arguments']); } + if (isset($customActionAttributes['skipReadiness'])) { + if ($customActionAttributes['skipReadiness']) { + $testSteps .= sprintf( + "\t\t$%s->setReadinessCheck(false);\n", + $actor + ); + } + } if (isset($customActionAttributes['attribute'])) { $attribute = $customActionAttributes['attribute']; @@ -1274,6 +1286,14 @@ public function generateStepsPhp($actionObjects, $hookObject = false, $actor = " default: $testSteps .= $this->wrapFunctionCall($actor, $actionObject, $selector, $input, $parameter); } + if (isset($customActionAttributes['skipReadiness'])) { + if ($customActionAttributes['skipReadiness']) { + $testSteps .= sprintf( + "\t\t$%s->setReadinessCheck(true);\n", + $actor + ); + } + } } return $testSteps; From 04a394f27cf269c1148e5c65dd5d90f9c3eca4cf Mon Sep 17 00:00:00 2001 From: Alex Calandra Date: Mon, 13 Aug 2018 14:17:30 -0500 Subject: [PATCH 3/7] MQE-1157: Add readiness bypass to test actions - Added skip command to web driver - Added check to page readiness extension --- .../TestModule/Test/AssertTest.xml | 2 +- .../Extension/PageReadinessExtension.php | 13 ++++++++---- .../Module/MagentoWebDriver.php | 13 ++++++++++++ .../Test/Objects/ActionObject.php | 20 ------------------- .../Util/TestGenerator.php | 7 ++----- 5 files changed, 25 insertions(+), 30 deletions(-) diff --git a/dev/tests/verification/TestModule/Test/AssertTest.xml b/dev/tests/verification/TestModule/Test/AssertTest.xml index f1a4dc17b..82f69b9b0 100644 --- a/dev/tests/verification/TestModule/Test/AssertTest.xml +++ b/dev/tests/verification/TestModule/Test/AssertTest.xml @@ -23,7 +23,7 @@ - + apple ['orange' => 2, 'apple' => 1] diff --git a/src/Magento/FunctionalTestingFramework/Extension/PageReadinessExtension.php b/src/Magento/FunctionalTestingFramework/Extension/PageReadinessExtension.php index 9b9163a0a..12fa29266 100644 --- a/src/Magento/FunctionalTestingFramework/Extension/PageReadinessExtension.php +++ b/src/Magento/FunctionalTestingFramework/Extension/PageReadinessExtension.php @@ -119,6 +119,8 @@ public function beforeTest(TestEvent $e) $this->testName = $e->getTest()->getMetadata()->getName(); $this->uri = null; + $this->getDriver()->_setConfig(['skipReadiness' => false]); + $metrics = []; foreach ($this->config['readinessMetrics'] as $metricClass) { $metrics[] = new $metricClass($this, $failThreshold); @@ -137,7 +139,8 @@ public function beforeTest(TestEvent $e) public function beforeStep(StepEvent $e) { $step = $e->getStep(); - if ($this->shouldSkipCheck($step)) { + $manualSkip = $this->getDriver()->_getConfig()['skipReadiness']; + if ($this->shouldSkipCheck($step, $manualSkip)) { return; } @@ -234,12 +237,14 @@ public function getTestName() * Should the given step bypass the readiness checks * todo: Implement step parameter to bypass specific metrics (or all) instead of basing on action type * - * @param Step $step + * @param Step $step + * @param boolean $manualSkip * @return boolean */ - private function shouldSkipCheck($step) + private function shouldSkipCheck($step, $manualSkip) { - if ($step instanceof Step\Comment || in_array($step->getAction(), $this->ignoredActions)) { + if ($step instanceof Step\Comment || in_array($step->getAction(), $this->ignoredActions) || $manualSkip) { + print("here"); return true; } return false; diff --git a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php index 62907fca4..c2d82e0d1 100644 --- a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php +++ b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php @@ -669,4 +669,17 @@ public function amOnPage($page) parent::amOnPage($page); $this->waitForPageLoad(); } + + /** + * Turn Readiness check on or off + * + * @param boolean $check + * @throws \Exception + * @return void + */ + public function skipReadinessCheck($check) + { + $this->config['skipReadiness'] = $check; + print("test"); + } } diff --git a/src/Magento/FunctionalTestingFramework/Test/Objects/ActionObject.php b/src/Magento/FunctionalTestingFramework/Test/Objects/ActionObject.php index 5ae395232..e4185a383 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Objects/ActionObject.php +++ b/src/Magento/FunctionalTestingFramework/Test/Objects/ActionObject.php @@ -124,13 +124,6 @@ class ActionObject */ private $actionOrigin = []; - /** - * A boolean which represents whether the readiness check will be skipped for the test - * - * @var boolean - */ - private $skipReadiness = false; - /** * ActionObject constructor. * @@ -138,7 +131,6 @@ class ActionObject * @param string $type * @param array $actionAttributes * @param string|null $linkedAction - * @param boolean $skipReadiness * @param string $order * @param array $actionOrigin */ @@ -248,18 +240,6 @@ public function setTimeout($timeout) $this->timeout = $timeout; } - /** - * This function returns the bool for skipReadiness - * - * @return boolean - */ - public function getSkipReadinessFlag() - { - if (array_key_exists(ActionObject::SKIP_READINESS_FLAG, $this->actionAttributes)) { - return $this->actionAttributes[ActionObject::SKIP_READINESS_FLAG]; - } - } - /** * Populate the resolved custom attributes array with lookup values for the following attributes: * selector diff --git a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php index 408a81437..e0f382525 100644 --- a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php +++ b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php @@ -466,9 +466,6 @@ public function generateStepsPhp($actionObjects, $hookObject = false, $actor = " foreach ($actionObjects as $actionObject) { $stepKey = $actionObject->getStepKey(); - if ($stepKey == "assertArrayHasKey") { - print("here"); - } $customActionAttributes = $actionObject->getCustomActionAttributes(); $attribute = null; @@ -519,7 +516,7 @@ public function generateStepsPhp($actionObjects, $hookObject = false, $actor = " if (isset($customActionAttributes['skipReadiness'])) { if ($customActionAttributes['skipReadiness']) { $testSteps .= sprintf( - "\t\t$%s->setReadinessCheck(false);\n", + "\t\t$%s->skipReadinessCheck(true);\n", $actor ); } @@ -1289,7 +1286,7 @@ public function generateStepsPhp($actionObjects, $hookObject = false, $actor = " if (isset($customActionAttributes['skipReadiness'])) { if ($customActionAttributes['skipReadiness']) { $testSteps .= sprintf( - "\t\t$%s->setReadinessCheck(true);\n", + "\t\t$%s->skipReadinessCheck(false);\n", $actor ); } From d45574356363032c4aab9797e1651a7f5fd8bdca Mon Sep 17 00:00:00 2001 From: Alex Calandra Date: Mon, 13 Aug 2018 15:21:56 -0500 Subject: [PATCH 4/7] MQE-1157: Add readiness bypass to test actions - Updated Tests - Added Restriction for action groups --- .../Resources/ActionGroupSkipReadiness.txt | 36 +++++++++++++++++++ .../Resources/BasicFunctionalTest.txt | 3 ++ .../ActionGroup/BasicActionGroup.xml | 4 +++ .../TestModule/Test/ActionGroupTest.xml | 4 +++ .../TestModule/Test/BasicFunctionalTest.xml | 1 + .../Tests/ActionGroupGenerationTest.php | 11 ++++++ .../Test/etc/mergedTestSchema.xsd | 1 + .../Util/TestGenerator.php | 4 +-- 8 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 dev/tests/verification/Resources/ActionGroupSkipReadiness.txt diff --git a/dev/tests/verification/Resources/ActionGroupSkipReadiness.txt b/dev/tests/verification/Resources/ActionGroupSkipReadiness.txt new file mode 100644 index 000000000..073211992 --- /dev/null +++ b/dev/tests/verification/Resources/ActionGroupSkipReadiness.txt @@ -0,0 +1,36 @@ +skipReadinessCheck(true); + $I->comment("ActionGroupSkipReadiness"); + $I->skipReadinessCheck(false); + } +} diff --git a/dev/tests/verification/Resources/BasicFunctionalTest.txt b/dev/tests/verification/Resources/BasicFunctionalTest.txt index 7fed6db42..21aa6d3a2 100644 --- a/dev/tests/verification/Resources/BasicFunctionalTest.txt +++ b/dev/tests/verification/Resources/BasicFunctionalTest.txt @@ -62,6 +62,9 @@ class BasicFunctionalTestCest { $I->comment(""); $I->comment(""); + $I->skipReadinessCheck(true); + $I->comment("skipReadiness"); + $I->skipReadinessCheck(false); $someVarDefinition = $I->grabValueFrom(); $I->acceptPopup(); $I->amOnPage("/test/url"); diff --git a/dev/tests/verification/TestModule/ActionGroup/BasicActionGroup.xml b/dev/tests/verification/TestModule/ActionGroup/BasicActionGroup.xml index 5b5ddf775..75ac71ef2 100644 --- a/dev/tests/verification/TestModule/ActionGroup/BasicActionGroup.xml +++ b/dev/tests/verification/TestModule/ActionGroup/BasicActionGroup.xml @@ -114,4 +114,8 @@ + + + + diff --git a/dev/tests/verification/TestModule/Test/ActionGroupTest.xml b/dev/tests/verification/TestModule/Test/ActionGroupTest.xml index ccace672b..848fe8bcc 100644 --- a/dev/tests/verification/TestModule/Test/ActionGroupTest.xml +++ b/dev/tests/verification/TestModule/Test/ActionGroupTest.xml @@ -144,6 +144,10 @@ + + + + diff --git a/dev/tests/verification/TestModule/Test/BasicFunctionalTest.xml b/dev/tests/verification/TestModule/Test/BasicFunctionalTest.xml index 0a2676ef6..322c5ac74 100644 --- a/dev/tests/verification/TestModule/Test/BasicFunctionalTest.xml +++ b/dev/tests/verification/TestModule/Test/BasicFunctionalTest.xml @@ -24,6 +24,7 @@ + diff --git a/dev/tests/verification/Tests/ActionGroupGenerationTest.php b/dev/tests/verification/Tests/ActionGroupGenerationTest.php index d7b57baed..65d65d04d 100644 --- a/dev/tests/verification/Tests/ActionGroupGenerationTest.php +++ b/dev/tests/verification/Tests/ActionGroupGenerationTest.php @@ -184,4 +184,15 @@ public function testActionGroupWithArgContainingStepKey() { $this->generateAndCompareTest('ActionGroupContainsStepKeyInArgText'); } + + /** + * Test an action group with an arg containing stepKey text + * + * @throws \Exception + * @throws \Magento\FunctionalTestingFramework\Exceptions\TestReferenceException + */ + public function testActionGroupWithSkipReadiness() + { + $this->generateAndCompareTest('ActionGroupSkipReadiness'); + } } diff --git a/src/Magento/FunctionalTestingFramework/Test/etc/mergedTestSchema.xsd b/src/Magento/FunctionalTestingFramework/Test/etc/mergedTestSchema.xsd index b65843bae..b663bb99d 100644 --- a/src/Magento/FunctionalTestingFramework/Test/etc/mergedTestSchema.xsd +++ b/src/Magento/FunctionalTestingFramework/Test/etc/mergedTestSchema.xsd @@ -130,5 +130,6 @@ + diff --git a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php index e0f382525..c2a59e663 100644 --- a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php +++ b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php @@ -514,7 +514,7 @@ public function generateStepsPhp($actionObjects, $hookObject = false, $actor = " $arguments = $this->addUniquenessFunctionCall($customActionAttributes['arguments']); } if (isset($customActionAttributes['skipReadiness'])) { - if ($customActionAttributes['skipReadiness']) { + if ($customActionAttributes['skipReadiness'] == "true") { $testSteps .= sprintf( "\t\t$%s->skipReadinessCheck(true);\n", $actor @@ -1284,7 +1284,7 @@ public function generateStepsPhp($actionObjects, $hookObject = false, $actor = " $testSteps .= $this->wrapFunctionCall($actor, $actionObject, $selector, $input, $parameter); } if (isset($customActionAttributes['skipReadiness'])) { - if ($customActionAttributes['skipReadiness']) { + if ($customActionAttributes['skipReadiness'] == "true") { $testSteps .= sprintf( "\t\t$%s->skipReadinessCheck(false);\n", $actor From ce6543d070201693ceec62834e4109bc9b761cf7 Mon Sep 17 00:00:00 2001 From: Alex Calandra Date: Mon, 13 Aug 2018 15:25:59 -0500 Subject: [PATCH 5/7] MQE-1157: Add readiness bypass to test actions - Removed testing statements and unused code --- .../Extension/PageReadinessExtension.php | 1 - .../FunctionalTestingFramework/Module/MagentoWebDriver.php | 1 - .../FunctionalTestingFramework/Test/Objects/ActionObject.php | 1 - 3 files changed, 3 deletions(-) diff --git a/src/Magento/FunctionalTestingFramework/Extension/PageReadinessExtension.php b/src/Magento/FunctionalTestingFramework/Extension/PageReadinessExtension.php index 12fa29266..f8269742e 100644 --- a/src/Magento/FunctionalTestingFramework/Extension/PageReadinessExtension.php +++ b/src/Magento/FunctionalTestingFramework/Extension/PageReadinessExtension.php @@ -244,7 +244,6 @@ public function getTestName() private function shouldSkipCheck($step, $manualSkip) { if ($step instanceof Step\Comment || in_array($step->getAction(), $this->ignoredActions) || $manualSkip) { - print("here"); return true; } return false; diff --git a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php index c2d82e0d1..0bfa2c9bf 100644 --- a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php +++ b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php @@ -680,6 +680,5 @@ public function amOnPage($page) public function skipReadinessCheck($check) { $this->config['skipReadiness'] = $check; - print("test"); } } diff --git a/src/Magento/FunctionalTestingFramework/Test/Objects/ActionObject.php b/src/Magento/FunctionalTestingFramework/Test/Objects/ActionObject.php index e4185a383..f229ccf8a 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Objects/ActionObject.php +++ b/src/Magento/FunctionalTestingFramework/Test/Objects/ActionObject.php @@ -62,7 +62,6 @@ class ActionObject const FUNCTION_CLOSURE_ACTIONS = ['waitForElementChange', 'performOn']; const MERGE_ACTION_ORDER_AFTER = 'after'; const MERGE_ACTION_ORDER_BEFORE = 'before'; - const SKIP_READINESS_FLAG = 'skipReadiness'; const ACTION_ATTRIBUTE_URL = 'url'; const ACTION_ATTRIBUTE_SELECTOR = 'selector'; const ACTION_ATTRIBUTE_VARIABLE_REGEX_PARAMETER = '/\(.+\)/'; From 826ff965b4a457b83c686b443ded0483d962f6b7 Mon Sep 17 00:00:00 2001 From: Alex Calandra Date: Mon, 20 Aug 2018 11:13:47 -0500 Subject: [PATCH 6/7] MQE-1157: Add readiness bypass to test actions - Removed print statements, created action steps instead --- .../Test/Util/ActionMergeUtil.php | 39 +++++++++++++++++++ .../Util/TestGenerator.php | 19 ++------- 2 files changed, 42 insertions(+), 16 deletions(-) diff --git a/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php b/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php index fb562c626..62099b27d 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php +++ b/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php @@ -23,6 +23,11 @@ class ActionMergeUtil const WAIT_ATTR = 'timeout'; const WAIT_ACTION_NAME = 'waitForPageLoad'; const WAIT_ACTION_SUFFIX = 'WaitForPageLoad'; + const SKIP_READINESS_ACTION_NAME = 'skipReadinessCheck'; + const SKIP_READINESS_OFF_SUFFIX = 'SkipReadinessOff'; + const SKIP_READINESS_ON_SUFFIX = 'SkipReadinessOn'; + const DEFAULT_SKIP_ON_ORDER = 'before'; + const DEFAULT_SKIP_OFF_ORDER = 'after'; const DEFAULT_WAIT_ORDER = 'after'; /** @@ -78,6 +83,7 @@ public function resolveActionSteps($parsedSteps, $skipActionGroupResolution = fa { $this->mergeActions($parsedSteps); $this->insertWaits(); + $this->insertReadinessSkips(); if ($skipActionGroupResolution) { return $this->orderedSteps; @@ -217,6 +223,39 @@ private function insertWaits() } } + /** + * Runs through the prepared orderedSteps and calls insertWait if a step requires a wait after it. + * + * @return void + */ + private function insertReadinessSkips() + { + foreach ($this->orderedSteps as $step) { + if (array_key_exists("skipReadiness", $step->getCustomActionAttributes())) { + if ($step->getCustomActionAttributes()['skipReadiness']) { + $skipReadinessOn = new ActionObject( + $step->getStepKey() . self::SKIP_READINESS_ON_SUFFIX, + self::SKIP_READINESS_ACTION_NAME, + ['state' => "true"], + $step->getStepKey(), + self::DEFAULT_SKIP_ON_ORDER + ); + + $skipReadinessOff = new ActionObject( + $step->getStepKey() . self::SKIP_READINESS_OFF_SUFFIX, + self::SKIP_READINESS_ACTION_NAME, + ['state' => "false"], + $step->getStepKey(), + self::DEFAULT_SKIP_OFF_ORDER + ); + + $this->insertStep($skipReadinessOn); + $this->insertStep($skipReadinessOff); + } + } + } + } + /** * This method takes the steps from the parser and splits steps which need merge from steps that are ordered. * diff --git a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php index c2a59e663..efad1506a 100644 --- a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php +++ b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php @@ -513,14 +513,6 @@ public function generateStepsPhp($actionObjects, $hookObject = false, $actor = " if (isset($customActionAttributes['arguments'])) { $arguments = $this->addUniquenessFunctionCall($customActionAttributes['arguments']); } - if (isset($customActionAttributes['skipReadiness'])) { - if ($customActionAttributes['skipReadiness'] == "true") { - $testSteps .= sprintf( - "\t\t$%s->skipReadinessCheck(true);\n", - $actor - ); - } - } if (isset($customActionAttributes['attribute'])) { $attribute = $customActionAttributes['attribute']; @@ -1280,17 +1272,12 @@ public function generateStepsPhp($actionObjects, $hookObject = false, $actor = " $testSteps .= $dateGenerateCode; break; + case "skipReadinessCheck": + $testSteps .= $this->wrapFunctionCall($actor, $actionObject, $customActionAttributes['state']); + break; default: $testSteps .= $this->wrapFunctionCall($actor, $actionObject, $selector, $input, $parameter); } - if (isset($customActionAttributes['skipReadiness'])) { - if ($customActionAttributes['skipReadiness'] == "true") { - $testSteps .= sprintf( - "\t\t$%s->skipReadinessCheck(false);\n", - $actor - ); - } - } } return $testSteps; From 6b919a7b24731ff98aaa4522e53b34296e0c2baa Mon Sep 17 00:00:00 2001 From: Alex Calandra Date: Tue, 21 Aug 2018 13:31:29 -0500 Subject: [PATCH 7/7] MQE-1157: Add readiness bypass to test actions - Adding action to readiness skip list - Adjusting conditional to check string match --- .../Extension/PageReadinessExtension.php | 1 + .../FunctionalTestingFramework/Test/Util/ActionMergeUtil.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Magento/FunctionalTestingFramework/Extension/PageReadinessExtension.php b/src/Magento/FunctionalTestingFramework/Extension/PageReadinessExtension.php index f8269742e..709647096 100644 --- a/src/Magento/FunctionalTestingFramework/Extension/PageReadinessExtension.php +++ b/src/Magento/FunctionalTestingFramework/Extension/PageReadinessExtension.php @@ -43,6 +43,7 @@ class PageReadinessExtension extends Extension */ private $ignoredActions = [ 'saveScreenshot', + 'skipReadinessCheck', 'wait' ]; diff --git a/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php b/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php index 62099b27d..0a6bc7957 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php +++ b/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php @@ -232,7 +232,7 @@ private function insertReadinessSkips() { foreach ($this->orderedSteps as $step) { if (array_key_exists("skipReadiness", $step->getCustomActionAttributes())) { - if ($step->getCustomActionAttributes()['skipReadiness']) { + if ($step->getCustomActionAttributes()['skipReadiness'] == "true") { $skipReadinessOn = new ActionObject( $step->getStepKey() . self::SKIP_READINESS_ON_SUFFIX, self::SKIP_READINESS_ACTION_NAME,