@salesforcedevs/sfdocs-e2e 1.0.0-link-alpha → 1.0.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/package.json +5 -3
- package/bin/publish.sh +0 -28
- package/src/shared/specs/internalLinks.test.ts +0 -70
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/sfdocs-e2e",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
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",
|
package/bin/publish.sh
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
VERSION="${1:?Usage: publish.sh <version> [--tag <tag>]}"
|
|
5
|
-
shift
|
|
6
|
-
TAG_ARGS=("$@")
|
|
7
|
-
|
|
8
|
-
cp package.json .package.json.bak
|
|
9
|
-
|
|
10
|
-
cleanup() {
|
|
11
|
-
mv .package.json.bak package.json
|
|
12
|
-
node -e "
|
|
13
|
-
var p = require('./package.json');
|
|
14
|
-
p.version = '$VERSION';
|
|
15
|
-
require('fs').writeFileSync('package.json', JSON.stringify(p, null, 2) + '\n');
|
|
16
|
-
"
|
|
17
|
-
git add package.json
|
|
18
|
-
git commit --amend --no-edit
|
|
19
|
-
}
|
|
20
|
-
trap cleanup EXIT
|
|
21
|
-
|
|
22
|
-
node -e "
|
|
23
|
-
var p = require('./package.json');
|
|
24
|
-
delete p.private;
|
|
25
|
-
require('fs').writeFileSync('package.json', JSON.stringify(p, null, 2) + '\n');
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
yarn publish --new-version "$VERSION" "${TAG_ARGS[@]}"
|
|
@@ -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
|
-
});
|