Package com.dougnoel.sentinel.steps
Class TableSteps
java.lang.Object
com.dougnoel.sentinel.steps.TableSteps
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
clickAssociatedLinkInTable
(String elementName, String tableName, String key) Clicks the link in a table row by matching text in another part of the row.static void
clickAssociatedLinkInTable
(String ordinal, String tableName, String clickLocatorType, String elementToClick) Clicks a text value, stored value or xpath part in a table in a row.static void
clickAssociatedLinkInTable
(String tableName, String clickLocatorType, String elementToClick, String matchLocatorType, String elementToMatch) Clicks a text value or xpath part in a table that contains another text value or xpath part.static void
clickColumnHeaderToSort
(String columnName, String tableName) Clicks the header element to sort the table on the given column.static void
clickCoordsInTable
(String columnNum, String tableName, String rowNum) Clicks a cell in a table by a given column and rowstatic void
enterAssociatedTextInTable
(String ordinal, String tableName, String text, String elementName) Enters a text value in a table in a row.static void
storeTableValues
(int pageNumber, String tableName) Stores the data for the given page in the given table for later comparison.
-
Field Details
-
XPATH
- See Also:
-
TEXT
- See Also:
-
CONTAINS_TEXT
- See Also:
-
-
Constructor Details
-
TableSteps
public TableSteps()
-
-
Method Details
-
clickAssociatedLinkInTable
@When("^I find the (.*?) link in the row of the (.*?) containing the (.*?) value and click it$") public static void clickAssociatedLinkInTable(String elementName, String tableName, String key) Clicks the link in a table row by matching text in another part of the row.Gherkin Examples:
- I find the row matching the text stored for the <Client> Login ID field in the search results table and click the Edit link
- I find the row matching the text stored for the current user in the Search Results Table and click the Edit button
- I find the link in the row of the Provider Search table containing the search criteria values and click the search button.
- Parameters:
key
- String the key used to retrieve the valuetableName
- String the name of the table to searchelementName
- String the name of the element to click
-
clickAssociatedLinkInTable
@When("^I find the (.*?) and click the (text|xpath|value for) (.*?) in the row containing the (text|xpath|value for) (.*?)$") public static void clickAssociatedLinkInTable(String tableName, String clickLocatorType, String elementToClick, String matchLocatorType, String elementToMatch) Clicks a text value or xpath part in a table that contains another text value or xpath part. Can be used to click a chevron or image in a table that is related to some piece of data in the table. For example: an expand, edit or delete button.Gherkin Examples:
- I find the Users Table and click the text Edit in the row containing the text Sally Smith
- I find the Cars Table and click the xpath //span[@class="cke_button_icon"] in the row containing the text Toyota Avalon
- I find the Categories Table and click the xpath //img[1] in the row containing the xpath //img[starts-with(@id,'uid')]
- I find the Example Table and click the text Delete in the row containing the xpath //*[name()="svg" and @class="svg-connector"]/*[name()="circle" and @class="inner-circle"]
- Parameters:
tableName
- String the name of the table to searchclickLocatorType
- String the type of locator the next value will be: text or xpathelementToClick
- String the text or xpath used to find the item you want to click uponmatchLocatorType
- String the type of locator the next value will be: text or xpathelementToMatch
- String the text or xpath of the value that will ensure you are in the correct row
-
clickAssociatedLinkInTable
@When("^I find the (\\d+|la)(?:st|nd|rd|th) row in the (.*?) and click the (text|xpath|value for) (.*?)$") public static void clickAssociatedLinkInTable(String ordinal, String tableName, String clickLocatorType, String elementToClick) Clicks a text value, stored value or xpath part in a table in a row. The row is determined by ordinal value (last, 1st, 2nd, 3rd, etc.).Gherkin Examples:
- I find the 1st row in the Soil Table and click the text Dirt
- I find the 2nd row in the Garbage Table and click the xpath //*[@id = 'myValue']
- I find the last row in the Users Table and click the value for Username
- Parameters:
ordinal
- String the row number to search; pass "la" or -1 to get the last rowtableName
- String the name of the table to searchclickLocatorType
- String the type of locator the next value will be: text, xpath, value for (stored value)elementToClick
- String the text, xpath or stored value used to find the item you want to click upon
-
storeTableValues
@Given("^I view the (\\d+)(?:st|nd|rd|th) page of results from the (.*)$") public static void storeTableValues(int pageNumber, String tableName) Stores the data for the given page in the given table for later comparison.Gherkin Examples:
- I view the 1st page of results from the Provider search
- I view the 5th page of results from the Members table
- I view the 2nd page of results from the NFL Schedule
- Parameters:
pageNumber
- int Page we are on to store as a key in a hash.tableName
- String the name of the table element on the page object
-
clickColumnHeaderToSort
@When("^I find and click the header for the (.*) column in the (.*)$") public static void clickColumnHeaderToSort(String columnName, String tableName) Clicks the header element to sort the table on the given column. Does not verify sort direction.Gherkin Examples:
- I find and click the header for the Name column in the Users table
- Parameters:
columnName
- String the name of the column to click the header oftableName
- String the name of the table element
-
clickCoordsInTable
@When("^I find the (fir|la|[1-9]+[0-9]{0,})(?:st|nd|rd|th) column in the (.*?) and click the cell in the (fir|la|[1-9]+[0-9]{0,})(?:st|nd|rd|th) row$") public static void clickCoordsInTable(String columnNum, String tableName, String rowNum) Clicks a cell in a table by a given column and rowGherkin Examples:
- I find the 3rd column in the example table and click the cell in the 2nd row
Scenario Outline Example:
I find the <integer><st,nd,rd,th> column in the <String> and click the cell in the <integer><st,nd,rd,th> row
- Parameters:
columnNum
- Integer the column of the cell to clicktableName
- String the name of the table of the cell to clickrowNum
- Integer the row of the cell to click
-
enterAssociatedTextInTable
@When("^I find the (\\d+|la)(?:st|nd|rd|th) row in the (.*?) and enter the text (.*?) in the (.*?)$") public static void enterAssociatedTextInTable(String ordinal, String tableName, String text, String elementName) Enters a text value in a table in a row. The row is determined by ordinal value (last, 1st, 2nd, 3rd, etc.).Gherkin Examples:
- I find the 3rd row in the Stats Editor Table and enter the text "3" in the Sequence Number
- I find the Last in the Stats Editor Table and enter the text "3" in the Sequence Number
- Parameters:
ordinal
- String the row number. Can be "la" to specify the last row, or an integer.tableName
- String the name of the table to searchtext
- String the text to enter into the elementelementName
- String the name of the element into which to enter text
-