Skip to content

Commit

Permalink
Execute browser tests for Edge #671
Browse files Browse the repository at this point in the history
Browser tests were only executed for the default configuration of a
system's browser using the SWT.NONE flag. Other configurations, such as
using the Edge browser in Windows, were not tested. A parameterization
has been added to allow other configurations to be tested.

This change adds Edge to the test configurations executed for the
browser. This allows to detect regressions when performing future
changes to the Edge browser.

Fixes
#671
  • Loading branch information
HeikoKlare authored and fedejeanne committed Dec 16, 2024
1 parent 37b22fb commit 2db6e49
Showing 1 changed file with 23 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -145,13 +146,10 @@ private void testLogAppend(String msg) {
@Parameters(name = "browser flags: {0}")
public static Collection<Object[]> browserFlagsToTest() {
List<Object[]> 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;
}
Expand All @@ -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() {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 2db6e49

Please sign in to comment.