This is an automated email from the ASF dual-hosted git repository.
joshtynjala pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/royale-docs.git
The following commit(s) were added to refs/heads/master by this push:
new 19abea6 royaleunit: Playwright and commandArgs
19abea6 is described below
commit 19abea65e23f0902b74dba672f577b16a0f9fb3a
Author: Josh Tynjala <[email protected]>
AuthorDate: Wed Sep 28 14:16:41 2022 -0700
royaleunit: Playwright and commandArgs
---
testing/royaleunit/run-unit-tests-with-ant.md | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/testing/royaleunit/run-unit-tests-with-ant.md
b/testing/royaleunit/run-unit-tests-with-ant.md
index d4fb03b..7394c67 100644
--- a/testing/royaleunit/run-unit-tests-with-ant.md
+++ b/testing/royaleunit/run-unit-tests-with-ant.md
@@ -36,15 +36,19 @@ Replace the `${royalesdk}` token with the path to the
Apache Royale SDK on your
## Run unit tests in HTML and JavaScript
-To run unit tests with a web browser and JavaScript, set the `player`
attribute to `"html"`. This tells the Ant task to use the WebSocket protocol.
Set the `swf` attribute to the path to an *.html* file:
+To run unit tests for JavaScript with a web browser, set the `player`
attribute to either `"chromium"`, `"webkit"`, or `"firefox"`. Or you can set it
to `"html"`, if you don't have a browser preference. This tells the Ant task to
use [Playwright](https://playwright.dev) to launch a _headless_ browser that
connects to using WebSockets. Set the `swf` attribute to the path to an *.html*
file:
```xml
-<royaleunit player="html" swf="${basedir}/bin/js-debug/index.html"/>
+<royaleunit player="webkit" swf="${basedir}/bin/js-debug/index.html"/>
```
-In the example above, we point to the *index.html* file generated by the
Apache Royale compiler in *bin/js-debug*.
+In the example above, we point to the *index.html* file generated by the
Apache Royale compiler in *bin/js-debug*, and we specifiy that the tests should
be run in WebKit.
-By default, the unit tests will run in your computer's default web browser. To
run in a specific web browser, you may specify the path to an executable using
the `command` attribute.
+### Custom browser executable
+
+By default, Ant will run the unit tests in a _headless_ browser powered by
[Playwright](https://playwright.dev). To run using a specific browser
executable, you may specify the executable's path using the `command` attribute.
+
+> In Royale 0.9.9 and older, Playwright was not yet supported, and Ant would
launch the tests in your system's default web browser, when no command
executable is specified.
In the following example, we'll run unit tests in Google Chrome.
@@ -62,6 +66,14 @@ On macOS, set the `command` to the executable **inside** an
*.app* package:
command="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"/>
```
+If you need to pass arguments to the executable, set the `commandArgs`
attribute:
+
+```xml
+<royaleunit player="html" swf="path/to/file.html"
+ command="c:/Program Files/Google/Chrome/Application/chrome.exe"
+ commandArgs="--no-sandbox --user-data-dir=custom_chrome_profile
--no-first-run"/>
+```
+
## Run unit tests in Adobe Flash Player
To run unit tests with Adobe Flash Player, set the `player` attribute to
`"flash"`. Set the `swf` attribute to the path of a *.swf* file:
@@ -91,5 +103,5 @@ On macOS, set the `command` to the executable **inside** an
*.app* package:
To fail the Ant build if the unit tests fail, set the `haltonfailure`
attribute to `true`:
```xml
-<royaleunit player="html" swf="${basedir}/bin/js-debug/index.html"
haltonfailure="true"/>
+<royaleunit player="chromium" swf="${basedir}/bin/js-debug/index.html"
haltonfailure="true"/>
```
\ No newline at end of file