Skip to content

Commit e35afe4

Browse files
README: document tunnel-identifier routing; wait for assets before embedding failure screenshots
1 parent 78d9437 commit e35afe4

2 files changed

Lines changed: 26 additions & 3 deletions

File tree

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,19 @@ The plugin then finds the sessions through the TestingBot builds API. Without pe
101101

102102
The TestingBot tunnel is a Java application: the agent needs **Java 11+** (17 LTS recommended) on its `PATH`. The tunnel jar is downloaded once and cached in `~/.cache/testingbot-tunnel`. Set `tunnel: false` if you don't need one.
103103

104-
**Important:** for your tests' traffic to go through the tunnel, point them at the tunnel's local relay — `http://localhost:4445/wd/hub` — instead of `https://hub.testingbot.com/wd/hub`. Sessions created against the public hub do not use the tunnel. If another tunnel may already be running on the agent, move the relay to a different port with `tunnel-args: ["--se-port", "8446"]`.
104+
**Routing your tests through the tunnel** — two options:
105+
106+
1. Point your tests at the tunnel's local relay, `http://localhost:4445/wd/hub`, instead of `https://hub.testingbot.com/wd/hub`. If another tunnel may already be running on the agent, move the relay to a different port with `tunnel-args: ["--se-port", "8446"]`.
107+
2. Keep using `https://hub.testingbot.com/wd/hub` and set a `tunnel-identifier` on the plugin; your tests then pass the same value (exported as `$TESTINGBOT_TUNNEL_IDENTIFIER`) as the `tunnel-identifier` capability in `tb:options`:
108+
109+
```js
110+
capabilities: {
111+
'tb:options': {
112+
build: process.env.TESTINGBOT_BUILD,
113+
'tunnel-identifier': process.env.TESTINGBOT_TUNNEL_IDENTIFIER,
114+
}
115+
}
116+
```
105117

106118
When a tunnel identifier is configured, it is exported as `$TESTINGBOT_TUNNEL_IDENTIFIER` so your tests can set the matching `tunnelIdentifier` capability.
107119

hooks/post-command

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,19 @@ if [[ "${annotate_enabled}" == "true" ]]; then
118118
details="${STATE_DIR}/tests.jsonl"
119119
: >"${details}"
120120
while read -r sid _; do
121-
if tb_get_test "${sid}" >>"${details}"; then
122-
echo >>"${details}"
121+
if resp="$(tb_get_test "${sid}")"; then
122+
# screenshots/video are processed shortly after a session ends; wait
123+
# briefly on failed tests so the annotation can embed a screenshot
124+
if plugin_read_bool THUMBNAILS "true"; then
125+
attempts=0
126+
while [[ "$(echo "${resp}" | jq -r '(.success == true or .success == 1) or (.assets_available == true)')" != "true" ]] \
127+
&& [[ "${attempts}" -lt 6 ]]; do
128+
sleep "${TESTINGBOT_PLUGIN_POLL_INTERVAL:-5}"
129+
attempts=$((attempts + 1))
130+
resp="$(tb_get_test "${sid}")" || break
131+
done
132+
fi
133+
printf '%s\n' "${resp}" >>"${details}"
123134
else
124135
soft_fail "Failed to fetch details of TestingBot test ${sid}"
125136
fi

0 commit comments

Comments
 (0)