Skip to main content



      Home
Home » Eclipse Projects » SWTBot » SWTBotNatTable opens dialog twice
SWTBotNatTable opens dialog twice [message #1828045] Fri, 29 May 2020 16:38 Go to next message
Eclipse UserFriend
I'm at my wits end.

I have a NatTable with a contextMenu for column headers. It works perfectly fine when running the application itself and doing manual clicks.

Now I've tried to write a simple UI test for the dialog, just opening and closing it by clicking on "OK".

The test looks like this:

@Test
  void testChangeAnnotationDialog() {
    openDefaultExample(); // Opens example data and populates the table

    SWTNatTableBot tableBot = new SWTNatTableBot();
    SWTBotNatTable table = tableBot.nattable();

    table.contextMenu(0, 2).contextMenu("Open dialog").click();
    SWTBotShell dialog = tableBot.shell("Dialog");
    tableBot.button("OK").click();
    bot.waitUntil(Conditions.shellCloses(dialog));
  }


The test (run in an Eclipse RCP product) passes in Eclipse when run by itself, but the dialog is opened twice during the test!

This has two problems:


  1. When running the test by itself, I get exceptions thrown in the console (java.lang.IllegalStateException: Application does not have an active window + an NPE from the command handler.)
  2. The test kills all other UI tests of the same and other classes when run via Run Config, both in Eclipse and via Tycho.


I'd be thankful for any ideas why the dialog would be opened twice during the test run! (Ading some bot.sleep()s, I can even see it with my own eyes...)
Re: SWTBotNatTable opens dialog twice [message #1828046 is a reply to message #1828045] Fri, 29 May 2020 17:07 Go to previous message
Eclipse UserFriend
I managed to fix it by chance. It seemed to have been a problem with one of the Text fields in the dialog being focused. When I le the test type a new value, then click OK, it worked.
Previous Topic:SWTBot with JUnit5?
Next Topic:SWTBot on Jenkins Bitvise SSH-Server
Goto Forum:
  


Current Time: Fri May 16 12:00:12 EDT 2025

Powered by FUDForum. Page generated in 0.02551 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top