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 8b12772580..7358b3727e 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 @@ -81,6 +81,7 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; import org.junit.Before; +import org.junit.BeforeClass; import org.junit.FixMethodOrder; import org.junit.Rule; import org.junit.Test; @@ -145,13 +146,10 @@ private void testLogAppend(String msg) { @Parameters(name = "browser flags: {0}") public static Collection browserFlagsToTest() { List browserFlags = new ArrayList<>(); + browserFlags.add(new Object[] {SWT.NONE}); 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}); + // Execute IE tests after Edge, because IE starts some OS timer that conflicts with Edge event handling browserFlags.add(new Object[] {SWT.IE}); - } else { - browserFlags.add(new Object[] {SWT.NONE}); } return browserFlags; } @@ -160,6 +158,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() { @@ -234,6 +242,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) {