@salesforcedevs/sfdocs-e2e 1.0.2 → 1.0.3-alpha1

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 CHANGED
@@ -106,6 +106,7 @@ npx sfdocs-e2e --baseUrl http://localhost:8080
106
106
  # Choose a config suite
107
107
  npx sfdocs-e2e --config portal
108
108
  npx sfdocs-e2e --config static-portal
109
+ npx sfdocs-e2e --config static-dsc-portal
109
110
  npx sfdocs-e2e --config search
110
111
 
111
112
  # Help
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
  };
@@ -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
- 'selenium-standalone',
187
- {
188
- installArgs: { drivers }, // drivers to install
189
- args: { drivers }, // drivers to use
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": "1.0.2",
3
+ "version": "1.0.3-alpha1",
4
4
  "description": "E2E test suite for SFDocs static portal pages (SSG)",
5
5
  "license": "ISC",
6
6
  "bin": {
@@ -16,6 +16,7 @@
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:e2e:static:dsc:portal": "TS_NODE_TRANSPILE_ONLY=true TS_NODE_PROJECT=./tsconfig.json wdio static-dsc-portal-wdio.conf.js",
19
20
  "test:scope-search": "TS_NODE_TRANSPILE_ONLY=true TS_NODE_PROJECT=./tsconfig.json wdio search-wdio.conf.js",
20
21
  "release:alpha:e2e": "f() { bash bin/publish.sh $1 --tag alpha; }; f",
21
22
  "release:e2e": "f() { bash bin/publish.sh $1; }; f"
@@ -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(18);
16
+ expect(projectCards.length).toEqual(19);
17
17
  });
18
18
 
19
19
  // it('is accessible', () => {
@@ -11,7 +11,7 @@ describe('Guides layout> ', () => {
11
11
  await page.waitPageLoad();
12
12
  });
13
13
 
14
- layoutTest(page);
14
+ layoutTest(page, 'doc-header');
15
15
 
16
16
  it('should have Guides tab as active', async () => {
17
17
  const selectedHeaderNavItem = await page.getActiveNavTab();
@@ -18,7 +18,9 @@ export default function layoutTest(givenPage: Page, headerTag = 'dx-global-heade
18
18
  const header = await $(headerTag);
19
19
  await header.waitForDisplayed();
20
20
  expect(await header.isDisplayed()).toBeTruthy();
21
- expect(await header.getText()).toContain('Developers');
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 () => {
@@ -11,7 +11,7 @@ describe('/docs/api overview page > ', () => {
11
11
  (await $('dx-section')).waitForDisplayed();
12
12
  });
13
13
 
14
- layoutTest(page);
14
+ layoutTest(page, 'doc-header');
15
15
 
16
16
  it('should show Overview, Guides and Reference tabs and have Overview as active', async () => {
17
17
  const overviewPageSection = await $('>>>.content-type-overview');
@@ -9,9 +9,10 @@ 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
- layoutTest(referencePage);
15
+ layoutTest(referencePage, 'doc-header');
15
16
 
16
17
  it('should have the right title', async () => {
17
18
  expect(browser).toHaveTitle('TEST Commerce Cloud Orders APIs');
@@ -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 browser.pause(1000);
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();
@@ -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
+ };