Skip to content

Commit 8ec487f

Browse files
[ZEPPELIN-6195] Fix Selenium tests by switching from Chrome to Firefox and upgrading outdated Spark
### What is this PR for? The `test-selenium-with-spark-module-for-spark-3-4` job in GitHub Actions was consistently failing with the error: ```bash from unknown command: 'Runtime.evaluate' wasn't found ``` This issue was caused by ChromeDriver not recognizing the `Runtime.evaluate` command. To resolve it, the browser used in the test was switched from Chrome to Firefox. During the migration to Firefox, another issue occurred: ```bash Unable to download from https://dlcdn.apache.org/spark/spark-3.4.2/spark-3.4.2-bin-hadoop3.tgz java.io.FileNotFoundException: https://dlcdn.apache.org/spark/spark-3.4.2/spark-3.4.2-bin-hadoop3.tgz ``` This was due to the Spark 3.4.2 binaries no longer being available from the Apache mirror. The test environment was therefore updated to use Spark 3.5.6, which resolved the download problem. Summary of changes: - Switched Selenium tests from Chrome to Firefox (non-snap) using geckodriver. - Updated Spark version in the test environment from 3.4.2 to 3.5.6 to fix missing binary downloads. Before: test-selenium-with-spark-module-for-spark-3-4 (Chrome, Spark 3.4.2) After: test-selenium-with-spark-module-for-spark-3-5 (Firefox, Spark 3.5.6) ### What type of PR is it? Bug Fix ### Todos * [x] - Verified that other integration tests (if any) are not affected * [x] - Confirmed long-term compatibility with the Chrome for Testing approach ### What is the Jira issue? * Jira: https://issues.apache.org/jira/browse/ZEPPELIN-6195 ### How should this be tested? - Run the `test-selenium-with-spark-module-for-spark-3-4` job in GitHub Actions. - Verify that `AuthenticationIT` and any other affected Selenium tests pass without encountering `Runtime.evaluate` errors. ### Screenshots (if appropriate) N/A ### Questions: * Does the license files need to update? No. * Is there breaking changes for older versions? No. * Does this needs documentation? No. Closes #4941 from ParkGyeongTae/fix-selenium-runtime-evaluate-error. Signed-off-by: Philipp Dallig <philipp.dallig@gmail.com>
1 parent 4bf5ab9 commit 8ec487f

4 files changed

Lines changed: 43 additions & 32 deletions

File tree

.github/workflows/frontend.yml

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -86,32 +86,34 @@ jobs:
8686
- name: Run headless test
8787
run: xvfb-run --auto-servernum --server-args="-screen 0 1024x768x24" ./mvnw package -pl zeppelin-web-angular ${MAVEN_ARGS}
8888

89-
test-selenium-with-spark-module-for-spark-3-4:
89+
test-selenium-with-spark-module-for-spark-3-5:
9090
runs-on: ubuntu-24.04
9191
defaults:
9292
run:
9393
shell: bash -l {0}
94+
env:
95+
ZEPPELIN_SELENIUM_BROWSER: firefox
9496
steps:
9597
- name: Checkout
9698
uses: actions/checkout@v4
97-
- name: Tune Runner VM
98-
uses: ./.github/actions/tune-runner-vm
99-
- name: Set up JDK 11
100-
uses: actions/setup-java@v4
101-
with:
102-
distribution: 'temurin'
103-
java-version: 11
104-
- name: Cache local Maven repository
105-
uses: actions/cache@v4
106-
with:
107-
path: |
108-
~/.m2/repository
109-
!~/.m2/repository/org/apache/zeppelin/
110-
~/.spark-dist
111-
~/.cache
112-
key: ${{ runner.os }}-zeppelin-${{ hashFiles('**/pom.xml') }}
113-
restore-keys: |
114-
${{ runner.os }}-zeppelin-
99+
- name: Install Firefox (non-snap) and geckodriver
100+
run: |
101+
sudo snap remove firefox || true
102+
sudo add-apt-repository -y ppa:mozillateam/ppa
103+
sudo tee -a /etc/apt/preferences.d/mozilla-firefox <<EOF
104+
Package: *
105+
Pin: release o=LP-PPA-mozillateam
106+
Pin-Priority: 1001
107+
EOF
108+
sudo apt-get update
109+
sudo apt-get install -y firefox
110+
GECKODRIVER_VERSION=$(curl -s https://api.github.com/repos/mozilla/geckodriver/releases/latest | grep tag_name | cut -d '"' -f 4)
111+
wget -q https://github.com/mozilla/geckodriver/releases/download/${GECKODRIVER_VERSION}/geckodriver-${GECKODRIVER_VERSION}-linux64.tar.gz
112+
tar -xzf geckodriver-${GECKODRIVER_VERSION}-linux64.tar.gz
113+
chmod +x geckodriver
114+
sudo mv geckodriver /usr/local/bin/
115+
geckodriver --version
116+
firefox --version
115117
- name: Setup conda environment with python 3.9 and R
116118
uses: conda-incubator/setup-miniconda@v3
117119
with:
@@ -122,15 +124,19 @@ jobs:
122124
channel-priority: strict
123125
auto-activate-base: false
124126
use-mamba: true
125-
- name: Make IRkernel available to Jupyter
126-
run: |
127-
R -e "IRkernel::installspec()"
128127
- name: Install Environment
129128
run: |
130-
./mvnw clean install -DskipTests -am -pl zeppelin-integration -Pweb-classic -Pintegration -Pspark-scala-2.12 -Pspark-3.4 -Pweb-dist ${MAVEN_ARGS}
131-
- name: run tests
129+
./mvnw clean install -DskipTests -am -pl zeppelin-integration -Pweb-classic -Pintegration -Pspark-scala-2.12 -Pspark-3.5 -Pweb-dist ${MAVEN_ARGS}
130+
- name: Print browser version
132131
run: |
133-
xvfb-run --auto-servernum --server-args="-screen 0 1600x1024x16" ./mvnw verify -DfailIfNoTests=false -pl zeppelin-integration -Pweb-classic -Pintegration -Pspark-scala-2.12 -Pspark-3.4 -Pweb-dist -Pusing-source-tree ${MAVEN_ARGS}
134-
- name: Print zeppelin logs
135-
if: always()
136-
run: if [ -d "logs" ]; then cat logs/*; fi
132+
echo "Firefox version:"
133+
firefox --version
134+
echo "GeckoDriver version:"
135+
geckodriver --version
136+
- name: Run integration tests with Firefox
137+
run: |
138+
xvfb-run --auto-servernum --server-args="-screen 0 1600x1024x16" \
139+
./mvnw verify -DfailIfNoTests=false \
140+
-pl zeppelin-integration \
141+
-Pweb-classic -Pintegration -Pspark-scala-2.12 -Pspark-3.5 -Pweb-dist -Pusing-source-tree \
142+
${MAVEN_ARGS}

zeppelin-integration/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
<properties>
4040
<!--test library versions-->
41-
<selenium.java.version>4.11.0</selenium.java.version>
41+
<selenium.java.version>4.20.0</selenium.java.version>
4242
</properties>
4343

4444
<dependencies>

zeppelin-integration/src/test/java/org/apache/zeppelin/WebDriverManager.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ private WebDriver constructWebDriver(int port) {
139139
while (System.currentTimeMillis() - start < 60 * 1000) {
140140
// wait for page load
141141
try {
142-
(new WebDriverWait(driver, Duration.ofSeconds(30))).until(new ExpectedCondition<Boolean>() {
142+
(new WebDriverWait(driver, Duration.ofSeconds(60))).until(new ExpectedCondition<Boolean>() {
143143
@Override
144144
public Boolean apply(WebDriver d) {
145145
return d.findElement(By.xpath("//i[@uib-tooltip='WebSocket Connected']"))
@@ -156,7 +156,12 @@ public Boolean apply(WebDriver d) {
156156

157157
assertTrue(loaded);
158158

159-
driver.manage().window().maximize();
159+
try {
160+
driver.manage().window().maximize();
161+
} catch (Exception e) {
162+
LOG.warn("Failed to maximize browser window. Consider using setSize() instead.", e);
163+
}
164+
160165
return driver;
161166
}
162167

zeppelin-test/src/main/java/org/apache/zeppelin/test/DownloadUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public class DownloadUtils {
6565
private static final int PROGRESS_BAR_UPDATE_INTERVAL;
6666

6767
private static String downloadFolder = System.getProperty("user.home") + "/.cache";
68-
public static final String DEFAULT_SPARK_VERSION = "3.4.2";
68+
public static final String DEFAULT_SPARK_VERSION = "3.5.6";
6969
public static final String DEFAULT_SPARK_HADOOP_VERSION = "3";
7070

7171

0 commit comments

Comments
 (0)