Skip to content

Commit f602b48

Browse files
committed
Significant rewrite removing Sikuli dependency and supporting video recording.
1 parent c594f5c commit f602b48

15 files changed

Lines changed: 1310 additions & 615 deletions

File tree

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
ARG NAMESPACE=selenium
2+
ARG VERSION=4.41.0
3+
ARG BASE=node-all-browsers
4+
FROM ${NAMESPACE}/${BASE}:${VERSION}
5+
LABEL authors=${AUTHORS}
6+
7+
USER root
8+
9+
#RUN apt-get update -qqy && apt-get install --no-install-recommends -qqy libx11-6 libxext6 libxi6 libxtst6 libxrender1 libxrandr2 libxfixes3 libxcursor1 libxinerama1 libxt6 libopencv-java
10+
# Dépendances pour Robot/AWT
11+
RUN apt-get update && apt-get install -y --no-install-recommends \
12+
xvfb \
13+
libx11-6 \
14+
libxext6 \
15+
libxi6 \
16+
libxtst6 \
17+
libxrender1 \
18+
libxrandr2 \
19+
libxfixes3 \
20+
libxcursor1 \
21+
libxinerama1 \
22+
libxt6 \
23+
libfontconfig1 \
24+
libfreetype6 \
25+
libnss3 \
26+
openjdk-21-jdk \
27+
ffmpeg \
28+
wmctrl \
29+
&& rm -rf /var/lib/apt/lists/*
30+
RUN ln -s /usr/lib/jni/libopencv_java454d.so /usr/lib/libopencv_java.so
31+
32+
#==============================
33+
# Cerberus Robot Extension
34+
#==============================
35+
ARG CERBERUS_ROBOT_EXTENSION_VERSION=1.7.2
36+
ENV CERBERUS_ROBOT_EXTENSION_VERSION=${CERBERUS_ROBOT_EXTENSION_VERSION}
37+
#COPY cerberus-robot-extension-${CERBERUS_ROBOT_EXTENSION_VERSION}-full.jar /opt/selenium/cerberus-robot-extension.jar
38+
RUN wget --no-verbose http://vm.cerberus-testing.org/delivery/cerberus-robot-extension-$CERBERUS_ROBOT_EXTENSION_VERSION.jar -O /opt/selenium/cerberus-robot-extension.jar
39+
40+
COPY start-cerberus-robot-extension.sh /opt/start-cerberus-robot-extension.sh
41+
RUN chmod 0755 /opt/start-cerberus-robot-extension.sh
42+
43+
# Supervisor configuration file
44+
COPY cerberus-robot-extension.conf /etc/supervisor/conf.d/
45+
46+
USER ${SEL_UID}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
; Documentation of this file format -> http://supervisord.org/configuration.html
2+
3+
; Priority 0 - xvfb & fluxbox, 5 - x11vnc, 10 - noVNC, 15 - selenium-node
4+
5+
[program:cerberus-robot-extension]
6+
command=/opt/start-cerberus-robot-extension.sh
7+
autostart=true
8+
stderr_logfile=/dev/stdout
9+
stderr_logfile_maxbytes = 0
10+
stdout_logfile=/dev/stdout
11+
stdout_logfile_maxbytes = 0
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
CMD_START_JAVA="java -Djava.awt.headless=false "
3+
4+
if [ -n "$CERBERUS_ROBOT_EXTENSION_HIGHLIGHT_ELEMENT" ]; then
5+
CRB_START_EXTENSION="$CRB_START_EXTENSION -e $CERBERUS_ROBOT_EXTENSION_HIGHLIGHT_ELEMENT"
6+
fi
7+
8+
if [ -n "$CERBERUS_ROBOT_EXTENSION_AUTHORIZED_FOLDER_SCOPE" ]; then
9+
CRB_START_EXTENSION="$CRB_START_EXTENSION -a $CERBERUS_ROBOT_EXTENSION_AUTHORIZED_FOLDER_SCOPE"
10+
fi
11+
12+
if [ -n "$CERBERUS_ROBOT_EXTENSION_DEBUG" ]; then
13+
CRB_START_EXTENSION="$CRB_START_EXTENSION -d"
14+
CMD_START_JAVA="$CMD_START_JAVA -Dlog.level=DEBUG -Xmx1024m "
15+
fi
16+
17+
CMD_START_EXTENSION="$CMD_START_JAVA -jar /opt/selenium/cerberus-robot-extension.jar -p ${CERBERUS_ROBOT_EXTENSION_PORT:-6555} $CRB_START_EXTENSION"
18+
echo "Starting Cerberus Extension : " $CMD_START_EXTENSION
19+
eval $CMD_START_EXTENSION

docker/cerberusNodeChrome/Dockerfile

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,42 @@
11
ARG NAMESPACE=selenium
2-
ARG VERSION=4.19.0-20240328
3-
#ARG VERSION=145.0-chromedriver-145.0-grid-4.41.0-20260222
2+
ARG VERSION=145.0-chromedriver-145.0-grid-4.41.0-20260222
43
ARG BASE=node-chrome
54
FROM ${NAMESPACE}/${BASE}:${VERSION}
65
LABEL authors=${AUTHORS}
76

87
USER root
98

9+
#RUN apt-get update -qqy && apt-get install --no-install-recommends -qqy libx11-6 libxext6 libxi6 libxtst6 libxrender1 libxrandr2 libxfixes3 libxcursor1 libxinerama1 libxt6 libopencv-java
10+
# Dépendances pour Robot/AWT
11+
RUN apt-get update && apt-get install -y --no-install-recommends \
12+
xvfb \
13+
libx11-6 \
14+
libxext6 \
15+
libxi6 \
16+
libxtst6 \
17+
libxrender1 \
18+
libxrandr2 \
19+
libxfixes3 \
20+
libxcursor1 \
21+
libxinerama1 \
22+
libxt6 \
23+
libfontconfig1 \
24+
libfreetype6 \
25+
libnss3 \
26+
openjdk-21-jdk \
27+
ffmpeg \
28+
wmctrl \
29+
&& rm -rf /var/lib/apt/lists/*
30+
RUN ln -s /usr/lib/jni/libopencv_java454d.so /usr/lib/libopencv_java.so
31+
1032
#==============================
1133
# Cerberus Robot Extension
1234
#==============================
1335
ARG CERBERUS_ROBOT_EXTENSION_VERSION=1.7.2
36+
ENV CERBERUS_ROBOT_EXTENSION_VERSION=${CERBERUS_ROBOT_EXTENSION_VERSION}
37+
#COPY cerberus-robot-extension-${CERBERUS_ROBOT_EXTENSION_VERSION}-full.jar /opt/selenium/cerberus-robot-extension.jar
1438
RUN wget --no-verbose http://vm.cerberus-testing.org/delivery/cerberus-robot-extension-$CERBERUS_ROBOT_EXTENSION_VERSION.jar -O /opt/selenium/cerberus-robot-extension.jar
1539

16-
RUN apt-get update -qqy && apt-get install --no-install-recommends -qqy libopencv4.5-java
17-
RUN ln -s /usr/lib/jni/libopencv_java454d.so /usr/lib/libopencv_java.so
18-
1940
COPY start-cerberus-robot-extension.sh /opt/start-cerberus-robot-extension.sh
2041
RUN chmod 0755 /opt/start-cerberus-robot-extension.sh
2142

docker/cerberusNodeFirefox/Dockerfile

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,42 @@
11
ARG NAMESPACE=selenium
2-
ARG VERSION=4.19.0-20240328
3-
#ARG VERSION=128.0-geckodriver-0.36-grid-4.41.0-20260222
2+
ARG VERSION=128.0-geckodriver-0.36-grid-4.41.0-20260222
43
ARG BASE=node-firefox
54
FROM ${NAMESPACE}/${BASE}:${VERSION}
65
LABEL authors=${AUTHORS}
76

87
USER root
98

9+
#RUN apt-get update -qqy && apt-get install --no-install-recommends -qqy libx11-6 libxext6 libxi6 libxtst6 libxrender1 libxrandr2 libxfixes3 libxcursor1 libxinerama1 libxt6 libopencv-java
10+
# Dépendances pour Robot/AWT
11+
RUN apt-get update && apt-get install -y --no-install-recommends \
12+
xvfb \
13+
libx11-6 \
14+
libxext6 \
15+
libxi6 \
16+
libxtst6 \
17+
libxrender1 \
18+
libxrandr2 \
19+
libxfixes3 \
20+
libxcursor1 \
21+
libxinerama1 \
22+
libxt6 \
23+
libfontconfig1 \
24+
libfreetype6 \
25+
libnss3 \
26+
openjdk-21-jdk \
27+
ffmpeg \
28+
wmctrl \
29+
&& rm -rf /var/lib/apt/lists/*
30+
RUN ln -s /usr/lib/jni/libopencv_java454d.so /usr/lib/libopencv_java.so
31+
1032
#==============================
1133
# Cerberus Robot Extension
1234
#==============================
1335
ARG CERBERUS_ROBOT_EXTENSION_VERSION=1.7.2
36+
ENV CERBERUS_ROBOT_EXTENSION_VERSION=${CERBERUS_ROBOT_EXTENSION_VERSION}
37+
#COPY cerberus-robot-extension-${CERBERUS_ROBOT_EXTENSION_VERSION}-full.jar /opt/selenium/cerberus-robot-extension.jar
1438
RUN wget --no-verbose http://vm.cerberus-testing.org/delivery/cerberus-robot-extension-$CERBERUS_ROBOT_EXTENSION_VERSION.jar -O /opt/selenium/cerberus-robot-extension.jar
1539

16-
RUN apt-get update -qqy && apt-get install --no-install-recommends -qqy libopencv4.5-java
17-
RUN ln -s /usr/lib/jni/libopencv_java454d.so /usr/lib/libopencv_java.so
18-
1940
COPY start-cerberus-robot-extension.sh /opt/start-cerberus-robot-extension.sh
2041
RUN chmod 0755 /opt/start-cerberus-robot-extension.sh
2142

pom.xml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>org.cerberus</groupId>
55
<artifactId>cerberus-robot-extension</artifactId>
6-
<version>1.8-SNAPSHOT</version>
6+
<version>2.0-SNAPSHOT</version>
77
<packaging>jar</packaging>
88
<name>Cerberus Robot Extension</name>
99

1010
<properties>
1111
<!-- Maven properties -->
1212
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
13-
<maven.compiler.source>1.7</maven.compiler.source>
14-
<maven.compiler.target>1.7</maven.compiler.target>
13+
<maven.compiler.source>21</maven.compiler.source>
14+
<maven.compiler.target>21</maven.compiler.target>
1515
<timestamp>${maven.build.timestamp}</timestamp>
1616
<maven.build.timestamp.format>yyyyMMdd'-'HHmmss</maven.build.timestamp.format>
1717
<ant-jsch.version>1.10.1</ant-jsch.version>
@@ -79,10 +79,16 @@
7979
</repository>
8080
</repositories>
8181
<dependencies>
82+
<!-- OpenCV 4.13 via JavaCPP -->
8283
<dependency>
83-
<groupId>com.sikulix</groupId>
84-
<artifactId>sikulixapi</artifactId>
85-
<version>2.0.4</version>
84+
<groupId>org.bytedeco</groupId>
85+
<artifactId>opencv</artifactId>
86+
<version>4.13.0-1.5.13</version>
87+
</dependency>
88+
<dependency>
89+
<groupId>org.bytedeco</groupId>
90+
<artifactId>opencv-platform</artifactId>
91+
<version>4.13.0-1.5.13</version>
8692
</dependency>
8793
<dependency>
8894
<groupId>commons-io</groupId>

src/main/java/org/cerberus/robot/extension/QueueReceiver.java

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.eclipse.jetty.servlet.ServletHandler;
2626
import org.cerberus.robot.extension.filemanagement.ExecuteFilemanagementAction;
2727
import org.cerberus.robot.extension.management.ExecuteManagementAction;
28+
import org.cerberus.robot.extension.parameter.Parameter;
2829
import org.cerberus.robot.extension.version.Infos;
2930

3031
/**
@@ -87,25 +88,24 @@ public static void main(String[] args) throws IOException {
8788
if (cmd.hasOption("port")) {
8889
portParam = cmd.getOptionValue("port");
8990
}
91+
LOG.info(infos.getProjectNameAndVersion() + " - Build " + infos.getProjectBuildId() + " - Http Server Launching on port : " + portParam);
9092

91-
/**
92-
* Set DebugMode if specified
93-
*/
94-
if (cmd.hasOption("debug")) {
95-
LOG.info("Activating Debug Mode.");
96-
setLogLevelToDebug();
97-
}
9893
/**
9994
* Set Highlight Element if specified
10095
*/
96+
Parameter param = Parameter.getInstance();
97+
param.setHighlightElement(Integer.parseInt("0"));
10198
if (cmd.hasOption("highlightElement")) {
99+
param.setHighlightElement(Integer.parseInt(cmd.getOptionValue("highlightElement")));
102100
System.setProperty("highlightElement", cmd.getOptionValue("highlightElement"));
103101
LOG.info("Set highlightElement parameter to " + cmd.getOptionValue("highlightElement") + " seconds");
104102
}
105103
/**
106104
* Set Authorised Folder Scope if specified
107105
*/
106+
param.setAuthorisedFolderScope("");
108107
if (cmd.hasOption("authorisedFolderScope")) {
108+
param.setAuthorisedFolderScope(cmd.getOptionValue("authorisedFolderScope"));
109109
System.setProperty("authorisedFolderScope", cmd.getOptionValue("authorisedFolderScope"));
110110
LOG.info("Set authorisedFolderScope parameter to " + cmd.getOptionValue("authorisedFolderScope"));
111111
}
@@ -123,6 +123,7 @@ public static void main(String[] args) throws IOException {
123123
}
124124
LOG.warn("Java Property (java.io.tmpdir) for temporary folder not defined. Default to :" + sauthorisedFolderScope);
125125
}
126+
param.setAuthorisedFolderScope(sauthorisedFolderScope);
126127
System.setProperty("authorisedFolderScope", sauthorisedFolderScope);
127128
}
128129

@@ -138,7 +139,6 @@ public static void main(String[] args) throws IOException {
138139
/*
139140
* Start the server
140141
*/
141-
LOG.info(infos.getProjectNameAndVersion() + " - Build " + infos.getProjectBuildId() + " - Http Server Launching on port : " + portParam);
142142
Server server = new Server();
143143

144144
ServerConnector connector = new ServerConnector(server);
@@ -163,14 +163,4 @@ public static void main(String[] args) throws IOException {
163163
LOG.error(ex, ex);
164164
}
165165
}
166-
167-
private static void setLogLevelToDebug() {
168-
Logger logger = LogManager.getRootLogger();
169-
Configurator.setAllLevels(logger.getName(), Level.DEBUG);
170-
Configurator.setLevel(LOG.getName(), Level.DEBUG);
171-
Configurator.setAllLevels(logger.getName(), Level.DEBUG);
172-
// Configurator.setLevel(System.getProperty("log4j.logger"), Level.DEBUG);
173-
LOG.debug("Debug mode enabled");
174-
}
175-
176166
}

src/main/java/org/cerberus/robot/extension/filemanagement/ExecuteFilemanagementAction.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re
100100

101101
String action = obj.getString("action");
102102

103-
LOG.info("Executing: [" + action + "]");
103+
LOG.info("[{}] Executing...", action);
104104
String path = "";
105105
String filename = "";
106106
String opt = "";
@@ -114,7 +114,7 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re
114114
if (obj.has("filename")) {
115115
filename = obj.getString("filename");
116116
}
117-
LOG.info("Cleaning files from '{}'.", filename);
117+
LOG.info("[{}] Cleaning files from '{}'.", action, filename);
118118
actionResult = clean_folder(filename, authorisedFolderScope);
119119

120120
break;
@@ -132,7 +132,7 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re
132132
if (obj.has("option")) {
133133
opt = obj.getString("option");
134134
}
135-
LOG.info("Saving local file to path '{}' with option '{}'.", filename, opt);
135+
LOG.info("[{}] Saving local file to path '{}' with option '{}'.", action, filename, opt);
136136
actionResult = upload_files(filename, contentBase64, opt, authorisedFolderScope);
137137

138138
break;
@@ -151,7 +151,7 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re
151151
if (obj.has("option")) {
152152
opt = obj.getString("option");
153153
}
154-
LOG.info("Getting {} local file(s) from '{}'.", nbfiles, filename);
154+
LOG.info("[{}] Getting {} local file(s) from '{}'.", action, nbfiles, filename);
155155
actionResult = download_files(filename, nbfiles, opt, authorisedFolderScope);
156156

157157
break;
@@ -163,7 +163,7 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re
163163
/**
164164
* Log and return actionResult
165165
*/
166-
LOG.info("[" + action + "] finish with result: " + actionResult.get("status"));
166+
LOG.info("[{}] finish with result: {}", action, actionResult.get("status"));
167167
os.println(actionResult.toString(1));
168168

169169
is.close();
@@ -393,7 +393,7 @@ private JSONObject download_files(String filenamecomplete, int nbfiles, String o
393393
if ("LASMODIFIED".equals(opt)) {
394394
Collections.sort(files, new Comparator<File>() {
395395
public int compare(File o1, File o2) {
396-
return new Long(o2.lastModified()).compareTo(o1.lastModified());
396+
return Long.compare(o2.lastModified(), o1.lastModified());
397397
}
398398
});
399399
} else if ("IGNORECASEDESC".equals(opt)) {

0 commit comments

Comments
 (0)