Skip to content

Commit 09999f2

Browse files
committed
Browser tests: reduce timeout for instantiation to reasonable value
The timeout for browser instantiation in the browser tests has been increased to avoid flaky tests. However, browser instantiation taking that long is an indicator for something being wrong with the instantiation. There is no reason why instantiation may take that long during test execution but the same issue should never arise in productive use, thus such a case should be captured by tests and, if necessary, be fixed productively. In order to do so, this change reduces the test timeout value again to a more reasonable value. Since the first Edge browser instantiation takes rather long at least in the GitHub actions test environment, that instantiation is isolated in an execution before the test class. Related to #1676
1 parent 3e45b23 commit 09999f2

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

.github/workflows/maven.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
run: >-
6666
${{ contains(matrix.config.native, 'linux') && 'xvfb-run' || '' }}
6767
mvn --batch-mode -V -U -e
68-
--threads 1C
68+
--threads 1
6969
-DforkCount=1
7070
'-Dnative=${{ matrix.config.native }}'
7171
-Papi-check

Jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ pipeline {
314314
dir('eclipse.platform.swt') {
315315
sh '''
316316
mvn clean verify \
317-
--batch-mode --threads 1C -V -U -e -DforkCount=0 \
317+
--batch-mode --threads 1 -V -U -e -DforkCount=0 \
318318
-Papi-check \
319319
-Dcompare-version-with-baselines.skip=false \
320320
-Dorg.eclipse.swt.tests.junit.disable.test_isLocal=true \

tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_Browser.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,16 +102,15 @@
102102
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
103103
public class Test_org_eclipse_swt_browser_Browser extends Test_org_eclipse_swt_widgets_Composite {
104104

105-
// TODO Reduce to reasonable value
106-
private static Duration MAXIMUM_BROWSER_CREATION_TIME = Duration.ofSeconds(90);
105+
private static Duration MAXIMUM_BROWSER_CREATION_TIME = Duration.ofSeconds(15);
107106

108107
static {
109108
try {
110109
printSystemEnv();
111110
} catch (Exception e) {
112111
e.printStackTrace();
113112
}
114-
System.setProperty("org.eclipse.swt.internal.win32.Edge.timeout", Long.toString(MAXIMUM_BROWSER_CREATION_TIME.toMillis()));
113+
System.setProperty("org.eclipse.swt.internal.win32.Edge.timeout", Long.toString(Duration.ofSeconds(90).toMillis()));
115114
}
116115

117116
// CONFIG
@@ -165,10 +164,11 @@ public Test_org_eclipse_swt_browser_Browser(int swtBrowserSettings) {
165164

166165
@BeforeClass
167166
public static void setupEdgeEnvironment() {
168-
// initialize Edge environment before any test runs to isolate environment setup
167+
// Initialize Edge environment before any test runs to isolate environment setup
168+
// as this takes quite long in GitHub Actions builds
169169
if (SwtTestUtil.isWindows) {
170170
Shell shell = new Shell();
171-
new Browser(shell, SWT.EDGE);
171+
new Browser(shell, SWT.EDGE).getUrl();
172172
shell.dispose();
173173
}
174174
}

0 commit comments

Comments
 (0)