Package org.primefaces.selenium
Class AbstractPrimePageTest
- java.lang.Object
-
- org.primefaces.selenium.AbstractPrimePageTest
-
@TestInstance(PER_CLASS) @TestMethodOrder(org.junit.jupiter.api.MethodOrderer.OrderAnnotation.class) @ExtendWith(BootstrapExtension.class) @ExtendWith(WebDriverExtension.class) @ExtendWith(PageInjectionExtension.class) public abstract class AbstractPrimePageTest extends Object
-
-
Constructor Summary
Constructors Constructor Description AbstractPrimePageTest()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidassertClickable(org.openqa.selenium.WebElement element)protected voidassertCss(org.openqa.selenium.WebElement element, String... cssClasses)Checks a WebElement if it has a CSS class or classes.protected voidassertDisabled(org.openqa.selenium.By by)protected voidassertDisabled(org.openqa.selenium.WebElement element)protected voidassertDisplayed(org.openqa.selenium.By by)protected voidassertDisplayed(org.openqa.selenium.WebElement element)protected voidassertEnabled(org.openqa.selenium.By by)protected voidassertEnabled(org.openqa.selenium.WebElement element)protected voidassertIsAt(Class<? extends AbstractPrimePage> pageClass)protected voidassertIsAt(String relativePath)protected voidassertIsAt(AbstractPrimePage page)protected voidassertNoJavascriptErrors()Checks the browse console and asserts there are no SEVERE level messages.protected voidassertNotClickable(org.openqa.selenium.WebElement element)protected voidassertNotDisabled(org.openqa.selenium.By by)protected voidassertNotDisabled(org.openqa.selenium.WebElement element)protected voidassertNotDisplayed(org.openqa.selenium.By by)protected voidassertNotDisplayed(org.openqa.selenium.WebElement element)protected voidassertNotEnabled(org.openqa.selenium.By by)protected voidassertNotEnabled(org.openqa.selenium.WebElement element)protected voidassertNotPresent(org.openqa.selenium.By by)protected voidassertNotPresent(org.openqa.selenium.WebElement element)protected voidassertPresent(org.openqa.selenium.By by)protected voidassertPresent(org.openqa.selenium.WebElement element)protected voidassertText(org.openqa.selenium.WebElement element, String text)Asserts text of a web element and cleanses it of whitespace issues due to different WebDriver results.voidbeforeEach()protected voidclearConsole()Clears the browser console.protected org.openqa.selenium.logging.LogEntriesgetLogsForType(String type)Utility method for checking the browser console for a specific type of message.protected org.openqa.selenium.WebDrivergetWebDriver()protected <T extends AbstractPrimePage>
TgoTo(Class<T> pageClass)protected voidgoTo(String partialUrl)static StringnormalizeSpace(String str)protected voidprintConsole()Dumps to System.out or System.err any messages found in the browser console.
-
-
-
Method Detail
-
beforeEach
@BeforeEach public void beforeEach()
-
assertPresent
protected void assertPresent(org.openqa.selenium.WebElement element)
-
assertPresent
protected void assertPresent(org.openqa.selenium.By by)
-
assertNotPresent
protected void assertNotPresent(org.openqa.selenium.WebElement element)
-
assertNotPresent
protected void assertNotPresent(org.openqa.selenium.By by)
-
assertDisplayed
protected void assertDisplayed(org.openqa.selenium.WebElement element)
-
assertDisplayed
protected void assertDisplayed(org.openqa.selenium.By by)
-
assertNotDisplayed
protected void assertNotDisplayed(org.openqa.selenium.WebElement element)
-
assertNotDisplayed
protected void assertNotDisplayed(org.openqa.selenium.By by)
-
assertEnabled
protected void assertEnabled(org.openqa.selenium.WebElement element)
-
assertEnabled
protected void assertEnabled(org.openqa.selenium.By by)
-
assertNotEnabled
protected void assertNotEnabled(org.openqa.selenium.WebElement element)
-
assertNotEnabled
protected void assertNotEnabled(org.openqa.selenium.By by)
-
assertDisabled
protected void assertDisabled(org.openqa.selenium.WebElement element)
-
assertDisabled
protected void assertDisabled(org.openqa.selenium.By by)
-
assertNotDisabled
protected void assertNotDisabled(org.openqa.selenium.WebElement element)
-
assertNotDisabled
protected void assertNotDisabled(org.openqa.selenium.By by)
-
assertIsAt
protected void assertIsAt(AbstractPrimePage page)
-
assertClickable
protected void assertClickable(org.openqa.selenium.WebElement element)
-
assertNotClickable
protected void assertNotClickable(org.openqa.selenium.WebElement element)
-
assertIsAt
protected void assertIsAt(Class<? extends AbstractPrimePage> pageClass)
-
assertNoJavascriptErrors
protected void assertNoJavascriptErrors()
Checks the browse console and asserts there are no SEVERE level messages.
-
clearConsole
protected void clearConsole()
Clears the browser console.
-
printConsole
protected void printConsole()
Dumps to System.out or System.err any messages found in the browser console.
-
getLogsForType
protected org.openqa.selenium.logging.LogEntries getLogsForType(String type)
Utility method for checking the browser console for a specific type of message.- Parameters:
type- theLogTypeyou are searching for- Returns:
- either NULL if not available or the
LogEntries
-
assertIsAt
protected void assertIsAt(String relativePath)
-
goTo
protected <T extends AbstractPrimePage> T goTo(Class<T> pageClass)
-
goTo
protected void goTo(String partialUrl)
-
getWebDriver
protected org.openqa.selenium.WebDriver getWebDriver()
-
assertText
protected void assertText(org.openqa.selenium.WebElement element, String text)Asserts text of a web element and cleanses it of whitespace issues due to different WebDriver results.- Parameters:
element- the element to check its texttext- the text expected in the element
-
assertCss
protected void assertCss(org.openqa.selenium.WebElement element, String... cssClasses)Checks a WebElement if it has a CSS class or classes. If more than one is listed then ALL must be found on the element.- Parameters:
element- the element to checkcssClasses- the CSS class or classes to look for
-
normalizeSpace
public static String normalizeSpace(String str)
Similar to http://www.w3.org/TR/xpath/#function-normalize -space
The function returns the argument string with whitespace normalized by using to remove leading and trailing whitespace and then replacing sequences of whitespace characters by a single space.
In XML Whitespace characters are the same as those allowed by the S production, which is S ::= (#x20 | #x9 | #xD | #xA)+Java's regexp pattern \s defines whitespace as [ \t\n\x0B\f\r]
For reference:
- \x0B = vertical tab
- \f = #xC = form feed
- #x20 = space
- #x9 = \t
- #xA = \n
- #xD = \r
The difference is that Java's whitespace includes vertical tab and form feed, which this functional will also normalize. Additionally removes control characters (char <= 32) from both ends of this String.
- Parameters:
str- the source String to normalize whitespaces from, may be null- Returns:
- the modified string with whitespace normalized,
nullif null String input - Since:
- 3.0
- See Also:
Pattern, http://www.w3.org/TR/xpath/#function-normalize-space
-
-