-
-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[plugin-web-app-playwright] Add steps for text manipulations and vali…
…dations (#4678)
- Loading branch information
Showing
23 changed files
with
612 additions
and
226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
docs/modules/plugins/partials/common-web-app-text-steps.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
=== Text content validation | ||
|
||
The context can be set by the <<_change_context,corresponding steps>>. If no context is set, the text will be searched across the whole page. | ||
|
||
|
||
==== Validate the text exists | ||
|
||
Validates the text is present in the current context. The expected text is *case-sensitive*. | ||
|
||
[source,gherkin] | ||
---- | ||
Then text `$text` exists | ||
---- | ||
* `$text` - The expected text to be found in the context text. | ||
|
||
.Check the text 'Contract Us' is present on the page | ||
[source,gherkin] | ||
---- | ||
Given I am on page with URL `https://docs.vividus.dev/` | ||
Then text `Contact Us` exists | ||
---- | ||
|
||
|
||
==== Validate the text does not exists | ||
|
||
Validates the text is not present in the current context. | ||
|
||
[source,gherkin] | ||
---- | ||
Then text `$text` does not exist | ||
---- | ||
* `$text` - The text that should not be present in the context. | ||
|
||
.Check the text 'Deprecated' is not present in the element | ||
[source,gherkin] | ||
---- | ||
When I change context to element located by `id(code)` | ||
Then text `Deprecated` does not exist | ||
---- | ||
|
||
|
||
==== Validate the text matches regular expression | ||
|
||
Validates the text from current context matches the specified regular expression. | ||
|
||
[source,gherkin] | ||
---- | ||
Then text matches `$regex` | ||
---- | ||
* `$regex` - The https://www.regular-expressions.info[regular expression] used to validate the context text. | ||
|
||
.Check the text with pattern 'User ".*" successfully logged in' is present in the current context | ||
[source,gherkin] | ||
---- | ||
When I change context to element located by `id(message)` | ||
Then text matches `User ".*" successfully logged in` | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
docs/modules/plugins/partials/ui-selenium-text-content-steps.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
include::plugins:partial$ui-text-content-steps.adoc[] | ||
|
||
==== Save the text of the context | ||
|
||
Saves the text of the context element into a variable. | ||
|
||
[NOTE] | ||
An error is thrown if the context is not set to the element. | ||
|
||
[source,gherkin] | ||
---- | ||
When I save text of context element to $scopes variable `$variableName` | ||
---- | ||
|
||
* `$scopes` - The comma-separated set of the xref:commons:variables.adoc#_scopes[variables scopes]. | ||
* `$variableName` - The name of the variable to save the text content. | ||
|
||
.Save the text of the context element | ||
[source,gherkin] | ||
---- | ||
When I change context to element located by `id(username)` | ||
When I save text of context element to scneario variable `username` | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
=== Text content manupulations | ||
|
||
==== Save the text of an element | ||
|
||
Finds the element by the given locator and saves its text into a variable. | ||
|
||
[source,gherkin] | ||
---- | ||
When I save text of element located by `$locator` to $scopes variable `$variableName` | ||
---- | ||
|
||
* `$locator` - The <<_locator,locator>> used to find the element whose text content will be saved. | ||
* `$scopes` - The comma-separated set of the xref:commons:variables.adoc#_scopes[variables scopes]. | ||
* `$variableName` - The name of the variable to save the text content. | ||
|
||
.Save the text of the header element | ||
[source,gherkin] | ||
---- | ||
When I save text of element located by `id(header)` to scenario variable `heading-text` | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.