Skip to content

Commit

Permalink
Fix settings map
Browse files Browse the repository at this point in the history
  • Loading branch information
bjuric committed Oct 28, 2024
1 parent 485fb9c commit 4c7207a
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
4.0.0
=====
27 October 2024
28 October 2024
- Introduce Gwen processes to support multiple launch configurations
- `-p|--process` option
- Require Java 17+ instead of Java 11+
Expand Down
2 changes: 1 addition & 1 deletion gwen.conf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ gwen {
feature {
mode = "imperative" # declarative|imperative
}
launch { # Default launch options
launch { # Launch options
options { # See: https://gweninterpreter.org/docs/settings#launch-settings
batch = false
format = [
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/init/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FROM node:21-alpine
# install bash and java
RUN apk update \
&& apk add bash \
&& apk add openjdk11-jre
&& apk add openjdk17-jre

# Run as a non root user
RUN addgroup -S gwen && adduser -S gwen -G gwen -u 4936
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/init/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ services:
ports:
- "4444:4444"
volumes:
- "$PWD/${gwen.initDir}${slash}browsers:/etc/selenoid/:ro"
- "$PWD/${gwen.initDir}${slash}conf/browsers:/etc/selenoid/:ro"
- "/var/run/docker.sock:/var/run/docker.sock"
- "$PWD/${gwen.initDir}${slash}output/.video:/opt/selenoid/video"
environment:
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/init/gwen.conf
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ gwen {
readOnly = true
}
}
launch { # Default launch options
launch { # Launch options
options { # See: https://gweninterpreter.org/docs/settings#launch-settings
batch = false
features = [
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/gwen/web/eval/WebSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ object WebSettings extends LazyLogging {
*/
def `gwen.web.capture.screenshots.enabled`: Boolean = {
Settings.getBoolean("gwen.web.capture.screenshots.enabled", Some("gwen.web.capture.screenshots")) tap { isSet =>
if (isSet) sys.props += (("gwen.report.slideshow.create", true.toString))
if (isSet) Settings.set("gwen.report.slideshow.create", true.toString)
}
}

Expand All @@ -233,7 +233,7 @@ object WebSettings extends LazyLogging {
*/
def `gwen.web.capture.screenshots.highlighting`: Boolean = {
Settings.getBoolean("gwen.web.capture.screenshots.highlighting") tap { isSet =>
if (isSet) sys.props += (("gwen.report.slideshow.create", true.toString))
if (isSet) Settings.set("gwen.report.slideshow.create", true.toString)
}
}

Expand Down
22 changes: 22 additions & 0 deletions src/test/scala/gwen/web/eval/WebSettingsTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ import gwen.core.status.StatusKeyword
import org.scalatest.matchers.should.Matchers
import org.scalatestplus.mockito.MockitoSugar

import scala.jdk.CollectionConverters._

import java.io.File
import java.util.logging.Level

Expand Down Expand Up @@ -334,6 +336,26 @@ class WebSettingsTest extends BaseTest with Matchers with MockitoSugar {

}

"Selenoid capabilties" should "load" in {
Settings.exclusively {
withSetting("gwen.initDir", ".") {
Settings.init(
List(
new File("src/main/resources/init/gwen.conf"),
new File("src/main/resources/init/conf/browsers/chrome.conf"),
new File("src/main/resources/init/conf/browsers/selenoid.conf")
)
)
val caps = WebSettings.`gwen.web.capabilities`.asMap.asScala
caps.size should be (1)
val options = caps("selenoid:options").asInstanceOf[java.util.HashMap[String, Object]]
options.get("enableVNC").toString should be ("true")
options.get("enableVideo").toString should be ("true")
caps.get("\"selenoid:options\"") should be (None)
}
}
}

"Results files in gwen init conf" should "resolve" in {
Settings.exclusively {
withSetting("gwen.initDir", "gwen") {
Expand Down

0 comments on commit 4c7207a

Please sign in to comment.