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/Extension/PageReadinessExtension.php b/src/Magento/FunctionalTestingFramework/Extension/PageReadinessExtension.php
index 9b9163a0a..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'
];
@@ -119,6 +120,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 +140,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 +238,13 @@ 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) {
return true;
}
return false;
diff --git a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php
index 62907fca4..0bfa2c9bf 100644
--- a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php
+++ b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php
@@ -669,4 +669,16 @@ 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;
+ }
}
diff --git a/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php b/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php
index fb562c626..0a6bc7957 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'] == "true") {
+ $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/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
+
+
+
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 be9ad9996..efad1506a 100644
--- a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php
+++ b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php
@@ -466,6 +466,7 @@ public function generateStepsPhp($actionObjects, $hookObject = false, $actor = "
foreach ($actionObjects as $actionObject) {
$stepKey = $actionObject->getStepKey();
+
$customActionAttributes = $actionObject->getCustomActionAttributes();
$attribute = null;
$selector = null;
@@ -1271,6 +1272,9 @@ 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);
}