Skip to content

gmkumar2005/scala-js-env-playwright

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build status Scala CI

scala-js-env-playwright

A JavaScript environment for Scala.js (a JSEnv) running playwright

Usage

Add the following line to your project/plugins.sbt

// For Scala.js 1.x
libraryDependencies += "io.github.gmkumar2005" %% "scala-js-env-playwright" % "0.1.2-SNAPSHOT"

Add the following line to your build.sbt

Test / jsEnv := new PWEnv(
      browserName = "chrome",
      headless = true,
      showLogs = true
    )

Avoid trouble

  • This is a very early version. It is not yet published to maven central. You need to clone this repo and do a sbt publishLocal to use it.
  • It works only with Scala.js 1.x
  • Make sure the project is set up to use ModuleKind.ESModule in the Scala.js project.
      // For Scala.js 1.x
      scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.ESModule) }
  • Some projects which may need to use both Selenium and Playwright may run into google execption. To resolve this, add the following line to your plugins.sbt
libraryDependencies += "com.google.guava" % "guava" % "33.0.0-jre"

KeepAlive configuration

lazy val pwenvConfig = Def.setting {
  jsenv.playwright.PWEnv
    .Config()
    .withKeepAlive(false)
}

jsEnv := new jsenv.playwright.PWEnv(
  browserName = "chrome",
  headless = true,
  showLogs = true,
  pwenvConfig.value,
)

References

Todo

  • Add examples to demonstrate how to use LaunchOptions
  • Add feature to keepAlive the browser
  • Optimize to use a single browser instance for all tests by creating multiple tabs
  • Configure github actions to test this project
  • Configure github actions to publish to maven central
  • Verify debug mode works
  • Verify other test frameworks work
  • Verify it works on windows and Linux

About

A JavaScript environment for Scala.js (JSEnv) running playwright

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •