@salesforcedevs/sfdocs-e2e 1.0.12-fix-redoc-topic-v-2 → 1.0.12-fix-redoc-topic-v-4
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
|
@@ -112,14 +112,23 @@ export default class Page {
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
/**
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
115
|
+
* Opens a parent row without navigating. The icon toggles, so skip the click when
|
|
116
|
+
* the row is already open. WebDriver's click throws on the SVG inside dx-icon, so
|
|
117
|
+
* click through the DOM instead.
|
|
118
118
|
*/
|
|
119
119
|
async expandTreeItem(treeItem: WebdriverIO.Element): Promise<void> {
|
|
120
120
|
const tile = await this.getTreeItemTile(treeItem);
|
|
121
121
|
const icon = await tile.shadow$('.tile-expand-icon dx-icon');
|
|
122
|
-
await icon.
|
|
122
|
+
if ((await icon.getAttribute('aria-expanded')) !== 'true') {
|
|
123
|
+
await browser.execute((expandIcon: { click: () => void }) => {
|
|
124
|
+
expandIcon.click();
|
|
125
|
+
}, icon);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
await browser.waitUntil(async () => (await treeItem.shadow$$('dx-tree-item')).length > 0, {
|
|
129
|
+
timeout: 5000,
|
|
130
|
+
timeoutMsg: 'Expected the tree item to expand and render its children',
|
|
131
|
+
});
|
|
123
132
|
}
|
|
124
133
|
|
|
125
134
|
async findTreeItemByLabel(
|
|
@@ -63,21 +63,18 @@ export default class TopicVersionPage extends Page {
|
|
|
63
63
|
return wrapper.$('doc-version-picker');
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
/** Clicks a sidebar tree item and waits for the Redoc page it opens to load. */
|
|
67
66
|
async openRedocFromSidebar(label: string): Promise<void> {
|
|
68
67
|
const item = await this.getSidebarTreeItem(label);
|
|
69
68
|
await item.click();
|
|
70
69
|
await this.waitForRedocTopicLoad();
|
|
71
70
|
}
|
|
72
71
|
|
|
73
|
-
/** Selects a version on the Redoc page's own picker and waits for the new spec to load. */
|
|
74
72
|
async selectRedocVersionByLabel(label: string): Promise<void> {
|
|
75
73
|
const picker = await this.getRedocPicker();
|
|
76
74
|
await this.selectVersionByLabel(picker!, label);
|
|
77
75
|
await this.waitForRedocTopicLoad();
|
|
78
76
|
}
|
|
79
77
|
|
|
80
|
-
/** Clicks the Redoc back link and waits for the markdown page it returns to load. */
|
|
81
78
|
async goBackFromRedoc(): Promise<void> {
|
|
82
79
|
await (await this.getRedocBackLink()).click();
|
|
83
80
|
await this.waitForMarkdownTopicLoad();
|
|
@@ -149,12 +146,17 @@ export default class TopicVersionPage extends Page {
|
|
|
149
146
|
}
|
|
150
147
|
|
|
151
148
|
async getOptionLabel(option: WebdriverIO.Element): Promise<string> {
|
|
152
|
-
const label = await option.shadow$('
|
|
149
|
+
const label = await option.shadow$('.option_label');
|
|
153
150
|
return (await label.getText()).trim();
|
|
154
151
|
}
|
|
155
152
|
|
|
156
153
|
async selectVersionByLabel(picker: WebdriverIO.Element, label: string): Promise<void> {
|
|
157
154
|
await this.openPicker(picker);
|
|
155
|
+
// The menu fades in. isDisplayed is false while its opacity is still 0.
|
|
156
|
+
await browser.waitUntil(async () => (await this.getVersionOptions()).length > 0, {
|
|
157
|
+
timeout: 5000,
|
|
158
|
+
timeoutMsg: 'Expected the version menu to show its options',
|
|
159
|
+
});
|
|
158
160
|
const options = await this.getVersionOptions();
|
|
159
161
|
for (const option of options) {
|
|
160
162
|
if ((await this.getOptionLabel(option)) === label) {
|
|
@@ -235,8 +235,8 @@ describe('Topic-level versioning > versioned parent with own content, subtopics
|
|
|
235
235
|
page.open();
|
|
236
236
|
await page.waitForMarkdownTopicLoad();
|
|
237
237
|
|
|
238
|
-
//
|
|
239
|
-
//
|
|
238
|
+
// The spec row is absent until its parent is expanded. Expanding does not
|
|
239
|
+
// navigate, so Get Started stays the referrer.
|
|
240
240
|
const parent = await page.getSidebarTreeItem('Errors and Rate Limits');
|
|
241
241
|
await page.expandTreeItem(parent);
|
|
242
242
|
|
|
@@ -249,9 +249,8 @@ describe('Topic-level versioning > versioned parent with own content, subtopics
|
|
|
249
249
|
});
|
|
250
250
|
|
|
251
251
|
it('should fall back to the project landing page when the Redoc page is opened with no referrer', async () => {
|
|
252
|
-
//
|
|
253
|
-
//
|
|
254
|
-
// globalThis since the tsconfig's lib list omits "DOM" (see readSessionVersionSelections).
|
|
252
|
+
// No stored back target. WebDriver navigation also leaves document.referrer empty.
|
|
253
|
+
// globalThis: this package's tsconfig lib list omits DOM.
|
|
255
254
|
await browser.execute(() =>
|
|
256
255
|
(globalThis as any).sessionStorage.removeItem('redoc-back-target'),
|
|
257
256
|
);
|
|
@@ -263,8 +262,7 @@ describe('Topic-level versioning > versioned parent with own content, subtopics
|
|
|
263
262
|
await page.selectRedocVersionByLabel(ERRORS_V1_LABEL);
|
|
264
263
|
await page.goBackFromRedoc();
|
|
265
264
|
|
|
266
|
-
//
|
|
267
|
-
// (headerHref) — and it's unversioned, so no version segment should leak onto it either.
|
|
265
|
+
// With no back target, Back goes to the first TOC topic. That topic is unversioned.
|
|
268
266
|
await page.waitForUrlToContain(`${BASE}/get-started.html`);
|
|
269
267
|
expect(await browser.getUrl()).not.toContain('/v1/');
|
|
270
268
|
});
|