@salesforcedevs/sfdocs-e2e 1.0.6 → 1.0.7-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/sfdocs-e2e",
3
- "version": "1.0.6",
3
+ "version": "1.0.7-alpha",
4
4
  "description": "E2E test suite for SFDocs static portal pages (SSG)",
5
5
  "license": "ISC",
6
6
  "bin": {
@@ -35,11 +35,6 @@ class ApiRedocReferencePage extends Page {
35
35
  const lnbItems = await scrollbarContainer.$$('ul[role="menu"] > li');
36
36
  return lnbItems[index];
37
37
  }
38
-
39
- async getProjectHeader(): Promise<WebdriverIO.Element> {
40
- const sidebar = await this.getSidebar();
41
- return sidebar.$('div.redoc-project-header');
42
- }
43
38
  }
44
39
 
45
40
  export default ApiRedocReferencePage;
@@ -38,13 +38,4 @@ export class ReferencePage extends Page {
38
38
  async getSidebarContent(): Promise<WebdriverIO.Element> {
39
39
  return $('>>>div .sidebar-item-selected');
40
40
  }
41
-
42
- async getSidebar(): Promise<WebdriverIO.Element> {
43
- return (await $('>>>doc-content-layout')).shadow$('div > dx-sidebar-old');
44
- }
45
-
46
- async getSidebarItems(): Promise<WebdriverIO.ElementArray> {
47
- const sidebar = await this.getSidebar();
48
- return sidebar.shadow$$('div.container div.sidebar-content dx-tree');
49
- }
50
41
  }
@@ -6,26 +6,55 @@ let liquidEnabled = false;
6
6
  describe('Liquid Template Rendering', () => {
7
7
  before(async () => {
8
8
  try {
9
+ // Check frontmatter to determine if Liquid is enabled
10
+ let frontmatterCheckSucceeded = false;
11
+
12
+ try {
13
+ const fs = require('fs');
14
+ const path = require('path');
15
+ const matter = require('gray-matter');
16
+
17
+ const contentPath = path.resolve(
18
+ __dirname,
19
+ '../../../../example-repository/content/en-us/liquid-project/guides/liquid-quickstart.md',
20
+ );
21
+
22
+ if (fs.existsSync(contentPath)) {
23
+ const fileContent = fs.readFileSync(contentPath, 'utf-8');
24
+ const { data: frontmatter } = matter(fileContent);
25
+ liquidEnabled = frontmatter?.liquid?.enabled === true;
26
+ frontmatterCheckSucceeded = true;
27
+ }
28
+ } catch (frontmatterError) {
29
+ // Frontmatter check failed (file not found or gray-matter not available)
30
+ // Fall back to checking rendered output
31
+ frontmatterCheckSucceeded = false;
32
+ }
33
+
34
+ // Initialize page for tests
9
35
  page = new GuidePage('/docs/liquid-project/guide/liquid-quickstart.html');
10
36
  page.open();
11
37
  await page.waitPageLoad();
12
38
 
13
- const content = await $('>>>doc-content-layout');
14
- const text = await content.getText();
15
- const html = await content.getHTML();
16
-
17
- const hasLiquidOutput = text.includes('Hello from data.yaml');
18
- const hasRawSyntax =
19
- html.includes('{{ data.greeting }}') ||
20
- html.includes('{{ topic }}') ||
21
- (html.includes('{{') && html.includes('{%'));
22
-
23
- if (hasRawSyntax) {
24
- liquidEnabled = false;
25
- } else if (hasLiquidOutput) {
26
- liquidEnabled = true;
27
- } else {
28
- liquidEnabled = false;
39
+ // Fallback: If frontmatter check didn't succeed, check rendered output
40
+ if (!frontmatterCheckSucceeded) {
41
+ const content = await $('>>>doc-content-layout');
42
+ const text = await content.getText();
43
+ const html = await content.getHTML();
44
+
45
+ const hasLiquidOutput = text.includes('Hello from data.yaml');
46
+ const hasRawSyntax =
47
+ html.includes('{{ data.greeting }}') ||
48
+ html.includes('{{ topic }}') ||
49
+ (html.includes('{{') && html.includes('{%'));
50
+
51
+ if (hasRawSyntax) {
52
+ liquidEnabled = false;
53
+ } else if (hasLiquidOutput) {
54
+ liquidEnabled = true;
55
+ } else {
56
+ liquidEnabled = false;
57
+ }
29
58
  }
30
59
  } catch (e) {
31
60
  liquidEnabled = false;
@@ -1,7 +1,6 @@
1
1
  import { it } from 'mocha';
2
2
  import RedocApisPage from '../pageobjects/api-redoc-reference.page';
3
3
  import OverviewPage from '../pageobjects/overview.page';
4
- import { ReferencePage } from '../pageobjects/reference.page';
5
4
  import {
6
5
  waitAndGetDocPhaseParentInRedocReferencesPage,
7
6
  assertDocPhaseUnavailability,
@@ -10,7 +9,6 @@ import {
10
9
  } from '../pageobjects/doc-phase-config';
11
10
 
12
11
  let page: RedocApisPage;
13
- let refPage: ReferencePage;
14
12
  describe('Redoc API Reference page', () => {
15
13
  describe('check layouts', () => {
16
14
  before(async () => {
@@ -169,145 +167,4 @@ describe('Redoc API Reference page', () => {
169
167
  expect(await heading.isDisplayedInViewport()).toBe(true);
170
168
  });
171
169
  });
172
-
173
- describe('Flexible References with Redoc Rendering', () => {
174
- describe('All references view', () => {
175
- before(async () => {
176
- refPage = new ReferencePage('docs/service/multi-oas-redoc/references');
177
- refPage.open();
178
-
179
- await refPage.waitForMarkdownBasedReferencePageLoad();
180
- });
181
-
182
- it('should display all reference titles in LNB', async () => {
183
- const treeItems = await refPage.getSidebarItems();
184
-
185
- expect(treeItems.length).toEqual(3);
186
- });
187
-
188
- it('should show arrow button after OAS reference titles', async () => {
189
- const sideBarContent = await refPage.getSidebarItems();
190
-
191
- const secondItem = sideBarContent[1];
192
- const treeItem = await secondItem.shadow$('dx-tree-item');
193
- const treeTile = await treeItem.shadow$('a > dx-tree-tile');
194
- const arrowIcon = await treeTile.shadow$(
195
- 'a > div[role="heading"] > div.tile-forward-arrow',
196
- );
197
-
198
- expect(await arrowIcon.isExisting()).toBeTruthy();
199
- });
200
- });
201
-
202
- describe('Navigation and content verification', () => {
203
- it('should display markdown content when first reference is clicked', async () => {
204
- const sideBarContent = await refPage.getSidebarItems();
205
- const firstItem = sideBarContent[0];
206
- const treeItem = await firstItem.shadow$('dx-tree-item');
207
- await treeItem.click();
208
-
209
- const contentLayout = await $('>>>doc-content-layout');
210
- await contentLayout.waitForDisplayed();
211
-
212
- expect(await contentLayout.isDisplayed()).toBeTruthy();
213
-
214
- const heading = await $('>>>h1');
215
- const headingText = await heading.getText();
216
-
217
- expect(headingText).toEqual('Metamind API references');
218
- });
219
-
220
- it('should display Redoc UI when OAS reference is clicked', async () => {
221
- await browser.url('/docs/service/multi-oas-redoc/references');
222
- await refPage.waitForMarkdownBasedReferencePageLoad();
223
-
224
- const sideBarContent = await refPage.getSidebarItems();
225
- const secondItem = sideBarContent[1];
226
- const treeItem = await secondItem.shadow$('dx-tree-item');
227
- await treeItem.click();
228
-
229
- const redocContainer = await $('doc-redoc-reference > .redoc-container');
230
- await redocContainer.waitForDisplayed({ timeout: 30000 });
231
-
232
- expect(await redocContainer.isDisplayed()).toBeTruthy();
233
-
234
- page = new RedocApisPage(
235
- 'docs/service/multi-oas-redoc/references/redoc-orders-multiple',
236
- );
237
- });
238
-
239
- it('should have the correct api info title', async () => {
240
- const apiTitle = await page.getApiTitle();
241
- const titleText = await apiTitle.getText();
242
-
243
- expect(titleText).toMatch('Einstein Vision and Einstein Language');
244
- });
245
-
246
- it('should display current reference title and "All References" with back arrow in LNB', async () => {
247
- const projectHeaderContainer = await page.getProjectHeader();
248
-
249
- const backButton = await projectHeaderContainer.$('a.redoc-project-back');
250
- const allReference = await backButton.$('span.redoc-project-title');
251
- const specTitle = await projectHeaderContainer.$('h2.redoc-spec-title');
252
-
253
- expect(await allReference.getText()).toEqual('All Reference');
254
- expect(await backButton.isExisting()).toBeTruthy();
255
- expect(await specTitle.getText()).toEqual('Orders API');
256
- });
257
- });
258
-
259
- describe('Navigation back to all references', () => {
260
- before(async () => {
261
- page = new RedocApisPage(
262
- 'docs/service/multi-oas-redoc/references/redoc-orders-multiple',
263
- );
264
- page.open();
265
- await page.waitPageLoad();
266
- });
267
-
268
- it('should navigate back to main URL when back arrow is clicked', async () => {
269
- const projectHeaderContainer = await page.getProjectHeader();
270
- const backButton = await projectHeaderContainer.$('a.redoc-project-back');
271
-
272
- await backButton.click();
273
-
274
- const contentLayout = await $('>>>doc-content-layout');
275
- await contentLayout.waitForDisplayed();
276
-
277
- const currentUrl = await browser.getUrl();
278
-
279
- expect(currentUrl).toContain('/docs/service/multi-oas-redoc/references');
280
- expect(currentUrl).not.toContain('redoc-orders-multiple');
281
- });
282
-
283
- it('should display all references in LNB after navigating back', async () => {
284
- refPage = new ReferencePage('/docs/service/multi-oas-redoc/references');
285
- const treeItems = await refPage.getSidebarItems();
286
-
287
- expect(treeItems.length).toEqual(3);
288
- });
289
-
290
- it('should navigate to third reference when clicked', async () => {
291
- const sideBarContent = await refPage.getSidebarItems();
292
- const thirdItem = sideBarContent[2];
293
- const treeItem = await thirdItem.shadow$('dx-tree-item');
294
- await treeItem.click();
295
-
296
- const redocContainer = await $('doc-redoc-reference > .redoc-container');
297
- await redocContainer.waitForDisplayed({ timeout: 30000 });
298
-
299
- expect(await redocContainer.isDisplayed()).toBeTruthy();
300
- expect(await browser.getUrl()).toContain('redoc-quip-admin-api');
301
-
302
- page = new RedocApisPage(
303
- 'docs/service/multi-oas-redoc/references/redoc-quip-admin-api',
304
- );
305
-
306
- const apiTitle = await page.getApiTitle();
307
- const titleText = await apiTitle.getText();
308
-
309
- expect(titleText).toMatch('Quip Admin API');
310
- });
311
- });
312
- });
313
170
  });
@@ -24,11 +24,8 @@ describe('Video Plugin Scenarios ', () => {
24
24
  expect(await videoTitle?.getText()).toBe('Video from YouTube');
25
25
  const videoContainer = await videoRootElement?.$('.video-plugin-container');
26
26
  const iframeElement = await videoContainer?.$('iframe');
27
- // The video plugin normalizes the YouTube host to www.youtube.com to
28
- // avoid a cross-origin redirect that would drop the iframe's fullscreen
29
- // grant (W-23222416). The authored src is `https://youtube.com/...`.
30
27
  expect(await iframeElement?.getAttribute('src')).toBe(
31
- 'https://www.youtube.com/embed/di6iwHhrH6s',
28
+ 'https://youtube.com/embed/di6iwHhrH6s',
32
29
  );
33
30
  });
34
31
  });
@@ -18,7 +18,6 @@ exports.config = {
18
18
 
19
19
  // Exclude tests that require dynamic server features or pages not in static build
20
20
  exclude: [
21
- './src/shared/specs/liquid.test.ts',
22
21
  './src/portal/specs/docs.api.test.ts',
23
22
  './src/portal/specs/docs.test.ts',
24
23
  './src/shared/specs/banner.test.ts',
@@ -18,7 +18,6 @@ exports.config = {
18
18
 
19
19
  // Exclude tests that require dynamic server features or pages not in static build
20
20
  exclude: [
21
- './src/shared/specs/liquid.test.ts',
22
21
  // /docs/apis landing page doesn't exist in static builds
23
22
  './src/portal/specs/docs.api.test.ts',
24
23
  // /docs landing page doesn't exist in static builds