You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm running into a problem where ContainerFixture.menuItemWithPath() throws an exception because it finds multiple matching components. E.g., if I try this:
--snip--
org.fest.swing.exception.ComponentLookupException: Found more than one component using matcher org.fest.swing.driver.JMenuItemMatcher[label='File|Exit'].
at org.fest.swing.core.BasicComponentFinder.multipleComponentsFound(BasicComponentFinder.java:296)
at org.fest.swing.core.BasicComponentFinder.find(BasicComponentFinder.java:261)
at org.fest.swing.core.BasicComponentFinder.find(BasicComponentFinder.java:254)
at org.fest.swing.fixture.JMenuItemFinder.menuItemWithPath(JMenuItemFinder.java:48)
at org.fest.swing.fixture.ContainerFixture.menuItemWithPath(ContainerFixture.java:267)
at david.playground.festbug.FestBugTest.testApp(FestBugTest.java:56)
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 org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
--snip--
I'm attaching a toy app and corresponding FEST JUnit test that demonstrates the problem. The initial window is a JFrame with a File > Exit menu item and also a "Launch" JButton in the content pane. When the launch button is pressed, a new JDialog is created as a child of the JFrame. This dialog also has a File > Exit menu item. The test closes the child dialog, and then attempts to click the frame's File > Exit menu item using ContainerFixture.menuItemWithPath(). It looks like it is finding the now-hidden dialog's menu as well, and giving up.
Issue by David Eisner from Fri, 27 Aug 2010 14:35:28 -0500
Originally opened as http://jira.codehaus.org/browse/FEST-385
I'm running into a problem where ContainerFixture.menuItemWithPath() throws an exception because it finds multiple matching components. E.g., if I try this:
--
snip--window.menuItemWithPath( "File", "Exit").click();
--
snip--then this exception is thrown:
--
snip--org.fest.swing.exception.ComponentLookupException: Found more than one component using matcher org.fest.swing.driver.JMenuItemMatcher[label='File|Exit'].
Found:
javax.swing.JMenuItem[name='parentExitMenuItem', text='Exit', selected=false, enabled=true, visible=true, showing=false]
javax.swing.JMenuItem[name='childExitMenuItem', text='Exit', selected=false, enabled=true, visible=true, showing=false]
at org.fest.swing.core.BasicComponentFinder.multipleComponentsFound(BasicComponentFinder.java:296)
at org.fest.swing.core.BasicComponentFinder.find(BasicComponentFinder.java:261)
at org.fest.swing.core.BasicComponentFinder.find(BasicComponentFinder.java:254)
at org.fest.swing.fixture.JMenuItemFinder.menuItemWithPath(JMenuItemFinder.java:48)
at org.fest.swing.fixture.ContainerFixture.menuItemWithPath(ContainerFixture.java:267)
at david.playground.festbug.FestBugTest.testApp(FestBugTest.java:56)
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 org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
--
snip--I'm attaching a toy app and corresponding FEST JUnit test that demonstrates the problem. The initial window is a JFrame with a File > Exit menu item and also a "Launch" JButton in the content pane. When the launch button is pressed, a new JDialog is created as a child of the JFrame. This dialog also has a File > Exit menu item. The test closes the child dialog, and then attempts to click the frame's File > Exit menu item using ContainerFixture.menuItemWithPath(). It looks like it is finding the now-hidden dialog's menu as well, and giving up.
votes (original issue): 0
watches (original issue): 0
The text was updated successfully, but these errors were encountered: