@salesforcedevs/sfdocs-e2e 1.0.10 → 1.0.11-toolbar.1
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 +1 -1
- package/src/content-repo/pageobjects/home.page.ts +6 -35
- package/src/content-repo/specs/guideAndReferencePage.test.ts +17 -31
- package/src/content-repo/specs/homepage.test.ts +35 -20
- package/src/content-repo/specs/navHeader.test.ts +3 -6
- package/src/content-repo/specs/sitemap.test.ts +84 -0
- package/src/portal/specs/docs.api.test.ts +0 -43
- package/src/shared/pageobjects/content-action-toolbar.ts +99 -0
- package/src/shared/pageobjects/docs-content-layout.ts +6 -7
- package/src/shared/pageobjects/docs.page.ts +128 -0
- package/src/shared/pageobjects/page.ts +0 -16
- package/src/shared/specs/contentActionToolbar.test.ts +130 -25
- package/src/shared/specs/docsContentType.test.ts +615 -0
- package/src/shared/specs/liquid-advanced.test.ts +54 -0
- package/src/shared/specs/liquid.test.ts +97 -0
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import DocsPage from '../pageobjects/docs.page';
|
|
1
2
|
import GuidePage from '../pageobjects/guide.page';
|
|
2
3
|
import { ReferencePage } from '../pageobjects/reference.page';
|
|
4
|
+
import contentActionToolbar from '../pageobjects/content-action-toolbar';
|
|
5
|
+
|
|
6
|
+
const DOCS_MARKDOWN_PATH = '/docs/docs-content-type-example/get-started.html';
|
|
3
7
|
|
|
4
8
|
const EN_US_GUIDE_PATH = '/docs/service/vscode-maintainer/guide/vscode-overview.html';
|
|
5
9
|
const EN_US_MARKDOWN_REFERENCE_PATH =
|
|
@@ -7,53 +11,154 @@ const EN_US_MARKDOWN_REFERENCE_PATH =
|
|
|
7
11
|
const NON_MARKDOWN_REFERENCE_PATH = '/docs/test-metamind-oas-api/references/1mkfx9?meta=Summary';
|
|
8
12
|
const NON_EN_US_MARKDOWN_REFERENCE_PATH =
|
|
9
13
|
'/docs/commerce/ja-jp/flex-references-loc/references/manual-ref/commerce-cloud-api-overview.html';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
14
|
+
const INLINE_MARKDOWN_LABELS = ['Copy as Markdown', 'View as Markdown', 'View llms.txt'];
|
|
15
|
+
const MENU_GROUPS = {
|
|
16
|
+
'This Page': [
|
|
17
|
+
'Copy as Markdown',
|
|
18
|
+
'View as Markdown',
|
|
19
|
+
'Copy URL to Markdown',
|
|
20
|
+
'Open in ChatGPT',
|
|
21
|
+
'Open in Claude',
|
|
22
|
+
'Open in Perplexity',
|
|
23
|
+
],
|
|
24
|
+
'All Documentation': ['View llms.txt', 'Copy URL to llms.txt'],
|
|
25
|
+
};
|
|
26
|
+
const AI_ASSISTANTS = [
|
|
27
|
+
{ label: 'Open in ChatGPT', host: 'chatgpt.com' },
|
|
28
|
+
{ label: 'Open in Claude', host: 'claude.ai' },
|
|
29
|
+
{ label: 'Open in Perplexity', host: 'www.perplexity.ai' },
|
|
30
|
+
];
|
|
31
|
+
const LLMS_TXT_PATH = '/docs/llms.txt';
|
|
32
|
+
const COPIED_TOOLTIP_LABEL = 'Copied!';
|
|
22
33
|
|
|
23
34
|
describe('Content action toolbar scenarios', () => {
|
|
24
|
-
it('
|
|
35
|
+
it('should show the inline markdown actions when opening a markdown guide', async () => {
|
|
25
36
|
const page = new GuidePage(EN_US_GUIDE_PATH);
|
|
26
37
|
page.open();
|
|
27
38
|
await page.waitPageLoad();
|
|
28
39
|
|
|
29
|
-
const toolbar = await
|
|
30
|
-
await toolbar.
|
|
31
|
-
|
|
40
|
+
const toolbar = await contentActionToolbar.get();
|
|
41
|
+
expect(await contentActionToolbar.getInlineButtonLabels(toolbar)).toEqual(
|
|
42
|
+
expect.arrayContaining(INLINE_MARKDOWN_LABELS),
|
|
43
|
+
);
|
|
32
44
|
});
|
|
33
45
|
|
|
34
|
-
it('
|
|
46
|
+
it('should show the inline markdown actions when opening a markdown reference', async () => {
|
|
35
47
|
const referencePage = new ReferencePage(EN_US_MARKDOWN_REFERENCE_PATH);
|
|
36
48
|
referencePage.open();
|
|
37
49
|
await referencePage.waitForMarkdownBasedReferencePageLoad();
|
|
38
50
|
|
|
39
|
-
const toolbar = await
|
|
40
|
-
await toolbar.
|
|
41
|
-
|
|
51
|
+
const toolbar = await contentActionToolbar.get();
|
|
52
|
+
expect(await contentActionToolbar.getInlineButtonLabels(toolbar)).toEqual(
|
|
53
|
+
expect.arrayContaining(INLINE_MARKDOWN_LABELS),
|
|
54
|
+
);
|
|
42
55
|
});
|
|
43
56
|
|
|
44
|
-
it(
|
|
57
|
+
it('should show the inline markdown actions when opening a markdown docs page', async () => {
|
|
58
|
+
const page = new DocsPage(DOCS_MARKDOWN_PATH);
|
|
59
|
+
page.open();
|
|
60
|
+
await page.waitPageLoad();
|
|
61
|
+
|
|
62
|
+
const toolbar = await contentActionToolbar.get();
|
|
63
|
+
expect(await contentActionToolbar.getInlineButtonLabels(toolbar)).toEqual(
|
|
64
|
+
expect.arrayContaining(INLINE_MARKDOWN_LABELS),
|
|
65
|
+
);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('should expose the full grouped action set through the More actions menu on a markdown page', async () => {
|
|
69
|
+
const page = new GuidePage(EN_US_GUIDE_PATH);
|
|
70
|
+
page.open();
|
|
71
|
+
await page.waitPageLoad();
|
|
72
|
+
|
|
73
|
+
const toolbar = await contentActionToolbar.get();
|
|
74
|
+
await contentActionToolbar.openMoreActionsMenu(toolbar);
|
|
75
|
+
|
|
76
|
+
const labelsByGroup = await contentActionToolbar.getMenuOptionLabelsByGroup(toolbar);
|
|
77
|
+
expect(Object.keys(labelsByGroup)).toEqual(
|
|
78
|
+
expect.arrayContaining(Object.keys(MENU_GROUPS)),
|
|
79
|
+
);
|
|
80
|
+
for (const [group, expectedLabels] of Object.entries(MENU_GROUPS)) {
|
|
81
|
+
expect(labelsByGroup[group]).toEqual(expect.arrayContaining(expectedLabels));
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
AI_ASSISTANTS.forEach(({ label, host }) => {
|
|
86
|
+
it(`should open ${host} with the page context when selecting ${label}`, async () => {
|
|
87
|
+
const page = new GuidePage(EN_US_GUIDE_PATH);
|
|
88
|
+
page.open();
|
|
89
|
+
await page.waitPageLoad();
|
|
90
|
+
|
|
91
|
+
const toolbar = await contentActionToolbar.get();
|
|
92
|
+
await contentActionToolbar.openMoreActionsMenu(toolbar);
|
|
93
|
+
|
|
94
|
+
const url = await contentActionToolbar.getUrlFromNewTab(() =>
|
|
95
|
+
contentActionToolbar.clickMenuOption(toolbar, label),
|
|
96
|
+
);
|
|
97
|
+
expect(url).toContain(host);
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it('should open the markdown version of the page in a new tab when selecting View as Markdown', async () => {
|
|
102
|
+
const page = new GuidePage(EN_US_GUIDE_PATH);
|
|
103
|
+
page.open();
|
|
104
|
+
await page.waitPageLoad();
|
|
105
|
+
|
|
106
|
+
const toolbar = await contentActionToolbar.get();
|
|
107
|
+
await contentActionToolbar.openMoreActionsMenu(toolbar);
|
|
108
|
+
|
|
109
|
+
const url = await contentActionToolbar.getUrlFromNewTab(() =>
|
|
110
|
+
contentActionToolbar.clickMenuOption(toolbar, 'View as Markdown'),
|
|
111
|
+
);
|
|
112
|
+
expect(url.endsWith('.md')).toBe(true);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it('should open the site llms.txt in a new tab when selecting View llms.txt', async () => {
|
|
116
|
+
const page = new GuidePage(EN_US_GUIDE_PATH);
|
|
117
|
+
page.open();
|
|
118
|
+
await page.waitPageLoad();
|
|
119
|
+
|
|
120
|
+
const toolbar = await contentActionToolbar.get();
|
|
121
|
+
await contentActionToolbar.openMoreActionsMenu(toolbar);
|
|
122
|
+
|
|
123
|
+
const url = await contentActionToolbar.getUrlFromNewTab(() =>
|
|
124
|
+
contentActionToolbar.clickMenuOption(toolbar, 'View llms.txt'),
|
|
125
|
+
);
|
|
126
|
+
expect(url.endsWith(LLMS_TXT_PATH)).toBe(true);
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it('should flash the Copied! tooltip when selecting Copy URL to Markdown', async () => {
|
|
130
|
+
const page = new GuidePage(EN_US_GUIDE_PATH);
|
|
131
|
+
page.open();
|
|
132
|
+
await page.waitPageLoad();
|
|
133
|
+
|
|
134
|
+
const toolbar = await contentActionToolbar.get();
|
|
135
|
+
await contentActionToolbar.openMoreActionsMenu(toolbar);
|
|
136
|
+
await contentActionToolbar.clickMenuOption(toolbar, 'Copy URL to Markdown');
|
|
137
|
+
|
|
138
|
+
await browser.waitUntil(
|
|
139
|
+
async () =>
|
|
140
|
+
(await contentActionToolbar.getVisibleCopiedTooltipLabel()) ===
|
|
141
|
+
COPIED_TOOLTIP_LABEL,
|
|
142
|
+
{
|
|
143
|
+
timeout: 5000,
|
|
144
|
+
timeoutMsg: 'Expected the menu tooltip to flash "Copied!"',
|
|
145
|
+
},
|
|
146
|
+
);
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
it('should not show the toolbar on a non-markdown reference', async () => {
|
|
45
150
|
const referencePage = new ReferencePage(NON_MARKDOWN_REFERENCE_PATH);
|
|
46
151
|
referencePage.open();
|
|
47
152
|
await referencePage.waitForSpecBasedReferencePageLoad();
|
|
48
153
|
|
|
49
|
-
|
|
50
|
-
expect(await toolbar.isExisting()).toBeFalsy();
|
|
154
|
+
expect(await contentActionToolbar.isPresent()).toBeFalsy();
|
|
51
155
|
});
|
|
52
156
|
|
|
53
|
-
it(
|
|
157
|
+
it('should not show the toolbar on a non en-us page', async () => {
|
|
54
158
|
const nonEnUsReferencePage = new ReferencePage(NON_EN_US_MARKDOWN_REFERENCE_PATH);
|
|
55
159
|
nonEnUsReferencePage.open();
|
|
56
160
|
await nonEnUsReferencePage.waitForMarkdownBasedReferencePageLoad();
|
|
57
|
-
|
|
161
|
+
|
|
162
|
+
expect(await contentActionToolbar.isPresent()).toBeFalsy();
|
|
58
163
|
});
|
|
59
164
|
});
|