com.atlassian.jira.functest.framework.assertions
Class AssertionsImpl

java.lang.Object
  extended by com.atlassian.jira.functest.framework.AbstractFuncTestUtil
      extended by com.atlassian.jira.functest.framework.assertions.AssertionsImpl
All Implemented Interfaces:
Assertions, com.atlassian.jira.testkit.client.log.FuncTestLogger

public class AssertionsImpl
extends AbstractFuncTestUtil
implements Assertions

Implementation of Assertions

Since:
v3.13

Field Summary
 
Fields inherited from class com.atlassian.jira.functest.framework.AbstractFuncTestUtil
environmentData, FS, locators, logger, logIndentLevel, tester
 
Constructor Summary
AssertionsImpl(net.sourceforge.jwebunit.WebTester tester, JIRAEnvironmentData environmentData, Navigation navigation, LocatorFactory locator)
           
 
Method Summary
 void assertEquals(String failureMessage, List expected, List actual)
          Elaboration of assertEquals for lists with nicer messages.
 void assertLastChangeHistoryRecords(String issueKey, ExpectedChangeHistoryRecord expectedChangeHistoryRecord)
          Useful to check that a particular change history item exists for a given issue.
 void assertLastChangeHistoryRecords(String issueKey, List expectedChangeHistoryRecords)
          Useful to check that a number of change history items exist for a given issue.
 void assertNodeByIdDoesNotExist(String id)
          Asserts that a given node does not exists
 void assertNodeByIdDoesNotHaveText(String id, String textToTest)
          Asserts that a given node exists but does not contain the given text
 void assertNodeByIdEquals(String id, String textToTest)
          Asserts that a given node exactly equals the given text
 void assertNodeByIdExists(String id)
          Asserts that a given node exists
 void assertNodeByIdHasText(String id, String textToTest)
          Asserts that a given node contains the given text
 void assertNodeDoesNotExist(Locator locator)
          Asserts that a given node does not exists
 void assertNodeDoesNotExist(String xpath)
          Asserts that a node does not exist under the xpath expression given
 void assertNodeDoesNotHaveText(Locator locator, String textToTest)
          Asserts that a given node exists but does not contain the given text
 void assertNodeDoesNotHaveText(String xpath, String textToTest)
          Asserts that a node under the xpath expression given does not contain the given text
 void assertNodeEquals(Locator locator, String textToTest)
          Asserts that a given node exactly equals the given text
 void assertNodeExists(Locator locator)
          Asserts that a given node exists
 void assertNodeExists(String xpath)
          Asserts that a node exists under the xpath expression given
 void assertNodeHasText(Locator locator, String textToTest)
          Asserts that a given node contains the given text
 void assertNodeHasText(String xpath, String textToTest)
          Asserts that a node under the xpath expression given contains the given text
 void assertProfileLinkPresent(String id, String linkText)
          Checks that a profile link with the given ID and link Text exists on the page.
 void assertSubmitButtonPresentWithText(String buttonId, String buttonText)
          Check that the button with the id provided has the text provided as its value.
 CommentAssertions comments(Iterable<String> comments)
          Returns an object that can be used to make assertions on a specified group of comments.
 void dumpResponse(junit.framework.TestCase testCase, net.sourceforge.jwebunit.WebTester tester, Throwable cause)
          This will "dump" the current contents of the WebTester including the Throwable 'cause'.
 JiraFormAssertions forms()
          Form assertions.
 DashboardAssertions getDashboardAssertions()
           
 IssueNavigatorAssertions getIssueNavigatorAssertions()
          Return an object that can be used to make assertions about the navigator.
 JiraFormAssertions getJiraFormAssertions()
           
 JiraMessageAssertions getJiraMessageAssertions()
           
 LabelAssertions getLabelAssertions()
           
 LinkAssertions getLinkAssertions()
           
 TableAssertions getTableAssertions()
           
 TextAssertions getTextAssertions()
           
 URLAssertions getURLAssertions()
           
 UserAssertions getUserAssertions()
           
 ViewIssueAssertions getViewIssueAssertions()
          Returns an object that can be used to make assertions on the "View Issue" page.
 HTMLAssertions html()
          HTML assertions.
 LinkAssertions link()
          Link assertions.
 TextAssertions text()
          Text assertions.
 
Methods inherited from class com.atlassian.jira.functest.framework.AbstractFuncTestUtil
childLogIndentLevel, getAssertions, getEnvironmentData, getFuncTestHelperFactory, getLogger, log, log, navigation, submitAtPage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AssertionsImpl

public AssertionsImpl(net.sourceforge.jwebunit.WebTester tester,
                      JIRAEnvironmentData environmentData,
                      Navigation navigation,
                      LocatorFactory locator)
Method Detail

dumpResponse

public void dumpResponse(junit.framework.TestCase testCase,
                         net.sourceforge.jwebunit.WebTester tester,
                         Throwable cause)
Description copied from interface: Assertions
This will "dump" the current contents of the WebTester including the Throwable 'cause'.

DONT LEAVE THESE CALLS IN THE TESTS. You should really only use this if you are debugging your test code. if you dont remove them, then you will generate "unwarranted" test artifacts in Bamboo.

Specified by:
dumpResponse in interface Assertions
Parameters:
testCase - the TestCase in play
tester - the WebTester in play
cause - an optional cause for dumping the response

assertLastChangeHistoryRecords

public void assertLastChangeHistoryRecords(String issueKey,
                                           ExpectedChangeHistoryRecord expectedChangeHistoryRecord)
Description copied from interface: Assertions
Useful to check that a particular change history item exists for a given issue.

Specified by:
assertLastChangeHistoryRecords in interface Assertions
Parameters:
issueKey - The issue to check
expectedChangeHistoryRecord - A ExpectedChangeHistoryRecord item

comments

public CommentAssertions comments(Iterable<String> comments)
Description copied from interface: Assertions
Returns an object that can be used to make assertions on a specified group of comments.

Specified by:
comments in interface Assertions
Parameters:
comments - The comments that will be used in the assertions.
Returns:
a {CommentAssertions} object that can be used to make assertions on a specified group of comments.

assertLastChangeHistoryRecords

public void assertLastChangeHistoryRecords(String issueKey,
                                           List expectedChangeHistoryRecords)
Description copied from interface: Assertions
Useful to check that a number of change history items exist for a given issue.

Specified by:
assertLastChangeHistoryRecords in interface Assertions
Parameters:
issueKey - The issue to check
expectedChangeHistoryRecords - A list of ExpectedChangeHistoryRecords

html

public HTMLAssertions html()
Description copied from interface: Assertions
HTML assertions.

Specified by:
html in interface Assertions
Returns:
HTML assertions.

text

public TextAssertions text()
Description copied from interface: Assertions
Text assertions. Shortcut for Assertions.getTextAssertions().

Specified by:
text in interface Assertions
Returns:
text assertions.

link

public LinkAssertions link()
Description copied from interface: Assertions
Link assertions. Shortcut for Assertions.getLinkAssertions().

Specified by:
link in interface Assertions
Returns:
link assertions.

forms

public JiraFormAssertions forms()
Description copied from interface: Assertions
Form assertions. Shortcut for Assertions.getJiraFormAssertions().

Specified by:
forms in interface Assertions
Returns:
form assertions

getIssueNavigatorAssertions

public IssueNavigatorAssertions getIssueNavigatorAssertions()
Description copied from interface: Assertions
Return an object that can be used to make assertions about the navigator.

Specified by:
getIssueNavigatorAssertions in interface Assertions
Returns:
an object that can be used to make assertions about the navigator.

getViewIssueAssertions

public ViewIssueAssertions getViewIssueAssertions()
Description copied from interface: Assertions
Returns an object that can be used to make assertions on the "View Issue" page.

It is assumed that you are already on the View Issue page. If not, then use something like navigation.issue().viewIssue("RAT-1") to get to the required Issue.

Specified by:
getViewIssueAssertions in interface Assertions
Returns:
an object that can be used to make assertions on the "View Issue" page.
See Also:
IssueNavigation.viewIssue(String)

getDashboardAssertions

public DashboardAssertions getDashboardAssertions()
Specified by:
getDashboardAssertions in interface Assertions
Returns:
an object that can be used to make assertions about Dashboard pages

getJiraFormAssertions

public JiraFormAssertions getJiraFormAssertions()
Specified by:
getJiraFormAssertions in interface Assertions
Returns:
an object that can be used to make assertions about JIRA forms

getJiraMessageAssertions

public JiraMessageAssertions getJiraMessageAssertions()
Specified by:
getJiraMessageAssertions in interface Assertions
Returns:
an object that can be used to make assertions about JIRA messages

getURLAssertions

public URLAssertions getURLAssertions()
Specified by:
getURLAssertions in interface Assertions
Returns:
an object that can be used to make assertions about the current JIRA url.

getTextAssertions

public TextAssertions getTextAssertions()
Specified by:
getTextAssertions in interface Assertions
Returns:
an object that can be used for text assertions.

getLinkAssertions

public LinkAssertions getLinkAssertions()
Specified by:
getLinkAssertions in interface Assertions
Returns:
an object that can be used to make assertions about links.

getLabelAssertions

public LabelAssertions getLabelAssertions()
Specified by:
getLabelAssertions in interface Assertions
Returns:
an object that can be used to make assertions about labels.

getTableAssertions

public TableAssertions getTableAssertions()
Specified by:
getTableAssertions in interface Assertions
Returns:
an object that can be used to make assertions about tables.

getUserAssertions

public UserAssertions getUserAssertions()
Specified by:
getUserAssertions in interface Assertions
Returns:
an object that can be used to make assertions about users.

assertEquals

public void assertEquals(String failureMessage,
                         List expected,
                         List actual)
Elaboration of assertEquals for lists with nicer messages.

Specified by:
assertEquals in interface Assertions
Parameters:
failureMessage - The message (prefix) to use to describe a failure.
expected - the expected list.
actual - the actual list to be tested.

assertProfileLinkPresent

public void assertProfileLinkPresent(String id,
                                     String linkText)
Description copied from interface: Assertions
Checks that a profile link with the given ID and link Text exists on the page. Also clicks the link and checks that the user's profile with linkText shows up.

Specified by:
assertProfileLinkPresent in interface Assertions
Parameters:
id - The id of the profileLink
linkText - The Text of the profileLink (usually the user's full name).

assertNodeByIdExists

public void assertNodeByIdExists(String id)
Description copied from interface: Assertions
Asserts that a given node exists

Specified by:
assertNodeByIdExists in interface Assertions
Parameters:
id - the id of the node

assertNodeByIdDoesNotExist

public void assertNodeByIdDoesNotExist(String id)
Description copied from interface: Assertions
Asserts that a given node does not exists

Specified by:
assertNodeByIdDoesNotExist in interface Assertions
Parameters:
id - the id of the node

assertNodeByIdEquals

public void assertNodeByIdEquals(String id,
                                 String textToTest)
Description copied from interface: Assertions
Asserts that a given node exactly equals the given text

Specified by:
assertNodeByIdEquals in interface Assertions
Parameters:
id - The id of the node to test
textToTest - The text to test for

assertNodeByIdHasText

public void assertNodeByIdHasText(String id,
                                  String textToTest)
Description copied from interface: Assertions
Asserts that a given node contains the given text

Specified by:
assertNodeByIdHasText in interface Assertions
Parameters:
id - The id of the node to test
textToTest - The text to test for

assertNodeByIdDoesNotHaveText

public void assertNodeByIdDoesNotHaveText(String id,
                                          String textToTest)
Description copied from interface: Assertions
Asserts that a given node exists but does not contain the given text

Specified by:
assertNodeByIdDoesNotHaveText in interface Assertions
Parameters:
id - The id of the node to test
textToTest - The text to test for

assertNodeExists

public void assertNodeExists(String xpath)
Description copied from interface: Assertions
Asserts that a node exists under the xpath expression given

Specified by:
assertNodeExists in interface Assertions
Parameters:
xpath - The xpath expression to evaluate

assertNodeDoesNotExist

public void assertNodeDoesNotExist(String xpath)
Description copied from interface: Assertions
Asserts that a node does not exist under the xpath expression given

Specified by:
assertNodeDoesNotExist in interface Assertions
Parameters:
xpath - The xpath expression to evaluate

assertNodeHasText

public void assertNodeHasText(String xpath,
                              String textToTest)
Description copied from interface: Assertions
Asserts that a node under the xpath expression given contains the given text

Specified by:
assertNodeHasText in interface Assertions
Parameters:
xpath - The xpath expression to evaluate
textToTest - The text to test for

assertNodeDoesNotHaveText

public void assertNodeDoesNotHaveText(String xpath,
                                      String textToTest)
Description copied from interface: Assertions
Asserts that a node under the xpath expression given does not contain the given text

Specified by:
assertNodeDoesNotHaveText in interface Assertions
Parameters:
xpath - The xpath expression to evaluate
textToTest - The text to test for

assertNodeExists

public void assertNodeExists(Locator locator)
Description copied from interface: Assertions
Asserts that a given node exists

Specified by:
assertNodeExists in interface Assertions
Parameters:
locator - the locator for the node

assertNodeDoesNotExist

public void assertNodeDoesNotExist(Locator locator)
Description copied from interface: Assertions
Asserts that a given node does not exists

Specified by:
assertNodeDoesNotExist in interface Assertions
Parameters:
locator - the locator for the node

assertNodeEquals

public void assertNodeEquals(Locator locator,
                             String textToTest)
Description copied from interface: Assertions
Asserts that a given node exactly equals the given text

Specified by:
assertNodeEquals in interface Assertions
Parameters:
locator - The locator that contains text
textToTest - The text to test for

assertNodeHasText

public void assertNodeHasText(Locator locator,
                              String textToTest)
Description copied from interface: Assertions
Asserts that a given node contains the given text

Specified by:
assertNodeHasText in interface Assertions
Parameters:
locator - The locator that contains text
textToTest - The text to test for

assertNodeDoesNotHaveText

public void assertNodeDoesNotHaveText(Locator locator,
                                      String textToTest)
Description copied from interface: Assertions
Asserts that a given node exists but does not contain the given text

Specified by:
assertNodeDoesNotHaveText in interface Assertions
Parameters:
locator - The locator to test
textToTest - The text to test for

assertSubmitButtonPresentWithText

public void assertSubmitButtonPresentWithText(String buttonId,
                                              String buttonText)
Description copied from interface: Assertions
Check that the button with the id provided has the text provided as its value.

Specified by:
assertSubmitButtonPresentWithText in interface Assertions
Parameters:
buttonId - The id of the button to locate
buttonText - The text the button should contain as its value


Copyright © 2002-2014 Atlassian. All Rights Reserved.