Revision: 575
http://svn.sourceforge.net/jwebunit/?rev=575&view=rev
Author: henryju
Date: 2006-10-06 07:10:19 -0700 (Fri, 06 Oct 2006)
Log Message:
-----------
Continue working on refactoring (should still not compile).
Modified Paths:
--------------
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/IJWebUnitDialog.java
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/JWebUnitTester.java
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/WebTestCase.java
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/locator/ClickableHtmlElementLocator.java
trunk/jwebunit-htmlunit-plugin/src/main/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitDialog.java
trunk/pom.xml
Added Paths:
-----------
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/locator/WindowLocatorByName.java
Modified:
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/IJWebUnitDialog.java
===================================================================
---
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/IJWebUnitDialog.java
2006-10-06 14:08:30 UTC (rev 574)
+++
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/IJWebUnitDialog.java
2006-10-06 14:10:19 UTC (rev 575)
@@ -32,18 +32,6 @@
/**
* Open the browser at an initial URL.
*
- * @param aInitialURL
- * Initial URL
- * @param aTestContext
- * Test context
- * @deprecated use [EMAIL PROTECTED] beginAt(URL, TestContext)}
- */
- void beginAt(String aInitialURL, TestContext aTestContext)
- throws TestingEngineResponseException;
-
- /**
- * Open the browser at an initial URL.
- *
* @param url
* Initial URL
* @param aTestContext
@@ -59,14 +47,7 @@
/**
* Simulate user typing a new URL in the browser.
- *
- * @deprecated use [EMAIL PROTECTED] gotoPage(URL)}
*/
- void gotoPage(String url) throws TestingEngineResponseException;
-
- /**
- * Simulate user typing a new URL in the browser.
- */
void gotoPage(URL url) throws TestingEngineResponseException;
/**
@@ -113,52 +94,11 @@
String[][] getCookies();
/**
- * Test if the window with the given name is present.
- *
- * @param windowName
- * @deprecated use [EMAIL PROTECTED] hasWindow(WindowLocator)}
- */
- boolean hasWindow(String windowName);
-
- /**
- * Test if window with the given title is present.
- * @deprecated use [EMAIL PROTECTED] hasWindow(WindowLocator)}
- */
- boolean hasWindowByTitle(String title);
-
- /**
* Test if a window is present.
*/
boolean hasWindow(WindowLocator window);
/**
- * Make the window with the given name active.
- *
- * @param windowName
- * Name of the window
- * @deprecated [EMAIL PROTECTED] gotoWindow(WindowLocator)}
- */
- void gotoWindow(String windowName);
-
- /**
- * Goto first window with the given title.
- *
- * @param title
- * Title of the window
- * @deprecated [EMAIL PROTECTED] gotoWindow(WindowLocator)}
- */
- void gotoWindowByTitle(String title);
-
- /**
- * Goto window with the given Javascript ID.
- *
- * @param windowID
- * Javascript ID of the window
- * @deprecated [EMAIL PROTECTED] gotoWindow(WindowLocator)}
- */
- void gotoWindow(int windowID);
-
- /**
* Make the given window active.
*
* @param window
@@ -185,14 +125,6 @@
/**
* Test if the given frame is present.
*
- * @param frameName
- * @deprecated use [EMAIL PROTECTED] hasFrame(FrameLocator)}
- */
- boolean hasFrame(String frameName);
-
- /**
- * Test if the given frame is present.
- *
* @param frame a frame locator.
*/
boolean hasFrame(FrameLocator frame);
@@ -200,33 +132,11 @@
/**
* Make the frame with the given name active in the current conversation.
*
- * @param frameName
- * @deprecated use [EMAIL PROTECTED] gotoFrame(FrameLocator)}
- */
- void gotoFrame(String frameName);
-
- /**
- * Make the frame with the given name active in the current conversation.
- *
* @param frame a frame locator.
*/
void gotoFrame(FrameLocator frame);
/**
- * Set the form on the current page that the client wishes to work with
- * explicitly by either the form name or id (match by id is attempted
- * first).
- *
- * @param nameOrId
- * name or id of the form to be worked with.
- * @param index
- * The 0-based index, when more than one form with the same name
- * is expected.
- * @deprecated use [EMAIL PROTECTED] setWorkingForm(FormLocator)}
- */
- void setWorkingForm(String nameOrId, int index);
-
- /**
* Set the form on the current page that the client wishes to work with.
*
* @param form
@@ -235,49 +145,6 @@
void setWorkingForm(HtmlFormLocator form) throws ElementNotFoundException;
/**
- * Return true if the current page contains at least a form.
- * @deprecated use [EMAIL PROTECTED](HtmlElementLocator)}
- */
- boolean hasForm();
-
- /**
- * Return true if the current page contains a specific form.
- *
- * @param nameOrID
- * name of id of the form to check for.
- * @deprecated use [EMAIL PROTECTED](HtmlElementLocator)}
- */
- boolean hasForm(String nameOrID);
-
- /**
- * Return true if a form input element is present on the current form.
- *
- * @param paramName
- * name of the input element to check for
- * @deprecated use [EMAIL PROTECTED](HtmlElementLocator)}
- */
- boolean hasFormParameterNamed(String paramName);
-
- /**
- * Return the current value of a form input element.
- *
- * @param paramName
- * name of the input element.
- * @deprecated
- */
- String getFormParameterValue(String paramName);
-
- /**
- * Return the current value of a text field with name
<code>paramName</code>.
- * Text fields are input text, input password and textarea
- *
- * @param paramName
- * name of the text field element.
- * @deprecated use [EMAIL PROTECTED] getAttributeValue(HtmlElementLocator,
String)}
- */
- String getTextFieldValue(String paramName);
-
- /**
* Get the current value of a html element's attribut.
* @param htmlElement a locator.
* @param attribut name of the attribut (e.g. value, alt, width)
@@ -300,29 +167,8 @@
int getCount(HtmlElementLocator htmlElement) throws
ElementNotFoundException;
/**
- * Return the current value of a hidden input element with name
- * <code>paramName</code>.
- *
- * @param paramName
- * name of the hidden input element.
- * @deprecated use [EMAIL PROTECTED] getAttributeValue(HtmlElementLocator,
String)}
- */
- String getHiddenFieldValue(String paramName);
-
- /**
* Fill a text, password or textarea field with the provided text.
*
- * @param fieldName
- * name of the text, password or textarea element
- * @param text
- * value to type in the field.
- * @deprecated use [EMAIL PROTECTED] setTextField(HtmlElementLocator,
String)}
- */
- void setTextField(String inputName, String text);
-
- /**
- * Fill a text, password or textarea field with the provided text.
- *
* @param htmlElement
* locator of the text, password, file or textarea element
* @param text
@@ -355,36 +201,7 @@
*
* @param selectName
* name of the select box.
- * @deprecated
*/
- String[] getSelectOptionValues(String selectName);
-
- /**
- * Return a string array of select box option values.
- *
- * Exemple: <br/>
- *
- * <pre>
- * <FORM action="http://my_host/doit"
method="post">
- * <P>
- * <SELECT multiple size="4"
name="component-select">
- * <OPTION selected
value="Component_1_a">Component_1</OPTION>
- * <OPTION selected
value="Component_1_b">Component_2</OPTION>
- * <OPTION>Component_3</OPTION>
- * <OPTION>Component_4</OPTION>
- * <OPTION>Component_5</OPTION>
- * </SELECT>
- * <INPUT type="submit"
value="Send"><INPUT type="reset">
- * </P>
- * </FORM>
- * </pre>
- *
- * Should return [Component_1_a, Component_1_b, Component_3, Component_4,
- * Component_5]
- *
- * @param selectName
- * name of the select box.
- */
SelectOption[] getSelectOptions(HtmlSelectLocator htmlSelect) throws
net.sourceforge.jwebunit.exception.ElementNotFoundException;
/**
@@ -392,52 +209,10 @@
*
* @param selectName
* name of the select box.
- * @deprecated
*/
- String[] getSelectedOptions(String selectName);
-
- /**
- * Return the values of the currently selected items in a select box.
- *
- * @param selectName
- * name of the select box.
- */
SelectOption[] getSelectedOptions(HtmlSelectLocator htmlSelect) throws
net.sourceforge.jwebunit.exception.ElementNotFoundException;
/**
- * Get the label for a given option of a select box.
- *
- * @param selectName
- * name of the select box.
- * @param optionValue
- * label of the option.
- * @deprecated
- */
- String getSelectOptionLabelForValue(String selectName, String optionValue);
-
- /**
- * Get the value for a given option of a select box.
- *
- * @param selectName
- * name of the select box.
- * @param optionLabel
- * label of the option.
- * @deprecated
- */
- String getSelectOptionValueForLabel(String selectName, String optionLabel);
-
- /**
- * Select option(s) of a select box by value.
- *
- * @param selectName
- * name of the select box.
- * @param optionsValue
- * values of the options to select.
- * @deprecated
- */
- void selectOptions(String selectName, String[] optionsValue);
-
- /**
* Select option(s) of a select box. If multi-select is enabled,
* you can specify more than one option. Options are selected in the given
order.
*
@@ -455,160 +230,20 @@
* name of the select box.
* @param optionsValue
* vaules of the options to unselect.
- * @deprecated
*/
- void unselectOptions(String selectName, String[] options);
-
- /**
- * Unselect option(s) of a select box by display label.
- *
- * @param selectName
- * name of the select box.
- * @param optionsValue
- * vaules of the options to unselect.
- */
void unselectOptions(HtmlSelectLocator htmlSelect, HtmlOptionLocator[]
options);
/**
- * Test if a select box has the given option (by label).
- *
- * @param selectName
- * name of the select box.
- * @param optionLabel
- * label of the option.
- * @return true if a select box has the given option (by label).
- * @deprecated use [EMAIL PROTECTED](HtmlElementLocator)}
- */
- boolean hasSelectOption(String selectName, String optionLabel);
-
- /**
- * Test if a select box has the given option (by value).
- *
- * @param selectName
- * name of the select box.
- * @param optionValue
- * value of the option.
- * @return true if a select box has the given option (by value).
- * @deprecated use [EMAIL PROTECTED](HtmlElementLocator)}
- */
- boolean hasSelectOptionValue(String selectName, String optionValue);
-
- /**
* Determines if the checkbox is selected.
*
* @param checkBoxName
* name of the checkbox.
* @return true if the checkbox is selected.
- * @deprecated
- */
- boolean isCheckboxSelected(String checkBoxName);
-
- /**
- * Determines if the checkbox is selected.
*
- * @param checkBoxName
- * name of the checkbox.
- * @return true if the checkbox is selected.
- *
*/
boolean isCheckboxSelected(HtmlCheckboxLocator checkbox);
/**
- * Select a specified checkbox. If the checkbox is already checked then the
- * checkbox will stay checked.
- *
- * @param checkBoxName
- * name of checkbox to be selected.
- * @deprecated use [EMAIL PROTECTED] clickElement(HtmlElementLocator)}
- */
- void checkCheckbox(String checkBoxName);
-
-
- /**
- * Select a specified checkbox. If the checkbox is already checked then the
- * checkbox will stay checked.
- *
- * @param checkBoxName
- * name of checkbox to be selected.
- * @param value
- * value of the checkbox (to differenciate checkboxes with the
- * same name).
- * @deprecated use [EMAIL PROTECTED] clickElement(HtmlElementLocator)}
- */
- void checkCheckbox(String checkBoxName, String value);
-
- /**
- * Deselect a specified checkbox. If the checkbox is already unchecked then
- * the checkbox will stay unchecked.
- *
- * @param checkBoxName
- * name of checkbox to be deselected.
- * @deprecated use [EMAIL PROTECTED] clickElement(HtmlElementLocator)}
- */
- void uncheckCheckbox(String checkBoxName);
-
- /**
- * Deselect a specified checkbox. If the checkbox is already unchecked then
- * the checkbox will stay unchecked.
- *
- * @param checkBoxName
- * name of checkbox to be deselected.
- * @param value
- * value of the checkbox (to differenciate checkboxes with the
- * same name).
- * @deprecated use [EMAIL PROTECTED] clickElement(HtmlElementLocator)}
- */
- void uncheckCheckbox(String checkBoxName, String value);
-
- /**
- * Clicks a radio option. Asserts that the radio option exists first.
- *
- * @param radioGroup
- * name of the radio group.
- * @param radioOptionValue
- * value of the option to check for.
- * @deprecated use [EMAIL PROTECTED] clickElement(HtmlElementLocator)}
- */
- void clickRadioOption(String radioGroup, String radioOptionValue);
-
- /**
- * Checks if a radio group contains the indicated option.
- *
- * @param radioGroup
- * name of the radio group.
- * @param radioOptionValue
- * value of the option to check for.
- * @deprecated use [EMAIL PROTECTED](HtmlElementLocator)}
- */
- boolean hasRadioOption(String radioGroup, String radioOptionValue);
-
- /**
- * Checks if the current form contains a submit button.
- * @deprecated use [EMAIL PROTECTED](HtmlElementLocator)} *
- */
- boolean hasSubmitButton();
-
- /**
- * Checks if the current form contains a specific submit button.
- *
- * @param nameOrID
- * name or id of the button to check for.
- * @deprecated use [EMAIL PROTECTED](HtmlElementLocator)}
- */
- boolean hasSubmitButton(String nameOrID);
-
- /**
- * Checks if the current form contains a specific submit button.
- *
- * @param nameOrID
- * name of id of the button to check for.
- * @param value
- * value of the button
- * @deprecated use [EMAIL PROTECTED](HtmlElementLocator)}
- */
- boolean hasSubmitButton(String nameOrID, String value);
-
- /**
* Submit the current form with the default submit button. See
* [EMAIL PROTECTED] #getForm}for an explanation of how the current form is
* established.
@@ -616,46 +251,6 @@
void submit();
/**
- * Submit the current form with the specifed submit button. See
- * [EMAIL PROTECTED] #getForm}for an explanation of how the current form is
- * established.
- *
- * @param buttonName
- * name of the button to use for submission.
- * @deprecated use [EMAIL PROTECTED] clickElement(HtmlElementLocator)}
- */
- void submit(String buttonName);
-
- /**
- * Submit the current form with the specifed submit button (by name and
- * value). See [EMAIL PROTECTED] #getForm}for an explanation of how the
current form
- * is established.
- *
- * @author Dragos Manolescu
- * @param buttonName
- * name of the button to use for submission.
- * @param buttonValue
- * value/label of the button to use for submission
- * @deprecated use [EMAIL PROTECTED] clickElement(HtmlElementLocator)}
- */
- void submit(String buttonName, String buttonValue);
-
- /**
- * Checks if the current form contains a reset button.
- * @deprecated use [EMAIL PROTECTED](HtmlElementLocator)}
- */
- boolean hasResetButton();
-
- /**
- * Checks if the current form contains a specific reset button.
- *
- * @param nameOrID
- * name or id of the button to check for.
- * @deprecated use [EMAIL PROTECTED](HtmlElementLocator)}
- */
- boolean hasResetButton(String nameOrID);
-
- /**
* Reset the current form with the default reset button. See
* [EMAIL PROTECTED] #getForm}for an explanation of how the current form is
* established.
@@ -663,44 +258,6 @@
void reset();
/**
- * Checks if a button with <code>text</code> is present.
- *
- * @param text
- * the text of the button (contents of the value attribute).
- * @return <code>true</code> when the button with text could be found.
- * @deprecated use [EMAIL PROTECTED](HtmlElementLocator)}
- */
- boolean hasButtonWithText(String text);
-
- /**
- * Checks if a button with <code>id</code> is present.
- *
- * @param buttonId
- * the ID of the button.
- * @return <code>true</code> when the button with text could be found.
- * @deprecated use [EMAIL PROTECTED](HtmlElementLocator)}
- */
- boolean hasButton(String buttonId);
-
- /**
- * Click the indicated button (input type=button ou button type=button).
- *
- * @param buttonId
- * the ID of the button.
- * @deprecated use [EMAIL PROTECTED] clickElement(HtmlElementLocator)}
- */
- void clickButton(String buttonId);
-
- /**
- * Clicks a button with <code>text</code> of the value attribute.
- *
- * @param text
- * the text of the button (contents of the value attribute).
- * @deprecated use [EMAIL PROTECTED] clickElement(HtmlElementLocator)}
- */
- void clickButtonWithText(String buttonValueText);
-
- /**
* Return the string representation of the current page, encoded as
* specified by the current [EMAIL PROTECTED]
net.sourceforge.jwebunit.TestContext}.
*/
@@ -723,30 +280,9 @@
String getServerResponse();
/**
- * Check if the Table object representing a specified table exists.
- *
- * @param tableSummaryNameOrId
- * summary, name or id of the table.
- * @return true if table exists.
- * @deprecated use [EMAIL PROTECTED](HtmlElementLocator)}
- */
- boolean hasTable(String tableSummaryNameOrId);
-
- /**
* Each framework have it's own way to represent a Table. Dialogs are
* responsible for converting to the unified jWebUnit format.
*
- * @param tableSummaryNameOrId
- * summary, name or id of the table to return.
- * @return unified jWebUnit representation of a table.
- * @deprecated
- */
- Table getTable(String tableSummaryNameOrId);
-
- /**
- * Each framework have it's own way to represent a Table. Dialogs are
- * responsible for converting to the unified jWebUnit format.
- *
* @param table
* table locator.
* @return unified jWebUnit representation of a table.
@@ -754,129 +290,6 @@
Table getTable(HtmlTableLocator table) throws
net.sourceforge.jwebunit.exception.ElementNotFoundException;
/**
- * Return true if a link is present in the current response containing the
- * specified text.
- *
- * @param linkText
- * text to check for in links on the response.
- * @param index
- * The 0-based index, when more than one link with the same text
- * is expected.
- * @deprecated use [EMAIL PROTECTED](HtmlElementLocator)}
- */
- boolean hasLinkWithText(String linkText, int index);
-
- /**
- * Return true if a link is present in the current page containing the
exact
- * specified text. Note. This will call String.trim() to trim all leading /
- * trailing spaces.
- *
- * RFE 996031...
- *
- * @param linkText
- * text to check for in links on the response.
- * @param index
- * The 0-based index, when more than one link with the same text
- * is expected.
- * @deprecated use [EMAIL PROTECTED](HtmlElementLocator)}
- */
- boolean hasLinkWithExactText(String linkText, int index);
-
- /**
- * Return true if a link is present with a given image based on filename of
- * image.
- *
- * @param imageFileName
- * A suffix of the image's filename; for example, to match
- * <tt>"images/my_icon.png"<tt>, you could just pass in
- * <tt>"my_icon.png"<tt>.
- * @param index
- * The 0-based index, when more than one link with the same text
- * is expected.
- * @deprecated use [EMAIL PROTECTED](HtmlElementLocator)}
- */
- boolean hasLinkWithImage(String imageFileName, int index);
-
- /**
- * Return true if a link is present in the current response with the
- * specified id.
- *
- * @param anId
- * link id to check for.
- * @deprecated use [EMAIL PROTECTED](HtmlElementLocator)}
- */
- boolean hasLink(String anId);
-
- /**
- * Navigate by submitting a request based on a link containing the
specified
- * text. A RuntimeException is thrown if no such link can be found.
- *
- * @param linkText
- * text which link to be navigated should contain.
- * @param index
- * The 0-based index, when more than one link with the same text
- * is expected.
- * @deprecated use [EMAIL PROTECTED] clickElement(HtmlElementLocator)}
- */
- void clickLinkWithText(String linkText, int index);
-
- /**
- * Navigate by clicking a link with the exact specified text. A
- * RuntimeException is thrown if no such link can be found.
- *
- * @param linkText
- * exact text which link to be navigated should contain.
- * @param index
- * The 0-based index, when more than one link with the same text
- * is expected.
- * @deprecated use [EMAIL PROTECTED] clickElement(HtmlElementLocator)}
- */
- void clickLinkWithExactText(String linkText, int index);
-
- /**
- * Navigate by submitting a request based on a link with a given ID. A
- * RuntimeException is thrown if no such link can be found.
- *
- * @param anID
- * id of link to be navigated.
- * @deprecated use [EMAIL PROTECTED] clickElement(HtmlElementLocator)}
- */
- void clickLink(String anID);
-
- /**
- * Navigate by submitting a request based on a link with a given image file
- * name. A RuntimeException is thrown if no such link can be found.
- *
- * @param imageFileName
- * A suffix of the image's filename; for example, to match
- * <tt>"images/my_icon.png"<tt>, you could just pass in
- * <tt>"my_icon.png"<tt>.
- * @param index
- * The 0-based index, when more than one link with the same text
- * is expected.
- * @deprecated use [EMAIL PROTECTED] clickElement(HtmlElementLocator)}
- */
- void clickLinkWithImage(String imageFileName, int index);
-
- /**
- * Test if element with given id exists.
- *
- * @param anID
- * id of the element.
- * @deprecated use [EMAIL PROTECTED](HtmlElementLocator)}
- */
- boolean hasElement(String anID);
-
- /**
- * Test if element with given xpath exists.
- *
- * @param xpath
- * xpath of the element.
- * @deprecated use [EMAIL PROTECTED](HtmlElementLocator)}
- */
- boolean hasElementByXPath(String xpath);
-
- /**
* Test if Html element exists.
*
* @param htmlElement
@@ -885,15 +298,6 @@
boolean hasElement(HtmlElementLocator htmlElement);
/**
- * Click element with given xpath.
- *
- * @param xpath
- * xpath of the element.
- * @deprecated use [EMAIL PROTECTED] clickElement(HtmlElementLocator)}
- */
- void clickElementByXPath(String xpath);
-
- /**
* Click html element.
*
* @param htmlElement
@@ -904,17 +308,6 @@
/**
* Return true if a given string is contained within the specified element.
*
- * @param elementID
- * ID of element to inspect.
- * @param text
- * text to check for.
- * @deprecated use [EMAIL PROTECTED] isTextInElement(HtmlElementLocator,
String)}
- */
- boolean isTextInElement(String elementID, String text);
-
- /**
- * Return true if a given string is contained within the specified element.
- *
* @param htmlElement
* a locator of html element to inspect.
* @param text
@@ -925,17 +318,6 @@
/**
* Return true if a given regexp is contained within the specified element.
*
- * @param elementID
- * Id of element to inspect.
- * @param regexp
- * regexp to match.
- * @deprecated use [EMAIL PROTECTED] isMatchInElement(HtmlElementLocator,
String)}
- */
- boolean isMatchInElement(String elementID, String regexp);
-
- /**
- * Return true if a given regexp is contained within the specified element.
- *
* @param htmlElement
* a locator of html element to inspect.
* @param regexp
Modified:
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/JWebUnitTester.java
===================================================================
---
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/JWebUnitTester.java
2006-10-06 14:08:30 UTC (rev 574)
+++
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/JWebUnitTester.java
2006-10-06 14:10:19 UTC (rev 575)
@@ -364,7 +364,6 @@
*/
public void assertTextInTable(HtmlTableLocator tableLocator, String text)
throws ElementNotFoundException, AssertContainsException {
- assertElementPresent(tableLocator);
if (!getDialog().getTable(tableLocator).hasText(text)) {
throw new AssertContainsException(text, getDialog().getTable(
tableLocator).toString());
@@ -378,7 +377,6 @@
*/
public void assertMatchInTable(HtmlTableLocator tableLocator, String
regexp)
throws ElementNotFoundException, AssertMatchException {
- assertElementPresent(tableLocator);
Table table = getDialog().getTable(tableLocator);
if (!table.hasMatch(regexp)) {
throw new AssertMatchException(regexp, table.toString());
Modified:
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/WebTestCase.java
===================================================================
--- trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/WebTestCase.java
2006-10-06 14:08:30 UTC (rev 574)
+++ trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/WebTestCase.java
2006-10-06 14:10:19 UTC (rev 575)
@@ -38,7 +38,7 @@
*/
public class WebTestCase extends TestCase {
private JWebUnitTester tester = null;
-
+
public WebTestCase(String name) {
super(name);
}
@@ -135,7 +135,7 @@
try {
getTester().assertTitleMatch(regexp);
} catch (RESyntaxException e) {
- //TODO add link to the apache regexp site
+ // TODO add link to the apache regexp site
fail("Invalid regexp " + regexp);
} catch (AssertMatchException e) {
fail(regexp + " do not match actual title: " + e.getActualText());
@@ -154,7 +154,8 @@
try {
getTester().assertKeyPresent(key);
} catch (AssertContainsException e) {
- failNotSame("Unable to find the given text",
e.getExpectedContent(), e.getActualText());
+ failNotSame("Unable to find the given text",
+ e.getExpectedContent(), e.getActualText());
}
}
@@ -162,7 +163,8 @@
try {
getTester().assertTextPresent(text);
} catch (AssertContainsException e) {
- failNotSame("Unable to find the given text",
e.getExpectedContent(), e.getActualText());
+ failNotSame("Unable to find the given text",
+ e.getExpectedContent(), e.getActualText());
}
}
@@ -170,7 +172,8 @@
try {
getTester().assertMatch(regexp);
} catch (AssertMatchException e) {
- failNotSame("Unable to find a match for the given regexp",
e.getExpectedRE(), e.getActualText());
+ failNotSame("Unable to find a match for the given regexp", e
+ .getExpectedRE(), e.getActualText());
}
}
@@ -200,20 +203,20 @@
e.printStackTrace();
}
}
-
+
public void assertElementPresent(HtmlElementLocator element) {
try {
getTester().assertElementPresent(element);
} catch (ElementNotFoundException e) {
- fail("Element not found: "+element.toString());
+ fail("Element not found: " + element.toString());
}
}
-
+
public void assertElementNotPresent(HtmlElementLocator element) {
try {
getTester().assertElementNotPresent(element);
} catch (ElementFoundException e) {
- fail("Element found when not expected: "+element.toString());
+ fail("Element found when not expected: " + element.toString());
}
}
@@ -239,10 +242,12 @@
*/
public void assertKeyInTable(String tableSummaryOrId, String key) {
try {
- getTester().assertKeyInTable(new
HtmlTableLocatorByName(tableSummaryOrId), key);
+ getTester().assertKeyInTable(
+ new HtmlTableLocatorByName(tableSummaryOrId), key);
} catch (ElementNotFoundException e) {
try {
- getTester().assertKeyInTable(new
HtmlTableLocatorBySummary(tableSummaryOrId), key);
+ getTester().assertKeyInTable(
+ new HtmlTableLocatorBySummary(tableSummaryOrId), key);
} catch (ElementNotFoundException e1) {
fail("Unable to find given table");
} catch (AssertContainsException e1) {
@@ -277,10 +282,12 @@
*/
public void assertTextInTable(String tableSummaryOrId, String text) {
try {
- getTester().assertTextInTable(new
HtmlTableLocatorByName(tableSummaryOrId), text);
+ getTester().assertTextInTable(
+ new HtmlTableLocatorByName(tableSummaryOrId), text);
} catch (ElementNotFoundException e) {
try {
- getTester().assertTextInTable(new
HtmlTableLocatorBySummary(tableSummaryOrId), text);
+ getTester().assertTextInTable(
+ new HtmlTableLocatorBySummary(tableSummaryOrId), text);
} catch (ElementNotFoundException e1) {
fail("Unable to find given table");
} catch (AssertContainsException e1) {
@@ -294,7 +301,7 @@
fail("Given table do not contains text");
}
}
-
+
public void assertTextInTable(HtmlTableLocator tableLocator, String text) {
try {
getTester().assertTextInTable(tableLocator, text);
@@ -313,12 +320,89 @@
* @deprecated
*/
public void assertMatchInTable(String tableSummaryOrId, String regexp) {
- tester.assertMatchInTable(tableSummaryOrId, regexp);
+ try {
+ try {
+ getTester().assertMatchInTable(
+ new HtmlTableLocator(tableSummaryOrId), regexp);
+ } catch (ElementNotFoundException e) {
+ try {
+ getTester().assertMatchInTable(
+ new HtmlTableLocatorByName(tableSummaryOrId),
+ regexp);
+ } catch (ElementNotFoundException e1) {
+ try {
+ getTester()
+ .assertMatchInTable(
+ new HtmlTableLocatorBySummary(
+ tableSummaryOrId), regexp);
+ } catch (ElementNotFoundException e2) {
+ e.printStackTrace();
+ fail();
+ }
+ }
+ }
+ } catch (AssertMatchException e) {
+ e.printStackTrace();
+ fail();
+ }
}
+ public void assertMatchInTable(HtmlTableLocator tableLocator, String
regexp) {
+ try {
+ getTester().assertMatchInTable(tableLocator, regexp);
+ } catch (ElementNotFoundException e) {
+ //TODO
+ e.printStackTrace();
+ fail();
+ } catch (AssertMatchException e) {
+ //TODO
+ e.printStackTrace();
+ fail();
+ }
+ }
+
public void assertKeysInTable(String tableSummaryOrId, String[] keys) {
- getTester().assertKeysInTable(tableSummaryOrId, keys);
+ try {
+ try {
+ getTester().assertKeysInTable(
+ new HtmlTableLocator(tableSummaryOrId), keys);
+ } catch (ElementNotFoundException e) {
+ try {
+ getTester().assertKeysInTable(
+ new HtmlTableLocatorByName(tableSummaryOrId),
+ keys);
+ } catch (ElementNotFoundException e1) {
+ try {
+ getTester()
+ .assertKeysInTable(
+ new HtmlTableLocatorBySummary(
+ tableSummaryOrId), keys);
+ } catch (ElementNotFoundException e2) {
+ e.printStackTrace();
+ fail();
+ }
+ }
+ }
+ } catch (AssertContainsException e) {
+ //FIXME
+ e.printStackTrace();
+ fail();
+ }
}
+
+ public void assertKeysInTable(HtmlTableLocator tableLocator, String[]
keys) {
+ try {
+ getTester().assertKeysInTable(tableLocator, keys);
+ } catch (ElementNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ fail();
+ } catch (AssertContainsException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ fail();
+ }
+ }
public void assertTextInTable(String tableSummaryOrId, String[] text) {
getTester().assertTextInTable(tableSummaryOrId, text);
@@ -386,7 +470,8 @@
public void assertTableRowsMatch(String tableSummaryOrId, int startRow,
Table expectedTable) {
- getTester().assertTableRowsMatch(tableSummaryOrId, startRow,
expectedTable);
+ getTester().assertTableRowsMatch(tableSummaryOrId, startRow,
+ expectedTable);
}
public void assertTableRowsMatch(String tableSummaryOrId, int startRow,
@@ -420,7 +505,7 @@
}
/**
- * @deprecated
+ * @deprecated
*/
public void assertFormElementEquals(String formElementName,
String expectedValue) {
@@ -434,12 +519,14 @@
public void assertFormElementEmpty(String formElementName) {
getTester().assertFormElementEmpty(formElementName);
}
-
- public void assertTextFieldEquals(String formElementName, String
expectedValue) {
+
+ public void assertTextFieldEquals(String formElementName,
+ String expectedValue) {
getTester().assertTextFieldEquals(formElementName, expectedValue);
}
-
- public void assertHiddenFieldPresent(String formElementName, String
expectedValue) {
+
+ public void assertHiddenFieldPresent(String formElementName,
+ String expectedValue) {
getTester().assertHiddenFieldPresent(formElementName, expectedValue);
}
@@ -607,7 +694,7 @@
try {
getTester().assertButtonPresentWithText(text);
} catch (ElementNotFoundException e) {
- fail("Button not found with text "+text);
+ fail("Button not found with text " + text);
}
}
@@ -750,7 +837,7 @@
public void assertCookieValueMatch(String cookieName, String regexp) {
getTester().assertCookieValueMatch(cookieName, regexp);
}
-
+
public void assertJavascriptAlertPresent(String msg) {
getTester().assertJavascriptAlertPresent(msg);
}
@@ -773,7 +860,7 @@
try {
getTester().setWorkingForm(formLocator);
} catch (ElementNotFoundException e) {
- fail("Form not found "+ e.getElementNotFound().toString());
+ fail("Form not found " + e.getElementNotFound().toString());
}
}
@@ -787,7 +874,7 @@
try {
getTester().setWorkingForm(new
HtmlFormLocatorByName(nameOrId));
} catch (ElementNotFoundException e2) {
- fail("Unable to find a form whose name or id is "+nameOrId);
+ fail("Unable to find a form whose name or id is " + nameOrId);
}
}
}
@@ -797,12 +884,16 @@
*/
public void setWorkingForm(String nameOrId, int index) {
try {
- getTester().setWorkingForm(new HtmlFormLocator(nameOrId)); //Id
should be unique
+ getTester().setWorkingForm(new HtmlFormLocator(nameOrId)); // Id
+ // should
+ // be
+ // unique
} catch (ElementNotFoundException e) {
try {
- getTester().setWorkingForm(new HtmlFormLocatorByName(nameOrId,
index));
+ getTester().setWorkingForm(
+ new HtmlFormLocatorByName(nameOrId, index));
} catch (ElementNotFoundException e2) {
- fail("Unable to find a form whose name or id is "+nameOrId);
+ fail("Unable to find a form whose name or id is " + nameOrId);
}
}
}
@@ -1004,7 +1095,7 @@
protected void dumpTable(String tableNameOrId) {
getTester().dumpTable(tableNameOrId);
}
-
+
/**
* @deprecated Use setTextField instead.
*/
Modified:
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/locator/ClickableHtmlElementLocator.java
===================================================================
---
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/locator/ClickableHtmlElementLocator.java
2006-10-06 14:08:30 UTC (rev 574)
+++
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/locator/ClickableHtmlElementLocator.java
2006-10-06 14:10:19 UTC (rev 575)
@@ -18,5 +18,5 @@
public ClickableHtmlElementLocator(String tag, String id) {
super(tag, id);
}
-
+
}
Added:
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/locator/WindowLocatorByName.java
===================================================================
---
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/locator/WindowLocatorByName.java
(rev 0)
+++
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/locator/WindowLocatorByName.java
2006-10-06 14:10:19 UTC (rev 575)
@@ -0,0 +1,25 @@
+/******************************************************************************
+ * jWebUnit project (http://jwebunit.sourceforge.net) *
+ * Distributed open-source, see full license under LICENCE.txt *
+
******************************************************************************/
+package net.sourceforge.jwebunit.locator;
+
+/**
+ * This is the interface for all Windowlocators.
+ * A window locator is a way to locate a window in a browser.
+ *
+ * @author Julien Henry
+ */
+public class WindowLocatorByName implements WindowLocator {
+
+ private String name;
+
+ public WindowLocatorByName(String name) {
+ this.name=name;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+}
Modified:
trunk/jwebunit-htmlunit-plugin/src/main/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitDialog.java
===================================================================
---
trunk/jwebunit-htmlunit-plugin/src/main/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitDialog.java
2006-10-06 14:08:30 UTC (rev 574)
+++
trunk/jwebunit-htmlunit-plugin/src/main/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitDialog.java
2006-10-06 14:10:19 UTC (rev 575)
@@ -41,6 +41,7 @@
import net.sourceforge.jwebunit.locator.HtmlSelectLocator;
import net.sourceforge.jwebunit.locator.HtmlTableLocator;
import net.sourceforge.jwebunit.locator.WindowLocator;
+import net.sourceforge.jwebunit.locator.WindowLocatorByName;
import net.sourceforge.jwebunit.util.ExceptionUtility;
import net.sourceforge.jwebunit.IJWebUnitDialog;
import net.sourceforge.jwebunit.TestContext;
@@ -309,7 +310,7 @@
if (frame instanceof FrameLocatorByName) {
win = getFrame(((FrameLocatorByName)frame).getName());
} else {
- throw new RuntimeException("Unknow FrameLocator. This method
should be updated.");
+ throw new UnsupportedOperationException("Unknow FrameLocator.
gotoFrame should be updated.");
}
}
@@ -337,8 +338,12 @@
* @see
net.sourceforge.jwebunit.IJWebUnitDialog#gotoWindow(net.sourceforge.jwebunit.locator.WindowLocator)
*/
public void gotoWindow(WindowLocator window) {
- // TODO Auto-generated method stub
-
+ if (window instanceof WindowLocatorByName) {
+ setMainWindow(getWindow(((WindowLocatorByName)window).getName()));
+ }
+ else {
+ throw new UnsupportedOperationException("Unknow WindowLocator.
gotoWindow should be updated.");
+ }
}
/**
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2006-10-06 14:08:30 UTC (rev 574)
+++ trunk/pom.xml 2006-10-06 14:10:19 UTC (rev 575)
@@ -260,6 +260,14 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>taglist-maven-plugin</artifactId>
+ <configuration>
+ <tags>
+ <tag>TODO</tag>
+ <tag>@todo</tag>
+ <tag>FIXME</tag>
+ <tag>@deprecated</tag>
+ </tags>
+ </configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
@@ -267,6 +275,10 @@
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-changes-plugin</artifactId>
<inherited>false</inherited>
<reportSets>
@@ -295,6 +307,22 @@
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<aggregate>true</aggregate>
+ <links>
+ <link>http://java.sun.com/j2ee/1.4/docs/api</link>
+ <link>http://java.sun.com/j2se/1.5.0/docs/api</link>
+
<link>http://jakarta.apache.org/commons/collections/apidocs-COLLECTIONS_3_0/</link>
+
<link>http://jakarta.apache.org/commons/dbcp/apidocs/</link>
+
<link>http://jakarta.apache.org/commons/fileupload/apidocs/</link>
+
<link>http://jakarta.apache.org/commons/httpclient/apidocs/</link>
+
<link>http://jakarta.apache.org/commons/logging/apidocs/</link>
+
<link>http://jakarta.apache.org/commons/pool/apidocs/</link>
+ <link>http://www.junit.org/junit/javadoc/</link>
+ <link>http://logging.apache.org/log4j/docs/api/</link>
+ <link>http://jakarta.apache.org/regexp/apidocs/</link>
+ <link>http://jakarta.apache.org/velocity/api/</link>
+ <link>http://htmlunit.sourceforge.net/apidocs/</link>
+
<link>http://release.openqa.org/selenium-remote-control/nightly/doc/java/</link>
+ </links>
</configuration>
</plugin>
<plugin>
@@ -312,12 +340,14 @@
<reports>
<report>index</report>
<report>dependencies</report>
+ <report>dependency-convergence</report>
<report>project-team</report>
<report>mailing-list</report>
<report>license</report>
<report>issue-tracking</report>
<report>scm</report>
<report>summary</report>
+ <!--<report>cim</report>-->
</reports>
</reportSet>
</reportSets>
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Jwebunit-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-development