Dropdown asserts
<dropdown> <text|value> should[ not] be <blank|empty>
Checks whether or not a dropdown selection matches a blank or empty string. Reports an assertion error if the match fails.
<dropdown> <text|value> should[ not] be <blank|empty>
With custom assertion error message (as of v3.9.0):
<dropdown> <text|value> should[ not] be blank @Message("my custom assert fail message")
Without any timeout (as of v3.73.0):
@Timeout('0s') <dropdown> <text|value> should[ not] be blank
With custom timeout (as of v3.73.0):
@Timeout('10s') <dropdown> <text|value> should[ not] be blank
Where
<dropdown>is the dropdown element to check<text|value>is one of:textto check the displayed text of the selectionvalueto check the option value of the selection
notnegates the match if included<timeoutSecs>is the timeout period in seconds<wait|timeout>is eitherwaitortimeout
Example
Given the age dropdown can be located by id "challenger_age"
When I navigate to "https://challengers.flood.io/step/2"
And I select the 2nd option in the age dropdown
Then the age dropdown value should not be blank
Trimming (since v3.62.0)
- The
@Trimannotation can be used on step to trim strings when comparing
<dropdown> <text|value> should[ not] <match> "<expression>"
Checks whether or not a dropdown selection matches a given expression. Reports an assertion error if the match fails.
<dropdown> <text|value> should[ not] <match> "<expression>"
With custom assertion error message (as of v3.9.0):
<dropdown> <text|value> should[ not] <match> "<expression>" @Message("my custom assert fail message")
Without any timeout (as of v3.73.0):
@Timeout('0s') <dropdown> <text|value> should[ not] <match> "<expression>"
With custom timeout (as of v3.73.0):
@Timeout('10s') <dropdown> <text|value> should[ not] <match> "<expression>"
Where
<dropdown>is the dropdown element to check<text|value>is one of:textto check the displayed text of the selectionvalueto check the option value of the selection
notnegates the match if included<match>is the type of match to perform, one of:befor exact matchcontainfor partial matchstart withfor partial leading matchend withfor partial trailing matchmatch regexfor regex matchmatch xpathfor XML matchmatch json pathfor JSON match, since v1.4.0match templatefor template match, since v2.16.0match template filefor template file match, since v2.16.0
<expression>is the expression to match (can be in DocString position)<timeoutSecs>is the timeout period in seconds<wait|timeout>is eitherwaitortimeout
Example
Given the age dropdown can be located by id "challenger_age"
When I navigate to "https://challengers.flood.io/step/2"
And I select the 2nd option in the age dropdown
Then the age dropdown value should be "18"
Trimming and ignoring case (since v3.62.0)
- The
@Trimannotation can be used on step to trim strings when comparing - The
@IgnoreCaseannotation can be used on step to ignore case when comparing
<dropdown> <text|value> should[ not] <match> <expressionRef>
Checks whether or not a dropdown selection matches a referenced expression. Reports an assertion error if the match fails.
<dropdown> <text|value> should[ not] <match> <expressionRef>
With custom assertion error message (as of v3.9.0):
<dropdown> <text|value> should[ not] <match> <expressionRef> @Message("my custom assert fail message")
Without any timeout (as of v3.73.0):
@Timeout('0s') <dropdown> <text|value> should[ not] <match> <expressionRef>
With custom timeout (as of v3.73.0):
@Timeout('10s') <dropdown> <text|value> should[ not] <match> <expressionRef>
Where
<dropdown>is the dropdown element to check<text|value>is one of:textto check the displayed text of the selectionvalueto check the option value of the selection
notnegates the match if included<match>is the type of match to perform, one of:befor exact matchcontainfor partial matchstart withfor partial leading matchend withfor partial trailing matchmatch regexfor regex matchmatch xpathfor XML matchmatch json pathfor JSON match, since v1.4.0match templatefor template match, since v2.16.0match template filefor template file match, since v2.16.0
<expressionRef>is the name of the binding containing the expression to match- Can be the name of any binding that contains or resolves to an expression value, including a web element in which case the text in the element will be dynamically retrieved and used.
<timeoutSecs>is the timeout period in seconds<wait|timeout>is eitherwaitortimeout
Example
Given the age dropdown can be located by id "challenger_age"
And my age is "18"
When I navigate to "https://challengers.flood.io/step/2"
And I select the 2nd option in the age dropdown
Then the age dropdown value should be my age
Trimming and ignoring case (since v3.62.0)
- The
@Trimannotation can be used on step to trim strings when comparing - The
@IgnoreCaseannotation can be used on step to ignore case when comparing