I have recorded a test for a Wizard. The wizard contains only a single CheckboxTableViewer within the content area. The recorded test opens the Wizard, checks a checkbox in the first row of the CheckboxTableViewer and then selects Finish.
When I rerun the test it fails to check the checkbox. When running the recorded test it appears to try and select the checkbox in the first column following the checkbox column. Below is the exception I see on running the test. Here is line 46 of my test case (Hammer.java). I'm suspicious about the first paramter of the TableItemLocator (""), is there something else I should insert to represent a checkbox?:
ui.click(1, new TableItemLocator("", 0, new SWTWidgetLocator(
Table.class)));
com.windowtester.runtime.WaitTimedOutException: Timed out waiting for condition:
class=com.windowtester.runtime.condition.IsEnabledCondition
expected=true
actual=false
at com.windowtester.runtime.swt.internal.UIContextSWT.wait(UIContextSWT.java:775)
at com.windowtester.runtime.swt.internal.UIContextSWT.wait(UIContextSWT.java:747)
at com.windowtester.runtime.swt.locator.ButtonLocator.preClick(ButtonLocator.java:86)
at com.windowtester.runtime.swt.locator.SWTWidgetLocator.click(SWTWidgetLocator.java:225)
at com.windowtester.internal.runtime.selector.ClickHelper.doClick(ClickHelper.java:178)
at com.windowtester.internal.runtime.selector.ClickHelper.click(ClickHelper.java:65)
at com.windowtester.internal.runtime.UIContextCommon.click(UIContextCommon.java:87)
at com.windowtester.runtime.swt.internal.UIContextSWT.click(UIContextSWT.java:296)
at com.windowtester.internal.runtime.UIContextCommon.click(UIContextCommon.java:80)
at com.windowtester.runtime.swt.internal.UIContextSWT.click(UIContextSWT.java:304)
at com.windowtester.internal.runtime.UIContextCommon.click(UIContextCommon.java:73)
at com.windowtester.runtime.swt.internal.UIContextSWT.click(UIContextSWT.java:287)
at com.cisco.nm.xmp.sdk.cd.ui.internal.wizards.test.Hammer.testHammer(Hammer.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at com.windowtester.runtime.common.UITestCaseCommon.access$001(UITestCaseCommon.java:25)
at com.windowtester.runtime.common.UITestCaseCommon$2.run(UITestCaseCommon.java:136)
at com.windowtester.runtime.common.UITestCaseCommon$3.run(UITestCaseCommon.java:157)
at com.windowtester.internal.runtime.junit.core.SequenceRunner$1.run(SequenceRunner.java:46)
---------------------------------------------------------------------------------------------------------------------
When I added the following line to the test case I get the following error instead:
ui.find(new TableItemLocator("", 0, new SWTWidgetLocator(
Table.class)));
com.windowtester.runtime.WidgetNotFoundException: Widget NOT Found:
TableItemLocator(, 0, SWTWidgetLocator(org.eclipse.swt.widgets.Table))
at com.windowtester.runtime.swt.internal.UIContextSWT.find(UIContextSWT.java:608)
at com.windowtester.runtime.swt.internal.UIContextSWT.find(UIContextSWT.java:583)
at com.windowtester.runtime.swt.internal.UIContextSWT.find(UIContextSWT.java:583)
at com.windowtester.runtime.swt.internal.UIContextSWT.find(UIContextSWT.java:583)
at com.windowtester.runtime.swt.internal.UIContextSWT.find(UIContextSWT.java:583)
at com.windowtester.runtime.swt.internal.UIContextSWT.find(UIContextSWT.java:583)
at com.windowtester.runtime.swt.internal.UIContextSWT.find(UIContextSWT.java:583)
at com.windowtester.runtime.swt.internal.UIContextSWT.find(UIContextSWT.java:583)
at com.windowtester.runtime.swt.internal.UIContextSWT.find(UIContextSWT.java:583)
at com.windowtester.runtime.swt.internal.UIContextSWT.find(UIContextSWT.java:583)
at com.windowtester.runtime.swt.internal.UIContextSWT.find(UIContextSWT.java:583)
at com.cisco.nm.xmp.sdk.cd.ui.internal.wizards.test.Hammer.testHammer(Hammer.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at com.windowtester.runtime.common.UITestCaseCommon.access$001(UITestCaseCommon.java:25)
at com.windowtester.runtime.common.UITestCaseCommon$2.run(UITestCaseCommon.java:136)
at com.windowtester.runtime.common.UITestCaseCommon$3.run(UITestCaseCommon.java:157)
at com.windowtester.internal.runtime.junit.core.SequenceRunner$1.run(SequenceRunner.java:46)
-----------------------------------------------------------------------------------------------------------------------
I also inserted the following to check the Table was being located. The table is being located correctly.
WidgetReference ref = (WidgetReference)ui.find(new SWTWidgetLocator(Table.class));
Widget foundWidget = (Widget)ref.getWidget();
System.out.println(foundWidget.getClass);