Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Headless Testing on Github(Failed to inject or execute JavaScript)
Headless Testing on Github [message #1858177] Mon, 20 March 2023 09:39
Gilles Iachelini is currently offline Gilles IacheliniFriend
Messages: 8
Registered: November 2017
Junior Member
Hi everyone,

I am trying to integrate SWTBot tests into a given product build on github.

I have a tycho-maven based RCP product build. I added the org.eclipse.swtbot.junit5 feature to the product under test, as well as my own test-plug-ins, by grouping them in a custom feature. The final product then contains the required bundles and I am able to launch the test from within a github action by calling:

      run: |
         sudo apt-get install libwebkit2gtk-4.0-37
         xvfb-run java -Xms256M -Xmx768M \
jar my.product/target/products/my.product/linux/gtk/x86_64/plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar \
-application org.eclipse.swtbot.eclipse.junit5.headless.swtbottestapplication \
-product my.product \
-testApplication my.application \
-data . \
-testPluginName my.test formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,AllTests.xml \
formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter\
 -classname my.test.PopupCapabilityTest \
-os linux -ws gtk -arch x86_64 -consoleLog -debug


What happens now, is:
!MESSAGE Failed to inject or execute JavaScript: ( async () => { // ======= SCRIPT PLACEHOLDERS BEGIN =======
const refs = {IntentClient: window['__SCION_RCP'].refs.IntentClient};
const helpers = {fromJson: window['__SCION_RCP'].helpers.fromJson};
const callback = window['__scion_rcp_browserfunction_0987a5af_cbc5_4b9b_8917_87b3ec7b0b9b'];
const intent = helpers.fromJson('{"type":"view","qualifier":{"component":"devtools","vendor":"scion"},"params":null}');
const body = helpers.fromJson('null');
const options = {
  headers: helpers.fromJson('null'),
  retain: null,
};
// ======= SCRIPT PLACEHOLDERS END =======

This works locally just fine (not "headless" though, I see the windows popping up.)

Has anyone made SWTBot tests working on github (actions)?
What packages did you install in prior to create the required environment?
I am able to install the Edge browser to my container, but have no clue how to tell gtk about it? Anyone done this before?

@Edit: The fact, that we try to inject JS code is probably not the interesting part, but that we want to use the Edge browser component. I found actions to install the linux version of the browser to the container, but I have no clue how to inform gtk about it and therefore make it available in gtk/SWT.

[Updated on: Wed, 22 March 2023 10:58]

Report message to a moderator

Previous Topic:SWTBot via the Command Line
Next Topic:Executing a single SWTbot test from the headless runner
Goto Forum:
  


Current Time: Wed Apr 17 22:19:51 GMT 2024

Powered by FUDForum. Page generated in 0.01763 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top