@salesforcedevs/sfdocs-e2e 0.6.134-cache-test-2 → 1.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +163 -33
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -1,63 +1,193 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @salesforcedevs/sfdocs-e2e
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
End-to-end test suite for SFDocs portal pages, built on [WebdriverIO](https://webdriver.io/) + Mocha. It runs headless Chrome tests against a live (or locally served) SFDocs portal and generates Allure reports with video recordings on failure.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
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](#publishing) below.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## What it tests
|
|
10
|
+
|
|
11
|
+
Tests are organised into three suites, each targeting a different surface:
|
|
12
|
+
|
|
13
|
+
| Suite | Config file | Default base URL | Spec paths |
|
|
14
|
+
| --------------- | ---------------------------- | ----------------------- | ----------------------------------------- |
|
|
15
|
+
| `static-portal` | `static-portal-wdio.conf.js` | `http://localhost:3000` | `src/portal/specs/`, `src/shared/specs/` |
|
|
16
|
+
| `portal` | `portal-wdio.conf.js` | `http://localhost:3001` | `src/portal/specs/`, `src/shared/specs/` |
|
|
17
|
+
| `search` | `search-wdio.conf.js` | `http://localhost:3000` | `src/portal/specs/scope.search.*.test.ts` |
|
|
18
|
+
|
|
19
|
+
**Shared specs** (`src/shared/specs/`) cover UI components that exist on both portal and content-repo pages:
|
|
20
|
+
|
|
21
|
+
- Anchor headings, banners, breadcrumbs, callout content
|
|
22
|
+
- Code blocks, doc phase badges, dev-center links
|
|
23
|
+
- Error routes, guides, overview pages, page titles
|
|
24
|
+
- Redoc references, references, videos
|
|
25
|
+
|
|
26
|
+
**Portal specs** (`src/portal/specs/`) cover portal-specific pages:
|
|
27
|
+
|
|
28
|
+
- `/docs` landing page, `/docs/apis` landing page
|
|
29
|
+
- Media mapper, scoped search (guides and references)
|
|
30
|
+
|
|
31
|
+
**Content-repo specs** (`src/content-repo/specs/`) cover the content-repository portal:
|
|
32
|
+
|
|
33
|
+
- Homepage, guide and reference pages, component specifications
|
|
34
|
+
- Nav header, tabset, media mapper, sitemap
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Running tests locally
|
|
39
|
+
|
|
40
|
+
### Prerequisites
|
|
41
|
+
|
|
42
|
+
- Node.js and Yarn installed
|
|
43
|
+
- Google Chrome installed (ChromeDriver version is auto-detected from your local Chrome installation)
|
|
44
|
+
- A running SFDocs portal at the target base URL
|
|
45
|
+
|
|
46
|
+
### Run against the static portal (default)
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# 1. Build and serve the static portal (from the monorepo root or example-portal package)
|
|
50
|
+
yarn build:static:portal
|
|
51
|
+
yarn start:static:portal # serves on http://localhost:3000
|
|
52
|
+
|
|
53
|
+
# 2. Run the static-portal suite
|
|
54
|
+
yarn test:e2e:static:portal
|
|
9
55
|
```
|
|
10
56
|
|
|
11
|
-
|
|
57
|
+
### Run against the live portal
|
|
12
58
|
|
|
13
|
-
|
|
59
|
+
```bash
|
|
60
|
+
# Portal must be running on http://localhost:3001
|
|
61
|
+
yarn test:e2e:portal
|
|
62
|
+
```
|
|
14
63
|
|
|
15
|
-
|
|
64
|
+
### Run scope search tests
|
|
16
65
|
|
|
17
|
-
|
|
66
|
+
```bash
|
|
67
|
+
yarn test:scope-search
|
|
68
|
+
```
|
|
18
69
|
|
|
19
|
-
|
|
70
|
+
### Override the base URL
|
|
20
71
|
|
|
21
|
-
|
|
72
|
+
Pass the `E2E_BASE_URL` environment variable to point tests at any environment:
|
|
22
73
|
|
|
23
|
-
|
|
74
|
+
```bash
|
|
75
|
+
E2E_BASE_URL=https://staging.example.com yarn test:e2e:static:portal
|
|
76
|
+
```
|
|
24
77
|
|
|
25
|
-
|
|
78
|
+
---
|
|
26
79
|
|
|
27
|
-
|
|
80
|
+
## Using as a CLI in external projects
|
|
28
81
|
|
|
29
|
-
|
|
82
|
+
This package ships a `sfdocs-e2e` binary so consuming projects can run the suite without cloning this repo.
|
|
30
83
|
|
|
31
|
-
|
|
84
|
+
### Install
|
|
32
85
|
|
|
86
|
+
```bash
|
|
87
|
+
npm install --save-dev @salesforcedevs/sfdocs-e2e
|
|
88
|
+
# or
|
|
89
|
+
yarn add --dev @salesforcedevs/sfdocs-e2e
|
|
33
90
|
```
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
91
|
+
|
|
92
|
+
### Run
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# Defaults: static-portal config, http://localhost:3000
|
|
96
|
+
npx sfdocs-e2e
|
|
97
|
+
|
|
98
|
+
# Custom base URL
|
|
99
|
+
npx sfdocs-e2e --baseUrl http://localhost:8080
|
|
100
|
+
|
|
101
|
+
# Choose a config suite
|
|
102
|
+
npx sfdocs-e2e --config portal
|
|
103
|
+
npx sfdocs-e2e --config static-portal
|
|
104
|
+
npx sfdocs-e2e --config search
|
|
105
|
+
|
|
106
|
+
# Help
|
|
107
|
+
npx sfdocs-e2e --help
|
|
41
108
|
```
|
|
42
109
|
|
|
43
|
-
###
|
|
110
|
+
### Environment variables
|
|
111
|
+
|
|
112
|
+
| Variable | Description |
|
|
113
|
+
| ----------------------- | --------------------------------------------------------------------------------- |
|
|
114
|
+
| `E2E_BASE_URL` | Base URL of the site under test (overridden by `--baseUrl`) |
|
|
115
|
+
| `CHROME_DRIVER_VERSION` | Pin a specific ChromeDriver version (auto-detected locally; set explicitly in CI) |
|
|
116
|
+
|
|
117
|
+
---
|
|
44
118
|
|
|
45
|
-
|
|
119
|
+
## Test results and reports
|
|
120
|
+
|
|
121
|
+
Results are written to `_results_/` inside the package directory:
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
_results_/
|
|
125
|
+
static-portal/
|
|
126
|
+
allure-raw/ # Allure XML + video attachments
|
|
127
|
+
videos/ # MP4 recordings of failed tests
|
|
128
|
+
wdio-*.log # Browser driver logs
|
|
129
|
+
```
|
|
46
130
|
|
|
47
|
-
|
|
48
|
-
user pwd as below.
|
|
131
|
+
To generate and open an Allure HTML report:
|
|
49
132
|
|
|
133
|
+
```bash
|
|
134
|
+
npx allure generate _results_/static-portal/allure-raw -o _results_/static-portal/allure-report --clean
|
|
135
|
+
npx allure open _results_/static-portal/allure-report
|
|
50
136
|
```
|
|
51
|
-
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Publishing
|
|
141
|
+
|
|
142
|
+
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.
|
|
143
|
+
|
|
144
|
+
### When to publish
|
|
145
|
+
|
|
146
|
+
Publish a new version when:
|
|
147
|
+
|
|
148
|
+
- New test suites or specs are added
|
|
149
|
+
- The CLI runner (`bin/run-e2e.js`) is updated
|
|
150
|
+
- WebdriverIO or other test dependencies are upgraded
|
|
151
|
+
- Config files are changed in a way that affects consumers
|
|
152
|
+
|
|
153
|
+
### How to publish
|
|
154
|
+
|
|
155
|
+
Always validate with an alpha release first, then promote to stable.
|
|
156
|
+
|
|
157
|
+
**1. Publish an alpha (for testing)**
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
cd packages/e2e
|
|
161
|
+
yarn publish --tag alpha --new-version 1.0.0-alpha.0
|
|
52
162
|
```
|
|
53
163
|
|
|
54
|
-
|
|
164
|
+
The `alpha` dist-tag means `npm install @salesforcedevs/sfdocs-e2e` will **not** resolve this version by default — consumers must opt in explicitly:
|
|
55
165
|
|
|
56
|
-
|
|
166
|
+
```bash
|
|
167
|
+
# Install latest alpha
|
|
168
|
+
yarn add --dev @salesforcedevs/sfdocs-e2e@alpha
|
|
57
169
|
|
|
170
|
+
# Or pin to a specific alpha version
|
|
171
|
+
yarn add --dev @salesforcedevs/sfdocs-e2e@1.0.0-alpha.0
|
|
58
172
|
```
|
|
59
|
-
|
|
173
|
+
|
|
174
|
+
Iterate on alphas as needed (`1.0.0-alpha.1`, `1.0.0-alpha.2`, ...) until the release is validated.
|
|
175
|
+
|
|
176
|
+
**2. Promote to stable**
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
yarn publish --tag latest --new-version 1.0.0
|
|
60
180
|
```
|
|
61
181
|
|
|
62
|
-
|
|
63
|
-
|
|
182
|
+
**3. Future releases — bump and publish**
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
# Bug fix
|
|
186
|
+
yarn publish --tag latest --new-version 1.0.1
|
|
187
|
+
|
|
188
|
+
# New feature
|
|
189
|
+
yarn publish --tag latest --new-version 1.1.0
|
|
190
|
+
|
|
191
|
+
# Breaking change
|
|
192
|
+
yarn publish --tag latest --new-version 2.0.0
|
|
193
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/sfdocs-e2e",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-alpha.0",
|
|
4
4
|
"description": "E2E test suite for SFDocs static portal pages (SSG)",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"bin": {
|
|
@@ -35,6 +35,5 @@
|
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/mocha": "^10.0.1"
|
|
38
|
-
}
|
|
39
|
-
"gitHead": "5c846e08135126b2e8fdcf6d752f97eea13fbbae"
|
|
38
|
+
}
|
|
40
39
|
}
|