@salesforcedevs/sfdocs-e2e 1.0.3 → 1.0.4-skip-footer
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 +8 -19
- package/package.json +5 -3
- package/src/content-repo/specs/homepage.test.ts +1 -1
- package/src/shared/pageobjects/page.ts +3 -3
- package/src/shared/specs/layout-tests.ts +3 -5
- package/src/shared/specs/reference.test.ts +0 -3
- package/static-portal-wdio.conf.js +7 -0
- package/bin/publish.sh +0 -31
- package/src/shared/specs/internalLinks.test.ts +0 -70
package/README.md
CHANGED
|
@@ -43,11 +43,6 @@ 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
|
-
|
|
51
46
|
### Run against the static portal (default)
|
|
52
47
|
|
|
53
48
|
```bash
|
|
@@ -159,18 +154,13 @@ Publish a new version when:
|
|
|
159
154
|
|
|
160
155
|
Always validate with an alpha release first, then promote to stable.
|
|
161
156
|
|
|
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
|
-
|
|
169
157
|
**1. Publish an alpha (for testing)**
|
|
170
158
|
|
|
159
|
+
> The e2e package is marked `"private": true` so it is automatically skipped during the monorepo's standard `yarn release` workflow.
|
|
160
|
+
|
|
171
161
|
```bash
|
|
172
162
|
cd packages/e2e
|
|
173
|
-
yarn
|
|
163
|
+
yarn publish --tag alpha --new-version 1.0.0-alpha.0
|
|
174
164
|
```
|
|
175
165
|
|
|
176
166
|
The `alpha` dist-tag means `yarn add @salesforcedevs/sfdocs-e2e` will **not** resolve this version by default — consumers must opt in explicitly:
|
|
@@ -189,20 +179,19 @@ Iterate on alphas as needed (`1.0.0-alpha.1`, `1.0.0-alpha.2`, ...) until the re
|
|
|
189
179
|
|
|
190
180
|
```bash
|
|
191
181
|
cd packages/e2e
|
|
192
|
-
yarn
|
|
182
|
+
yarn publish --tag latest --new-version 1.0.0
|
|
193
183
|
```
|
|
194
184
|
|
|
195
185
|
**3. Future releases — bump and publish**
|
|
196
186
|
|
|
197
187
|
```bash
|
|
198
|
-
cd packages/e2e
|
|
199
|
-
|
|
200
188
|
# Bug fix
|
|
201
|
-
|
|
189
|
+
cd packages/e2e
|
|
190
|
+
yarn publish --tag latest --new-version 1.0.1
|
|
202
191
|
|
|
203
192
|
# New feature
|
|
204
|
-
yarn
|
|
193
|
+
yarn publish --tag latest --new-version 1.1.0
|
|
205
194
|
|
|
206
195
|
# Breaking change
|
|
207
|
-
yarn
|
|
196
|
+
yarn publish --tag latest --new-version 2.0.0
|
|
208
197
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/sfdocs-e2e",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4-skip-footer",
|
|
4
4
|
"description": "E2E test suite for SFDocs static portal pages (SSG)",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"bin": {
|
|
@@ -17,8 +17,10 @@
|
|
|
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
19
|
"test:scope-search": "TS_NODE_TRANSPILE_ONLY=true TS_NODE_PROJECT=./tsconfig.json wdio search-wdio.conf.js",
|
|
20
|
-
"
|
|
21
|
-
"
|
|
20
|
+
"prepublish:e2e": "node -e \"const p=require('./package.json'); delete p.private; require('fs').writeFileSync('./package.json', JSON.stringify(p, null, 2)+'\\n')\"",
|
|
21
|
+
"postpublish:e2e": "node -e \"const p=require('./package.json'); p.private=true; require('fs').writeFileSync('./package.json', JSON.stringify(p, null, 2)+'\\n')\"",
|
|
22
|
+
"release:alpha:e2e": "f() { yarn prepublish:e2e && yarn publish --tag alpha --new-version $1; yarn postpublish:e2e; }; f",
|
|
23
|
+
"release:e2e": "f() { yarn prepublish:e2e && yarn publish --new-version $1; yarn postpublish:e2e; }; f"
|
|
22
24
|
},
|
|
23
25
|
"dependencies": {
|
|
24
26
|
"@sa11y/wdio": "^7.0.0",
|
|
@@ -13,7 +13,7 @@ describe('Homepage', () => {
|
|
|
13
13
|
it('should show the expected number of projects', async () => {
|
|
14
14
|
const projectCards = await HomePage.projectCards;
|
|
15
15
|
|
|
16
|
-
expect(projectCards.length).toEqual(
|
|
16
|
+
expect(projectCards.length).toEqual(17);
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
// it('is accessible', () => {
|
|
@@ -44,15 +44,15 @@ export default class Page {
|
|
|
44
44
|
);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
async getHeader(
|
|
48
|
-
return await $(
|
|
47
|
+
async getHeader(): Promise<WebdriverIO.Element> {
|
|
48
|
+
return await $('hgf-c360contextnav');
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
async getHeaderTitle(): Promise<WebdriverIO.Element> {
|
|
52
52
|
return (await $('>>>header')).$('h4');
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
async getGlobalSearchBox(headerTag = 'dx-
|
|
55
|
+
async getGlobalSearchBox(headerTag = 'dx-header'): Promise<WebdriverIO.Element> {
|
|
56
56
|
return (await $(headerTag)).shadow$('dx-header-search');
|
|
57
57
|
}
|
|
58
58
|
|
|
@@ -7,7 +7,7 @@ import Page from '../pageobjects/page';
|
|
|
7
7
|
* @param givenPage : This is the current page for which we need to test chrome.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
export default function layoutTest(givenPage: Page, headerTag = 'dx-
|
|
10
|
+
export default function layoutTest(givenPage: Page, headerTag = 'dx-header') {
|
|
11
11
|
let page: Page;
|
|
12
12
|
describe('Basic layout testing > ', () => {
|
|
13
13
|
beforeEach(async () => {
|
|
@@ -15,12 +15,10 @@ export default function layoutTest(givenPage: Page, headerTag = 'dx-global-heade
|
|
|
15
15
|
});
|
|
16
16
|
|
|
17
17
|
it('should display header', async () => {
|
|
18
|
-
const header = await $(
|
|
18
|
+
const header = await $('hgf-c360contextnav');
|
|
19
19
|
await header.waitForDisplayed();
|
|
20
20
|
expect(await header.isDisplayed()).toBeTruthy();
|
|
21
|
-
|
|
22
|
-
expect(await header.getText()).toContain('Developers');
|
|
23
|
-
}
|
|
21
|
+
expect(await header.getText()).toContain('Developers');
|
|
24
22
|
});
|
|
25
23
|
|
|
26
24
|
it.skip('should display global search box', async () => {
|
|
@@ -179,10 +179,8 @@ describe('Reference Versioning', () => {
|
|
|
179
179
|
|
|
180
180
|
await referencePage.waitForSpecBasedReferencePageLoad();
|
|
181
181
|
await referencePage.selectVersion();
|
|
182
|
-
await referencePage.waitForSpecBasedReferencePageLoad();
|
|
183
182
|
|
|
184
183
|
const container = await $('>>>div.title-area div');
|
|
185
|
-
await container.waitForDisplayed();
|
|
186
184
|
const apiTitle = await container.getText();
|
|
187
185
|
|
|
188
186
|
expect(apiTitle).toEqual('createBasket');
|
|
@@ -276,7 +274,6 @@ describe('Spec-Based Flexible References', () => {
|
|
|
276
274
|
await referencePage.waitForSpecBasedReferencePageLoad();
|
|
277
275
|
|
|
278
276
|
const container = await $('>>>div.title-area div');
|
|
279
|
-
await container.waitForDisplayed();
|
|
280
277
|
const apiTitle = await container.getText();
|
|
281
278
|
|
|
282
279
|
expect(apiTitle).toEqual('getBasket');
|
|
@@ -24,6 +24,13 @@ exports.config = {
|
|
|
24
24
|
'./src/portal/specs/docs.test.ts',
|
|
25
25
|
],
|
|
26
26
|
|
|
27
|
+
// Skip footer tests - footer is not available in static builds
|
|
28
|
+
mochaOpts: {
|
|
29
|
+
...BASE_CONFIG.config.mochaOpts,
|
|
30
|
+
grep: 'should display footer',
|
|
31
|
+
invert: true,
|
|
32
|
+
},
|
|
33
|
+
|
|
27
34
|
// Output directory for static test results
|
|
28
35
|
outputDir: './_results_/static-portal',
|
|
29
36
|
|
package/bin/publish.sh
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
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
|
|
@@ -1,70 +0,0 @@
|
|
|
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
|
-
});
|