diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_Browser.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_Browser.java index 9097284461..74b0cdc677 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_Browser.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_Browser.java @@ -78,6 +78,7 @@ import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.junit.Before; +import org.junit.BeforeClass; import org.junit.FixMethodOrder; import org.junit.Rule; import org.junit.Test; @@ -145,7 +146,7 @@ public static Collection browserFlagsToTest() { if (SwtTestUtil.isWindows) { // NOTE: This is currently disabled due to test issues in the CI // Execute Edge tests first, because IE starts some OS timer that conflicts with Edge event handling - // browserFlags.add(0, new Object[] {SWT.EDGE}); + browserFlags.add(0, new Object[] {SWT.EDGE}); } browserFlags.add(new Object[] {SWT.NONE}); return browserFlags; @@ -155,6 +156,16 @@ public Test_org_eclipse_swt_browser_Browser(int swtBrowserSettings) { this.swtBrowserSettings = swtBrowserSettings; } +@BeforeClass +public static void setupEdgeEnvironment() { + // initialize Edge environment before any test runs to isolate environment setup + if (SwtTestUtil.isWindows) { + Shell shell = new Shell(); + new Browser(shell, SWT.EDGE); + shell.dispose(); + } +} + @Override @Before public void setUp() { @@ -229,6 +240,16 @@ protected void afterDispose(Display display) { printThreadsInfo(); } } + if (isEdge) { + // wait for and process pending events to properly cleanup Edge browser resources + do { + processUiEvents(); + try { + Thread.sleep(100); + } catch (InterruptedException e) { + } + } while (Display.getCurrent().readAndDispatch()); + } if (SwtTestUtil.isGTK) { int descriptorDiff = reportOpenedDescriptors(); if(descriptorDiff > 0) {