-
-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add document and change the syntax on the Script Steps #4612
Add document and change the syntax on the Script Steps #4612
Conversation
158ce16
to
2b2d4f9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure to deprecate the steps in the code
@@ -1114,6 +1114,64 @@ When I click on a button with the name 'Toggle element visibility with delay' | |||
Then element located by 'xpath(//div[@id='delayed'])' disappears in 'PT3S' | |||
---- | |||
|
|||
==== Script Steps | |||
|
|||
WARNING: These steps are deprecated and will be removed in VIVIDUS 0.8.0. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WARNING: These steps are deprecated and will be removed in VIVIDUS 0.8.0. | |
WARNING: These steps are deprecated and will be removed in VIVIDUS 0.7.0. |
The Script Steps checks for validate the presence of JavaScript files within the HTML source code of an active page. | ||
These steps primarily focus on verifying the existence of specific JavaScript files based on Filename, Text and TextPart attributes. | ||
|
||
=== The script steps on FileName attributes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😵💫
fe59818
to
d88ac89
Compare
.Checks the script for the presence of a document by name | ||
[source,gherkin] | ||
---- | ||
Then a javascript file with the name '$jsFileName' is included in the source code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please replace placeholders for step parameters in examples here and below
d88ac89
to
10ea3bb
Compare
2404c30
to
1ad7a42
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4612 +/- ##
=========================================
Coverage 97.40% 97.40%
Complexity 6563 6563
=========================================
Files 915 915
Lines 18878 18878
Branches 1258 1258
=========================================
Hits 18389 18389
Misses 383 383
Partials 106 106 ☔ View full report in Codecov by Sentry. |
*/ | ||
@Deprecated(since = "0.6.5", forRemoval = true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Deprecated(since = "0.6.5", forRemoval = true) | |
@Deprecated(since = "0.6.6", forRemoval = true) |
*/ | ||
@Deprecated(since = "0.6.5", forRemoval = true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Deprecated(since = "0.6.5", forRemoval = true) | |
@Deprecated(since = "0.6.6", forRemoval = true) |
*/ | ||
@Deprecated(since = "0.6.5", forRemoval = true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Deprecated(since = "0.6.5", forRemoval = true) | |
@Deprecated(since = "0.6.6", forRemoval = true) |
@Then("a javascript file with the name '$jsFileName' is included in the source code") | ||
public WebElement thenJavascriptFileWithNameIsIncludedInTheSourceCode(String jsFileName) | ||
{ | ||
LOGGER.warn(String.format(DEPRECATED_STEP_MESSAGE, "thenJavascriptFileWithNameIsIncludedInTheSourceCode")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably in these cases it would be be enough to use @Replacement
annotation, also please pay attention our log messages are for end-users, not technical people, thus we should never use method names.
1ad7a42
to
a7a0b1c
Compare
|
||
=== Validate JavaScript files is present in HTML source code | ||
|
||
These step primarily focus on checking for the existence of certain JavaScript files based on FileName attributes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please follow the same format as for other steps in the docs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the same for all step docs
The Script Steps verify the presence of JavaScript files in the HTML source code of an active page. | ||
They focus on validating specific JavaScript files using attributes like FileName, Text, and TextPart. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- not only files
- there is no such attributes as
text
ortext part
.Checks the script for the presence of a document by name | ||
[source,gherkin] | ||
---- | ||
Then a javascript file with the name 'app' is included in the source code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please, make examples for more close to real, obviously there couldn't be JS files with name app
Then a javascript file with the name '$jsFileName' is included in the source code | ||
---- | ||
|
||
* `$jsFileName` - The JavaScript FileName. In order to save a result return statement should be used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does it mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the same for all step docs
@Then("a javascript file with the name '$jsFileName' is included in the source code") | ||
@Replacement(versionToRemoveStep = "0.7.0", | ||
replacementFormatPattern = "Then number of elements found by `xpath(.//script[contains(@src()='%1$s'])` " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to find all elements regardless of their visibility, check source code of the step to info on the applied visibility attributes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the same for the step below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not fixed
@Then("a javascript with the textpart '$jsTextPart' is included in the source code") | ||
@Replacement(versionToRemoveStep = "0.7.0", | ||
replacementFormatPattern = "Then number of elements found by `xpath(.//script)->filter.textPart('%1$s')` " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does the form of the locator not match to the value from the step?
@Then("a javascript with the textpart '$jsTextPart' is included in the source code") | ||
@Replacement(versionToRemoveStep = "0.7.0", | ||
replacementFormatPattern = "Then number of elements found by `xpath(.//script)->filter.textPart('%1$s')` " | ||
+ "is greater than or equal to `1`") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is >=1 ?
@@ -31,7 +33,7 @@ | |||
import org.vividus.ui.action.search.Visibility; | |||
import org.vividus.ui.web.action.search.WebLocatorType; | |||
|
|||
@ExtendWith(MockitoExtension.class) | |||
@ExtendWith({ MockitoExtension.class, TestLoggerFactoryExtension.class }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant change?
a7a0b1c
to
31ff65a
Compare
31ff65a
to
ba32e74
Compare
vividus-plugin-web-app/src/main/java/org/vividus/steps/ui/web/ScriptSteps.java
Show resolved
Hide resolved
@Then("a javascript file with the name '$jsFileName' is included in the source code") | ||
@Replacement(versionToRemoveStep = "0.7.0", | ||
replacementFormatPattern = "Then number of elements found by `xpath(//script[contains(@src()='%1$s']):a` " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use exactly the same xpath as in the original code, mind the dot
* @deprecated Use step: | ||
* This step "Then a javascript with the text '$jsText' is included in the source code" will be removed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plese fix javadocs
* @deprecated Use step: | ||
* This step "Then a javascript with the textpart '$jsTextPart' is included in the source code" will be removed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plese fix javadocs
@Then("a javascript with the text '$jsText' is included in the source code") | ||
@Replacement(versionToRemoveStep = "0.7.0", | ||
replacementFormatPattern = "Then number of elements found by `xpath(//script[text()='%1$s']):a` " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use exactly the same xpath as in the original code, mind the dot
|
||
=== Check for JavaScript code in HTML source code with a specific file name (@src attribute) | ||
|
||
This step verifies that JavaScript (an element with the <script> tag) with specific file name (@src attribute) is present on the page. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please follow the same approach as for other steps: start with a verb in 3rd form in present simple tense
@@ -1250,6 +1250,63 @@ When I wait until scroll is finished | |||
Then page is scrolled to element located by `id(footerElement)` | |||
---- | |||
|
|||
==== Script Steps | |||
|
|||
WARNING: These steps are deprecated and will be removed in VIVIDUS 0.7.0. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's needed to provide information about replacement for each deprecated step
|
||
=== Check for JavaScript code in the HTML source code containing the given text (@script attribute) | ||
|
||
This step verifies that JavaScript (an element with the <script> tag) is actual content of text is present on the page. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
something broken in the second half of the sentence
|
||
* `$jsTextPart` - Specifies the text of an external script file from the script attribute. | ||
|
||
.Checks if the javascript file containing the given text exists in the page source code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not correct
|
||
* `$jsText` - Specifies the text of an external script file from the script attribute. | ||
|
||
.Checks if the javascript file with the given text exists in the page source code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not correct
ba32e74
to
39f1f2b
Compare
a895535
to
a14d545
Compare
096fa58
to
2bb2c7a
Compare
_Replacement_: | ||
[source,gherkin] | ||
---- | ||
Then number of elements found by `xpath(.//script[contains(@src()='%1$s']):a` is equal to `1` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does %1$s mean
|
||
==== Check script with the specified content is included on the page | ||
|
||
Checks that the page contains a script (an element with the <script> tag) whose content is equal to the specified content. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the specified content -> the specified text
_Replacement_: | ||
[source,gherkin] | ||
---- | ||
Then number of elements found by `xpath(.//script[text()='%1$s']):a` is equal to `1` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then a javascript with the text '$jsText' is included in the source code | ||
---- | ||
|
||
* `$jsText` - Specifies the text of an external script file from the script attribute. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does it mean?
|
||
==== Check if HTML includes a script that contains the specified content | ||
|
||
Checks that the page contains a script (an element with the <script> tag) whose content contains the specified content. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
specified text
_Deprecated syntax (will be removed in VIVIDUS 0.7.0)_: | ||
[source,gherkin] | ||
---- | ||
Then a javascript file with the name '$jsTextPart' is included in the source code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrong step
2bb2c7a
to
bed80dd
Compare
bed80dd
to
743314e
Compare
|
||
The Script Steps verify the presence of JavaScript files in the HTML source code of an active page. | ||
|
||
==== Check script with the specified file name is included on the page |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
==== Check script with the specified file name is included on the page | |
==== Check presence of script resource |
|
||
==== Check script with the specified file name is included on the page | ||
|
||
Checks script (an element with the <script> tag) with the specified file name (@src attribute) is included on the page. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checks script (an element with the <script> tag) with the specified file name (@src attribute) is included on the page. | |
Checks script (an element with the `<script>` tag) with the specified path (`@src` attribute) is included on the page. |
|
||
Checks script (an element with the <script> tag) with the specified file name (@src attribute) is included on the page. | ||
|
||
WARNING: This step is deprecated and will be removed in VIVIDUS 0.7.0. Please see the replacement below. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please, move replacement inside this warning admonition
|
||
WARNING: This step is deprecated and will be removed in VIVIDUS 0.7.0. Please see the replacement below. | ||
|
||
_Deprecated syntax (will be removed in VIVIDUS 0.7.0)_: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_Deprecated syntax (will be removed in VIVIDUS 0.7.0)_: |
no need to duplicate the info
Then a javascript file with the name '$jsFileName' is included in the source code | ||
---- | ||
|
||
* `$jsFileName` - Specifies the URL of an external script file from the src attribute. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* `$jsFileName` - Specifies the URL of an external script file from the src attribute. | |
* `$jsFileName` - The part of the script resource URL from the `@src` attribute. |
Then a javascript with the textpart '$jsTextPart' is included in the source code | ||
---- | ||
|
||
* `$jsTextPart` - Specifies text that should be contained inside a <script> tag. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* `$jsTextPart` - Specifies text that should be contained inside a <script> tag. | |
* `$jsTextPart` - The expected text to be contained in the text of a `<script>` tag. |
Then number of elements found by `xpath(.//script[contains(text(),'jsTextPart')]):a` is equal to `1` | ||
---- | ||
|
||
.Checks if the javascript text contains 'Hello JavaScript' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.Checks if the javascript text contains 'Hello JavaScript' | |
.Checks if the JavaScript code contains 'Hello JavaScript' |
@@ -46,8 +47,14 @@ public class ScriptSteps | |||
* | |||
* @param jsFileName Value of the <i>src</i> attribute | |||
* @return webElement found js script | |||
* @deprecated Use step: | |||
* "Then number of elements found by `xpath(.//script[contains(@src()='%1$s']):a` is equal to `1`" instead |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* "Then number of elements found by `xpath(.//script[contains(@src()='%1$s']):a` is equal to `1`" instead | |
* "Then number of elements found by `xpath(.//script[contains(@src()='<jsFileName >']):a` is equal to `1`" instead |
@@ -71,8 +78,14 @@ public WebElement thenJavascriptFileWithNameIsIncludedInTheSourceCode(String jsF | |||
* | |||
* @param jsText Content of the <i>{@literal <script>}</i> tag. | |||
* @return webElement found js script | |||
* @deprecated Use step: | |||
* "Then number of elements found by `xpath(.//script[text()='%1$s']):a` is equal to `1`" instead |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* "Then number of elements found by `xpath(.//script[text()='%1$s']):a` is equal to `1`" instead | |
* "Then number of elements found by `xpath(.//script[text()='<jsText>']):a` is equal to `1`" instead |
@@ -96,8 +109,14 @@ public WebElement thenJavascriptFileWithTextIsIncludedInTheSourceCode(String jsT | |||
* | |||
* @param jsTextPart String which should be contained in the <i>{@literal <script>}</i> tag. | |||
* @return webElement found js script | |||
* @deprecated Use step: | |||
* "Then number of elements found by `xpath(.//script[contains(text(),'%1$s')]):a` is equal to `1`" instead |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* "Then number of elements found by `xpath(.//script[contains(text(),'%1$s')]):a` is equal to `1`" instead | |
* "Then number of elements found by `xpath(.//script[contains(text(),'<jsTextPart.')]):a` is equal to `1`" instead |
19acb69
to
1eba7bb
Compare
de9d510
to
17051b1
Compare
No description provided.