@salesforcedevs/sfdocs-e2e 0.6.132-linkfix-alpha
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 +63 -0
- package/bin/run-e2e.js +115 -0
- package/common-wdio.conf.js +402 -0
- package/package.json +40 -0
- package/portal-wdio.conf.js +7 -0
- package/search-wdio.conf.js +10 -0
- package/src/content-repo/pageobjects/home.page.ts +55 -0
- package/src/content-repo/specs/componentSpecification.test.ts +287 -0
- package/src/content-repo/specs/guideAndReferencePage.test.ts +46 -0
- package/src/content-repo/specs/homepage.test.ts +47 -0
- package/src/content-repo/specs/media-mapper.test.ts +18 -0
- package/src/content-repo/specs/navHeader.test.ts +79 -0
- package/src/content-repo/specs/sitemap.test.ts +58 -0
- package/src/content-repo/specs/tabset.test.ts +81 -0
- package/src/portal/pageobjects/docs.apis.page.ts +23 -0
- package/src/portal/pageobjects/docs.page.ts +18 -0
- package/src/portal/pageobjects/help-page/ScopeSeachTest.page.ts +20 -0
- package/src/portal/specs/docs.api.test.ts +68 -0
- package/src/portal/specs/docs.test.ts +84 -0
- package/src/portal/specs/media-mapper.test.ts +42 -0
- package/src/portal/specs/scope.search.guide.test.ts +33 -0
- package/src/portal/specs/scope.search.reference.test.ts +37 -0
- package/src/shared/pageobjects/api-redoc-reference.page.ts +40 -0
- package/src/shared/pageobjects/callout.ts +24 -0
- package/src/shared/pageobjects/doc-phase-config.ts +106 -0
- package/src/shared/pageobjects/docs-content-layout.ts +17 -0
- package/src/shared/pageobjects/error.page.ts +14 -0
- package/src/shared/pageobjects/guide.page.ts +24 -0
- package/src/shared/pageobjects/overview.page.ts +20 -0
- package/src/shared/pageobjects/page.ts +115 -0
- package/src/shared/pageobjects/reference.page.ts +41 -0
- package/src/shared/specs/anchorHeading.test.ts +21 -0
- package/src/shared/specs/banner.test.ts +66 -0
- package/src/shared/specs/breadcrumbs.test.ts +45 -0
- package/src/shared/specs/calloutContent.test.ts +102 -0
- package/src/shared/specs/codeBlock.test.ts +44 -0
- package/src/shared/specs/devCenterLink.test.ts +42 -0
- package/src/shared/specs/docPhase.test.ts +127 -0
- package/src/shared/specs/errorRoutes.test.ts +24 -0
- package/src/shared/specs/guides.test.ts +333 -0
- package/src/shared/specs/layout-tests.ts +38 -0
- package/src/shared/specs/overview.test.ts +82 -0
- package/src/shared/specs/page-title.test.ts +12 -0
- package/src/shared/specs/redoc-reference.test.ts +170 -0
- package/src/shared/specs/reference.test.ts +281 -0
- package/src/shared/specs/video.test.ts +31 -0
- package/static-portal-wdio.conf.js +50 -0
- package/tsconfig.json +26 -0
- package/wdio.conf.js +6 -0
package/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# E2E for Content repo
|
|
2
|
+
|
|
3
|
+
We can run e2e cases on example-repository
|
|
4
|
+
|
|
5
|
+
Command to run
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
yarn test:e2e
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
# E2E for Portal
|
|
12
|
+
|
|
13
|
+
To run portal e2e test cases, we need portal to run first.
|
|
14
|
+
|
|
15
|
+
`yarn start:portal`
|
|
16
|
+
|
|
17
|
+
Note: This will take a bit time as it will download all the required repositories mentioned in docsportal.config.json
|
|
18
|
+
|
|
19
|
+
## How to run test cases
|
|
20
|
+
|
|
21
|
+
Once the portal is running at localhost:3001, in a separate terminal - run
|
|
22
|
+
|
|
23
|
+
`yarn test:e2e:portal`
|
|
24
|
+
|
|
25
|
+
This will run the test cases as needed.
|
|
26
|
+
|
|
27
|
+
### Browser compatibility test
|
|
28
|
+
|
|
29
|
+
in doc-framework-monorepo/packages/e2e/portal-wdio-conf.js
|
|
30
|
+
|
|
31
|
+
uncomment the below lines
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
capabilities: [
|
|
35
|
+
// SFDOCs team: For chrome only. If we want debug check the above statement
|
|
36
|
+
defaultCapabilities[0],
|
|
37
|
+
{
|
|
38
|
+
browserName: 'firefox'
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### If you want to run with production URl
|
|
44
|
+
|
|
45
|
+
in doc-framework-monorepo/packages/e2e/portal-wdio-conf.js
|
|
46
|
+
|
|
47
|
+
change the `baseUrl` property as needed. For private space apps (as we need TMP auth) - we need to pass
|
|
48
|
+
user pwd as below.
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
//baseUrl:"https://beta:cloudwalker@beta.developer.salesforce.com",
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### What if you want allure reports
|
|
55
|
+
|
|
56
|
+
After that just run the below command
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
allure generate allure generate packages/e2e/_results_/allure-raw --clean && allure open --clean && allure open
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Note: If allure is not available in your PC, it may throw error.
|
|
63
|
+
Please make sure either adding allure globally or run it from node_modules.
|
package/bin/run-e2e.js
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* CLI runner for @salesforcedevs/sfdocs-e2e
|
|
5
|
+
*
|
|
6
|
+
* This script allows running the SSG E2E tests from any repo that installs
|
|
7
|
+
* this package as an npm dependency.
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* sfdocs-e2e # defaults: static-portal config, http://localhost:3000
|
|
11
|
+
* sfdocs-e2e --baseUrl http://localhost:8080 # custom base URL
|
|
12
|
+
* sfdocs-e2e --config portal # run portal tests (non-static)
|
|
13
|
+
* sfdocs-e2e --config static-portal # run static portal tests (default)
|
|
14
|
+
* sfdocs-e2e --config search # run search tests
|
|
15
|
+
*
|
|
16
|
+
* Priority: CLI args > environment variables > defaults
|
|
17
|
+
*
|
|
18
|
+
* Environment variables:
|
|
19
|
+
* E2E_BASE_URL - Base URL of the site under test
|
|
20
|
+
* CHROME_DRIVER_VERSION - Chrome driver version to use
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
const { spawnSync } = require('child_process');
|
|
24
|
+
const fs = require('fs');
|
|
25
|
+
const path = require('path');
|
|
26
|
+
|
|
27
|
+
// Parse CLI arguments
|
|
28
|
+
const args = process.argv.slice(2);
|
|
29
|
+
const parsedArgs = {};
|
|
30
|
+
for (let i = 0; i < args.length; i++) {
|
|
31
|
+
if (args[i] === '--baseUrl' && args[i + 1] && !args[i + 1].startsWith('--')) {
|
|
32
|
+
parsedArgs.baseUrl = args[++i];
|
|
33
|
+
} else if (args[i] === '--config' && args[i + 1] && !args[i + 1].startsWith('--')) {
|
|
34
|
+
parsedArgs.config = args[++i];
|
|
35
|
+
} else if (args[i] === '--help' || args[i] === '-h') {
|
|
36
|
+
console.log(`
|
|
37
|
+
sfdocs-e2e - Run SSG E2E tests
|
|
38
|
+
|
|
39
|
+
Usage:
|
|
40
|
+
sfdocs-e2e [options]
|
|
41
|
+
|
|
42
|
+
Options:
|
|
43
|
+
--baseUrl <url> Base URL of the site under test (default: http://localhost:3000)
|
|
44
|
+
--config <name> WebdriverIO config to use: static-portal (default), portal, search
|
|
45
|
+
--help, -h Show this help message
|
|
46
|
+
|
|
47
|
+
Environment Variables:
|
|
48
|
+
E2E_BASE_URL Override the base URL (CLI --baseUrl takes precedence)
|
|
49
|
+
CHROME_DRIVER_VERSION Chrome driver version to use
|
|
50
|
+
`);
|
|
51
|
+
process.exit(0);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Resolve the config name
|
|
56
|
+
const configName = parsedArgs.config || 'static-portal';
|
|
57
|
+
const configMap = {
|
|
58
|
+
'static-portal': 'static-portal-wdio.conf.js',
|
|
59
|
+
portal: 'portal-wdio.conf.js',
|
|
60
|
+
search: 'search-wdio.conf.js',
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const configFile = configMap[configName];
|
|
64
|
+
if (!configFile) {
|
|
65
|
+
console.error(
|
|
66
|
+
`Unknown config: "${configName}". Available: ${Object.keys(configMap).join(', ')}`,
|
|
67
|
+
);
|
|
68
|
+
process.exit(1);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// The package root is one level up from bin/
|
|
72
|
+
const packageRoot = path.resolve(__dirname, '..');
|
|
73
|
+
const configPath = path.join(packageRoot, configFile);
|
|
74
|
+
|
|
75
|
+
if (!fs.existsSync(configPath)) {
|
|
76
|
+
console.error(`Config file not found: ${configPath}`);
|
|
77
|
+
process.exit(1);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Determine base URL: CLI arg > env var > default
|
|
81
|
+
const baseUrl = parsedArgs.baseUrl || process.env.E2E_BASE_URL || 'http://localhost:3000';
|
|
82
|
+
|
|
83
|
+
// Build the environment
|
|
84
|
+
const env = {
|
|
85
|
+
...process.env,
|
|
86
|
+
E2E_BASE_URL: baseUrl,
|
|
87
|
+
TS_NODE_TRANSPILE_ONLY: 'true',
|
|
88
|
+
TS_NODE_PROJECT: path.join(packageRoot, 'tsconfig.json'),
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
// Resolve the wdio binary - look in the package's own node_modules first, then fall back to the consuming project's node_modules
|
|
92
|
+
let wdioBin;
|
|
93
|
+
try {
|
|
94
|
+
wdioBin = require.resolve('@wdio/cli/bin/wdio', { paths: [packageRoot] });
|
|
95
|
+
} catch {
|
|
96
|
+
try {
|
|
97
|
+
wdioBin = require.resolve('@wdio/cli/bin/wdio');
|
|
98
|
+
} catch {
|
|
99
|
+
console.error('Could not find @wdio/cli. Make sure it is installed.');
|
|
100
|
+
process.exit(1);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
console.log(
|
|
105
|
+
`\n=== sfdocs-e2e ===\nConfig: ${configName} (${configPath})\nBase URL: ${baseUrl}\nwdio: ${wdioBin}\n==================\n`,
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
const result = spawnSync('node', [wdioBin, configPath], {
|
|
109
|
+
stdio: 'inherit',
|
|
110
|
+
env,
|
|
111
|
+
// Run from the package root so relative spec paths resolve correctly
|
|
112
|
+
cwd: packageRoot,
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
process.exit(result.status ?? 1);
|
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
const { execSync } = require('child_process');
|
|
2
|
+
const debug = process.env.DEBUG;
|
|
3
|
+
const video = require('wdio-video-reporter');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Detects the full version of the locally installed Chrome (e.g. "145.0.7632.117").
|
|
7
|
+
* Returns the full version string, or undefined if detection fails.
|
|
8
|
+
*/
|
|
9
|
+
function detectChromeVersion() {
|
|
10
|
+
const chromeBinaries = [
|
|
11
|
+
'google-chrome --version',
|
|
12
|
+
'google-chrome-stable --version',
|
|
13
|
+
'chromium --version',
|
|
14
|
+
'chromium-browser --version',
|
|
15
|
+
// macOS
|
|
16
|
+
'"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --version',
|
|
17
|
+
];
|
|
18
|
+
for (const cmd of chromeBinaries) {
|
|
19
|
+
try {
|
|
20
|
+
const output = execSync(cmd, {
|
|
21
|
+
encoding: 'utf8',
|
|
22
|
+
stdio: 'pipe',
|
|
23
|
+
timeout: 3000,
|
|
24
|
+
});
|
|
25
|
+
const match = output.match(/(\d+\.\d+\.\d+\.\d+)/);
|
|
26
|
+
if (match) return match[1];
|
|
27
|
+
} catch (_) {
|
|
28
|
+
// binary not found or timed out — try next
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Resolves the ChromeDriver version that matches the locally installed Chrome.
|
|
36
|
+
* Skipped entirely in GitHub Actions where the pipeline sets CHROME_DRIVER_VERSION explicitly.
|
|
37
|
+
*/
|
|
38
|
+
function resolveChromedriverVersion() {
|
|
39
|
+
if (process.env.CHROME_DRIVER_VERSION) {
|
|
40
|
+
return process.env.CHROME_DRIVER_VERSION;
|
|
41
|
+
}
|
|
42
|
+
// Skip auto-detection in GitHub Actions — the pipeline sets CHROME_DRIVER_VERSION explicitly.
|
|
43
|
+
if (process.env.GITHUB_ACTIONS) {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
const version = detectChromeVersion();
|
|
47
|
+
if (version) {
|
|
48
|
+
console.log(`[wdio] Auto-detected Chrome ${version}; using matching ChromeDriver version`);
|
|
49
|
+
return version;
|
|
50
|
+
}
|
|
51
|
+
console.warn(
|
|
52
|
+
'[wdio] Could not detect local Chrome version; using latest ChromeDriver (may mismatch)',
|
|
53
|
+
);
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const defaultCapabilities = [
|
|
58
|
+
{
|
|
59
|
+
// maxInstances can get overwritten per capability. So if you have an in-house Selenium
|
|
60
|
+
// grid with only 5 firefox instances available you can make sure that not more than
|
|
61
|
+
// 5 instances get started at a time.
|
|
62
|
+
maxInstances: 1,
|
|
63
|
+
//
|
|
64
|
+
browserName: 'chrome',
|
|
65
|
+
'goog:chromeOptions': {
|
|
66
|
+
// (see https://developers.google.com/web/updates/2017/04/headless-chrome)
|
|
67
|
+
args: [
|
|
68
|
+
'--disable-gpu',
|
|
69
|
+
'--headless',
|
|
70
|
+
'--window-size=1920,1080',
|
|
71
|
+
'--no-sandbox',
|
|
72
|
+
'--disable-dev-shm-usage',
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
acceptInsecureCerts: true,
|
|
76
|
+
// If outputDir is provided WebdriverIO can capture driver session logs
|
|
77
|
+
// it is possible to configure which logTypes to include/exclude.
|
|
78
|
+
// excludeDriverLogs: ['*'], // pass '*' to exclude all driver session logs
|
|
79
|
+
// excludeDriverLogs: ['bugreport', 'server'],
|
|
80
|
+
},
|
|
81
|
+
];
|
|
82
|
+
const defaultMochaTimeoutInterval = 200000; //increased timeout because its taking more time to load for references file
|
|
83
|
+
|
|
84
|
+
// Resolve ChromeDriver version: env var → Chrome for Testing API lookup → latest
|
|
85
|
+
const resolvedChromeDriverVersion = resolveChromedriverVersion();
|
|
86
|
+
const chrome = resolvedChromeDriverVersion ? { version: resolvedChromeDriverVersion } : true;
|
|
87
|
+
|
|
88
|
+
const drivers = {
|
|
89
|
+
// ChromeDriver 115+ is distributed via Chrome for Testing:
|
|
90
|
+
// https://googlechromelabs.github.io/chrome-for-testing/
|
|
91
|
+
chrome,
|
|
92
|
+
firefox: { version: '0.35.0' }, // https://github.com/mozilla/geckodriver/releases - 0.30.0+ supports ARM64 Mac
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
exports.config = {
|
|
96
|
+
//
|
|
97
|
+
// ====================
|
|
98
|
+
// Runner Configuration
|
|
99
|
+
// ====================
|
|
100
|
+
//
|
|
101
|
+
// WebdriverIO allows it to run your tests in arbitrary locations (e.g. locally or
|
|
102
|
+
// on a remote machine).
|
|
103
|
+
runner: 'local',
|
|
104
|
+
// Patterns to exclude.
|
|
105
|
+
exclude: [
|
|
106
|
+
// 'path/to/excluded/files'
|
|
107
|
+
],
|
|
108
|
+
//
|
|
109
|
+
// ============
|
|
110
|
+
// Capabilities
|
|
111
|
+
// ============
|
|
112
|
+
// Define your capabilities here. WebdriverIO can run multiple capabilities at the same
|
|
113
|
+
// time. Depending on the number of capabilities, WebdriverIO launches several test
|
|
114
|
+
// sessions. Within your capabilities you can overwrite the spec and exclude options in
|
|
115
|
+
// order to group specific specs to a specific capability.
|
|
116
|
+
//
|
|
117
|
+
// First, you can define how many instances should be started at the same time. Let's
|
|
118
|
+
// say you have 3 different capabilities (Chrome, Firefox, and Safari) and you have
|
|
119
|
+
// set maxInstances to 1; wdio will spawn 3 processes. Therefore, if you have 10 spec
|
|
120
|
+
// files and you set maxInstances to 10, all spec files will get tested at the same time
|
|
121
|
+
// and 30 processes will get spawned. The property handles how many capabilities
|
|
122
|
+
// from the same test should run tests.
|
|
123
|
+
//
|
|
124
|
+
maxInstances: debug ? 1 : 5,
|
|
125
|
+
//
|
|
126
|
+
// If you have trouble getting all important capabilities together, check out the
|
|
127
|
+
// Sauce Labs platform configurator - a great tool to configure your capabilities:
|
|
128
|
+
// https://docs.saucelabs.com/reference/platforms-configurator
|
|
129
|
+
//
|
|
130
|
+
capabilities: debug
|
|
131
|
+
? [{ browserName: 'chrome', acceptInsecureCerts: true }]
|
|
132
|
+
: defaultCapabilities,
|
|
133
|
+
//
|
|
134
|
+
// ===================
|
|
135
|
+
// Test Configurations
|
|
136
|
+
// ===================
|
|
137
|
+
// Define all options that are relevant for the WebdriverIO instance here
|
|
138
|
+
//
|
|
139
|
+
// Level of logging verbosity: trace | debug | info | warn | error | silent
|
|
140
|
+
logLevel: debug ? 'debug' : 'error',
|
|
141
|
+
//
|
|
142
|
+
// Set specific log levels per logger
|
|
143
|
+
// loggers:
|
|
144
|
+
// - webdriver, webdriverio
|
|
145
|
+
// - @wdio/applitools-service, @wdio/browserstack-service, @wdio/devtools-service, @wdio/sauce-service
|
|
146
|
+
// - @wdio/mocha-framework, @wdio/jasmine-framework
|
|
147
|
+
// - @wdio/local-runner
|
|
148
|
+
// - @wdio/sumologic-reporter
|
|
149
|
+
// - @wdio/cli, @wdio/config, @wdio/sync, @wdio/utils
|
|
150
|
+
// Level of logging verbosity: trace | debug | info | warn | error | silent
|
|
151
|
+
// logLevels: {
|
|
152
|
+
// webdriver: 'info',
|
|
153
|
+
// '@wdio/applitools-service': 'info'
|
|
154
|
+
// },
|
|
155
|
+
//
|
|
156
|
+
// If you only want to run your tests until a specific amount of tests have failed use
|
|
157
|
+
// bail (default is 0 - don't bail, run all tests).
|
|
158
|
+
bail: 0,
|
|
159
|
+
//
|
|
160
|
+
// Set a base URL in order to shorten url command calls. If your `url` parameter starts
|
|
161
|
+
// with `/`, the base url gets prepended, not including the path portion of your baseUrl.
|
|
162
|
+
// If your `url` parameter starts without a scheme or `/` (like `some/path`), the base url
|
|
163
|
+
// gets prepended directly.
|
|
164
|
+
baseUrl: process.env.E2E_BASE_URL || 'http://localhost:3000',
|
|
165
|
+
//
|
|
166
|
+
// Default timeout for all waitFor* commands.
|
|
167
|
+
waitforTimeout: 30000,
|
|
168
|
+
//
|
|
169
|
+
// Default timeout in milliseconds for request
|
|
170
|
+
// if browser driver or grid doesn't send response
|
|
171
|
+
connectionRetryTimeout: 120000,
|
|
172
|
+
//
|
|
173
|
+
// Default request retries count
|
|
174
|
+
connectionRetryCount: 3,
|
|
175
|
+
|
|
176
|
+
/* The number of times to retry an entire specfile when it fails as a whole.*/
|
|
177
|
+
specFileRetries: 1,
|
|
178
|
+
|
|
179
|
+
//
|
|
180
|
+
// Test runner services
|
|
181
|
+
// Services take over a specific job you don't want to take care of. They enhance
|
|
182
|
+
// your test setup with almost no effort. Unlike plugins, they don't add new
|
|
183
|
+
// commands. Instead, they hook themselves up into the test process.
|
|
184
|
+
services: [
|
|
185
|
+
[
|
|
186
|
+
'selenium-standalone',
|
|
187
|
+
{
|
|
188
|
+
installArgs: { drivers }, // drivers to install
|
|
189
|
+
args: { drivers }, // drivers to use
|
|
190
|
+
},
|
|
191
|
+
],
|
|
192
|
+
],
|
|
193
|
+
|
|
194
|
+
// Framework you want to run your specs with.
|
|
195
|
+
// The following are supported: Mocha, Jasmine, and Cucumber
|
|
196
|
+
// see also: https://webdriver.io/docs/frameworks.html
|
|
197
|
+
//
|
|
198
|
+
// Make sure you have the wdio adapter package for the specific framework installed
|
|
199
|
+
// before running any tests.
|
|
200
|
+
framework: 'mocha',
|
|
201
|
+
//
|
|
202
|
+
// The number of times to retry the entire specfile when it fails as a whole
|
|
203
|
+
// specFileRetries: 1,
|
|
204
|
+
//
|
|
205
|
+
// Delay in seconds between the spec file retry attempts
|
|
206
|
+
// specFileRetriesDelay: 0,
|
|
207
|
+
//
|
|
208
|
+
// Whether or not retried specfiles should be retried immediately or deferred to the end of the queue
|
|
209
|
+
// specFileRetriesDeferred: false,
|
|
210
|
+
//
|
|
211
|
+
// Test reporter for stdout.
|
|
212
|
+
// The only one supported by default is 'dot'
|
|
213
|
+
// see also: https://webdriver.io/docs/dot-reporter.html
|
|
214
|
+
reporters: [
|
|
215
|
+
'spec',
|
|
216
|
+
[
|
|
217
|
+
video,
|
|
218
|
+
{
|
|
219
|
+
saveAllVideos: false, // If true, also saves videos for successful test cases
|
|
220
|
+
videoSlowdownMultiplier: 3, // Higher to get slower videos, lower for faster videos [Value 1-100]
|
|
221
|
+
},
|
|
222
|
+
],
|
|
223
|
+
[
|
|
224
|
+
'allure',
|
|
225
|
+
{
|
|
226
|
+
outputDir: './_results_/allure-raw',
|
|
227
|
+
disableWebdriverStepsReporting: true,
|
|
228
|
+
disableWebdriverScreenshotsReporting: false,
|
|
229
|
+
},
|
|
230
|
+
],
|
|
231
|
+
],
|
|
232
|
+
|
|
233
|
+
//
|
|
234
|
+
// Options to be passed to Mocha.
|
|
235
|
+
// See the full list at http://mochajs.org/
|
|
236
|
+
mochaOpts: {
|
|
237
|
+
// TypeScript setup
|
|
238
|
+
require: ['ts-node/register'],
|
|
239
|
+
ui: 'bdd',
|
|
240
|
+
timeout: debug ? 24 * 60 * 60 * 1000 : defaultMochaTimeoutInterval,
|
|
241
|
+
},
|
|
242
|
+
// For convenience, if ts-node or @babel/register modules are detected
|
|
243
|
+
// they are automatically loaded for config parsing so that TypeScript and
|
|
244
|
+
// future ES features can be used in wsdio configs, and are also
|
|
245
|
+
// automatically loaded for test running so that tests can be written
|
|
246
|
+
// using TypeScript and future ES features.
|
|
247
|
+
// Because this may not be ideal in every situation, the following options
|
|
248
|
+
// may be used to customize the loading for test running, incase it has
|
|
249
|
+
// other requirements.
|
|
250
|
+
autoCompileOpts: {
|
|
251
|
+
//
|
|
252
|
+
// To disable auto-loading entirely set this to false.
|
|
253
|
+
autoCompile: true, // <boolean> Disable this to turn off autoloading. Note: When disabling, you will need to handle calling any such libraries yourself.
|
|
254
|
+
//
|
|
255
|
+
// If you have ts-node installed, you can customize how options are passed to it here:
|
|
256
|
+
// Any valid ts-node config option is allowed. Alternatively the ENV Vars could also be used instead of this.
|
|
257
|
+
// See also: https://github.com/TypeStrong/ts-node#cli-and-programmatic-options
|
|
258
|
+
// See also RegisterOptions in https://github.com/TypeStrong/ts-node/blob/master/src/index.ts
|
|
259
|
+
tsNodeOpts: {
|
|
260
|
+
transpileOnly: true,
|
|
261
|
+
project: './tsconfig.json',
|
|
262
|
+
},
|
|
263
|
+
//
|
|
264
|
+
// If @babel/register is installed, you can customize how options are passed to it here:
|
|
265
|
+
// Any valid @babel/register config option is allowed.
|
|
266
|
+
// https://babeljs.io/docs/en/babel-register#specifying-options
|
|
267
|
+
babelOpts: {
|
|
268
|
+
ignore: [],
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
// Node arguments to specify when launching child processes.
|
|
272
|
+
execArgv: debug ? ['--inspect'] : [],
|
|
273
|
+
//
|
|
274
|
+
// =====
|
|
275
|
+
// Hooks
|
|
276
|
+
// =====
|
|
277
|
+
// WebdriverIO provides several hooks you can use to interfere with the test process in order to enhance
|
|
278
|
+
// it and to build services around it. You can either apply a single function or an array of
|
|
279
|
+
// methods to it. If one of them returns with a promise, WebdriverIO will wait until that promise got
|
|
280
|
+
// resolved to continue.
|
|
281
|
+
/**
|
|
282
|
+
* Gets executed once before all workers get launched.
|
|
283
|
+
* @param {Object} config wdio configuration object
|
|
284
|
+
* @param {Array.<Object>} capabilities list of capabilities details
|
|
285
|
+
*/
|
|
286
|
+
// onPrepare: function (config, capabilities) {
|
|
287
|
+
// },
|
|
288
|
+
/**
|
|
289
|
+
* Gets executed before a worker process is spawned and can be used to initialise specific service
|
|
290
|
+
* for that worker as well as modify runtime environments in an async fashion.
|
|
291
|
+
* @param {String} cid capability id (e.g 0-0)
|
|
292
|
+
* @param {[type]} caps object containing capabilities for session that will be spawn in the worker
|
|
293
|
+
* @param {[type]} specs specs to be run in the worker process
|
|
294
|
+
* @param {[type]} args object that will be merged with the main configuration once worker is initialised
|
|
295
|
+
* @param {[type]} execArgv list of string arguments passed to the worker process
|
|
296
|
+
*/
|
|
297
|
+
// onWorkerStart: function (cid, caps, specs, args, execArgv) {
|
|
298
|
+
// },
|
|
299
|
+
/**
|
|
300
|
+
* Gets executed just before initialising the webdriver session and test framework. It allows you
|
|
301
|
+
* to manipulate configurations depending on the capability or spec.
|
|
302
|
+
* @param {Object} config wdio configuration object
|
|
303
|
+
* @param {Array.<Object>} capabilities list of capabilities details
|
|
304
|
+
* @param {Array.<String>} specs List of spec file paths that are to be run
|
|
305
|
+
*/
|
|
306
|
+
// beforeSession: function (config, capabilities, specs) {
|
|
307
|
+
// },
|
|
308
|
+
/**
|
|
309
|
+
* Gets executed before test execution begins. At this point you can access to all global
|
|
310
|
+
* variables like `browser`. It is the perfect place to define custom commands.
|
|
311
|
+
* @param {Array.<Object>} capabilities list of capabilities details
|
|
312
|
+
* @param {Array.<String>} specs List of spec file paths that are to be run
|
|
313
|
+
* @param {Object} browser instance of created browser/device session
|
|
314
|
+
*/
|
|
315
|
+
// before: function (capabilities, specs) {
|
|
316
|
+
// },
|
|
317
|
+
/**
|
|
318
|
+
* Runs before a WebdriverIO command gets executed.
|
|
319
|
+
* @param {String} commandName hook command name
|
|
320
|
+
* @param {Array} args arguments that command would receive
|
|
321
|
+
*/
|
|
322
|
+
// beforeCommand: function (commandName, args) {
|
|
323
|
+
// },
|
|
324
|
+
/**
|
|
325
|
+
* Hook that gets executed before the suite starts
|
|
326
|
+
* @param {Object} suite suite details
|
|
327
|
+
*/
|
|
328
|
+
// beforeSuite: function (suite) {
|
|
329
|
+
// },
|
|
330
|
+
/**
|
|
331
|
+
* Function to be executed before a test (in Mocha/Jasmine) starts.
|
|
332
|
+
*/
|
|
333
|
+
// beforeTest: function (test, context) {
|
|
334
|
+
// },
|
|
335
|
+
/**
|
|
336
|
+
* Hook that gets executed _before_ a hook within the suite starts (e.g. runs before calling
|
|
337
|
+
* beforeEach in Mocha)
|
|
338
|
+
*/
|
|
339
|
+
// beforeHook: function (test, context) {
|
|
340
|
+
// },
|
|
341
|
+
/**
|
|
342
|
+
* Hook that gets executed _after_ a hook within the suite starts (e.g. runs after calling
|
|
343
|
+
* afterEach in Mocha)
|
|
344
|
+
*/
|
|
345
|
+
// afterHook: function (test, context, { error, result, duration, passed, retries }) {
|
|
346
|
+
// },
|
|
347
|
+
/**
|
|
348
|
+
* Function to be executed after a test (in Mocha/Jasmine).
|
|
349
|
+
*/
|
|
350
|
+
// afterTest: function(test, context, { error, result, duration, passed, retries }) {
|
|
351
|
+
// },
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Hook that gets executed after the suite has ended
|
|
355
|
+
* @param {Object} suite suite details
|
|
356
|
+
*/
|
|
357
|
+
// afterSuite: function (suite) {
|
|
358
|
+
// },
|
|
359
|
+
/**
|
|
360
|
+
* Runs after a WebdriverIO command gets executed
|
|
361
|
+
* @param {String} commandName hook command name
|
|
362
|
+
* @param {Array} args arguments that command would receive
|
|
363
|
+
* @param {Number} result 0 - command success, 1 - command error
|
|
364
|
+
* @param {Object} error error object if any
|
|
365
|
+
*/
|
|
366
|
+
// afterCommand: function (commandName, args, result, error) {
|
|
367
|
+
// },
|
|
368
|
+
/**
|
|
369
|
+
* Gets executed after all tests are done. You still have access to all global variables from
|
|
370
|
+
* the test.
|
|
371
|
+
* @param {Number} result 0 - test pass, 1 - test fail
|
|
372
|
+
* @param {Array.<Object>} capabilities list of capabilities details
|
|
373
|
+
* @param {Array.<String>} specs List of spec file paths that ran
|
|
374
|
+
*/
|
|
375
|
+
// after: function (result, capabilities, specs) {
|
|
376
|
+
// },
|
|
377
|
+
/**
|
|
378
|
+
* Gets executed right after terminating the webdriver session.
|
|
379
|
+
* @param {Object} config wdio configuration object
|
|
380
|
+
* @param {Array.<Object>} capabilities list of capabilities details
|
|
381
|
+
* @param {Array.<String>} specs List of spec file paths that ran
|
|
382
|
+
*/
|
|
383
|
+
// afterSession: function (config, capabilities, specs) {
|
|
384
|
+
// },
|
|
385
|
+
/**
|
|
386
|
+
* Gets executed after all workers got shut down and the process is about to exit. An error
|
|
387
|
+
* thrown in the onComplete hook will result in the test run failing.
|
|
388
|
+
* @param {Object} exitCode 0 - success, 1 - fail
|
|
389
|
+
* @param {Object} config wdio configuration object
|
|
390
|
+
* @param {Array.<Object>} capabilities list of capabilities details
|
|
391
|
+
* @param {<Object>} results object containing test results
|
|
392
|
+
*/
|
|
393
|
+
// onComplete: function(exitCode, config, capabilities, results) {
|
|
394
|
+
// },
|
|
395
|
+
/**
|
|
396
|
+
* Gets executed when a refresh happens.
|
|
397
|
+
* @param {String} oldSessionId session ID of the old session
|
|
398
|
+
* @param {String} newSessionId session ID of the new session
|
|
399
|
+
*/
|
|
400
|
+
//onReload: function(oldSessionId, newSessionId) {
|
|
401
|
+
//}
|
|
402
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@salesforcedevs/sfdocs-e2e",
|
|
3
|
+
"version": "0.6.132-linkfix-alpha",
|
|
4
|
+
"description": "E2E test suite for SFDocs static portal pages (SSG)",
|
|
5
|
+
"license": "ISC",
|
|
6
|
+
"bin": {
|
|
7
|
+
"sfdocs-e2e": "./bin/run-e2e.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin/",
|
|
11
|
+
"src/",
|
|
12
|
+
"*.conf.js",
|
|
13
|
+
"tsconfig.json"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"test:e2e": "TS_NODE_TRANSPILE_ONLY=true TS_NODE_PROJECT=./tsconfig.json wdio wdio.conf.js",
|
|
17
|
+
"test:e2e:portal": "TS_NODE_TRANSPILE_ONLY=true TS_NODE_PROJECT=./tsconfig.json wdio portal-wdio.conf.js",
|
|
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"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@sa11y/wdio": "^7.0.0",
|
|
23
|
+
"@wdio/allure-reporter": "^7.19.0",
|
|
24
|
+
"@wdio/cli": "^7.19.0",
|
|
25
|
+
"@wdio/local-runner": "^7.19.0",
|
|
26
|
+
"@wdio/mocha-framework": "^7.19.0",
|
|
27
|
+
"@wdio/selenium-standalone-service": "^7.19.0",
|
|
28
|
+
"@wdio/spec-reporter": "^7.19.0",
|
|
29
|
+
"allure-commandline": "2.20.1",
|
|
30
|
+
"got": "^11.8.3",
|
|
31
|
+
"ts-node": "^10.9.1",
|
|
32
|
+
"typescript": "^4.1.3",
|
|
33
|
+
"wdio-video-reporter": "^3.4.0",
|
|
34
|
+
"webdriverio": "^7.19.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/mocha": "^10.0.1"
|
|
38
|
+
},
|
|
39
|
+
"gitHead": "5a9c6faeae5e1c7e337706b1f0dff51007ab702f"
|
|
40
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const BASE_CONFIG = require('./common-wdio.conf');
|
|
2
|
+
|
|
3
|
+
exports.config = {
|
|
4
|
+
...BASE_CONFIG.config,
|
|
5
|
+
baseUrl: 'http://localhost:3001',
|
|
6
|
+
specs: [
|
|
7
|
+
'./src/portal/specs/scope.search.reference.test.ts',
|
|
8
|
+
'./src/portal/specs/scope.search.guide.test.ts',
|
|
9
|
+
],
|
|
10
|
+
};
|