@salesforcedevs/sfdocs-e2e 1.0.6 → 1.0.7-liquid-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-liquid-alpha",
4
4
  "description": "E2E test suite for SFDocs static portal pages (SSG)",
5
5
  "license": "ISC",
6
6
  "bin": {
@@ -4,4 +4,5 @@ exports.config = {
4
4
  ...BASE_CONFIG.config,
5
5
  baseUrl: process.env.E2E_BASE_URL || 'http://localhost:3001',
6
6
  specs: ['./src/portal/specs/**/*.test.ts', './src/shared/specs/*.test.ts'],
7
+ exclude: ['./src/shared/specs/contentActionToolbar.test.ts'],
7
8
  };
@@ -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(20);
16
+ expect(projectCards.length).toEqual(21);
17
17
  });
18
18
 
19
19
  // it('is accessible', () => {
@@ -0,0 +1,59 @@
1
+ import GuidePage from '../pageobjects/guide.page';
2
+ import { ReferencePage } from '../pageobjects/reference.page';
3
+
4
+ const EN_US_GUIDE_PATH = '/docs/service/vscode-maintainer/guide/vscode-overview.html';
5
+ const EN_US_MARKDOWN_REFERENCE_PATH =
6
+ '/docs/commerce/flexible-references/references/shopper-manual-ref/quick-start.html';
7
+ const NON_MARKDOWN_REFERENCE_PATH = '/docs/test-metamind-oas-api/references/1mkfx9?meta=Summary';
8
+ const NON_EN_US_MARKDOWN_REFERENCE_PATH =
9
+ '/docs/commerce/ja-jp/flex-references-loc/references/manual-ref/commerce-cloud-api-overview.html';
10
+
11
+ async function expectToolbarButtons(toolbar: WebdriverIO.Element): Promise<void> {
12
+ const toolbarButtons = await toolbar.shadow$$('dx-button.toolbar-button');
13
+ expect(toolbarButtons.length).toBe(3);
14
+
15
+ const labels = await Promise.all(
16
+ toolbarButtons.map(async (button) => (await button.getText()).trim()),
17
+ );
18
+ expect(labels).toEqual(
19
+ expect.arrayContaining(['Copy as Markdown', 'View as Markdown', 'Copy URL to Markdown']),
20
+ );
21
+ }
22
+
23
+ describe('Content action toolbar scenarios', () => {
24
+ it('Markdown guide should have the toolbar', async () => {
25
+ const page = new GuidePage(EN_US_GUIDE_PATH);
26
+ page.open();
27
+ await page.waitPageLoad();
28
+
29
+ const toolbar = await $('>>>doc-content-action-toolbar');
30
+ await toolbar.waitForDisplayed();
31
+ await expectToolbarButtons(toolbar);
32
+ });
33
+
34
+ it('Markdown reference should have the toolbar', async () => {
35
+ const referencePage = new ReferencePage(EN_US_MARKDOWN_REFERENCE_PATH);
36
+ referencePage.open();
37
+ await referencePage.waitForMarkdownBasedReferencePageLoad();
38
+
39
+ const toolbar = await $('>>>doc-content-action-toolbar');
40
+ await toolbar.waitForDisplayed();
41
+ await expectToolbarButtons(toolbar);
42
+ });
43
+
44
+ it("Non-markdown reference shouldn't have toolbar", async () => {
45
+ const referencePage = new ReferencePage(NON_MARKDOWN_REFERENCE_PATH);
46
+ referencePage.open();
47
+ await referencePage.waitForSpecBasedReferencePageLoad();
48
+
49
+ const toolbar = await $('>>>doc-content-action-toolbar');
50
+ expect(await toolbar.isExisting()).toBeFalsy();
51
+ });
52
+
53
+ it("Non en-us locale page shouldn't have toolbar", async () => {
54
+ const nonEnUsReferencePage = new ReferencePage(NON_EN_US_MARKDOWN_REFERENCE_PATH);
55
+ nonEnUsReferencePage.open();
56
+ await nonEnUsReferencePage.waitForMarkdownBasedReferencePageLoad();
57
+ expect(await (await $('>>>doc-content-action-toolbar')).isExisting()).toBeFalsy();
58
+ });
59
+ });
@@ -64,7 +64,7 @@ describe('Test Guides page components functionality> ', () => {
64
64
  const sidebar = await (await $('doc-content-layout')).shadow$('div > dx-sidebar-old');
65
65
  const sideBarContent = await sidebar.shadow$$('div.container div.sidebar-content dx-tree');
66
66
 
67
- expect(sideBarContent.length).toEqual(4);
67
+ expect(sideBarContent.length).toEqual(6);
68
68
 
69
69
  const nextStepOption = await (
70
70
  await sideBarContent[3].shadow$('dx-tree-item')
@@ -131,6 +131,113 @@ describe('Liquid Template Rendering', () => {
131
131
  expect(html.includes('{{ id2 }}')).toBeFalsy();
132
132
  });
133
133
 
134
+ it('Should render repository-level variables from content-config.yml', async function () {
135
+ if (!liquidEnabled) {
136
+ this.skip();
137
+ }
138
+
139
+ const content = await $('>>>doc-content-layout');
140
+ const text = await content.getText();
141
+ const html = await content.getHTML();
142
+
143
+ expect(text.includes('Salesforce Platform')).toBeTruthy();
144
+ expect(text.includes('62.0')).toBeTruthy();
145
+ expect(text.includes('sf')).toBeTruthy();
146
+ expect(html.includes('{{ variables.platform')).toBeFalsy();
147
+ });
148
+
149
+ it('Should render englishonly block content in production', async function () {
150
+ if (!liquidEnabled) {
151
+ this.skip();
152
+ }
153
+
154
+ const content = await $('>>>doc-content-layout');
155
+ const text = await content.getText();
156
+ const html = await content.getHTML();
157
+
158
+ expect(text.includes('This feature is currently only available in English')).toBeTruthy();
159
+ expect(html.includes('{% englishonly')).toBeFalsy();
160
+ expect(html.includes('{% endenglishonly')).toBeFalsy();
161
+ });
162
+
163
+ it('Should render future block content when previewFuture is enabled', async function () {
164
+ if (!liquidEnabled) {
165
+ this.skip();
166
+ }
167
+
168
+ const content = await $('>>>doc-content-layout');
169
+ const text = await content.getText();
170
+ const html = await content.getHTML();
171
+
172
+ expect(text.includes('Coming Soon')).toBeTruthy();
173
+ expect(html.includes('{% future')).toBeFalsy();
174
+ expect(html.includes('{% endfuture')).toBeFalsy();
175
+ });
176
+
177
+ it('Should render liquid.data string format — single YAML file on root context', async function () {
178
+ if (!liquidEnabled) {
179
+ this.skip();
180
+ }
181
+
182
+ const content = await $('>>>doc-content-layout');
183
+ const text = await content.getText();
184
+ const html = await content.getHTML();
185
+
186
+ expect(text.includes('Hello from data.yaml')).toBeTruthy();
187
+ expect(html.includes('{{ data.greeting }}')).toBeFalsy();
188
+ });
189
+
190
+ it('Should render liquid.data object format — multiple YAML files each under a named key', async function () {
191
+ if (!liquidEnabled) {
192
+ this.skip();
193
+ }
194
+
195
+ const dataFormatsPage = new GuidePage('/docs/redirects/guide/orders-api-overview.html');
196
+ dataFormatsPage.open();
197
+ await dataFormatsPage.waitPageLoad();
198
+
199
+ const content = await $('>>>doc-content-layout');
200
+ const text = await content.getText();
201
+ const html = await content.getHTML();
202
+
203
+ expect(text.includes('Sample data file to check the multi-include')).toBeTruthy();
204
+ expect(text.includes('Represents a scheduled or completed visit')).toBeTruthy();
205
+ expect(html.includes('{{ two.summary }}')).toBeFalsy();
206
+ expect(html.includes('{{ data.one.summary }}')).toBeFalsy();
207
+ });
208
+
209
+ it('Should render the future topic page when previewFuture is enabled', async function () {
210
+ if (!liquidEnabled) {
211
+ this.skip();
212
+ }
213
+
214
+ const futurePage = new GuidePage('/docs/liquid-project/guide/future-topic.html');
215
+ futurePage.open();
216
+ await futurePage.waitPageLoad();
217
+
218
+ const content = await $('>>>doc-content-layout');
219
+ const text = await content.getText();
220
+
221
+ expect(text.includes('Future Feature')).toBeTruthy();
222
+ expect(text.includes('previewFuture')).toBeTruthy();
223
+ });
224
+
225
+ it('Should render the englishonly topic page', async function () {
226
+ if (!liquidEnabled) {
227
+ this.skip();
228
+ }
229
+
230
+ const englishOnlyPage = new GuidePage('/docs/liquid-project/guide/english-only-topic.html');
231
+ englishOnlyPage.open();
232
+ await englishOnlyPage.waitPageLoad();
233
+
234
+ const content = await $('>>>doc-content-layout');
235
+ const text = await content.getText();
236
+
237
+ expect(text.includes('English-Only Topic')).toBeTruthy();
238
+ expect(text.includes('filters: [englishonly]')).toBeTruthy();
239
+ });
240
+
134
241
  it('Should not process Liquid when frontmatter has liquid.enabled as false', async function () {
135
242
  if (!liquidEnabled) {
136
243
  this.skip();
@@ -18,7 +18,7 @@ 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',
21
+ // './src/shared/specs/liquid.test.ts',
22
22
  './src/portal/specs/docs.api.test.ts',
23
23
  './src/portal/specs/docs.test.ts',
24
24
  './src/shared/specs/banner.test.ts',
@@ -18,7 +18,7 @@ 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',
21
+ // './src/shared/specs/liquid.test.ts',
22
22
  // /docs/apis landing page doesn't exist in static builds
23
23
  './src/portal/specs/docs.api.test.ts',
24
24
  // /docs landing page doesn't exist in static builds
package/wdio.conf.js CHANGED
@@ -3,4 +3,5 @@ const BASE_CONFIG = require('./common-wdio.conf');
3
3
  exports.config = {
4
4
  ...BASE_CONFIG.config,
5
5
  specs: ['./src/content-repo/specs/**/*.test.ts', './src/shared/specs/*.test.ts'],
6
+ exclude: ['./src/shared/specs/contentActionToolbar.test.ts'],
6
7
  };