Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions doc/project/js-environments.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,51 @@ jsEnv := PhantomJSEnv(args = Seq("arg1", "arg2")).value
For more options of the PhantomJS environment, see
[the Scaladoc of `PhantomJSEnv`]({{ site.production_url }}/api/sbt-scalajs-env-phantomjs/1.0.0/org/scalajs/jsenv/phantomjs/sbtplugin/PhantomJSEnvPlugin$$autoImport$.html).

## Playwright
[Playwright](https://playwright.dev/) is a comprehensive testing library, enabling automation of Chromium, Firefox, and WebKit browsers. It supports multiple platforms and languages, including Mobile Web, making it an optimal choice for testing JavaScript in real browser environments.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We keep one sentence per line for easier diffs later on:

Suggested change
[Playwright](https://playwright.dev/) is a comprehensive testing library, enabling automation of Chromium, Firefox, and WebKit browsers. It supports multiple platforms and languages, including Mobile Web, making it an optimal choice for testing JavaScript in real browser environments.
[Playwright](https://playwright.dev/) is a comprehensive testing library, enabling automation of Chromium, Firefox, and WebKit browsers.
It supports multiple platforms and languages, including Mobile Web, making it an optimal choice for testing JavaScript in real browser environments.

[`scala-js-env-playwright`](https://github.com/gmkumar2005/scala-js-env-playwright) is an independent project that offers jsEnv and employs Playwright for JavaScript execution.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[`scala-js-env-playwright`](https://github.com/gmkumar2005/scala-js-env-playwright) is an independent project that offers jsEnv and employs Playwright for JavaScript execution.
[`scala-js-env-playwright`](https://github.com/gmkumar2005/scala-js-env-playwright) is an independent project that offers a `JSEnv` that uses Playwright for JavaScript execution.

The playwright based `jsEnv` can be enabled by adding following settings in build.sbt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The playwright based `jsEnv` can be enabled by adding following settings in build.sbt
The playwright-based `jsEnv` can be enabled by adding the following settings in `build.sbt`
```scala
jsEnv := new PWEnv(
browserName = "chrome",
headless = true,
showLogs = true
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
jsEnv := new PWEnv(
browserName = "chrome",
headless = true,
showLogs = true
)
jsEnv := new PWEnv(
browserName = "chrome",
headless = true,
showLogs = true
)
```
Addtionally it requires following line in `project/plugins.sbt`:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Addtionally it requires following line in `project/plugins.sbt`:
Addtionally it requires the following line in `project/plugins.sbt`:
```scala
// For Scala.js 1.x
libraryDependencies += "io.github.gmkumar2005" %% "scala-js-env-playwright" % "0.1.8"
```

The `browserName` parameter accepts `chrome` , `chromium` , `firefox`, and `webkit` as possible options. Please be aware that webkit support is currently in an experimental stage.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The `browserName` parameter accepts `chrome` , `chromium` , `firefox`, and `webkit` as possible options. Please be aware that webkit support is currently in an experimental stage.
The `browserName` parameter accepts `chrome` , `chromium` , `firefox`, and `webkit` as possible options.
Please be aware that webkit support is currently in an experimental stage.

### In browser debugging
To maintain the browser window open post-execution, simply incorporate the `withKeepAlive` option into the environment.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"simply" never adds real meaning to a sentence; it should be removed:

Suggested change
To maintain the browser window open post-execution, simply incorporate the `withKeepAlive` option into the environment.
To maintain the browser window open post-execution, add the `withKeepAlive` option into the environment.

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

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

```
### Headless Usage
Running in headless mode is crucial for operations within Docker containers and build servers. By default, `scala-js-env-playwright` operates in headless mode. However, for debugging purposes, you can set headless to `false`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Running in headless mode is crucial for operations within Docker containers and build servers. By default, `scala-js-env-playwright` operates in headless mode. However, for debugging purposes, you can set headless to `false`.
Running in headless mode is crucial for operations within Docker containers and build servers.
By default, `scala-js-env-playwright` operates in headless mode.
However, for debugging purposes, you can set headless to `false`.

## Details
For more options of the plawwright environment see the github project [PlayWright-jsEnv](https://github.com/gmkumar2005/scala-js-env-playwright)

## Selenium

[Selenium](http://docs.seleniumhq.org/) provides a programmatic interface to real browsers.
Expand Down
2 changes: 1 addition & 1 deletion doc/tutorial/basic/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ After reloading, you can invoke `run` successfully:
[info] Running tutorial.webapp.TutorialApp
[success] (...)

Alternatively to Node.js with jsdom, you can use [Selenium](http://docs.seleniumhq.org/).
Alternatively to Node.js with jsdom, you can use [Selenium](http://docs.seleniumhq.org/) or [Playwright](https://github.com/gmkumar2005/scala-js-env-playwright)
You can find more information about this in the [documentation about JavaScript environments]({{ BASE_PATH }}/doc/project/js-environments.html).

### Adding uTest
Expand Down