@salesforcedevs/sfdocs-e2e 0.6.134-alpha203 → 0.6.139-node22-3
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 +179 -33
- package/bin/publish.sh +31 -0
- package/bin/run-e2e.js +1 -0
- package/common-wdio.conf.js +20 -9
- package/package.json +7 -5
- package/src/content-repo/specs/homepage.test.ts +1 -1
- package/src/shared/pageobjects/page.ts +3 -3
- package/src/shared/specs/internalLinks.test.ts +70 -0
- package/src/shared/specs/layout-tests.ts +5 -3
- package/src/shared/specs/reference.test.ts +6 -1
- package/static-dsc-portal-wdio.conf.js +49 -0
package/README.md
CHANGED
|
@@ -1,63 +1,209 @@
|
|
|
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
|
+
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
|
+
### Run against the static portal (default)
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# 1. Build and serve the static portal (from the monorepo root or example-portal package)
|
|
55
|
+
yarn build:static:portal
|
|
56
|
+
yarn start:static:portal # serves on http://localhost:3000
|
|
57
|
+
|
|
58
|
+
# 2. Run the static-portal suite
|
|
59
|
+
yarn test:e2e:static:portal
|
|
9
60
|
```
|
|
10
61
|
|
|
11
|
-
|
|
62
|
+
### Run against the live portal
|
|
12
63
|
|
|
13
|
-
|
|
64
|
+
```bash
|
|
65
|
+
# Portal must be running on http://localhost:3001
|
|
66
|
+
yarn test:e2e:portal
|
|
67
|
+
```
|
|
14
68
|
|
|
15
|
-
|
|
69
|
+
### Run scope search tests
|
|
16
70
|
|
|
17
|
-
|
|
71
|
+
```bash
|
|
72
|
+
yarn test:scope-search
|
|
73
|
+
```
|
|
18
74
|
|
|
19
|
-
|
|
75
|
+
### Override the base URL
|
|
20
76
|
|
|
21
|
-
|
|
77
|
+
Pass the `E2E_BASE_URL` environment variable to point tests at any environment:
|
|
22
78
|
|
|
23
|
-
|
|
79
|
+
```bash
|
|
80
|
+
E2E_BASE_URL=https://staging.example.com yarn test:e2e:static:portal
|
|
81
|
+
```
|
|
24
82
|
|
|
25
|
-
|
|
83
|
+
---
|
|
26
84
|
|
|
27
|
-
|
|
85
|
+
## Using as a CLI in external projects
|
|
28
86
|
|
|
29
|
-
|
|
87
|
+
This package ships a `sfdocs-e2e` binary so consuming projects can run the suite without cloning this repo.
|
|
30
88
|
|
|
31
|
-
|
|
89
|
+
### Install
|
|
32
90
|
|
|
91
|
+
```bash
|
|
92
|
+
npm install --save-dev @salesforcedevs/sfdocs-e2e
|
|
93
|
+
# or
|
|
94
|
+
yarn add --dev @salesforcedevs/sfdocs-e2e
|
|
33
95
|
```
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
96
|
+
|
|
97
|
+
### Run
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# Defaults: static-portal config, http://localhost:3000
|
|
101
|
+
npx sfdocs-e2e
|
|
102
|
+
|
|
103
|
+
# Custom base URL
|
|
104
|
+
npx sfdocs-e2e --baseUrl http://localhost:8080
|
|
105
|
+
|
|
106
|
+
# Choose a config suite
|
|
107
|
+
npx sfdocs-e2e --config portal
|
|
108
|
+
npx sfdocs-e2e --config static-portal
|
|
109
|
+
npx sfdocs-e2e --config static-dsc-portal
|
|
110
|
+
npx sfdocs-e2e --config search
|
|
111
|
+
|
|
112
|
+
# Help
|
|
113
|
+
npx sfdocs-e2e --help
|
|
41
114
|
```
|
|
42
115
|
|
|
43
|
-
###
|
|
116
|
+
### Environment variables
|
|
44
117
|
|
|
45
|
-
|
|
118
|
+
| Variable | Description |
|
|
119
|
+
| ----------------------- | --------------------------------------------------------------------------------- |
|
|
120
|
+
| `E2E_BASE_URL` | Base URL of the site under test (overridden by `--baseUrl`) |
|
|
121
|
+
| `CHROME_DRIVER_VERSION` | Pin a specific ChromeDriver version (auto-detected locally; set explicitly in CI) |
|
|
46
122
|
|
|
47
|
-
|
|
48
|
-
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Test results and reports
|
|
126
|
+
|
|
127
|
+
Results are written to `_results_/` inside the package directory:
|
|
49
128
|
|
|
50
129
|
```
|
|
51
|
-
|
|
130
|
+
_results_/
|
|
131
|
+
static-portal/
|
|
132
|
+
allure-raw/ # Allure XML + video attachments
|
|
133
|
+
videos/ # MP4 recordings of failed tests
|
|
134
|
+
wdio-*.log # Browser driver logs
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
To generate and open an Allure HTML report:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
npx allure generate _results_/static-portal/allure-raw -o _results_/static-portal/allure-report --clean
|
|
141
|
+
npx allure open _results_/static-portal/allure-report
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Publishing
|
|
147
|
+
|
|
148
|
+
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.
|
|
149
|
+
|
|
150
|
+
### When to publish
|
|
151
|
+
|
|
152
|
+
Publish a new version when:
|
|
153
|
+
|
|
154
|
+
- New test suites or specs are added
|
|
155
|
+
- The CLI runner (`bin/run-e2e.js`) is updated
|
|
156
|
+
- WebdriverIO or other test dependencies are upgraded
|
|
157
|
+
- Config files are changed in a way that affects consumers
|
|
158
|
+
|
|
159
|
+
### How to publish
|
|
160
|
+
|
|
161
|
+
Always validate with an alpha release first, then promote to stable.
|
|
162
|
+
|
|
163
|
+
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:
|
|
164
|
+
|
|
165
|
+
| Script | Command | Description |
|
|
166
|
+
| ------------------- | ---------------------------------- | ---------------------------------- |
|
|
167
|
+
| `release:alpha:e2e` | `yarn release:alpha:e2e <version>` | Publish with the `alpha` dist-tag |
|
|
168
|
+
| `release:e2e` | `yarn release:e2e <version>` | Publish with the `latest` dist-tag |
|
|
169
|
+
|
|
170
|
+
**1. Publish an alpha (for testing)**
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
cd packages/e2e
|
|
174
|
+
yarn release:alpha:e2e 1.0.0-alpha.0
|
|
52
175
|
```
|
|
53
176
|
|
|
54
|
-
|
|
177
|
+
The `alpha` dist-tag means `yarn add @salesforcedevs/sfdocs-e2e` will **not** resolve this version by default — consumers must opt in explicitly:
|
|
55
178
|
|
|
56
|
-
|
|
179
|
+
```bash
|
|
180
|
+
# Install latest alpha
|
|
181
|
+
yarn add --dev @salesforcedevs/sfdocs-e2e@alpha
|
|
57
182
|
|
|
183
|
+
# Or pin to a specific alpha version
|
|
184
|
+
yarn add --dev @salesforcedevs/sfdocs-e2e@1.0.0-alpha.0
|
|
58
185
|
```
|
|
59
|
-
|
|
186
|
+
|
|
187
|
+
Iterate on alphas as needed (`1.0.0-alpha.1`, `1.0.0-alpha.2`, ...) until the release is validated.
|
|
188
|
+
|
|
189
|
+
**2. Promote to stable**
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
cd packages/e2e
|
|
193
|
+
yarn release:e2e 1.0.0
|
|
60
194
|
```
|
|
61
195
|
|
|
62
|
-
|
|
63
|
-
|
|
196
|
+
**3. Future releases — bump and publish**
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
cd packages/e2e
|
|
200
|
+
|
|
201
|
+
# Bug fix
|
|
202
|
+
yarn release:e2e 1.0.1
|
|
203
|
+
|
|
204
|
+
# New feature
|
|
205
|
+
yarn release:e2e 1.1.0
|
|
206
|
+
|
|
207
|
+
# Breaking change
|
|
208
|
+
yarn release:e2e 2.0.0
|
|
209
|
+
```
|
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/bin/run-e2e.js
CHANGED
|
@@ -56,6 +56,7 @@ Environment Variables:
|
|
|
56
56
|
const configName = parsedArgs.config || 'static-portal';
|
|
57
57
|
const configMap = {
|
|
58
58
|
'static-portal': 'static-portal-wdio.conf.js',
|
|
59
|
+
'static-dsc-portal': 'static-dsc-portal-wdio.conf.js',
|
|
59
60
|
portal: 'portal-wdio.conf.js',
|
|
60
61
|
search: 'search-wdio.conf.js',
|
|
61
62
|
};
|
package/common-wdio.conf.js
CHANGED
|
@@ -80,6 +80,7 @@ const defaultCapabilities = [
|
|
|
80
80
|
},
|
|
81
81
|
];
|
|
82
82
|
const defaultMochaTimeoutInterval = 200000; //increased timeout because its taking more time to load for references file
|
|
83
|
+
const isGithubActions = Boolean(process.env.GITHUB_ACTIONS);
|
|
83
84
|
|
|
84
85
|
// Resolve ChromeDriver version: env var → Chrome for Testing API lookup → latest
|
|
85
86
|
const resolvedChromeDriverVersion = resolveChromedriverVersion();
|
|
@@ -181,15 +182,25 @@ exports.config = {
|
|
|
181
182
|
// Services take over a specific job you don't want to take care of. They enhance
|
|
182
183
|
// your test setup with almost no effort. Unlike plugins, they don't add new
|
|
183
184
|
// commands. Instead, they hook themselves up into the test process.
|
|
184
|
-
services:
|
|
185
|
-
[
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
185
|
+
services: isGithubActions
|
|
186
|
+
? []
|
|
187
|
+
: [
|
|
188
|
+
[
|
|
189
|
+
'selenium-standalone',
|
|
190
|
+
{
|
|
191
|
+
installArgs: { drivers }, // drivers to install
|
|
192
|
+
args: { drivers }, // drivers to use
|
|
193
|
+
},
|
|
194
|
+
],
|
|
195
|
+
],
|
|
196
|
+
...(isGithubActions
|
|
197
|
+
? {
|
|
198
|
+
protocol: 'http',
|
|
199
|
+
hostname: '127.0.0.1',
|
|
200
|
+
port: 4444,
|
|
201
|
+
path: '/wd/hub',
|
|
202
|
+
}
|
|
203
|
+
: {}),
|
|
193
204
|
|
|
194
205
|
// Framework you want to run your specs with.
|
|
195
206
|
// The following are supported: Mocha, Jasmine, and Cucumber
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/sfdocs-e2e",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.139-node22-3",
|
|
4
4
|
"description": "E2E test suite for SFDocs static portal pages (SSG)",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"bin": {
|
|
@@ -16,10 +16,13 @@
|
|
|
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:
|
|
19
|
+
"test:e2e:static:dsc:portal": "TS_NODE_TRANSPILE_ONLY=true TS_NODE_PROJECT=./tsconfig.json wdio static-dsc-portal-wdio.conf.js",
|
|
20
|
+
"test:scope-search": "TS_NODE_TRANSPILE_ONLY=true TS_NODE_PROJECT=./tsconfig.json wdio search-wdio.conf.js",
|
|
21
|
+
"release:alpha:e2e": "f() { bash bin/publish.sh $1 --tag alpha; }; f",
|
|
22
|
+
"release:e2e": "f() { bash bin/publish.sh $1; }; f"
|
|
20
23
|
},
|
|
21
24
|
"dependencies": {
|
|
22
|
-
"@sa11y/wdio": "^
|
|
25
|
+
"@sa11y/wdio": "^8.0.0",
|
|
23
26
|
"@wdio/allure-reporter": "^7.19.0",
|
|
24
27
|
"@wdio/cli": "^7.19.0",
|
|
25
28
|
"@wdio/local-runner": "^7.19.0",
|
|
@@ -35,6 +38,5 @@
|
|
|
35
38
|
},
|
|
36
39
|
"devDependencies": {
|
|
37
40
|
"@types/mocha": "^10.0.1"
|
|
38
|
-
}
|
|
39
|
-
"gitHead": "7159a015481c77999404c8ee2a324bd5e89f6e1e"
|
|
41
|
+
}
|
|
40
42
|
}
|
|
@@ -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(19);
|
|
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(): Promise<WebdriverIO.Element> {
|
|
48
|
-
return await $(
|
|
47
|
+
async getHeader(headerTag = 'dx-global-header'): Promise<WebdriverIO.Element> {
|
|
48
|
+
return await $(headerTag);
|
|
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-header'): Promise<WebdriverIO.Element> {
|
|
55
|
+
async getGlobalSearchBox(headerTag = 'dx-global-header'): Promise<WebdriverIO.Element> {
|
|
56
56
|
return (await $(headerTag)).shadow$('dx-header-search');
|
|
57
57
|
}
|
|
58
58
|
|
|
@@ -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
|
+
});
|
|
@@ -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-header') {
|
|
10
|
+
export default function layoutTest(givenPage: Page, headerTag = 'dx-global-header') {
|
|
11
11
|
let page: Page;
|
|
12
12
|
describe('Basic layout testing > ', () => {
|
|
13
13
|
beforeEach(async () => {
|
|
@@ -15,10 +15,12 @@ export default function layoutTest(givenPage: Page, headerTag = 'dx-header') {
|
|
|
15
15
|
});
|
|
16
16
|
|
|
17
17
|
it('should display header', async () => {
|
|
18
|
-
const header = await $(
|
|
18
|
+
const header = await $(headerTag);
|
|
19
19
|
await header.waitForDisplayed();
|
|
20
20
|
expect(await header.isDisplayed()).toBeTruthy();
|
|
21
|
-
|
|
21
|
+
if (headerTag === 'dx-global-header') {
|
|
22
|
+
expect(await header.getText()).toContain('Developers');
|
|
23
|
+
}
|
|
22
24
|
});
|
|
23
25
|
|
|
24
26
|
it.skip('should display global search box', async () => {
|
|
@@ -9,6 +9,7 @@ describe('API Pages', () => {
|
|
|
9
9
|
beforeEach(async () => {
|
|
10
10
|
referencePage = new ReferencePage('/docs/commerce/test-cc-orders-api/references');
|
|
11
11
|
referencePage.open();
|
|
12
|
+
await referencePage.waitForSpecBasedReferencePageLoad();
|
|
12
13
|
});
|
|
13
14
|
|
|
14
15
|
layoutTest(referencePage, 'doc-header');
|
|
@@ -85,6 +86,7 @@ describe('Reference Versioning', () => {
|
|
|
85
86
|
beforeEach(async () => {
|
|
86
87
|
referencePage = new ReferencePage('/docs/c-cart-apis/references/ref1?meta=Summary');
|
|
87
88
|
referencePage.open();
|
|
89
|
+
await referencePage.waitForSpecBasedReferencePageLoad();
|
|
88
90
|
});
|
|
89
91
|
|
|
90
92
|
it('should check for the presence of version picker dropdown', async () => {
|
|
@@ -133,7 +135,7 @@ describe('Reference Versioning', () => {
|
|
|
133
135
|
|
|
134
136
|
await versionOptions[1].waitForClickable();
|
|
135
137
|
await versionOptions[1].click();
|
|
136
|
-
await
|
|
138
|
+
await referencePage.waitForSpecBasedReferencePageLoad();
|
|
137
139
|
|
|
138
140
|
const apiTitle = await (await $('>>>div.api-title span')).getText();
|
|
139
141
|
const apiVersion = await (await $('>>>p.version span')).getText();
|
|
@@ -179,8 +181,10 @@ describe('Reference Versioning', () => {
|
|
|
179
181
|
|
|
180
182
|
await referencePage.waitForSpecBasedReferencePageLoad();
|
|
181
183
|
await referencePage.selectVersion();
|
|
184
|
+
await referencePage.waitForSpecBasedReferencePageLoad();
|
|
182
185
|
|
|
183
186
|
const container = await $('>>>div.title-area div');
|
|
187
|
+
await container.waitForDisplayed();
|
|
184
188
|
const apiTitle = await container.getText();
|
|
185
189
|
|
|
186
190
|
expect(apiTitle).toEqual('createBasket');
|
|
@@ -274,6 +278,7 @@ describe('Spec-Based Flexible References', () => {
|
|
|
274
278
|
await referencePage.waitForSpecBasedReferencePageLoad();
|
|
275
279
|
|
|
276
280
|
const container = await $('>>>div.title-area div');
|
|
281
|
+
await container.waitForDisplayed();
|
|
277
282
|
const apiTitle = await container.getText();
|
|
278
283
|
|
|
279
284
|
expect(apiTitle).toEqual('getBasket');
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WebdriverIO configuration for E2E tests on Static Portal Pages (SSG) on DSC
|
|
3
|
+
*
|
|
4
|
+
* Prerequisites:
|
|
5
|
+
* 1. Build static pages: yarn build:static:portal
|
|
6
|
+
* 2. Start static server: yarn start:static:portal (runs on port 3000)
|
|
7
|
+
* 3. Run tests: yarn test:e2e:static:portal
|
|
8
|
+
*/
|
|
9
|
+
const BASE_CONFIG = require('./common-wdio.conf');
|
|
10
|
+
|
|
11
|
+
exports.config = {
|
|
12
|
+
...BASE_CONFIG.config,
|
|
13
|
+
// Static pages are served on port 3000 by default; override via E2E_BASE_URL env var
|
|
14
|
+
baseUrl: process.env.E2E_BASE_URL || 'http://localhost:3000',
|
|
15
|
+
|
|
16
|
+
// Reuse the same portal specs - static pages have the same URL structure
|
|
17
|
+
specs: ['./src/portal/specs/**/*.test.ts', './src/shared/specs/*.test.ts'],
|
|
18
|
+
|
|
19
|
+
// Exclude tests that require dynamic server features or pages not in static build
|
|
20
|
+
exclude: [
|
|
21
|
+
'./src/portal/specs/docs.api.test.ts',
|
|
22
|
+
'./src/portal/specs/docs.test.ts',
|
|
23
|
+
'./src/shared/specs/banner.test.ts',
|
|
24
|
+
],
|
|
25
|
+
|
|
26
|
+
// Output directory for static test results
|
|
27
|
+
outputDir: './_results_/static-portal',
|
|
28
|
+
|
|
29
|
+
// Override reporters to use separate output directories
|
|
30
|
+
reporters: [
|
|
31
|
+
'spec',
|
|
32
|
+
[
|
|
33
|
+
require('wdio-video-reporter'),
|
|
34
|
+
{
|
|
35
|
+
saveAllVideos: false,
|
|
36
|
+
videoSlowdownMultiplier: 3,
|
|
37
|
+
outputDir: './_results_/static-portal/videos',
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
[
|
|
41
|
+
'allure',
|
|
42
|
+
{
|
|
43
|
+
outputDir: './_results_/static-portal/allure-raw',
|
|
44
|
+
disableWebdriverStepsReporting: true,
|
|
45
|
+
disableWebdriverScreenshotsReporting: false,
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
],
|
|
49
|
+
};
|