@@ -179,6 +179,18 @@ The following test actions handle data entities using [metadata](../metadata.md)
179179
180180Learn more in [ Handling a REST API response] ( ../metadata.md#rest-response ) .
181181
182+ ## Actions specifying HTML values
183+
184+ To use HTML in actions you must encode the HTML string. We recommend using [ CyberChef] ( https://gchq.github.io/CyberChef/#recipe=To_HTML_Entity(false,'Numeric%20entities') ) . Using CyberChef or a similar tool is straightforward: enter in your HTML string, copy the encoded result, and paste that value into your MFTF test.
185+
186+ For example, we want to ensure that this value is presented as a string and not rendered as a H1 tag: ` <h1 class="login-header"> `
187+
188+ After passing ` <h1 class="login-header"> ` through CyberChef we get ` <h1 class="login-header"> ` which can be used in a test like:
189+
190+ ``` xml
191+ <dontSeeInSource html =" < h1 class=" login-header"> " stepKey =" dontSeeInSource" />
192+ ```
193+
182194## Reference
183195
184196The following list contains reference documentation about all action elements available in the MFTF.
@@ -849,7 +861,7 @@ See [dontSeeInPageSource docs on codeception.com](http://codeception.com/docs/mo
849861
850862Attribute|Type|Use|Description
851863---|---|---|---
852- ` userInput ` |string|optional| Value for the form field .
864+ ` html ` |string|required| HTML code to be searched for within the page source. The value must be entity-encoded. See example .
853865` stepKey ` |string|required| A unique identifier of the action.
854866` skipReadiness ` |boolean|optional| A flag to skip the readiness check.
855867` before ` |string|optional| ` stepKey ` of action that must be executed next.
@@ -858,8 +870,8 @@ Attribute|Type|Use|Description
858870#### Example
859871
860872``` xml
861- <!-- Verify that the page source does not contain the string "Sample text" . -->
862- <dontSeeInPageSource userInput =" Sample text " stepKey =" dontSeeInPageSource" />
873+ <!-- Verify that the page source does not contain the raw source code `<h1 class="login-header">` . -->
874+ <dontSeeInPageSource userInput =" < h1 class =" login-header "> " stepKey =" dontSeeInPageSource" />
863875```
864876
865877### dontSeeInSource
@@ -868,17 +880,19 @@ See [dontSeeInSource docs on codeception.com](http://codeception.com/docs/module
868880
869881Attribute|Type|Use|Description
870882---|---|---|---
871- ` html ` |string|optional | HTML code to search for within the source code .
883+ ` html ` |string|required | HTML code to be searched for within the page source. The value must be entity-encoded. See example .
872884` stepKey ` |string|required| A unique identifier of the action.
873885` skipReadiness ` |boolean|optional| A flag to skip the readiness check.
874886` before ` |string|optional| ` stepKey ` of action that must be executed next.
875887` after ` |string|optional| ` stepKey ` of preceding action.
876888
877889#### Example
878890
891+ You must encode the ` html ` using a tool such as [ CyberChef] ( https://gchq.github.io/CyberChef/#recipe=To_HTML_Entity(false,'Numeric%20entities') ) .
892+
879893``` xml
880- <!-- Verify that the page does not contain the raw source code `<h1>Sample text</h1 >`. -->
881- <dontSeeInSource userInput = " <h1>Sample text</h1> " stepKey =" dontSeeInSource" />
894+ <!-- Verify that the page source does not contain the raw source code `<h1 class="login-header" >`. -->
895+ <dontSeeInSource html = " < h1 class =" login-header "> " stepKey =" dontSeeInSource" />
882896```
883897
884898### dontSeeInTitle
@@ -1922,17 +1936,19 @@ See [seeInPageSource docs on codeception.com](http://codeception.com/docs/module
19221936
19231937Attribute|Type|Use|Description
19241938---|---|---|---
1925- ` html ` |string|optional | HTML code to be searched for within the document .
1939+ ` html ` |string|required | HTML code to be searched for within the page source. The value must be entity-encoded. See example .
19261940` stepKey ` |string|required| A unique identifier of the action.
19271941` skipReadiness ` |boolean|optional| A flag to skip the readiness check.
19281942` before ` |string|optional| ` stepKey ` of action that must be executed next.
19291943` after ` |string|optional| ` stepKey ` of preceding action.
19301944
19311945#### Example
19321946
1947+ You must encode the ` html ` using a tool such as [ CyberChef] ( https://gchq.github.io/CyberChef/#recipe=To_HTML_Entity(false,'Numeric%20entities') ) .
1948+
19331949``` xml
1934- <!-- Verify that the page source contains the string "Sample text" . -->
1935- <seeInPageSource userInput = " Sample text " stepKey =" seeInPageSource" />
1950+ <!-- Verify that the page source contains the raw source code `<h1 class="login-header">` . -->
1951+ <seeInPageSource html = " < h1 class =" login-header "> " stepKey =" seeInPageSource" />
19361952```
19371953
19381954### seeInPopup
@@ -1960,17 +1976,19 @@ See [seeInSource docs on codeception.com](http://codeception.com/docs/modules/We
19601976
19611977Attribute|Type|Use|Description
19621978---|---|---|---
1963- ` html ` |string|optional | HTML code to be searched for within the page source.
1979+ ` html ` |string|required | HTML code to be searched for within the page source. The value must be entity-encoded. See example .
19641980` stepKey ` |string|required| A unique identifier of the action.
19651981` skipReadiness ` |boolean|optional| A flag to skip the readiness check.
19661982` before ` |string|optional| ` stepKey ` of action that must be executed next.
19671983` after ` |string|optional| ` stepKey ` of preceding action.
19681984
19691985#### Example
19701986
1987+ You must encode the ` html ` using a tool such as [ CyberChef] ( https://gchq.github.io/CyberChef/#recipe=To_HTML_Entity(false,'Numeric%20entities') ) .
1988+
19711989``` xml
1972- <!-- Verify that the page does contains the raw source code `<h1>Sample text</h1 >`. -->
1973- <seeInSource userInput = " <h1>Sample text</h1> " stepKey =" seeInSource" />
1990+ <!-- Verify that the page source contains the raw source code `<h1 class="login-header" >`. -->
1991+ <seeInSource html = " < h1 class =" login-header "> " stepKey =" seeInSource" />
19741992```
19751993
19761994### seeInTitle
0 commit comments