diff --git a/dev/tests/verification/Resources/AssertTest.txt b/dev/tests/verification/Resources/AssertTest.txt
index c0cf932ae..7697b7baf 100644
--- a/dev/tests/verification/Resources/AssertTest.txt
+++ b/dev/tests/verification/Resources/AssertTest.txt
@@ -45,6 +45,8 @@ class AssertTestCest
$I->assertArrayNotHasKey("kiwi", ['orange' => 2, 'apple' => 1], "pass"); // stepKey: assertArrayNotHasKey
$I->assertArraySubset([1, 2], [1, 2, 3, 5], "pass"); // stepKey: assertArraySubset
$I->assertContains("ab", ['item1' => 'a', 'item2' => 'ab'], "pass"); // stepKey: assertContains
+ $I->assertStringContainsString("apple", "apple", "pass"); // stepKey: assertStringContainsString
+ $I->assertStringContainsStringIgnoringCase("Banana", "banana", "pass"); // stepKey: assertStringContainsStringIgnoringCase
$I->assertCount(2, ['a', 'b'], "pass"); // stepKey: assertCount
$I->assertEmpty([], "pass"); // stepKey: assertEmpty
$I->assertEquals($text, "Copyright © 2013-2017 Magento, Inc. All rights reserved.", "pass"); // stepKey: assertEquals1
@@ -62,8 +64,9 @@ class AssertTestCest
$I->assertLessOrEquals(5, 2, "pass"); // stepKey: assertLessOrEquals
$I->assertLessThan(5, 2, "pass"); // stepKey: assertLessThan
$I->assertLessThanOrEqual(5, 2, "pass"); // stepKey: assertLessThanOrEquals
- $I->assertNotContains("bc", ['item1' => 'a', 'item2' => 'ab'], "pass"); // stepKey: assertNotContains1
- $I->assertNotContains("bc", $text, "pass"); // stepKey: assertNotContains2
+ $I->assertNotContains("bc", ['item1' => 'a', 'item2' => 'ab'], "pass"); // stepKey: assertNotContains
+ $I->assertStringNotContainsString("apple", "banana", "pass"); // stepKey: assertStringNotContainsString
+ $I->assertStringNotContainsStringIgnoringCase("apple", "banana", "pass"); // stepKey: assertStringNotContainsStringIgnoringCase
$I->assertNotEmpty([1, 2], "pass"); // stepKey: assertNotEmpty1
$I->assertNotEmpty($text, "pass"); // stepKey: assertNotEmpty2
$I->assertNotEquals(2, 5, "pass", 0); // stepKey: assertNotEquals
diff --git a/dev/tests/verification/TestModule/Test/AssertTest.xml b/dev/tests/verification/TestModule/Test/AssertTest.xml
index d17b60fae..fd81c9bea 100644
--- a/dev/tests/verification/TestModule/Test/AssertTest.xml
+++ b/dev/tests/verification/TestModule/Test/AssertTest.xml
@@ -39,6 +39,14 @@
ab
['item1' => 'a', 'item2' => 'ab']
+
+ apple
+ apple
+
+
+ Banana
+ banana
+
2
['a', 'b']
@@ -103,14 +111,18 @@
5
2
-
+
bc
['item1' => 'a', 'item2' => 'ab']
-
- bc
- text
-
+
+ apple
+ banana
+
+
+ apple
+ banana
+
[1, 2]
diff --git a/docs/test/assertions.md b/docs/test/assertions.md
index dfe4c3d4b..8577c85c3 100644
--- a/docs/test/assertions.md
+++ b/docs/test/assertions.md
@@ -1,6 +1,5 @@
# Assertions
-
Assertions serve to pass or fail the [test](../test.md#test-tag) if a condition is not met. These assertions will look familiar to you if you've used any other testing framework, like PHPUnit.
All assertions contain the same [common actions attributes](./actions.md#common-attributes): `stepKey`, `before`, and `after`.
@@ -31,6 +30,8 @@ To use variables embedded in a string in `expected` and `actual` of your asserti
`actual="A long assert string {$stepKeyOfGrab} with an embedded variable reference." actualType="variable"`
+In case of `assertContains` actions, `` is the needle and `` is the haystack.
+
## Example
The following example shows a common test that gets text from a page and asserts that it matches what we expect to see. If it does not, the test will fail at the assert step.
@@ -130,6 +131,28 @@ Attribute|Type|Use|Description
`before`|string|optional| `stepKey` of action that must be executed next.
`after`|string|optional| `stepKey` of the preceding action.
+### assertStringContainsString
+
+See [assertStringContainsString docs on codeception.com](http://codeception.com/docs/modules/Asserts#assertStringContainsString).
+
+Attribute|Type|Use|Description
+---|---|---|---
+`message`|string|optional|Text describing the cause of the failure.
+`stepKey`|string|required| Unique identifier of the text step.
+`before`|string|optional| `stepKey` of the action that must be executed next.
+`after`|string|optional| `stepKey` of the preceding action.
+
+### assertStringContainsStringIgnoringCase
+
+See [assertStringContainsStringIgnoringCase docs on codeception.com](http://codeception.com/docs/modules/Asserts#assertStringContainsStringIgnoringCase).
+
+Attribute|Type|Use|Description
+---|---|---|---
+`message`|string|optional|Message describing the cause of failure.
+`stepKey`|string|required| A unique identifier of the text step.
+`before`|string|optional| `stepKey` of the action that must be executed next.
+`after`|string|optional| `stepKey` of the preceding action.
+
### assertCount
See [assertCount docs on codeception.com](http://codeception.com/docs/modules/Asserts#assertCount).
@@ -307,6 +330,28 @@ Attribute|Type|Use|Description
`before`|string|optional| `stepKey` of action that must be executed next.
`after`|string|optional| `stepKey` of the preceding action.
+### assertStringNotContainsString
+
+See [assertStringNotContainsString docs on codeception.com](http://codeception.com/docs/modules/Asserts#assertStringNotContainsString).
+
+Attribute|Type|Use|Description
+---|---|---|---
+`message`|string|optional|Text of informational message about a cause of failure.
+`stepKey`|string|required| A unique identifier of the text step.
+`before`|string|optional| `stepKey` of action that must be executed next.
+`after`|string|optional| `stepKey` of the preceding action.
+
+### assertStringContainsStringIgnoringCase
+
+See [assertStringNotContainsStringIgnoringCase docs on codeception.com](http://codeception.com/docs/modules/Asserts#assertStringNotContainsStringIgnoringCase).
+
+Attribute|Type|Use|Description
+---|---|---|---
+`message`|string|optional|Text of informational message about a cause of failure.
+`stepKey`|string|required| A unique identifier of the text step.
+`before`|string|optional| `stepKey` of action that must be executed next.
+`after`|string|optional| `stepKey` of the preceding action.
+
### assertNotEmpty
See [assertNotEmpty docs on codeception.com](http://codeception.com/docs/modules/Asserts#assertNotEmpty).
diff --git a/etc/di.xml b/etc/di.xml
index d68b4dc92..9b0c53af1 100644
--- a/etc/di.xml
+++ b/etc/di.xml
@@ -8,7 +8,7 @@
+
]>
diff --git a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php
index 95e394062..265ce7ab9 100644
--- a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php
+++ b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php
@@ -256,7 +256,7 @@ public function dontSeeInCurrentUrl($needle)
$actualUrl = $this->webDriver->getCurrentURL();
$comparison = "Expected: $needle\nActual: $actualUrl";
AllureHelper::addAttachmentToCurrentStep($comparison, 'Comparison');
- $this->assertNotContains($needle, $actualUrl);
+ $this->assertStringNotContainsString($needle, $actualUrl);
}
/**
@@ -325,7 +325,7 @@ public function seeInCurrentUrl($needle)
$actualUrl = $this->webDriver->getCurrentURL();
$comparison = "Expected: $needle\nActual: $actualUrl";
AllureHelper::addAttachmentToCurrentStep($comparison, 'Comparison');
- $this->assertContains($needle, $actualUrl);
+ $this->assertStringContainsString($needle, $actualUrl);
}
/**
@@ -708,7 +708,7 @@ public function assertElementContainsAttribute($selector, $attribute, $value)
// When an "attribute" is blank or null it returns "true" so we assert that "true" is present.
$this->assertEquals($attributes, 'true');
} else {
- $this->assertContains($value, $attributes);
+ $this->assertStringContainsString($value, $attributes);
}
}
diff --git a/src/Magento/FunctionalTestingFramework/Test/etc/Actions/assertActions.xsd b/src/Magento/FunctionalTestingFramework/Test/etc/Actions/assertActions.xsd
index 22f306382..694429a30 100644
--- a/src/Magento/FunctionalTestingFramework/Test/etc/Actions/assertActions.xsd
+++ b/src/Magento/FunctionalTestingFramework/Test/etc/Actions/assertActions.xsd
@@ -16,6 +16,8 @@
+
+
@@ -32,6 +34,8 @@
+
+
@@ -156,6 +160,34 @@
+
+
+
+ Asserts that given string contains a value.
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Asserts that given string contains a value ignoring case.
+
+
+
+
+
+
+
+
+
+
@@ -376,6 +408,34 @@
+
+
+
+ Asserts that given string does not contain a value.
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Asserts that given string does not contain a value ignoring case.
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php
index 19319d0d7..be4c38e02 100644
--- a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php
+++ b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php
@@ -1294,6 +1294,10 @@ public function generateStepsPhp($actionObjects, $generationScope = TestGenerato
case "assertCount":
case "assertContains":
case "assertNotContains":
+ case "assertStringContainsString":
+ case "assertStringContainsStringIgnoringCase":
+ case "assertStringNotContainsString":
+ case "assertStringNotContainsStringIgnoringCase":
case "expectException":
$testSteps .= $this->wrapFunctionCall(
$actor,