-
Notifications
You must be signed in to change notification settings - Fork 53
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
Assertions #173
base: assertions
Are you sure you want to change the base?
Assertions #173
Conversation
@kealant could you provide a description of this PR? We could use it as documentation together with the merged code. We are also missing JavaDoc for the assertions. This is useful for programmers using our API. |
|
||
import org.apache.commons.io.input.ReversedLinesFileReader; | ||
|
||
public class GrapheneVerify extends Actions { |
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 is this code doing here? If it's dead no reason to have it :)
public WebElementAssert hasChild(){ | ||
if (this.negated) { | ||
assertThat(this.actual.findElements(ByJQuery.selector("*"))).asList().size().isEqualTo(0); | ||
this.negated = false; |
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.
If the about fails this line would never be reached. Why are we doing this assignment in the first place?
|
||
import org.jboss.arquillian.graphene.guard.RequestGuardFactory; | ||
|
||
public class EventHandler implements WebDriverEventListener { |
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 was the purpose of it?
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.
To track the following interactions: clicking, sending keys to an input box and clearing an input box. Write them to static storage and check it when calling .verify() on an actions object, confirming the above actions
Short description of what this resolves:
Adds the following fluent assertions to graphene:
-isNot() a method to negate the following assertion
-hasText(String expectedText) asserts the expectedText is equal to the text of the WebElement
-hasChild() asserts that the WebElement has child elements
-hasParent() asserts that the WebElement has parent nodes
-isDisplayed() asserts that the WebElement is displayed on the page i.e. not hidden
-isSelected() asserts the chosen WebElement is selected by the driver
-isChosenD(Select dropdown) the same as is selected but only works for dropboxes, asserting that the chosen dropbox is selected by the driver. The dropdown must be supplied to the method
-containsText(String expectedText) asserts that the text of an input box is equal to expectedText
-isEmpty() asserts that the given input box is empty
-isTypeOf(String expectedType) asserts that the type attribute of the WebElement is equal to expectedType
-hasCssClass(String expectedClass) asserts that the given WebElement's css class is the same as the supplied expectedClass
-isFocused() asserts that the given WebElement is in focus
-isEnabled() asserts that the WebElement is enabled i.e. not a disabled text input form etc.
-textMatchesRegex(String regex) asserts the supplied regex matches the text of the given WebElement
-caseInsensitiveMatching(String match) asserts the supplied string match is equal to the text of the WebElement regardless of case
-subStringMatching(String match) asserts the supplied substring matches the text of the given WebElement
Each method can be used by calling assertThat(WebElement) and calling subsequent assertions after e.g:
assertThat(inputForm).isNot().isEmpty().containsText("not empty")
Changes proposed in this pull request:
Fixes: #