Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » SWTBotNatTable opens dialog twice
SWTBotNatTable opens dialog twice [message #1828045] Fri, 29 May 2020 20:38 Go to next message
Stephan Druskat is currently offline Stephan DruskatFriend
Messages: 104
Registered: October 2011
Location: Berlin, Germany
Senior Member

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 21:07 Go to previous message
Stephan Druskat is currently offline Stephan DruskatFriend
Messages: 104
Registered: October 2011
Location: Berlin, Germany
Senior Member

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: Sun Jun 04 15:26:13 GMT 2023

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

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

Back to the top