Package com.atlassian.jira.webtests
Class AbstractAtlassianWebTestCase
java.lang.Object
junit.framework.Assert
junit.framework.TestCase
net.sourceforge.jwebunit.WebTestCase
com.atlassian.jira.webtests.WebTestCaseWrapper
com.atlassian.jira.webtests.AbstractAtlassianWebTestCase
- All Implemented Interfaces:
junit.framework.Test
This super class provides extensions to JWebUnit useful in acceptance tests.
-
Field Summary
Fields inherited from class net.sourceforge.jwebunit.WebTestCase
tester
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
assertCollapsedTextSequence
(String[] textSequence) Deprecated.protected void
assertLessThan
(int a, int b) Makes a junit assertion that a is less than b.protected void
assertLinkWithNameExists
(String message, String linkName) Deprecated.protected void
assertLinkWithNameNotPresent
(String message, String linkName) Deprecated.protected void
assertLinkWithTextExists
(String message, String linkText) protected void
assertLinkWithTextNotPresent
(String message, String linkText) void
assertTextPresent
(String text1, int numOccurrences) Deprecated.void
assertTextPresentAfterText
(String after, String before) Deprecated.void
assertTextPresentBeforeText
(String before, String after) Deprecated.protected void
assertTextPresentOnlyOnce
(String text1) void
assertTextSequence
(String[] text) Deprecated.Use {@link TextAssertions#assertTextSequence(java.lang.String, java.lang.String[])#} instead.void
assertTextSequence
(String failMesgPrefix, String[] text) Deprecated.Use {@link TextAssertions#assertTextSequence(java.lang.String, java.lang.String[])#} instead.protected void
clickAnyButtonWithValue
(String value) Deprecated.UseForm.clickAnyButtonWithValue(String)
instead.protected void
clickButtonWithValue
(String value) Deprecated.UseForm.clickButtonWithValue(String)
instead.static int
findTextSequence
(String stringToSearch, String[] sequenceToFind) Attempts to find the given sequence in the given string and if it fails to find the sequence, returns the index in the sequence that it failed to find a match for.static String[]
flattenArray
(String[][] text) Utility method that flattens a 2d array into a 1d array by stringing each inner array together in their outer array order.protected String
Deprecated.useHtmlPage.getCollapsedResponseText()
insteadcom.meterware.httpunit.WebTable
getFirstWebTableWithClass
(String className) Gets the first table on the current page that has the given class attribute.protected String
com.meterware.httpunit.WebTable[]
getWebTablesWithClass
(String className) Gets the tables on the current page that have the given class attribute.com.meterware.httpunit.WebTable
Gets the table on the current page that has the given ID.protected boolean
hasLinkWithName
(String linkName) protected boolean
hasLinkWithText
(String linkText) Methods inherited from class com.atlassian.jira.webtests.WebTestCaseWrapper
assertElementNotPresent, assertElementNotPresentBy, assertElementPresent, assertElementPresentBy, assertOptionValueNotPresent, assertOptionValuePresent, assertTextInTable, assertTextNotPresent, assertTextPresent, clickCancelButton, dumpResponse, dumpResponse, log, log, log, logSection, raiseRuntimeException, selectMultiOption, selectMultiOptionByValue, selectOption, submit, tearDown, waitAndReloadBulkOperationProgressPage, waitAndReloadBulkOperationProgressPage, waitAndReloadBulkOperationProgressPage
Methods inherited from class net.sourceforge.jwebunit.WebTestCase
assertButtonNotPresent, assertButtonPresent, assertCheckboxNotSelected, assertCheckboxSelected, assertCookiePresent, assertCookieValueEquals, assertFormElementEmpty, assertFormElementEquals, assertFormElementNotPresent, assertFormElementNotPresentWithLabel, assertFormElementPresent, assertFormElementPresentWithLabel, assertFormNotPresent, assertFormNotPresent, assertFormPresent, assertFormPresent, assertFramePresent, assertKeyInTable, assertKeyNotInTable, assertKeyNotPresent, assertKeyPresent, assertKeysInTable, assertLinkNotPresent, assertLinkNotPresentWithImage, assertLinkNotPresentWithText, assertLinkNotPresentWithText, assertLinkPresent, assertLinkPresentWithImage, assertLinkPresentWithText, assertLinkPresentWithText, assertOptionEquals, assertOptionsEqual, assertOptionsNotEqual, assertOptionValuesEqual, assertOptionValuesNotEqual, assertRadioOptionNotPresent, assertRadioOptionNotSelected, assertRadioOptionPresent, assertRadioOptionSelected, assertSubmitButtonNotPresent, assertSubmitButtonPresent, assertSubmitButtonValue, assertTableEquals, assertTableEquals, assertTableNotPresent, assertTablePresent, assertTableRowsEqual, assertTableRowsEqual, assertTextInElement, assertTextInTable, assertTextNotInElement, assertTextNotInTable, assertTextNotInTable, assertTitleEquals, assertTitleEqualsKey, assertWindowPresent, beginAt, checkCheckbox, checkCheckbox, clickButton, clickLink, clickLinkWithImage, clickLinkWithText, clickLinkWithText, clickLinkWithTextAfterText, dumpCookies, dumpCookies, dumpResponse, dumpTable, dumpTable, getDialog, getMessage, getTestContext, getTester, gotoFrame, gotoPage, gotoRootWindow, gotoWindow, reset, setFormElement, setFormElementWithLabel, setWorkingForm, submit, uncheckCheckbox, uncheckCheckbox
Methods inherited from class junit.framework.TestCase
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, setUp, toString
-
Method Details
-
clickButtonWithValue
Deprecated.UseForm.clickButtonWithValue(String)
instead.Click only a single button with the specific value. If more than one button found with that value it will barf.- Parameters:
value
- the value attribute of the of the button element to click.
-
clickAnyButtonWithValue
Deprecated.UseForm.clickAnyButtonWithValue(String)
instead.Click the first button you find with the given value. Ignores duplicate values.- Parameters:
value
- the value attribute of the of the button element to click.
-
hasLinkWithText
-
hasLinkWithName
-
assertLinkWithTextExists
-
assertLinkWithTextNotPresent
-
assertLinkWithNameExists
Deprecated. -
assertLinkWithNameNotPresent
Deprecated. -
assertTextPresentBeforeText
Deprecated.Asserts that the given String before occurs *before* the given String after.- Parameters:
before
- supposed to come before the other.after
- supposed to come after the other.
-
assertTextPresentOnlyOnce
-
assertTextPresent
Deprecated.Asserts that the specified text appears in the response text an exact number of times- Parameters:
text1
- the text to search fornumOccurrences
- the number of times the text should occur. Must not be negative.
-
assertTextPresentAfterText
Deprecated.UseTextAssertions.assertTextSequence(java.lang.String, java.lang.String, java.lang.String...)
instead. Since v7.1.Asserts that the given String after occurs *after* the given String before.- Parameters:
after
- supposed to come after the other.before
- supposed to come before the other.
-
assertLessThan
protected void assertLessThan(int a, int b) Makes a junit assertion that a is less than b.Note: Don't remove this method. It is used by the soapclient tests!
- Parameters:
a
- asserted to be the smaller.b
- asserted to be the greater.
-
assertTextSequence
Deprecated.Use {@link TextAssertions#assertTextSequence(java.lang.String, java.lang.String[])#} instead. Since v7.1.Asserts that the array of strings appears in the given order in the current response body.- Parameters:
text
- the sequence to assert is present.
-
assertTextSequence
Deprecated.Use {@link TextAssertions#assertTextSequence(java.lang.String, java.lang.String[])#} instead. Since v7.1.Asserts that the array of strings appears in the given order in the response body, on failure, using failMesgPrefix as a prefix on the assertion failure message.- Parameters:
failMesgPrefix
- the message prefix in the case of a failure.text
- the array.
-
findTextSequence
Attempts to find the given sequence in the given string and if it fails to find the sequence, returns the index in the sequence that it failed to find a match for. If the sequence is present, returns -1.- Parameters:
stringToSearch
- the String to search.sequenceToFind
- the sequence to search for.- Returns:
- -1 if sequence is found, otherwise the index in sequenceToFind of the first text that was not found in position.
-
flattenArray
Utility method that flattens a 2d array into a 1d array by stringing each inner array together in their outer array order. E.g. a 2d array {{1,2},{3,4}} would become {1,2,3,4}. TODO: find me a new home- Parameters:
text
- the 2d array to flatten- Returns:
- the flattened array.
-
getResponseText
-
getCollapsedResponseText
Deprecated.useHtmlPage.getCollapsedResponseText()
insteadReturns all the text nodes of the web response collapsed and then concatenated together. Very useful for text sequence detection when you don care about intermediate Elements such as anchors and spans.- Returns:
- all the text nodes of the web respone collapsed and then concatenated together
-
assertCollapsedTextSequence
Deprecated.UseTextAssertions.assertTextSequence(String, String, String...)
orTextAssertions.assertTextSequence(String, String[])
instead usingHtmlPage.getCollapsedResponseText()
as source of collapsed response text.Asserts that the text sequence occurs somewhere in the document in the order specified. It also uses the collapsed text nodes of the page response.- Parameters:
textSequence
- the text sequence
-
getFirstWebTableWithClass
Gets the first table on the current page that has the given class attribute.- Parameters:
className
- the name of the class attribute of the desired table element.- Returns:
- the tables.
-
getWebTableWithID
Gets the table on the current page that has the given ID.- Parameters:
id
- ID of the required table element.- Returns:
- The table on the current page that has the given ID.
-
getWebTablesWithClass
Gets the tables on the current page that have the given class attribute.- Parameters:
className
- the name of the class attribute of the desired table element.- Returns:
- the tables.
-
TextAssertions.assertTextSequence(String, String, String...)
orTextAssertions.assertTextSequence(String, String[])
instead usingHtmlPage.getCollapsedResponseText()
as source of collapsed response text.