@salesforcedevs/sfdocs-e2e 1.0.0-alpha.0 → 1.0.0-alpha.11
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 +21 -6
- package/bin/publish.sh +31 -0
- package/package.json +4 -2
- package/src/shared/specs/internalLinks.test.ts +70 -0
package/README.md
CHANGED
|
@@ -43,6 +43,11 @@ Tests are organised into three suites, each targeting a different surface:
|
|
|
43
43
|
- Google Chrome installed (ChromeDriver version is auto-detected from your local Chrome installation)
|
|
44
44
|
- A running SFDocs portal at the target base URL
|
|
45
45
|
|
|
46
|
+
The `static-portal` suite excludes the following tests that are not applicable to static builds:
|
|
47
|
+
|
|
48
|
+
- `docs.api.test.ts` and `docs.test.ts` — landing pages that don't exist in static builds
|
|
49
|
+
- Footer tests (`should display footer`) — footer component is not available in static builds
|
|
50
|
+
|
|
46
51
|
### Run against the static portal (default)
|
|
47
52
|
|
|
48
53
|
```bash
|
|
@@ -154,14 +159,21 @@ Publish a new version when:
|
|
|
154
159
|
|
|
155
160
|
Always validate with an alpha release first, then promote to stable.
|
|
156
161
|
|
|
162
|
+
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:
|
|
163
|
+
|
|
164
|
+
| Script | Command | Description |
|
|
165
|
+
| ------------------- | ---------------------------------- | ---------------------------------- |
|
|
166
|
+
| `release:alpha:e2e` | `yarn release:alpha:e2e <version>` | Publish with the `alpha` dist-tag |
|
|
167
|
+
| `release:e2e` | `yarn release:e2e <version>` | Publish with the `latest` dist-tag |
|
|
168
|
+
|
|
157
169
|
**1. Publish an alpha (for testing)**
|
|
158
170
|
|
|
159
171
|
```bash
|
|
160
172
|
cd packages/e2e
|
|
161
|
-
yarn
|
|
173
|
+
yarn release:alpha:e2e 1.0.0-alpha.0
|
|
162
174
|
```
|
|
163
175
|
|
|
164
|
-
The `alpha` dist-tag means `
|
|
176
|
+
The `alpha` dist-tag means `yarn add @salesforcedevs/sfdocs-e2e` will **not** resolve this version by default — consumers must opt in explicitly:
|
|
165
177
|
|
|
166
178
|
```bash
|
|
167
179
|
# Install latest alpha
|
|
@@ -176,18 +188,21 @@ Iterate on alphas as needed (`1.0.0-alpha.1`, `1.0.0-alpha.2`, ...) until the re
|
|
|
176
188
|
**2. Promote to stable**
|
|
177
189
|
|
|
178
190
|
```bash
|
|
179
|
-
|
|
191
|
+
cd packages/e2e
|
|
192
|
+
yarn release:e2e 1.0.0
|
|
180
193
|
```
|
|
181
194
|
|
|
182
195
|
**3. Future releases — bump and publish**
|
|
183
196
|
|
|
184
197
|
```bash
|
|
198
|
+
cd packages/e2e
|
|
199
|
+
|
|
185
200
|
# Bug fix
|
|
186
|
-
yarn
|
|
201
|
+
yarn release:e2e 1.0.1
|
|
187
202
|
|
|
188
203
|
# New feature
|
|
189
|
-
yarn
|
|
204
|
+
yarn release:e2e 1.1.0
|
|
190
205
|
|
|
191
206
|
# Breaking change
|
|
192
|
-
yarn
|
|
207
|
+
yarn release:e2e 2.0.0
|
|
193
208
|
```
|
package/bin/publish.sh
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
VERSION="${1:?Usage: publish.sh <version> [--tag <tag>]}"
|
|
5
|
+
shift
|
|
6
|
+
|
|
7
|
+
cp package.json .package.json.bak
|
|
8
|
+
|
|
9
|
+
cleanup() {
|
|
10
|
+
mv .package.json.bak package.json
|
|
11
|
+
node -e "
|
|
12
|
+
var p = require('./package.json');
|
|
13
|
+
p.version = '$VERSION';
|
|
14
|
+
require('fs').writeFileSync('package.json', JSON.stringify(p, null, 2) + '\n');
|
|
15
|
+
"
|
|
16
|
+
git add package.json
|
|
17
|
+
git commit --amend --no-edit
|
|
18
|
+
}
|
|
19
|
+
trap cleanup EXIT
|
|
20
|
+
|
|
21
|
+
node -e "
|
|
22
|
+
var p = require('./package.json');
|
|
23
|
+
delete p.private;
|
|
24
|
+
require('fs').writeFileSync('package.json', JSON.stringify(p, null, 2) + '\n');
|
|
25
|
+
"
|
|
26
|
+
|
|
27
|
+
if [ "$#" -gt 0 ]; then
|
|
28
|
+
yarn publish --new-version "$VERSION" "$@"
|
|
29
|
+
else
|
|
30
|
+
yarn publish --new-version "$VERSION"
|
|
31
|
+
fi
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/sfdocs-e2e",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.11",
|
|
4
4
|
"description": "E2E test suite for SFDocs static portal pages (SSG)",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"bin": {
|
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
"test:e2e": "TS_NODE_TRANSPILE_ONLY=true TS_NODE_PROJECT=./tsconfig.json wdio wdio.conf.js",
|
|
17
17
|
"test:e2e:portal": "TS_NODE_TRANSPILE_ONLY=true TS_NODE_PROJECT=./tsconfig.json wdio portal-wdio.conf.js",
|
|
18
18
|
"test:e2e:static:portal": "TS_NODE_TRANSPILE_ONLY=true TS_NODE_PROJECT=./tsconfig.json wdio static-portal-wdio.conf.js",
|
|
19
|
-
"test:scope-search": "TS_NODE_TRANSPILE_ONLY=true TS_NODE_PROJECT=./tsconfig.json wdio search-wdio.conf.js"
|
|
19
|
+
"test:scope-search": "TS_NODE_TRANSPILE_ONLY=true TS_NODE_PROJECT=./tsconfig.json wdio search-wdio.conf.js",
|
|
20
|
+
"release:alpha:e2e": "f() { bash bin/publish.sh $1 --tag alpha; }; f",
|
|
21
|
+
"release:e2e": "f() { bash bin/publish.sh $1; }; f"
|
|
20
22
|
},
|
|
21
23
|
"dependencies": {
|
|
22
24
|
"@sa11y/wdio": "^7.0.0",
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import GuidePage from '../pageobjects/guide.page';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* E2E tests for internal link resolution (internalReferencePlugin + referenceLinkTransformerPlugin).
|
|
5
|
+
* Covered: relative .md → .html resolution, guide-to-guide links, reference-to-guide links,
|
|
6
|
+
* external links.
|
|
7
|
+
**/
|
|
8
|
+
describe('Internal link resolution', () => {
|
|
9
|
+
const UPDATE_ORDER_STATES_PAGE =
|
|
10
|
+
'/docs/commerce/test-cc-orders-api/guide/update-order-states.html';
|
|
11
|
+
const QUICK_START_PAGE = '/docs/commerce/test-cc-orders-api/guide/quick-start.html';
|
|
12
|
+
const REFERENCE_PAGE =
|
|
13
|
+
'/docs/success/sfdocs/references/markdown-cheatsheet/markdown-cheatsheet.html#how-to-link-between-overviews-guides-and-references';
|
|
14
|
+
|
|
15
|
+
let page: GuidePage;
|
|
16
|
+
|
|
17
|
+
it('should resolve relative guide link correctly', async () => {
|
|
18
|
+
page = new GuidePage(UPDATE_ORDER_STATES_PAGE);
|
|
19
|
+
page.open();
|
|
20
|
+
await page.waitPageLoad();
|
|
21
|
+
|
|
22
|
+
const ordersApiLink = await $('a.internal-link-guide[href*="orders-api-overview"]');
|
|
23
|
+
await ordersApiLink.waitForDisplayed();
|
|
24
|
+
const href = await ordersApiLink.getAttribute('href');
|
|
25
|
+
expect(href).not.toMatch(/\.md(?:\?|#|$)/);
|
|
26
|
+
expect(href).toContain('orders-api-overview.html');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('should resolve guide linking in same folder correctly', async () => {
|
|
30
|
+
page = new GuidePage(QUICK_START_PAGE);
|
|
31
|
+
page.open();
|
|
32
|
+
await page.waitPageLoad();
|
|
33
|
+
|
|
34
|
+
await (await $('>>> doc-heading[hash="see-also"]')).waitForDisplayed();
|
|
35
|
+
|
|
36
|
+
const understandTheBasicsLink = await $('=Understand the Basics');
|
|
37
|
+
await understandTheBasicsLink.waitForDisplayed();
|
|
38
|
+
const href = await understandTheBasicsLink.getAttribute('href');
|
|
39
|
+
expect(href).not.toMatch(/\.md(?:\?|#|$)/);
|
|
40
|
+
expect(href).toContain('understand-the-basics.html');
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('should have html link for reference to guide linking', async () => {
|
|
44
|
+
page = new GuidePage(REFERENCE_PAGE);
|
|
45
|
+
page.open();
|
|
46
|
+
await page.waitPageLoad();
|
|
47
|
+
|
|
48
|
+
await (
|
|
49
|
+
await $('>>> doc-heading[hash="how-to-link-between-overviews-guides-and-references"]')
|
|
50
|
+
).waitForDisplayed();
|
|
51
|
+
|
|
52
|
+
const threeContentTypesLink = await $('=three content types');
|
|
53
|
+
await threeContentTypesLink.waitForDisplayed();
|
|
54
|
+
const href = await threeContentTypesLink.getAttribute('href');
|
|
55
|
+
expect(href).toContain('guide');
|
|
56
|
+
expect(href).toMatch(/\.html(?:#|$|\?)/);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('should treat external links as external', async () => {
|
|
60
|
+
page = new GuidePage(REFERENCE_PAGE);
|
|
61
|
+
page.open();
|
|
62
|
+
await page.waitPageLoad();
|
|
63
|
+
|
|
64
|
+
const externalLinks = await $$('a.external-link-guide');
|
|
65
|
+
expect(externalLinks.length).toBeGreaterThan(0);
|
|
66
|
+
for (const link of externalLinks) {
|
|
67
|
+
expect(await link.getAttribute('target')).toBe('_blank');
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
});
|