Skip to content

Fix Jest and WebdriverIO examples (README commands failed) - #1

Merged
jochen-testingbot merged 1 commit into
mainfrom
fix/run-as-readme
Nov 10, 2026
Merged

jochen-testingbot merged 1 commit into
mainfrom
fix/run-as-readme

Conversation

@jochen-testingbot

@jochen-testingbot jochen-testingbot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Part of https://testingbot-team.atlassian.net/browse/TB-1008 (docs audit). This repo is the Puppeteer sample project in the signup onboarding.

Results running the README in a clean node:22-bookworm-slim container (before this PR)

Command Result
npm run test:puppeteer:chrome PASS
npm run test:puppeteer:edge PASS
npm run test:puppeteer:firefox FAIL TargetCloseError: Protocol error (Target.getBrowserContexts): Target closed (not fixed here, see below)
npm run test:jest FAIL 4/4 ProtocolError: ... Missing key or secret
npm run test:webdriverio FAIL pattern ./examples/webdriverio/test.js did not match any file and Couldn't find plugin "testingbot" service

Changes

  • Jest: credentials in wss://key:secret@... are not accepted by the endpoint; pass them in tb:options via ?capabilities= (same as the Puppeteer examples). Replaced selectors that no longer exist on testingbot.com (.navbar-brand, .features) with .navigation span and a[href="/features"]. Guarded browser.close().
  • WebdriverIO: specs is resolved relative to the config file, so it is now ./test.js. Added the missing @wdio/testingbot-service (^9.33.1, same major as the other wdio packages). Same selector fixes.

Verification (after)

npm run test:jest        -> Tests: 4 passed, 4 total
npm run test:webdriverio -> 4 passing; Spec Files: 1 passed
                            session 34cde9f879a2-0a93a6464bec-6c50b4ee83c5-179424389494-69562672
npm run test:puppeteer:chrome / :edge -> Test passed!

Not fixed: Firefox

test:puppeteer:firefox fails on the TestingBot side. I tried puppeteer-core 24.8.2 and 25.16.0, browserVersion latest and 128, and protocol: 'webDriverBiDi'. CDP fails with Target closed; BiDi hangs until a 120 s timeout. The /support/web-automate/puppeteer Firefox tab uses the same pattern. This is flagged on TB-1008 as a platform issue, so the example is left unchanged.

- Jest: credentials in the wss:// userinfo were rejected ('Missing key or
  secret'); pass them in tb:options like the Puppeteer examples. Replace
  selectors that no longer exist on testingbot.com (.navbar-brand,
  .features). Guard browser.close() in afterAll.
- WebdriverIO: specs path is resolved relative to the config file, so
  './examples/webdriverio/test.js' matched nothing; add the missing
  @wdio/testingbot-service dependency; same selector fixes.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approved

The reviewed changes address the documented authentication, file-path, selector, dependency, and cleanup problems, with no active review issues remaining.

No open issues 🎉

What changed in this PR

This pull request fixes the Jest and WebdriverIO examples so the documented commands authenticate with TestingBot, locate the correct test files, and use current website selectors.

Changes:

  • Passes Jest credentials through encoded TestingBot capabilities and safely closes the browser.
  • Updates Jest and WebdriverIO selectors for the current TestingBot site.
  • Adds the WebdriverIO TestingBot service dependency.
  • Corrects the WebdriverIO config-relative spec path and refreshes the lockfile.
File Description
package.json Adds the WebdriverIO TestingBot service dependency.
package-lock.json Locks the new service and dependency tree.
examples/​webdriverio/​wdio.conf.js Corrects spec resolution relative to the configuration file.
examples/​webdriverio/​test.js Updates website selectors and assertions.
examples/​jest/​puppeteer.test.js Uses capability-based credentials, current selectors, and guarded cleanup.

Review effort: Lite

@jochen-testingbot
jochen-testingbot merged commit 31c74bc into main Nov 10, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants