Interface TextAssertions
- All Known Implementing Classes:
TextAssertionsImpl
public interface TextAssertions
Contains a number of methods that do "extended" functional test assertions involving text.
- Since:
- v3.13
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
assertAtLeastOneTextPresent
(Locator locator, String option1, String... options) Asserts that at least one of the provided text strings is present in the locator.void
assertEqualDateStrings
(String expected, String actual) void
assertRegexMatch
(Locator locator, String regexPattern) Synonym forassertRegexMatch(String, String)
that calls getText() on the provided locator.void
assertRegexMatch
(String srcText, String regexPattern) This asserets that the regular expression pattern 'regexPattern' has at least one match somewhere inside 'srcText'void
assertRegexNoMatch
(Locator locator, String regexPattern) Synonym forassertRegexNoMatch(String, String)
that calls getText() on the provided locator.void
assertRegexNoMatch
(String srcText, String regexPattern) This asserets that the regular expression pattern 'regexPattern' has NO match somewhere inside 'srcText'void
assertTextNotPresent
(Locator locator, String expectedText) Synonym forassertTextNotPresent(String, String)
that calls getText() on the provided locator.void
assertTextNotPresent
(String text) Asserts that the given text cannot be found in the current page.void
assertTextNotPresent
(String srcText, String expectedText) Asserts that 'expectedText' can NOT be found in 'srcText'.void
assertTextPresent
(Locator locator, String expectedText) Synonym forassertTextPresent(String, String)
that calls getText() on the provided locator.void
assertTextPresent
(String expectedText) Asserts that 'expectedText' can be found in the current page.void
assertTextPresent
(String srcText, String expectedText) Asserts that 'expectedText' can be found in 'srcText'.void
assertTextPresentHtmlEncoded
(String expectedText) Asserts that 'expectedText' can be found in the current page in a "HTML Encoded" form.void
assertTextPresentNumOccurences
(Locator locator, String expectedText, int numOccurences) Synonym forassertTextPresentNumOccurences(String, String, int)
that calls getText() on the provided locator.void
assertTextPresentNumOccurences
(String expectedText, int numOccurences) Asserts that 'expectedText' can be found in the current page exactly 'numOccurences' times.void
assertTextPresentNumOccurences
(String srcText, String expectedText, int numOccurences) Asserts that 'expectedText' can be found in 'srcText' exactly 'numOccurences' times.void
assertTextSequence
(Locator locator, String[] expectedTextSequence) Synonym forassertTextSequence(String, String[])
that calls getText() on the provided locator.void
assertTextSequence
(Locator locator, String expected1, String... expected2) Synonym forassertTextSequence(String, String[])
that calls getText() on the provided locator.void
assertTextSequence
(String srcText, String[] expectedTextSequence) Asserts that the text sequence 'expectedTextSequence' can be found in 'srcText'void
assertTextSequence
(String srcText, String expected1, String... expected2) Asserts that the text sequence 'expectedTextSequence' can be found in 'srcText'
-
Method Details
-
assertTextPresent
Asserts that 'expectedText' can be found in the current page.- Parameters:
expectedText
- the expected text
-
assertTextPresentHtmlEncoded
Asserts that 'expectedText' can be found in the current page in a "HTML Encoded" form.The encoding expects <, >, ", ', and & to be encoded to appropriate HTML encoding.
- Parameters:
expectedText
- the expected text
-
assertTextNotPresent
Asserts that the given text cannot be found in the current page.- Parameters:
text
- the expected text
-
assertTextPresent
Asserts that 'expectedText' can be found in 'srcText'.- Parameters:
srcText
- the text to search inexpectedText
- the expected text
-
assertTextPresent
Synonym forassertTextPresent(String, String)
that calls getText() on the provided locator. If the provided locator is null the method does the check for the current page instead.- Parameters:
locator
- the source of the textexpectedText
- the expected text
-
assertTextPresentNumOccurences
Asserts that 'expectedText' can be found in the current page exactly 'numOccurences' times.- Parameters:
expectedText
- the expected textnumOccurences
- the number of times the expected text should occur; must be greater than 0.
-
assertTextPresentNumOccurences
Asserts that 'expectedText' can be found in 'srcText' exactly 'numOccurences' times.- Parameters:
srcText
- the text to search inexpectedText
- the expected textnumOccurences
- the number of times the expected text should occur; must be greater than 0.
-
assertTextPresentNumOccurences
Synonym forassertTextPresentNumOccurences(String, String, int)
that calls getText() on the provided locator.- Parameters:
locator
- the source of the textexpectedText
- the expected textnumOccurences
- the number of times the expected text should occur; must be greater than 0.
-
assertRegexMatch
This asserets that the regular expression pattern 'regexPattern' has at least one match somewhere inside 'srcText'- Parameters:
srcText
- the text source to do the matching inregexPattern
- the regex pattern
-
assertRegexNoMatch
This asserets that the regular expression pattern 'regexPattern' has NO match somewhere inside 'srcText'- Parameters:
srcText
- the text source to do the matching inregexPattern
- the regex pattern
-
assertRegexMatch
Synonym forassertRegexMatch(String, String)
that calls getText() on the provided locator.- Parameters:
locator
- the source of the teextregexPattern
- the regex pattern
-
assertRegexNoMatch
Synonym forassertRegexNoMatch(String, String)
that calls getText() on the provided locator.- Parameters:
locator
- the source of the teextregexPattern
- the regex pattern
-
assertTextNotPresent
Asserts that 'expectedText' can NOT be found in 'srcText'.- Parameters:
srcText
- the text to search inexpectedText
- the expected text
-
assertTextNotPresent
Synonym forassertTextNotPresent(String, String)
that calls getText() on the provided locator.- Parameters:
locator
- the source of the textexpectedText
- the expected text
-
assertTextSequence
Asserts that the text sequence 'expectedTextSequence' can be found in 'srcText'- Parameters:
srcText
- the text to search inexpectedTextSequence
- the expected text sequence
-
assertTextSequence
Asserts that the text sequence 'expectedTextSequence' can be found in 'srcText'- Parameters:
srcText
- the text to search inexpected1
- the first expected text in the sequenceexpected2
- the rest of expected texts in the sequence
-
assertTextSequence
Synonym forassertTextSequence(String, String[])
that calls getText() on the provided locator.- Parameters:
locator
- the source of the textexpectedTextSequence
- the expected text sequence
-
assertTextSequence
Synonym forassertTextSequence(String, String[])
that calls getText() on the provided locator.- Parameters:
locator
- the source of the textexpected1
- the first expected text in the sequenceexpected2
- the rest of expected texts in the sequence
-
assertAtLeastOneTextPresent
Asserts that at least one of the provided text strings is present in the locator. Will throw anAssertionError
if none are present.- Parameters:
locator
- the source of the textoption1
- the expected textoptions
- the expected texts
-
assertEqualDateStrings
-