@salesforcedevs/sfdocs-e2e 1.0.7-liquid-alpha.1 → 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
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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('
|
|
65
|
-
expect(text.includes('
|
|
66
|
-
expect(text.includes('
|
|
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
|
|
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
|
|
83
|
-
expect(
|
|
84
|
-
expect(
|
|
85
|
-
expect(
|
|
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,109 +131,7 @@ describe('Liquid Template Rendering', () => {
|
|
|
108
131
|
expect(html.includes('{{ id2 }}')).toBeFalsy();
|
|
109
132
|
});
|
|
110
133
|
|
|
111
|
-
it('Should
|
|
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('Salesforce Platform')).toBeTruthy();
|
|
121
|
-
expect(text.includes('62.0')).toBeTruthy();
|
|
122
|
-
expect(text.includes('sf')).toBeTruthy();
|
|
123
|
-
expect(html.includes('{{ variables.platform')).toBeFalsy();
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
it('Should render englishonly block content in production', async function () {
|
|
127
|
-
if (!liquidEnabled) {
|
|
128
|
-
this.skip();
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
const content = await $('>>>doc-content-layout');
|
|
132
|
-
const text = await content.getText();
|
|
133
|
-
const html = await content.getHTML();
|
|
134
|
-
|
|
135
|
-
expect(text.includes('This feature is currently only available in English')).toBeTruthy();
|
|
136
|
-
expect(html.includes('{% englishonly')).toBeFalsy();
|
|
137
|
-
expect(html.includes('{% endenglishonly')).toBeFalsy();
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
it('Should render future block content when previewFuture is enabled', async function () {
|
|
141
|
-
if (!liquidEnabled) {
|
|
142
|
-
this.skip();
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
const content = await $('>>>doc-content-layout');
|
|
146
|
-
const text = await content.getText();
|
|
147
|
-
|
|
148
|
-
expect(text.includes('Coming Soon')).toBeTruthy();
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
it('Should render liquid.data string format — single YAML file on root context', async function () {
|
|
152
|
-
if (!liquidEnabled) {
|
|
153
|
-
this.skip();
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
const content = await $('>>>doc-content-layout');
|
|
157
|
-
const text = await content.getText();
|
|
158
|
-
|
|
159
|
-
expect(text.includes('Hello from data.yaml')).toBeTruthy();
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
it('Should render liquid.data object format — multiple YAML files each under a named key', async function () {
|
|
163
|
-
if (!liquidEnabled) {
|
|
164
|
-
this.skip();
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
const dataFormatsPage = new GuidePage('/docs/redirects-url/guide/orders-api-overview.html');
|
|
168
|
-
await browser.url(dataFormatsPage.path);
|
|
169
|
-
await dataFormatsPage.waitPageLoad();
|
|
170
|
-
|
|
171
|
-
const content = await $('>>>doc-content-layout');
|
|
172
|
-
const text = await content.getText();
|
|
173
|
-
const html = await content.getHTML();
|
|
174
|
-
|
|
175
|
-
expect(text.includes('Sample data file to check the multi-include')).toBeTruthy();
|
|
176
|
-
expect(text.includes('Represents a scheduled or completed visit')).toBeTruthy();
|
|
177
|
-
expect(html.includes('{{ two.summary }}')).toBeFalsy();
|
|
178
|
-
expect(html.includes('{{ data.one.summary }}')).toBeFalsy();
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
it('Should render the future topic page when previewFuture is enabled', async function () {
|
|
182
|
-
if (!liquidEnabled) {
|
|
183
|
-
this.skip();
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
const futurePage = new GuidePage('/docs/liquid-project/guide/future-topic.html');
|
|
187
|
-
await browser.url(futurePage.path);
|
|
188
|
-
await futurePage.waitPageLoad();
|
|
189
|
-
|
|
190
|
-
const content = await $('>>>doc-content-layout');
|
|
191
|
-
const text = await content.getText();
|
|
192
|
-
|
|
193
|
-
expect(text.includes('Future Feature')).toBeTruthy();
|
|
194
|
-
expect(text.includes('previewFuture')).toBeTruthy();
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
it('Should render the englishonly topic page', async function () {
|
|
198
|
-
if (!liquidEnabled) {
|
|
199
|
-
this.skip();
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
const englishOnlyPage = new GuidePage('/docs/liquid-project/guide/english-only-topic.html');
|
|
203
|
-
await browser.url(englishOnlyPage.path);
|
|
204
|
-
await englishOnlyPage.waitPageLoad();
|
|
205
|
-
|
|
206
|
-
const content = await $('>>>doc-content-layout');
|
|
207
|
-
const text = await content.getText();
|
|
208
|
-
|
|
209
|
-
expect(text.includes('English-Only Topic')).toBeTruthy();
|
|
210
|
-
expect(text.includes('filters: [englishonly]')).toBeTruthy();
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
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 () {
|
|
214
135
|
if (!liquidEnabled) {
|
|
215
136
|
this.skip();
|
|
216
137
|
}
|
|
@@ -218,7 +139,7 @@ describe('Liquid Template Rendering', () => {
|
|
|
218
139
|
const disabledPage = new GuidePage(
|
|
219
140
|
'/docs/liquid-project/guide/liquid-learning-resources.html',
|
|
220
141
|
);
|
|
221
|
-
|
|
142
|
+
disabledPage.open();
|
|
222
143
|
await disabledPage.waitPageLoad();
|
|
223
144
|
|
|
224
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
|
-
|
|
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,6 @@ exports.config = {
|
|
|
18
18
|
|
|
19
19
|
// Exclude tests that require dynamic server features or pages not in static build
|
|
20
20
|
exclude: [
|
|
21
|
-
// Liquid tests require previewFuture, variables, and redirects-url project — not in static build
|
|
22
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',
|