-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[ZEPPELIN-6350] Fix Selenium test by Replacing Firefox with Edge #5089
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,28 +104,32 @@ jobs: | |
run: | ||
shell: bash -l {0} | ||
env: | ||
ZEPPELIN_SELENIUM_BROWSER: firefox | ||
ZEPPELIN_SELENIUM_BROWSER: "edge" | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Install Firefox (non-snap) and geckodriver | ||
run: | | ||
sudo snap remove firefox || true | ||
sudo add-apt-repository -y ppa:mozillateam/ppa | ||
sudo tee -a /etc/apt/preferences.d/mozilla-firefox <<EOF | ||
Package: * | ||
Pin: release o=LP-PPA-mozillateam | ||
Pin-Priority: 1001 | ||
EOF | ||
sudo apt-get update | ||
sudo apt-get install -y firefox | ||
GECKODRIVER_VERSION=$(curl -s https://api.github.com/repos/mozilla/geckodriver/releases/latest | grep tag_name | cut -d '"' -f 4) | ||
wget -q https://github.com/mozilla/geckodriver/releases/download/${GECKODRIVER_VERSION}/geckodriver-${GECKODRIVER_VERSION}-linux64.tar.gz | ||
tar -xzf geckodriver-${GECKODRIVER_VERSION}-linux64.tar.gz | ||
chmod +x geckodriver | ||
sudo mv geckodriver /usr/local/bin/ | ||
geckodriver --version | ||
firefox --version | ||
- name: Tune Runner VM | ||
uses: ./.github/actions/tune-runner-vm | ||
- name: Set up Edge browser | ||
uses: browser-actions/setup-edge@v1 | ||
- name: Print Edge version | ||
run: msedgedriver --version | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: 11 | ||
- name: Cache local Maven repository | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.m2/repository | ||
!~/.m2/repository/org/apache/zeppelin/ | ||
~/.spark-dist | ||
~/.cache | ||
key: ${{ runner.os }}-zeppelin-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-zeppelin- | ||
Comment on lines
+117
to
+132
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I reverted this part to align it with other jobs |
||
- name: Setup conda environment with python 3.9 and R | ||
uses: conda-incubator/setup-miniconda@v3 | ||
with: | ||
|
@@ -136,19 +140,19 @@ jobs: | |
channel-priority: strict | ||
auto-activate-base: false | ||
use-mamba: true | ||
- name: Make IRkernel available to Jupyter | ||
run: | | ||
R -e "IRkernel::installspec()" | ||
- name: Install Environment | ||
run: | | ||
./mvnw clean install -DskipTests -am -pl zeppelin-integration -Pweb-classic -Pintegration -Pspark-scala-2.12 -Pspark-3.5 -Pweb-dist ${MAVEN_ARGS} | ||
- name: Print browser version | ||
run: | | ||
echo "Firefox version:" | ||
firefox --version | ||
echo "GeckoDriver version:" | ||
geckodriver --version | ||
- name: Run integration tests with Firefox | ||
- name: run tests | ||
run: | | ||
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.5 -Pweb-dist -Pusing-source-tree \ | ||
${MAVEN_ARGS} | ||
- name: Print zeppelin logs | ||
if: always() | ||
run: if [ -d "logs" ]; then cat logs/*; fi |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,7 @@ | |
import org.openqa.selenium.WebDriver; | ||
import org.openqa.selenium.chrome.ChromeDriver; | ||
import org.openqa.selenium.chrome.ChromeOptions; | ||
import org.openqa.selenium.edge.EdgeDriver; | ||
import org.openqa.selenium.firefox.FirefoxDriver; | ||
import org.openqa.selenium.firefox.FirefoxOptions; | ||
import org.openqa.selenium.firefox.FirefoxProfile; | ||
|
@@ -45,7 +46,7 @@ | |
import org.slf4j.LoggerFactory; | ||
|
||
// This class auto discovery the available WebDriver in the following priority: | ||
// Chrome, Firefox, Safari. | ||
// Chrome, Edge, Firefox, Safari. | ||
// | ||
// You can also use the environment variable ZEPPELIN_SELENIUM_BROWSER to choose a specific one. | ||
// For example, unlike Chromium and Firefox drivers, Safari's WebDriver is pre-installed on macOS, | ||
|
@@ -89,6 +90,14 @@ private WebDriver constructWebDriver(int port) { | |
return null; | ||
} | ||
}; | ||
Supplier<WebDriver> edgeDriverSupplier = () -> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please also update the comment at line 49 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've added it, thanks! |
||
try { | ||
return new EdgeDriver(); | ||
} catch (Exception e) { | ||
LOG.error("Exception in WebDriverManager while EdgeDriver ", e); | ||
return null; | ||
} | ||
}; | ||
Supplier<WebDriver> firefoxDriverSupplier = () -> { | ||
try { | ||
return getFirefoxDriver(); | ||
|
@@ -111,14 +120,17 @@ private WebDriver constructWebDriver(int port) { | |
case "chrome": | ||
driver = chromeDriverSupplier.get(); | ||
break; | ||
case "edge": | ||
driver = edgeDriverSupplier.get(); | ||
break; | ||
case "firefox": | ||
driver = firefoxDriverSupplier.get(); | ||
break; | ||
case "safari": | ||
driver = safariDriverSupplier.get(); | ||
break; | ||
default: | ||
driver = Stream.of(chromeDriverSupplier, firefoxDriverSupplier, safariDriverSupplier) | ||
driver = Stream.of(chromeDriverSupplier, edgeDriverSupplier, firefoxDriverSupplier, safariDriverSupplier) | ||
.map(Supplier::get) | ||
.filter(Objects::nonNull) | ||
.findFirst() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used official browser actions to setup Edge driver.