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 Details

    • assertTextPresent

      void assertTextPresent(String expectedText)
      Asserts that 'expectedText' can be found in the current page.
      Parameters:
      expectedText - the expected text
    • assertTextPresentHtmlEncoded

      void assertTextPresentHtmlEncoded(String expectedText)
      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

      void assertTextNotPresent(String text)
      Asserts that the given text cannot be found in the current page.
      Parameters:
      text - the expected text
    • assertTextPresent

      void assertTextPresent(String srcText, String expectedText)
      Asserts that 'expectedText' can be found in 'srcText'.
      Parameters:
      srcText - the text to search in
      expectedText - the expected text
    • assertTextPresent

      void assertTextPresent(Locator locator, String expectedText)
      Synonym for assertTextPresent(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 text
      expectedText - the expected text
    • assertTextPresentNumOccurences

      void assertTextPresentNumOccurences(String expectedText, int numOccurences)
      Asserts that 'expectedText' can be found in the current page exactly 'numOccurences' times.
      Parameters:
      expectedText - the expected text
      numOccurences - the number of times the expected text should occur; must be greater than 0.
    • assertTextPresentNumOccurences

      void assertTextPresentNumOccurences(String srcText, String expectedText, int numOccurences)
      Asserts that 'expectedText' can be found in 'srcText' exactly 'numOccurences' times.
      Parameters:
      srcText - the text to search in
      expectedText - the expected text
      numOccurences - the number of times the expected text should occur; must be greater than 0.
    • assertTextPresentNumOccurences

      void assertTextPresentNumOccurences(Locator locator, String expectedText, int numOccurences)
      Synonym for assertTextPresentNumOccurences(String, String, int) that calls getText() on the provided locator.
      Parameters:
      locator - the source of the text
      expectedText - the expected text
      numOccurences - the number of times the expected text should occur; must be greater than 0.
    • assertRegexMatch

      void assertRegexMatch(String srcText, String regexPattern)
      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 in
      regexPattern - the regex pattern
    • assertRegexNoMatch

      void assertRegexNoMatch(String srcText, String regexPattern)
      This asserets that the regular expression pattern 'regexPattern' has NO match somewhere inside 'srcText'
      Parameters:
      srcText - the text source to do the matching in
      regexPattern - the regex pattern
    • assertRegexMatch

      void assertRegexMatch(Locator locator, String regexPattern)
      Synonym for assertRegexMatch(String, String) that calls getText() on the provided locator.
      Parameters:
      locator - the source of the teext
      regexPattern - the regex pattern
    • assertRegexNoMatch

      void assertRegexNoMatch(Locator locator, String regexPattern)
      Synonym for assertRegexNoMatch(String, String) that calls getText() on the provided locator.
      Parameters:
      locator - the source of the teext
      regexPattern - the regex pattern
    • assertTextNotPresent

      void assertTextNotPresent(String srcText, String expectedText)
      Asserts that 'expectedText' can NOT be found in 'srcText'.
      Parameters:
      srcText - the text to search in
      expectedText - the expected text
    • assertTextNotPresent

      void assertTextNotPresent(Locator locator, String expectedText)
      Synonym for assertTextNotPresent(String, String) that calls getText() on the provided locator.
      Parameters:
      locator - the source of the text
      expectedText - the expected text
    • assertTextSequence

      void assertTextSequence(String srcText, String[] expectedTextSequence)
      Asserts that the text sequence 'expectedTextSequence' can be found in 'srcText'
      Parameters:
      srcText - the text to search in
      expectedTextSequence - the expected text sequence
    • assertTextSequence

      void assertTextSequence(String srcText, String expected1, String... expected2)
      Asserts that the text sequence 'expectedTextSequence' can be found in 'srcText'
      Parameters:
      srcText - the text to search in
      expected1 - the first expected text in the sequence
      expected2 - the rest of expected texts in the sequence
    • assertTextSequence

      void assertTextSequence(Locator locator, String[] expectedTextSequence)
      Synonym for assertTextSequence(String, String[]) that calls getText() on the provided locator.
      Parameters:
      locator - the source of the text
      expectedTextSequence - the expected text sequence
    • assertTextSequence

      void assertTextSequence(Locator locator, String expected1, String... expected2)
      Synonym for assertTextSequence(String, String[]) that calls getText() on the provided locator.
      Parameters:
      locator - the source of the text
      expected1 - the first expected text in the sequence
      expected2 - the rest of expected texts in the sequence
    • assertAtLeastOneTextPresent

      void assertAtLeastOneTextPresent(Locator locator, String option1, String... options)
      Asserts that at least one of the provided text strings is present in the locator. Will throw an AssertionError if none are present.
      Parameters:
      locator - the source of the text
      option1 - the expected text
      options - the expected texts
    • assertEqualDateStrings

      void assertEqualDateStrings(String expected, String actual)