Skip to content

Commit

Permalink
run tests in chrome and firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
lsoares committed Mar 4, 2024
1 parent 0664589 commit 8e40c08
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.JRELEASER_GPG_PUBLIC_KEY }}
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./gradlew clean
./gradlew clean
./gradlew test
./gradlew publish
./gradlew jreleaserFullRelease
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
branches:
- main
paths:
- lib/**
- lib/**

jobs:
build:
Expand All @@ -22,5 +22,14 @@ jobs:
run: |
sudo apt-get update && sudo apt-get install -y gnupg2 expect
- name: Test
- name: Test in Chrome
env:
BROWSER: firefox
run: ./gradlew test

- name: Test in Firefox
env:
BROWSER: firefox
run: |
./gradlew clean
./gradlew test
10 changes: 8 additions & 2 deletions lib/src/test/kotlin/seleniumtestinglib/driver.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@ package seleniumtestinglib

import org.openqa.selenium.chrome.ChromeDriver
import org.openqa.selenium.chrome.ChromeOptions
import org.openqa.selenium.firefox.FirefoxDriver
import org.openqa.selenium.firefox.FirefoxOptions
import org.openqa.selenium.remote.RemoteWebDriver
import java.lang.System.getenv

val driver by lazy {
ChromeDriver(ChromeOptions().addArguments("--headless"))
val driver: RemoteWebDriver by lazy {
when (getenv("BROWSER")) {
"firefox" -> FirefoxDriver(FirefoxOptions().addArguments("--headless"))
else -> ChromeDriver(ChromeOptions().addArguments("--headless"))
}
}

fun RemoteWebDriver.render(body: String): User {
Expand Down

0 comments on commit 8e40c08

Please sign in to comment.