@salesforcedevs/sfdocs-e2e 1.0.7 → 1.0.8-alpha.0

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.7",
3
+ "version": "1.0.8-alpha.0",
4
4
  "description": "E2E test suite for SFDocs static portal pages (SSG)",
5
5
  "license": "ISC",
6
6
  "bin": {
@@ -4,5 +4,9 @@ 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
+ exclude: [
8
+ './src/shared/specs/contentActionToolbar.test.ts',
9
+ // Advanced liquid tests require previewFuture — not enabled in portal builds
10
+ './src/shared/specs/liquid-advanced.test.ts',
11
+ ],
8
12
  };
@@ -0,0 +1,56 @@
1
+ import GuidePage from '../pageobjects/guide.page';
2
+
3
+ let page: GuidePage;
4
+ let liquidEnabled = false;
5
+
6
+ describe('Liquid Template Rendering — Advanced', () => {
7
+ before(async () => {
8
+ try {
9
+ page = new GuidePage('/docs/liquid-project/guide/liquid-quickstart.html');
10
+ await browser.url(page.path);
11
+ await page.waitPageLoad();
12
+
13
+ const content = await $('>>>doc-content-layout');
14
+ const text = await content.getText();
15
+
16
+ liquidEnabled = text.includes('Hello from data.yaml');
17
+ } catch (e) {
18
+ liquidEnabled = false;
19
+ }
20
+ });
21
+
22
+ beforeEach(async () => {
23
+ if (liquidEnabled) {
24
+ page = new GuidePage('/docs/liquid-project/guide/liquid-quickstart.html');
25
+ await browser.url(page.path);
26
+ await page.waitPageLoad();
27
+ }
28
+ });
29
+
30
+ it('Should render future block content when previewFuture is enabled', async function () {
31
+ if (!liquidEnabled) {
32
+ this.skip();
33
+ }
34
+
35
+ const content = await $('>>>doc-content-layout');
36
+ const text = await content.getText();
37
+
38
+ expect(text.includes('Coming Soon')).toBeTruthy();
39
+ });
40
+
41
+ it('Should render the future topic page when previewFuture is enabled', async function () {
42
+ if (!liquidEnabled) {
43
+ this.skip();
44
+ }
45
+
46
+ const futurePage = new GuidePage('/docs/liquid-project/guide/future-topic.html');
47
+ await browser.url(futurePage.path);
48
+ await futurePage.waitPageLoad();
49
+
50
+ const content = await $('>>>doc-content-layout');
51
+ const text = await content.getText();
52
+
53
+ expect(text.includes('Future Feature')).toBeTruthy();
54
+ expect(text.includes('previewFuture')).toBeTruthy();
55
+ });
56
+ });
@@ -7,7 +7,7 @@ describe('Liquid Template Rendering', () => {
7
7
  before(async () => {
8
8
  try {
9
9
  page = new GuidePage('/docs/liquid-project/guide/liquid-quickstart.html');
10
- page.open();
10
+ await browser.url(page.path);
11
11
  await page.waitPageLoad();
12
12
 
13
13
  const content = await $('>>>doc-content-layout');
@@ -16,9 +16,9 @@ describe('Liquid Template Rendering', () => {
16
16
 
17
17
  const hasLiquidOutput = text.includes('Hello from data.yaml');
18
18
  const hasRawSyntax =
19
- html.includes('{{ data.greeting }}') ||
20
- html.includes('{{ topic }}') ||
21
- (html.includes('{{') && html.includes('{%'));
19
+ html.includes('{% assign') ||
20
+ html.includes('{% include') ||
21
+ html.includes('{{ data.greeting }}');
22
22
 
23
23
  if (hasRawSyntax) {
24
24
  liquidEnabled = false;
@@ -35,7 +35,7 @@ describe('Liquid Template Rendering', () => {
35
35
  beforeEach(async () => {
36
36
  if (liquidEnabled) {
37
37
  page = new GuidePage('/docs/liquid-project/guide/liquid-quickstart.html');
38
- page.open();
38
+ await browser.url(page.path);
39
39
  await page.waitPageLoad();
40
40
  }
41
41
  });
@@ -50,10 +50,21 @@ describe('Liquid Template Rendering', () => {
50
50
 
51
51
  expect(text.includes('GitHub for writers')).toBeTruthy();
52
52
  expect(text.includes('Hello from data.yaml')).toBeTruthy();
53
+ });
53
54
 
55
+ it('Should render repository-level variables from content-config.yml', async function () {
56
+ if (!liquidEnabled) {
57
+ this.skip();
58
+ }
59
+
60
+ const content = await $('>>>doc-content-layout');
61
+ const text = await content.getText();
54
62
  const html = await content.getHTML();
55
- expect(html.includes('{{ topic }}')).toBeFalsy();
56
- expect(html.includes('{{ data.greeting }}')).toBeFalsy();
63
+
64
+ expect(text.includes('Salesforce Platform')).toBeTruthy();
65
+ expect(text.includes('62.0')).toBeTruthy();
66
+ expect(text.includes('sf')).toBeTruthy();
67
+ expect(html.includes('{{ variables.platform')).toBeFalsy();
57
68
  });
58
69
 
59
70
  it('Should render included templates from shared directory', async function () {
@@ -86,27 +97,29 @@ describe('Liquid Template Rendering', () => {
86
97
  const listItems = await content.$$('li');
87
98
  expect(listItems.length).toBeGreaterThan(5);
88
99
 
89
- expect(html.includes('{% for')).toBeFalsy();
90
- expect(html.includes('{%- for')).toBeFalsy();
91
- expect(html.includes('{% endfor')).toBeFalsy();
100
+ expect(text.includes('supported_calls')).toBeFalsy();
101
+ expect(html.includes('for call in supported_calls')).toBeFalsy();
92
102
  });
93
103
 
94
- it('Should not process Liquid syntax inside code blocks', async function () {
104
+ it('Should resolve {{ }} outputs inside code blocks but keep {% %} tags literal', async function () {
95
105
  if (!liquidEnabled) {
96
106
  this.skip();
97
107
  }
98
108
 
99
- const content = await $('>>>doc-content-layout');
100
- const html = await content.getHTML();
101
- const codeBlock = await content.$('code');
109
+ const codeBlockElement = await $('>>>.code-block-content');
110
+ const codeBlock = await codeBlockElement.shadow$('code');
102
111
 
103
112
  expect(await codeBlock.isExisting()).toBeTruthy();
104
113
 
105
- const codeHtml = await codeBlock.getHTML();
106
- expect(codeHtml.includes('{{ data.greeting }}')).toBeTruthy();
107
- expect(codeHtml.includes('{{ topic }}')).toBeTruthy();
108
- expect(codeHtml.includes('{% for item in items %}')).toBeTruthy();
114
+ const codeText = await codeBlock.getText();
115
+ expect(codeText.includes('{{ data.greeting }}')).toBeFalsy();
116
+ expect(codeText.includes('{{ topic }}')).toBeFalsy();
117
+ expect(codeText.includes('Hello from data.yaml')).toBeTruthy();
118
+ expect(codeText.includes('GitHub for writers')).toBeTruthy();
119
+ expect(codeText.includes('{% for item in items %}')).toBeTruthy();
120
+ expect(codeText.includes('{{ item }}')).toBeTruthy();
109
121
 
122
+ const content = await $('>>>doc-content-layout');
110
123
  const text = await content.getText();
111
124
  expect(text.includes('Visit')).toBeTruthy();
112
125
  });
@@ -131,16 +144,76 @@ describe('Liquid Template Rendering', () => {
131
144
  expect(html.includes('{{ id2 }}')).toBeFalsy();
132
145
  });
133
146
 
134
- it('Should not process Liquid when frontmatter has liquid.enabled as false', async function () {
147
+ it('Should render englishonly block content in production', async function () {
135
148
  if (!liquidEnabled) {
136
149
  this.skip();
137
150
  }
138
151
 
139
- const disabledPage = new GuidePage(
152
+ const content = await $('>>>doc-content-layout');
153
+ const text = await content.getText();
154
+ const html = await content.getHTML();
155
+
156
+ expect(text.includes('This feature is currently only available in English')).toBeTruthy();
157
+ expect(html.includes('{% englishonly')).toBeFalsy();
158
+ expect(html.includes('{% endenglishonly')).toBeFalsy();
159
+ });
160
+
161
+ it('Should render liquid.data string format — single YAML file on root context', async function () {
162
+ if (!liquidEnabled) {
163
+ this.skip();
164
+ }
165
+
166
+ const content = await $('>>>doc-content-layout');
167
+ const text = await content.getText();
168
+
169
+ expect(text.includes('Hello from data.yaml')).toBeTruthy();
170
+ });
171
+
172
+ it('Should render liquid.data object format — multiple YAML files each under a named key', async function () {
173
+ if (!liquidEnabled) {
174
+ this.skip();
175
+ }
176
+
177
+ const multiDataPage = new GuidePage('/docs/liquid-project/guide/multi-data.html');
178
+ await browser.url(multiDataPage.path);
179
+ await multiDataPage.waitPageLoad();
180
+
181
+ const content = await $('>>>doc-content-layout');
182
+ const text = await content.getText();
183
+ const html = await content.getHTML();
184
+
185
+ expect(text.includes('Sample data file to check the multi-include')).toBeTruthy();
186
+ expect(html.includes('{{ two.summary }}')).toBeFalsy();
187
+ expect(html.includes('{{ data.one.summary }}')).toBeFalsy();
188
+ });
189
+
190
+ it('Should render the englishonly topic page', async function () {
191
+ if (!liquidEnabled) {
192
+ this.skip();
193
+ }
194
+
195
+ const englishOnlyPage = new GuidePage('/docs/liquid-project/guide/english-only-topic.html');
196
+ await browser.url(englishOnlyPage.path);
197
+ await englishOnlyPage.waitPageLoad();
198
+
199
+ const content = await $('>>>doc-content-layout');
200
+ const text = await content.getText();
201
+
202
+ expect(text.includes('English-Only Topic')).toBeTruthy();
203
+ expect(text.includes('filters: [englishonly]')).toBeTruthy();
204
+ });
205
+
206
+ it('Should render a file with no Liquid syntax as plain markdown', async function () {
207
+ if (!liquidEnabled) {
208
+ this.skip();
209
+ }
210
+
211
+ const plainPage = new GuidePage(
140
212
  '/docs/liquid-project/guide/liquid-learning-resources.html',
141
213
  );
142
- disabledPage.open();
143
- await disabledPage.waitPageLoad();
214
+
215
+ await browser.url(plainPage.path);
216
+ await plainPage.waitPageLoad();
144
217
 
145
218
  const content = await $('>>>doc-content-layout');
146
219
  const text = await content.getText();
@@ -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,8 @@ 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
+ // Advanced liquid tests require previewFuture, variables — not in static build
22
+ './src/shared/specs/liquid-advanced.test.ts',
22
23
  // /docs/apis landing page doesn't exist in static builds
23
24
  './src/portal/specs/docs.api.test.ts',
24
25
  // /docs landing page doesn't exist in static builds