Skip to content

Commit

Permalink
Merge pull request #203 from pitest/flaky-ui-test
Browse files Browse the repository at this point in the history
Flaky UI tests
  • Loading branch information
LorenzoBettini authored Aug 24, 2022
2 parents 7225ec5 + fe50310 commit 2b3d400
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tests/org.pitest.pitclipse.ui.tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
<useUIHarness>true</useUIHarness>
<useUIThread>false</useUIThread>
<!-- Increase the timeout for SWTBot especially for the CI -->
<argLine>${additionalTestArgLine} ${os-jvm-flags} -Dorg.eclipse.swtbot.search.timeout=90000 -Dorg.pitest.pitclipse.tests.pit.timeout=20000</argLine>
<argLine>${additionalTestArgLine} ${os-jvm-flags} -Dorg.eclipse.swtbot.search.timeout=180000 -Dorg.pitest.pitclipse.tests.pit.timeout=20000</argLine>
</configuration>
</plugin>
<!-- Explicit dependency to the listeners fragment: make Pitclipse's mutation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.pitest.pitclipse.ui.behaviours.pageobjects;

import static org.pitest.pitclipse.ui.behaviours.pageobjects.PageObjects.PAGES;
import static org.pitest.pitclipse.ui.behaviours.pageobjects.SwtBotTreeHelper.expand;

import java.util.List;
Expand Down Expand Up @@ -60,10 +61,15 @@ public SWTBotTree mutationTreeRoot() {
}

public SWTBotView getView() {
// let's close the Console view first, otherwise it seems
// to block the opening of "PIT Mutations"
PAGES.getConsole().close();
SWTBotView mutationsView = bot.viewByTitle("PIT Mutations");
mutationsView.show();
mutationsView.setFocus();
// Make sure the 'PIT Mutations' view is opened
bot.waitUntil(new ViewOpenedCondition(bot, "PIT Mutations"));
// this should not be required anymore
// bot.waitUntil(new ViewOpenedCondition(bot, "PIT Mutations"));
return mutationsView;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ public ViewOpenedCondition(SWTWorkbenchBot bot, String viewTitle) {
this.bot = bot;
this.viewTitle = viewTitle;
}

@Override
public boolean test() throws Exception {
return bot.viewByTitle(viewTitle) != null;
return bot.viewByTitle(viewTitle).isActive();
}

@Override
public String getFailureMessage() {
return "The view '" + viewTitle + "' did not open";
Expand Down

0 comments on commit 2b3d400

Please sign in to comment.