@salesforcedevs/sfdocs-e2e
v1.0.13
Published
E2E test suite for SFDocs static portal pages (SSG)
Maintainers
Keywords
Readme
@salesforcedevs/sfdocs-e2e
End-to-end test suite for SFDocs portal pages, built on WebdriverIO + Mocha. It runs headless Chrome tests against a live (or locally served) SFDocs portal and generates Allure reports with video recordings on failure.
This package is published independently from the rest of the monorepo. It is not released as part of the standard yarn release workflow — see Publishing below.
What it tests
Tests are organised into three suites, each targeting a different surface:
| Suite | Config file | Default base URL | Spec paths |
| --------------- | ---------------------------- | ----------------------- | ----------------------------------------- |
| static-portal | static-portal-wdio.conf.js | http://localhost:3000 | src/portal/specs/, src/shared/specs/ |
| portal | portal-wdio.conf.js | http://localhost:3001 | src/portal/specs/, src/shared/specs/ |
| search | search-wdio.conf.js | http://localhost:3000 | src/portal/specs/scope.search.*.test.ts |
Shared specs (src/shared/specs/) cover UI components that exist on both portal and content-repo pages:
- Anchor headings, banners, breadcrumbs, callout content
- Code blocks, doc phase badges, dev-center links
- Error routes, guides, overview pages, page titles
- Redoc references, references, videos
Portal specs (src/portal/specs/) cover portal-specific pages:
/docslanding page,/docs/apislanding page- Media mapper, scoped search (guides and references)
Content-repo specs (src/content-repo/specs/) cover the content-repository portal:
- Homepage, guide and reference pages, component specifications
- Nav header, tabset, media mapper, sitemap
Running tests locally
Prerequisites
- Node.js and Yarn installed
- Google Chrome installed (ChromeDriver version is auto-detected from your local Chrome installation)
- A running SFDocs portal at the target base URL
The static-portal suite excludes the following tests that are not applicable to static builds:
docs.api.test.tsanddocs.test.ts— landing pages that don't exist in static builds- Footer tests (
should display footer) — footer component is not available in static builds
Run against the static portal (default)
# 1. Build and serve the static portal (from the monorepo root or example-portal package)
yarn build:static:portal
yarn start:static:portal # serves on http://localhost:3000
# 2. Run the static-portal suite
yarn test:e2e:static:portalRun against the live portal
# Portal must be running on http://localhost:3001
yarn test:e2e:portalRun scope search tests
yarn test:scope-searchOverride the base URL
Pass the E2E_BASE_URL environment variable to point tests at any environment:
E2E_BASE_URL=https://staging.example.com yarn test:e2e:static:portalUsing as a CLI in external projects
This package ships a sfdocs-e2e binary so consuming projects can run the suite without cloning this repo.
Install
npm install --save-dev @salesforcedevs/sfdocs-e2e
# or
yarn add --dev @salesforcedevs/sfdocs-e2eRun
# Defaults: static-portal config, http://localhost:3000
npx sfdocs-e2e
# Custom base URL
npx sfdocs-e2e --baseUrl http://localhost:8080
# Choose a config suite
npx sfdocs-e2e --config portal
npx sfdocs-e2e --config static-portal
npx sfdocs-e2e --config static-dsc-portal
npx sfdocs-e2e --config search
# Help
npx sfdocs-e2e --helpEnvironment variables
| Variable | Description |
| ----------------------- | --------------------------------------------------------------------------------- |
| E2E_BASE_URL | Base URL of the site under test (overridden by --baseUrl) |
| CHROME_DRIVER_VERSION | Pin a specific ChromeDriver version (auto-detected locally; set explicitly in CI) |
Test results and reports
Results are written to _results_/ inside the package directory:
_results_/
static-portal/
allure-raw/ # Allure XML + video attachments
videos/ # MP4 recordings of failed tests
wdio-*.log # Browser driver logsTo generate and open an Allure HTML report:
npx allure generate _results_/static-portal/allure-raw -o _results_/static-portal/allure-report --clean
npx allure open _results_/static-portal/allure-reportPublishing
This package is excluded from the monorepo's standard release script (scripts/release_npm.sh) because it is an independent test utility with its own release cadence.
When to publish
Publish a new version when:
- New test suites or specs are added
- The CLI runner (
bin/run-e2e.js) is updated - WebdriverIO or other test dependencies are upgraded
- Config files are changed in a way that affects consumers
How to publish
Always validate with an alpha release first, then promote to stable.
The e2e package is marked "private": true so it is automatically skipped during the monorepo's standard yarn release workflow. Two convenience scripts handle temporarily removing the private flag, publishing, and restoring it:
| Script | Command | Description |
| ------------------- | ---------------------------------- | ---------------------------------- |
| release:alpha:e2e | yarn release:alpha:e2e <version> | Publish with the alpha dist-tag |
| release:e2e | yarn release:e2e <version> | Publish with the latest dist-tag |
1. Publish an alpha (for testing)
cd packages/e2e
yarn release:alpha:e2e 1.0.0-alpha.0The alpha dist-tag means yarn add @salesforcedevs/sfdocs-e2e will not resolve this version by default — consumers must opt in explicitly:
# Install latest alpha
yarn add --dev @salesforcedevs/sfdocs-e2e@alpha
# Or pin to a specific alpha version
yarn add --dev @salesforcedevs/[email protected]Iterate on alphas as needed (1.0.0-alpha.1, 1.0.0-alpha.2, ...) until the release is validated.
2. Promote to stable
cd packages/e2e
yarn release:e2e 1.0.03. Future releases — bump and publish
cd packages/e2e
# Bug fix
yarn release:e2e 1.0.1
# New feature
yarn release:e2e 1.1.0
# Breaking change
yarn release:e2e 2.0.0