@salesforcedevs/sfdocs-e2e 1.0.11-toolbar.0 → 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
CHANGED
|
@@ -7,7 +7,7 @@ class ContentActionToolbar {
|
|
|
7
7
|
MENU_HEADING_SELECTOR = 'span.menu_heading';
|
|
8
8
|
MENU_OPTION_SELECTOR = 'dx-dropdown-option';
|
|
9
9
|
OPTION_LABEL_SELECTOR = 'div.option_label';
|
|
10
|
-
|
|
10
|
+
COPIED_TOOLTIP_SELECTOR = '[role="tooltip"].is-visible';
|
|
11
11
|
|
|
12
12
|
async get(): Promise<WebdriverIO.Element> {
|
|
13
13
|
const toolbar = await $(`>>>${this.HOST_SELECTOR}`);
|
|
@@ -64,11 +64,6 @@ class ContentActionToolbar {
|
|
|
64
64
|
throw new Error(`Menu option "${label}" not found`);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
/**
|
|
68
|
-
* The AI-assistant, View-as-Markdown, and View-llms.txt actions open the target in a
|
|
69
|
-
* new tab. Runs the click, waits for the extra tab, and returns its URL. Restores the
|
|
70
|
-
* original tab afterwards so later assertions run against the docs page.
|
|
71
|
-
*/
|
|
72
67
|
async getUrlFromNewTab(action: () => Promise<void>): Promise<string> {
|
|
73
68
|
const originalHandle = await browser.getWindowHandle();
|
|
74
69
|
const handlesBefore = await browser.getWindowHandles();
|
|
@@ -95,9 +90,9 @@ class ContentActionToolbar {
|
|
|
95
90
|
return url;
|
|
96
91
|
}
|
|
97
92
|
|
|
98
|
-
async
|
|
99
|
-
const tooltip = await
|
|
100
|
-
return (await tooltip.getAttribute('label'))?.trim() ?? '';
|
|
93
|
+
async getVisibleCopiedTooltipLabel(): Promise<string> {
|
|
94
|
+
const tooltip = await $(`>>>${this.COPIED_TOOLTIP_SELECTOR}`);
|
|
95
|
+
return (await tooltip.getAttribute('aria-label'))?.trim() ?? '';
|
|
101
96
|
}
|
|
102
97
|
}
|
|
103
98
|
|
|
@@ -24,9 +24,9 @@ const MENU_GROUPS = {
|
|
|
24
24
|
'All Documentation': ['View llms.txt', 'Copy URL to llms.txt'],
|
|
25
25
|
};
|
|
26
26
|
const AI_ASSISTANTS = [
|
|
27
|
-
{ label: 'Open in ChatGPT',
|
|
28
|
-
{ label: 'Open in Claude',
|
|
29
|
-
{ label: 'Open in Perplexity',
|
|
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
30
|
];
|
|
31
31
|
const LLMS_TXT_PATH = '/docs/llms.txt';
|
|
32
32
|
const COPIED_TOOLTIP_LABEL = 'Copied!';
|
|
@@ -82,8 +82,8 @@ describe('Content action toolbar scenarios', () => {
|
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
84
|
|
|
85
|
-
AI_ASSISTANTS.forEach(({ label,
|
|
86
|
-
it(`should open ${
|
|
85
|
+
AI_ASSISTANTS.forEach(({ label, host }) => {
|
|
86
|
+
it(`should open ${host} with the page context when selecting ${label}`, async () => {
|
|
87
87
|
const page = new GuidePage(EN_US_GUIDE_PATH);
|
|
88
88
|
page.open();
|
|
89
89
|
await page.waitPageLoad();
|
|
@@ -94,8 +94,7 @@ describe('Content action toolbar scenarios', () => {
|
|
|
94
94
|
const url = await contentActionToolbar.getUrlFromNewTab(() =>
|
|
95
95
|
contentActionToolbar.clickMenuOption(toolbar, label),
|
|
96
96
|
);
|
|
97
|
-
expect(url
|
|
98
|
-
expect(url).toContain('q=');
|
|
97
|
+
expect(url).toContain(host);
|
|
99
98
|
});
|
|
100
99
|
});
|
|
101
100
|
|
|
@@ -138,7 +137,8 @@ describe('Content action toolbar scenarios', () => {
|
|
|
138
137
|
|
|
139
138
|
await browser.waitUntil(
|
|
140
139
|
async () =>
|
|
141
|
-
(await contentActionToolbar.
|
|
140
|
+
(await contentActionToolbar.getVisibleCopiedTooltipLabel()) ===
|
|
141
|
+
COPIED_TOOLTIP_LABEL,
|
|
142
142
|
{
|
|
143
143
|
timeout: 5000,
|
|
144
144
|
timeoutMsg: 'Expected the menu tooltip to flash "Copied!"',
|