@salesforcedevs/sfdocs-e2e 1.0.7-liquid-alpha.2 → 1.0.7

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-liquid-alpha.2",
3
+ "version": "1.0.7",
4
4
  "description": "E2E test suite for SFDocs static portal pages (SSG)",
5
5
  "license": "ISC",
6
6
  "bin": {
@@ -7,13 +7,26 @@ describe('Liquid Template Rendering', () => {
7
7
  before(async () => {
8
8
  try {
9
9
  page = new GuidePage('/docs/liquid-project/guide/liquid-quickstart.html');
10
- await browser.url(page.path);
10
+ page.open();
11
11
  await page.waitPageLoad();
12
12
 
13
13
  const content = await $('>>>doc-content-layout');
14
14
  const text = await content.getText();
15
-
16
- liquidEnabled = text.includes('Hello from data.yaml');
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;
29
+ }
17
30
  } catch (e) {
18
31
  liquidEnabled = false;
19
32
  }
@@ -22,7 +35,7 @@ describe('Liquid Template Rendering', () => {
22
35
  beforeEach(async () => {
23
36
  if (liquidEnabled) {
24
37
  page = new GuidePage('/docs/liquid-project/guide/liquid-quickstart.html');
25
- await browser.url(page.path);
38
+ page.open();
26
39
  await page.waitPageLoad();
27
40
  }
28
41
  });
@@ -37,6 +50,10 @@ describe('Liquid Template Rendering', () => {
37
50
 
38
51
  expect(text.includes('GitHub for writers')).toBeTruthy();
39
52
  expect(text.includes('Hello from data.yaml')).toBeTruthy();
53
+
54
+ const html = await content.getHTML();
55
+ expect(html.includes('{{ topic }}')).toBeFalsy();
56
+ expect(html.includes('{{ data.greeting }}')).toBeFalsy();
40
57
  });
41
58
 
42
59
  it('Should render included templates from shared directory', async function () {
@@ -59,14 +76,19 @@ describe('Liquid Template Rendering', () => {
59
76
  }
60
77
 
61
78
  const content = await $('>>>doc-content-layout');
79
+ const html = await content.getHTML();
62
80
  const text = await content.getText();
63
81
 
64
- expect(text.includes('AccountId')).toBeTruthy();
65
- expect(text.includes('Type:')).toBeTruthy();
66
- expect(text.includes('Properties:')).toBeTruthy();
82
+ expect(text.includes('create()')).toBeTruthy();
83
+ expect(text.includes('query()')).toBeTruthy();
84
+ expect(text.includes('update()')).toBeTruthy();
67
85
 
68
86
  const listItems = await content.$$('li');
69
87
  expect(listItems.length).toBeGreaterThan(5);
88
+
89
+ expect(html.includes('{% for')).toBeFalsy();
90
+ expect(html.includes('{%- for')).toBeFalsy();
91
+ expect(html.includes('{% endfor')).toBeFalsy();
70
92
  });
71
93
 
72
94
  it('Should not process Liquid syntax inside code blocks', async function () {
@@ -75,14 +97,15 @@ describe('Liquid Template Rendering', () => {
75
97
  }
76
98
 
77
99
  const content = await $('>>>doc-content-layout');
78
- const codeBlock = await content.$('dx-code-block');
100
+ const html = await content.getHTML();
101
+ const codeBlock = await content.$('code');
79
102
 
80
103
  expect(await codeBlock.isExisting()).toBeTruthy();
81
104
 
82
- const codeBlockAttr = await codeBlock.getAttribute('code-block');
83
- expect(codeBlockAttr.includes('{{ data.greeting }}')).toBeTruthy();
84
- expect(codeBlockAttr.includes('{{ topic }}')).toBeTruthy();
85
- expect(codeBlockAttr.includes('{% for item in items %}')).toBeTruthy();
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();
86
109
 
87
110
  const text = await content.getText();
88
111
  expect(text.includes('Visit')).toBeTruthy();
@@ -108,66 +131,7 @@ describe('Liquid Template Rendering', () => {
108
131
  expect(html.includes('{{ id2 }}')).toBeFalsy();
109
132
  });
110
133
 
111
- it('Should render englishonly block content in production', async function () {
112
- if (!liquidEnabled) {
113
- this.skip();
114
- }
115
-
116
- const content = await $('>>>doc-content-layout');
117
- const text = await content.getText();
118
- const html = await content.getHTML();
119
-
120
- expect(text.includes('This feature is currently only available in English')).toBeTruthy();
121
- expect(html.includes('{% englishonly')).toBeFalsy();
122
- expect(html.includes('{% endenglishonly')).toBeFalsy();
123
- });
124
-
125
- it('Should render liquid.data string format — single YAML file on root context', async function () {
126
- if (!liquidEnabled) {
127
- this.skip();
128
- }
129
-
130
- const content = await $('>>>doc-content-layout');
131
- const text = await content.getText();
132
-
133
- expect(text.includes('Hello from data.yaml')).toBeTruthy();
134
- });
135
-
136
- it('Should render liquid.data object format — multiple YAML files each under a named key', async function () {
137
- if (!liquidEnabled) {
138
- this.skip();
139
- }
140
-
141
- const multiDataPage = new GuidePage('/docs/liquid-project/guide/multi-data.html');
142
- await browser.url(multiDataPage.path);
143
- await multiDataPage.waitPageLoad();
144
-
145
- const content = await $('>>>doc-content-layout');
146
- const text = await content.getText();
147
- const html = await content.getHTML();
148
-
149
- expect(text.includes('Sample data file to check the multi-include')).toBeTruthy();
150
- expect(html.includes('{{ two.summary }}')).toBeFalsy();
151
- expect(html.includes('{{ data.one.summary }}')).toBeFalsy();
152
- });
153
-
154
- it('Should render the englishonly topic page', async function () {
155
- if (!liquidEnabled) {
156
- this.skip();
157
- }
158
-
159
- const englishOnlyPage = new GuidePage('/docs/liquid-project/guide/english-only-topic.html');
160
- await browser.url(englishOnlyPage.path);
161
- await englishOnlyPage.waitPageLoad();
162
-
163
- const content = await $('>>>doc-content-layout');
164
- const text = await content.getText();
165
-
166
- expect(text.includes('English-Only Topic')).toBeTruthy();
167
- expect(text.includes('filters: [englishonly]')).toBeTruthy();
168
- });
169
-
170
- it('Should not render raw Liquid syntax when Liquid processing is disabled', async function () {
134
+ it('Should not process Liquid when frontmatter has liquid.enabled as false', async function () {
171
135
  if (!liquidEnabled) {
172
136
  this.skip();
173
137
  }
@@ -175,7 +139,7 @@ describe('Liquid Template Rendering', () => {
175
139
  const disabledPage = new GuidePage(
176
140
  '/docs/liquid-project/guide/liquid-learning-resources.html',
177
141
  );
178
- await browser.url(disabledPage.path);
142
+ disabledPage.open();
179
143
  await disabledPage.waitPageLoad();
180
144
 
181
145
  const content = await $('>>>doc-content-layout');
@@ -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,8 +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
- // Advanced liquid tests require previewFuture, variables — not in static build
22
- './src/shared/specs/liquid-advanced.test.ts',
21
+ './src/shared/specs/liquid.test.ts',
23
22
  // /docs/apis landing page doesn't exist in static builds
24
23
  './src/portal/specs/docs.api.test.ts',
25
24
  // /docs landing page doesn't exist in static builds
@@ -1,71 +0,0 @@
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 repository-level variables from content-config.yml', async function () {
31
- if (!liquidEnabled) {
32
- this.skip();
33
- }
34
-
35
- const content = await $('>>>doc-content-layout');
36
- const text = await content.getText();
37
- const html = await content.getHTML();
38
-
39
- expect(text.includes('Salesforce Platform')).toBeTruthy();
40
- expect(text.includes('62.0')).toBeTruthy();
41
- expect(text.includes('sf')).toBeTruthy();
42
- expect(html.includes('{{ variables.platform')).toBeFalsy();
43
- });
44
-
45
- it('Should render future block content when previewFuture is enabled', async function () {
46
- if (!liquidEnabled) {
47
- this.skip();
48
- }
49
-
50
- const content = await $('>>>doc-content-layout');
51
- const text = await content.getText();
52
-
53
- expect(text.includes('Coming Soon')).toBeTruthy();
54
- });
55
-
56
- it('Should render the future topic page when previewFuture is enabled', async function () {
57
- if (!liquidEnabled) {
58
- this.skip();
59
- }
60
-
61
- const futurePage = new GuidePage('/docs/liquid-project/guide/future-topic.html');
62
- await browser.url(futurePage.path);
63
- await futurePage.waitPageLoad();
64
-
65
- const content = await $('>>>doc-content-layout');
66
- const text = await content.getText();
67
-
68
- expect(text.includes('Future Feature')).toBeTruthy();
69
- expect(text.includes('previewFuture')).toBeTruthy();
70
- });
71
- });