@salesforcedevs/sfdocs-e2e 0.6.132-linkfix-alpha

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.
Files changed (49) hide show
  1. package/README.md +63 -0
  2. package/bin/run-e2e.js +115 -0
  3. package/common-wdio.conf.js +402 -0
  4. package/package.json +40 -0
  5. package/portal-wdio.conf.js +7 -0
  6. package/search-wdio.conf.js +10 -0
  7. package/src/content-repo/pageobjects/home.page.ts +55 -0
  8. package/src/content-repo/specs/componentSpecification.test.ts +287 -0
  9. package/src/content-repo/specs/guideAndReferencePage.test.ts +46 -0
  10. package/src/content-repo/specs/homepage.test.ts +47 -0
  11. package/src/content-repo/specs/media-mapper.test.ts +18 -0
  12. package/src/content-repo/specs/navHeader.test.ts +79 -0
  13. package/src/content-repo/specs/sitemap.test.ts +58 -0
  14. package/src/content-repo/specs/tabset.test.ts +81 -0
  15. package/src/portal/pageobjects/docs.apis.page.ts +23 -0
  16. package/src/portal/pageobjects/docs.page.ts +18 -0
  17. package/src/portal/pageobjects/help-page/ScopeSeachTest.page.ts +20 -0
  18. package/src/portal/specs/docs.api.test.ts +68 -0
  19. package/src/portal/specs/docs.test.ts +84 -0
  20. package/src/portal/specs/media-mapper.test.ts +42 -0
  21. package/src/portal/specs/scope.search.guide.test.ts +33 -0
  22. package/src/portal/specs/scope.search.reference.test.ts +37 -0
  23. package/src/shared/pageobjects/api-redoc-reference.page.ts +40 -0
  24. package/src/shared/pageobjects/callout.ts +24 -0
  25. package/src/shared/pageobjects/doc-phase-config.ts +106 -0
  26. package/src/shared/pageobjects/docs-content-layout.ts +17 -0
  27. package/src/shared/pageobjects/error.page.ts +14 -0
  28. package/src/shared/pageobjects/guide.page.ts +24 -0
  29. package/src/shared/pageobjects/overview.page.ts +20 -0
  30. package/src/shared/pageobjects/page.ts +115 -0
  31. package/src/shared/pageobjects/reference.page.ts +41 -0
  32. package/src/shared/specs/anchorHeading.test.ts +21 -0
  33. package/src/shared/specs/banner.test.ts +66 -0
  34. package/src/shared/specs/breadcrumbs.test.ts +45 -0
  35. package/src/shared/specs/calloutContent.test.ts +102 -0
  36. package/src/shared/specs/codeBlock.test.ts +44 -0
  37. package/src/shared/specs/devCenterLink.test.ts +42 -0
  38. package/src/shared/specs/docPhase.test.ts +127 -0
  39. package/src/shared/specs/errorRoutes.test.ts +24 -0
  40. package/src/shared/specs/guides.test.ts +333 -0
  41. package/src/shared/specs/layout-tests.ts +38 -0
  42. package/src/shared/specs/overview.test.ts +82 -0
  43. package/src/shared/specs/page-title.test.ts +12 -0
  44. package/src/shared/specs/redoc-reference.test.ts +170 -0
  45. package/src/shared/specs/reference.test.ts +281 -0
  46. package/src/shared/specs/video.test.ts +31 -0
  47. package/static-portal-wdio.conf.js +50 -0
  48. package/tsconfig.json +26 -0
  49. package/wdio.conf.js +6 -0
@@ -0,0 +1,333 @@
1
+ import GuidePage from '../pageobjects/guide.page';
2
+ import OverviewPage from '../pageobjects/overview.page';
3
+ import layoutTest from './layout-tests';
4
+
5
+ let page: GuidePage;
6
+
7
+ describe('Guides layout> ', () => {
8
+ beforeEach(async () => {
9
+ page = new GuidePage('/docs/service/vscode-maintainer/guide/vscode-overview.html');
10
+ page.open();
11
+ await page.waitPageLoad();
12
+ });
13
+
14
+ layoutTest(page, 'doc-header');
15
+
16
+ it('should have Guides tab as active', async () => {
17
+ const selectedHeaderNavItem = await page.getActiveNavTab();
18
+
19
+ expect(await selectedHeaderNavItem.getText()).toMatch('Guides');
20
+ });
21
+ });
22
+
23
+ describe('Test Guides page transition> ', () => {
24
+ it('Check overview to Guide page Transition', async () => {
25
+ const page = new OverviewPage('/docs/service/vscode-maintainer');
26
+ page.open();
27
+
28
+ await page.waitPageLoad();
29
+
30
+ const overviewContent = await $('>>>.overview-content > dx-group-text');
31
+
32
+ expect(await overviewContent.getAttribute('header')).toEqual('Visual Studio Code (VSCode)');
33
+
34
+ (await overviewContent.$('>>> dx-button')).click();
35
+ await (await $('>>> #overview')).waitForDisplayed();
36
+
37
+ expect(await (await $('>>> #overview')).getText()).toEqual('Overview');
38
+
39
+ const docHeaderNav = await $('>>> .header_l2_group-nav_overflow');
40
+ const headerNav = await docHeaderNav.$('>>> dx-header-nav');
41
+ const navItem = await headerNav.shadow$$('dx-tab');
42
+
43
+ expect(await navItem[0].getText()).toEqual('Overview');
44
+ expect(await navItem[1].getText()).toEqual('Guides');
45
+ });
46
+ });
47
+
48
+ describe('Test Guides page components functionality> ', () => {
49
+ beforeEach(async () => {
50
+ page = new GuidePage('/docs/service/vscode-maintainer/guide/vscode-overview.html');
51
+ page.open();
52
+
53
+ await page.waitPageLoad();
54
+ });
55
+
56
+ it('Check Left navigation Bar(LNB) options and move to another Guide page', async () => {
57
+ await (await $('>>> h1#overview')).waitForDisplayed();
58
+ await (await $('>>> div.flex.tile-expand-icon.tile-icon')).waitForDisplayed();
59
+
60
+ const navExpandsOption = await $$('>>> div.flex.tile-expand-icon.tile-icon');
61
+
62
+ expect(navExpandsOption.length).toEqual(2);
63
+
64
+ const sidebar = await (await $('doc-content-layout')).shadow$('div > dx-sidebar-old');
65
+ const sideBarContent = await sidebar.shadow$$('div.container div.sidebar-content dx-tree');
66
+
67
+ expect(sideBarContent.length).toEqual(4);
68
+
69
+ const nextStepOption = await (
70
+ await sideBarContent[3].shadow$('dx-tree-item')
71
+ ).shadow$('dx-tree-tile');
72
+
73
+ expect(nextStepOption.isExisting()).toBeTruthy();
74
+
75
+ const installVSCodeOptionTile = await (
76
+ await sideBarContent[1].shadow$('dx-tree-item')
77
+ ).shadow$('dx-tree-tile');
78
+
79
+ expect(installVSCodeOptionTile.isExisting()).toBeTruthy();
80
+
81
+ await (await sideBarContent[1].shadow$('dx-tree-item')).click();
82
+ await page.waitPageLoad();
83
+
84
+ const installVSCodeOption = await (
85
+ await sideBarContent[1].shadow$('dx-tree-item')
86
+ ).shadow$$('dx-tree-item');
87
+
88
+ expect(installVSCodeOption.length).toEqual(3);
89
+
90
+ await installVSCodeOption[1].click();
91
+
92
+ const installOnWindows = await $('>>> #install-on-windows');
93
+
94
+ await installOnWindows.waitForDisplayed();
95
+
96
+ expect(await installOnWindows.getText()).toEqual('Install on Windows');
97
+ });
98
+
99
+ it('Check Right navigation bar actions', async () => {
100
+ page = new GuidePage(
101
+ '/docs/commerce/test-cc-orders-api/guide/build-deploy-apps.html#prepare-the-platform',
102
+ );
103
+ page.open();
104
+
105
+ await page.waitPageLoad();
106
+ await (await $('>>> a.content-button.selected')).waitForDisplayed();
107
+
108
+ const rightNavContent = await $$(
109
+ '>>> div.toc.toc_content > div.toc-items > a.content-button',
110
+ );
111
+
112
+ await rightNavContent[0].waitForClickable();
113
+ await rightNavContent[0].click();
114
+
115
+ expect(await rightNavContent[0].getText()).toEqual('Prerequisites');
116
+
117
+ const selectedElement = rightNavContent[0];
118
+
119
+ await browser.waitUntil(
120
+ async function () {
121
+ const className = await selectedElement.getAttribute('class');
122
+ return (
123
+ className != null &&
124
+ className.includes('content-button') &&
125
+ className.includes('selected')
126
+ );
127
+ },
128
+ {
129
+ timeout: 5000,
130
+ timeoutMsg: 'Expecting element class to have `selected` value',
131
+ },
132
+ );
133
+
134
+ expect(await browser.getUrl()).toContain('build-deploy-apps.html#prerequisites');
135
+ });
136
+
137
+ it('Validate viewport scroll on right navigation bar actions', async () => {
138
+ page = new GuidePage(
139
+ '/docs/service/vscode-maintainer/guide/vscode-quickstart.html#helpful-resources',
140
+ );
141
+ page.open();
142
+
143
+ await page.waitPageLoad();
144
+
145
+ expect(await (await $('>>> h2#helpful-resources')).isDisplayedInViewport).toBeTruthy();
146
+ });
147
+
148
+ it('Check RNB is sticky when scrolling the content to the top', async () => {
149
+ const page = new GuidePage('/docs/service/vscode-maintainer/guide/vscode-quickstart.html');
150
+ page.open();
151
+ await page.waitPageLoad();
152
+
153
+ await (await $('>>> a.content-button.selected')).scrollIntoView();
154
+
155
+ const tocItem = await $('>>> div.toc.toc_content > div.toc-items > a.content-button');
156
+ await tocItem.waitForExist({ timeout: 2000 });
157
+ const isTocItemDisplayedInViewPort = await tocItem.isDisplayedInViewport();
158
+
159
+ expect(isTocItemDisplayedInViewPort).toBeTruthy();
160
+ });
161
+ });
162
+
163
+ describe('Validate guide breadcrumbs', () => {
164
+ it('Validate breadcrumbs on guide page', async () => {
165
+ const page = new GuidePage(
166
+ '/docs/service/vscode-maintainer/guide/vscode-authoring-kit-v1.html',
167
+ );
168
+ page.open();
169
+ await page.waitPageLoad();
170
+
171
+ const bcs = await $('>>>doc-breadcrumbs');
172
+ const anchorBreadcrumbs = await bcs.$$('>>>doc-breadcrumb-item');
173
+
174
+ expect(anchorBreadcrumbs.length > 1).toBeTruthy();
175
+
176
+ const bc0 = await anchorBreadcrumbs[0];
177
+ const bc1 = await anchorBreadcrumbs[1];
178
+
179
+ expect(await bc0.getText()).toMatch('Overview');
180
+ expect(await bc1.getText()).toMatch('Authoring Kit v1.0');
181
+ });
182
+ });
183
+
184
+ // TODO: Skipping these until we add the LWC repo to example repo post framework release.
185
+ describe.skip('Tabset Plugin Scenarios ', () => {
186
+ const getQueryParam = async (param: string): Promise<any> => {
187
+ const searchParams = new URLSearchParams(new URL(await browser.getUrl()).search);
188
+ const paramValue = searchParams.get(param);
189
+
190
+ return paramValue;
191
+ };
192
+
193
+ const getActiveTabLabel = async (): Promise<any> => {
194
+ const activeTab = await $('>>>button.tab-active');
195
+ const activeTabTitle = await activeTab.getText();
196
+
197
+ return activeTabTitle;
198
+ };
199
+
200
+ beforeEach(async () => {
201
+ page = new GuidePage('/docs/plugin-development/guide/tab-plugin-usage.html');
202
+ page.open();
203
+ await page.waitPageLoad();
204
+ });
205
+
206
+ it('Tabset plugin should render tabs and its content', async () => {
207
+ const tabsetContent = await $('>>>dx-tab-panel-list.docs-tab');
208
+ expect(tabsetContent.isExisting()).toBeTruthy();
209
+ });
210
+
211
+ it('First tab should be active by default', async () => {
212
+ const activeTabTitle = await getActiveTabLabel();
213
+
214
+ expect(activeTabTitle).toEqual('Tab Plugin');
215
+ await browser.waitUntil(
216
+ async function () {
217
+ return (await getQueryParam('type')) === 'Tab Plugin';
218
+ },
219
+ {
220
+ timeout: 5000,
221
+ timeoutMsg: 'Expecting query param to be `Tab Plugin` value',
222
+ },
223
+ );
224
+ });
225
+
226
+ it('First tab content should be visible', async () => {
227
+ const firstTabContent = await $('>>>div.tabpanel-active');
228
+ expect(firstTabContent.isExisting()).toBeTruthy();
229
+ });
230
+
231
+ it('Should switch to the second tab when clicked', async () => {
232
+ const allTabs = await $$('>>>dx-tab-panel-item');
233
+ await allTabs[1].click();
234
+ await page.waitPageLoad();
235
+
236
+ const activeTabTitle = await getActiveTabLabel();
237
+
238
+ expect(activeTabTitle).toEqual('Usage');
239
+ await browser.waitUntil(
240
+ async function () {
241
+ return (await getQueryParam('type')) === 'Usage';
242
+ },
243
+ {
244
+ timeout: 5000,
245
+ timeoutMsg: 'Expecting query param to be `Usage` value',
246
+ },
247
+ );
248
+ });
249
+
250
+ it('Check the URL has correct active tab as param', async () => {
251
+ await browser.waitUntil(
252
+ async function () {
253
+ return (await getQueryParam('type')) === 'Tab Plugin';
254
+ },
255
+ {
256
+ timeout: 5000,
257
+ timeoutMsg: 'Expecting query param to be `Tab Plugin` value',
258
+ },
259
+ );
260
+ });
261
+ });
262
+
263
+ describe('Validate the URL Structure ', () => {
264
+ beforeEach(async () => {
265
+ const page = new GuidePage(
266
+ '/docs/commerce/test-cc-orders-api/guide/build-deploy-apps.html',
267
+ );
268
+ page.open();
269
+ await page.waitPageLoad();
270
+ });
271
+
272
+ it('Slug is not having special charcters', async () => {
273
+ await $('>>>div.toc.toc_content').$('=Prerequisites').click();
274
+
275
+ await expect((await browser.getUrl()).toString().endsWith('#prerequisites')).toBeTruthy();
276
+ });
277
+
278
+ it('Spaces in the slug is replaced with hypen character', async () => {
279
+ await $('>>>div.toc.toc_content').$('=Prepare the Platform').click();
280
+
281
+ await expect(
282
+ (await browser.getUrl()).toString().endsWith('#prepare-the-platform'),
283
+ ).toBeTruthy();
284
+ });
285
+ });
286
+
287
+ describe('Search guides', () => {
288
+ beforeEach(async () => {
289
+ page = new GuidePage(
290
+ '/docs/commerce/test-cc-orders-api/guide/commerce-cloud-api-overview.html',
291
+ );
292
+ page.open();
293
+ await page.waitPageLoad();
294
+ });
295
+
296
+ it('should display search results based on the search text', async () => {
297
+ await $('doc-content-layout')
298
+ .then((layout) => layout.shadow$('div > dx-sidebar-old'))
299
+ .then((sidebar) => sidebar.waitForDisplayed());
300
+ const sidebar = await (await $('doc-content-layout')).shadow$('div > dx-sidebar-old');
301
+ const dxInput = await sidebar.shadow$('div > div.sidebar-header > div.search > dx-input');
302
+ const searchBox = await dxInput.shadow$('input');
303
+ await searchBox.click();
304
+ await browser.keys('SFRA');
305
+
306
+ const trees = await sidebar.shadow$$('div.container div.sidebar-content dx-tree');
307
+ const servicesTree = await (await trees[0].shadow$('dx-tree-item')).shadow$('dx-tree-item');
308
+ const treeItem = await servicesTree.shadow$('dx-tree-item');
309
+ const item = await (await treeItem.shadow$('dx-tree-tile')).shadow$('span');
310
+ const itemText = await item.getText();
311
+ expect(itemText).toBe('Find SFRA Tools');
312
+ });
313
+
314
+ it('should filter and navigate to the filtered guide', async () => {
315
+ await $('doc-content-layout')
316
+ .then((layout) => layout.shadow$('div > dx-sidebar-old'))
317
+ .then((sidebar) => sidebar.waitForDisplayed());
318
+ const sidebar = await (await $('doc-content-layout')).shadow$('div > dx-sidebar-old');
319
+ const dxInput = await sidebar.shadow$('div > div.sidebar-header > div.search > dx-input');
320
+ const searchBox = await dxInput.shadow$('input');
321
+ await searchBox.click();
322
+ await browser.keys('SFRA');
323
+
324
+ const trees = await (await sidebar).shadow$$('div.container div.sidebar-content dx-tree');
325
+ const servicesTree = await (await trees[0].shadow$('dx-tree-item')).shadow$('dx-tree-item');
326
+ const treeItem = await servicesTree.shadow$('dx-tree-item');
327
+ await treeItem.click();
328
+ await page.waitPageLoad();
329
+ const header = await (await $('doc-content-layout')).$('h1');
330
+
331
+ expect(await header.getText()).toBe('Find SFRA Tools');
332
+ });
333
+ });
@@ -0,0 +1,38 @@
1
+ import Page from '../pageobjects/page';
2
+
3
+ /**
4
+ * This is an exported test whereever we want to test the basic layout of the page (chrome)
5
+ * We don't want to duplicate this in each page. Each page can have more tests as required apart
6
+ * from this chrome test.
7
+ * @param givenPage : This is the current page for which we need to test chrome.
8
+ */
9
+
10
+ export default function layoutTest(givenPage: Page, headerTag = 'dx-header') {
11
+ let page: Page;
12
+ describe('Basic layout testing > ', () => {
13
+ beforeEach(async () => {
14
+ page = givenPage;
15
+ });
16
+
17
+ it('should display header', async () => {
18
+ const header = await $('hgf-c360contextnav');
19
+ await header.waitForDisplayed();
20
+ expect(await header.isDisplayed()).toBeTruthy();
21
+ expect(await header.getText()).toContain('Developers');
22
+ });
23
+
24
+ it.skip('should display global search box', async () => {
25
+ // should have search box
26
+ const searchBox = (await $(headerTag)).shadow$('dx-header-search');
27
+ await (await $(headerTag)).waitForDisplayed();
28
+ expect(await (await searchBox).isDisplayed()).toBeTruthy();
29
+ });
30
+
31
+ it('should display footer', async () => {
32
+ // should have footer
33
+ const footer = await $('>>>dx-footer');
34
+ await footer.waitForDisplayed();
35
+ expect(await footer.isDisplayed()).toBeTruthy();
36
+ });
37
+ });
38
+ }
@@ -0,0 +1,82 @@
1
+ import DocsApiPage from '../../portal/pageobjects/docs.apis.page';
2
+ import OverviewPage from '../pageobjects/overview.page';
3
+ import layoutTest from './layout-tests';
4
+
5
+ let page: DocsApiPage;
6
+ describe('/docs/api overview page > ', () => {
7
+ beforeEach(async () => {
8
+ page = new DocsApiPage('/docs/commerce/test-cc-orders-api/overview');
9
+ page.open();
10
+ await page.waitPageLoad();
11
+ (await $('dx-section')).waitForDisplayed();
12
+ });
13
+
14
+ layoutTest(page, 'doc-header');
15
+
16
+ it('should show Overview, Guides and Reference tabs and have Overview as active', async () => {
17
+ const overviewPageSection = await $('>>>.content-type-overview');
18
+ overviewPageSection.waitForDisplayed();
19
+
20
+ const docHeaderNav = await $('>>> .header_l2_group-nav_overflow');
21
+ const headerNav = await docHeaderNav.$('>>> dx-header-nav');
22
+ const navTabs = await headerNav.shadow$$('dx-tab');
23
+
24
+ expect(navTabs.length).toBeGreaterThanOrEqual(2);
25
+ expect(await navTabs[0].getText()).toEqual('Overview');
26
+ expect(await navTabs[1].getText()).toEqual('Guides');
27
+
28
+ const activeNavItem = await page.getActiveNavTab();
29
+ expect(await activeNavItem.getText()).toMatch('Overview');
30
+ });
31
+
32
+ it('should show Overview page with key features and correct header', async () => {
33
+ const overviewPage = await $('>>>.content-type-overview');
34
+ const grid = await overviewPage.$('dx-section > dx-grid');
35
+ const mainContent = await grid.$$('div');
36
+ const header1 = await mainContent[0].$('dx-group-text').shadow$('.title');
37
+ const header2 = await mainContent[1].$('dx-group-text').shadow$('.title');
38
+
39
+ expect(await header1.getText()).toBe('Commerce Cloud API Overview');
40
+ expect(await header2.getText()).toBe('Key Features');
41
+ });
42
+
43
+ it('Should land on Overview Page for default URL', async () => {
44
+ const overviewPage = new OverviewPage('/docs/commerce/test-cc-orders-api');
45
+ overviewPage.open();
46
+ await overviewPage.waitPageLoad();
47
+
48
+ const overviewContent = await $('>>>.overview-content');
49
+ await overviewContent.waitForDisplayed();
50
+ expect(await overviewContent.isDisplayed()).toBe(true);
51
+ });
52
+
53
+ it('should show overview header and CTA buttons on default URL', async () => {
54
+ const overviewPage = new OverviewPage('/docs/commerce/test-cc-orders-api');
55
+ overviewPage.open();
56
+ await overviewPage.waitPageLoad();
57
+
58
+ const overviewContent = await $('>>>.overview-content > dx-group-text');
59
+ const buttons = await overviewContent.shadow$$('dx-button');
60
+
61
+ expect(await overviewContent.getAttribute('header')).toEqual('Commerce Cloud API Overview');
62
+ expect(await buttons[0].getText()).toBe('Test custom external link');
63
+ expect(await buttons[1].getText()).toBe('Test internal Guide link');
64
+ });
65
+
66
+ it('should show Key Features list on overview page', async () => {
67
+ const overviewPage = new OverviewPage('/docs/commerce/test-cc-orders-api');
68
+ overviewPage.open();
69
+ await overviewPage.waitPageLoad();
70
+
71
+ const section = await $('dx-section');
72
+ const grid = await section.$('dx-grid');
73
+ const mainContent = await grid.$$('div');
74
+ const featuresList = await mainContent[1].$('dx-features-list');
75
+ const options = await featuresList.shadow$$('li.option');
76
+
77
+ expect(options.length).toBe(3);
78
+ expect(await (await options[0].$('div')).getText()).toBe('Update an Order');
79
+ expect(await (await options[1].$('div')).getText()).toBe('Update Order States');
80
+ expect(await (await options[2].$('div')).getText()).toBe('Change Shipping Address');
81
+ });
82
+ });
@@ -0,0 +1,12 @@
1
+ import Page from '../pageobjects/page';
2
+
3
+ describe('Homepage', () => {
4
+ beforeEach(async () => {
5
+ const page = new Page('/content-page');
6
+ page.open();
7
+ });
8
+
9
+ it('should have the right title', async () => {
10
+ expect(browser).toHaveTitle('Salesforce Developers');
11
+ });
12
+ });
@@ -0,0 +1,170 @@
1
+ import { it } from 'mocha';
2
+ import RedocApisPage from '../pageobjects/api-redoc-reference.page';
3
+ import OverviewPage from '../pageobjects/overview.page';
4
+ import {
5
+ waitAndGetDocPhaseParentInRedocReferencesPage,
6
+ assertDocPhaseUnavailability,
7
+ assertDocPhaseElementsForRedoc,
8
+ phases,
9
+ } from '../pageobjects/doc-phase-config';
10
+
11
+ let page: RedocApisPage;
12
+ describe('Redoc API Reference page', () => {
13
+ describe('check layouts', () => {
14
+ before(async () => {
15
+ page = new RedocApisPage('docs/service/single-oas-redoc/references/redoc-orders-api1');
16
+ page.open();
17
+ await page.waitPageLoad();
18
+ });
19
+
20
+ it('should have the right title', async () => {
21
+ await page.waitPageLoad();
22
+ expect(browser).toHaveTitle('Redoc UI Example');
23
+ });
24
+
25
+ it('should have the correct api info title', async () => {
26
+ const apiTitle = await page.getApiTitle();
27
+ const titleText = await apiTitle.getText();
28
+
29
+ expect(titleText).toMatch('Einstein Vision and Einstein Language');
30
+ });
31
+
32
+ it('should highlight Reference as a selected tab on nav', async () => {
33
+ const selectedHeaderNavItem = await page.getActiveNavTab();
34
+
35
+ expect(await selectedHeaderNavItem.getText()).toMatch('Reference');
36
+ });
37
+
38
+ it('should display footer', async () => {
39
+ const footer = await $('>>>dx-footer');
40
+ await footer.waitForDisplayed();
41
+ expect(await footer.isDisplayed()).toBeTruthy();
42
+ });
43
+ });
44
+
45
+ describe('Test Reference page transition> ', () => {
46
+ it('Check Overview to Reference page Transition', async () => {
47
+ const page = new OverviewPage('docs/service/single-oas-redoc/overview');
48
+ page.open();
49
+ await page.waitPageLoad();
50
+ const docHeaderNav = await $('>>> .header_l2_group-nav_overflow');
51
+ const headerNav = await docHeaderNav.$('>>> dx-header-nav');
52
+ const navItem = await headerNav.shadow$$('nav > ul > li');
53
+ expect(navItem.length).toEqual(2);
54
+ const dxHeaderNavOpt = await navItem[1].$('dx-tab');
55
+ const referenceAnchor = await dxHeaderNavOpt.shadow$('a');
56
+ expect(await referenceAnchor.getAttribute('href')).toContain(
57
+ '/docs/service/single-oas-redoc/references',
58
+ );
59
+ expect(await (await referenceAnchor.$('span')).getText()).toEqual('Reference');
60
+ await navItem[1].click();
61
+ const header = await $('>>>doc-header');
62
+ await header.waitForDisplayed();
63
+ expect(await referenceAnchor.getAttribute('class')).toContain(
64
+ 'nav-list-item state-active',
65
+ );
66
+ });
67
+ });
68
+
69
+ describe('Doc Phase', () => {
70
+ it('should not render doc-phase when not configured', async () => {
71
+ page = new RedocApisPage('docs/service/single-oas-redoc/references/redoc-orders-api1');
72
+ page.open();
73
+ await page.waitPageLoad();
74
+
75
+ const sectionsContentLayout = await waitAndGetDocPhaseParentInRedocReferencesPage();
76
+
77
+ await assertDocPhaseUnavailability(sectionsContentLayout);
78
+ });
79
+
80
+ it('should render beta doc-phase config', async () => {
81
+ page = new RedocApisPage(
82
+ 'docs/service/redoc-parent-banner/references/redoc-orders-api2',
83
+ );
84
+ page.open();
85
+ await page.waitPageLoad();
86
+
87
+ const sectionsContentLayout = await waitAndGetDocPhaseParentInRedocReferencesPage();
88
+
89
+ await assertDocPhaseElementsForRedoc(sectionsContentLayout, phases.beta);
90
+ });
91
+ });
92
+
93
+ describe('Redoc reference sidebar', () => {
94
+ before(async () => {
95
+ page = new RedocApisPage('docs/service/single-oas-redoc/references/redoc-orders-api1');
96
+ page.open();
97
+ await page.waitPageLoad();
98
+ });
99
+
100
+ it('should display the first item text correctly and expand the first item', async () => {
101
+ const firstItem = await page.getLnbItemByIndex(0);
102
+
103
+ expect(await (await firstItem.$('label')).getText()).toEqual('Check API Usage');
104
+
105
+ const expandFirstItem = await (await firstItem.$('label')).$('svg');
106
+ await expandFirstItem.click();
107
+
108
+ expect(await firstItem.getAttribute('aria-expanded')).toBe('true');
109
+ });
110
+
111
+ it('should update the URL hash to the item id and show the correct heading, when the item is clicked', async () => {
112
+ const fifthItem = await page.getLnbItemByIndex(4);
113
+ await fifthItem.click();
114
+
115
+ const dataItemId = await fifthItem.getAttribute('data-item-id');
116
+ expect(await browser.getUrl()).toContain(`#${dataItemId}`);
117
+
118
+ const content = await page.getContent();
119
+ const heading = await content.$(`div[data-section-id="${dataItemId}"] h2`);
120
+
121
+ expect(await heading.isDisplayedInViewport()).toBe(true);
122
+ });
123
+
124
+ it('should render the sticky searchbar when scroll to bottom', async () => {
125
+ const sidebar = await page.getSidebar();
126
+ const searchbar = sidebar.$('div[role="search"]');
127
+ const scrollbarContainer = await sidebar.$('.scrollbar-container');
128
+
129
+ const searchbarInitialPosition = await searchbar.getLocation('y');
130
+
131
+ // Scroll to the bottom of the sidebar
132
+ await browser.execute((element) => {
133
+ if ('scrollTop' in element && 'scrollHeight' in element) {
134
+ element['scrollTop'] = element['scrollHeight'];
135
+ }
136
+ }, scrollbarContainer);
137
+
138
+ const searchbarFinalPosition = await searchbar.getLocation('y');
139
+
140
+ expect(searchbarInitialPosition).toEqual(searchbarFinalPosition);
141
+ });
142
+
143
+ it('should not display branding by redoc on LNB', async () => {
144
+ const sidebar = await page.getSidebar();
145
+ const scrollbarContainer = sidebar.$('.scrollbar-container');
146
+ const redocBrand = (await scrollbarContainer).$('a[href*="redocly.com/redoc"]');
147
+
148
+ expect(redocBrand).not.toBeDisplayed();
149
+ });
150
+ });
151
+
152
+ describe('Redoc reference bookmark url', () => {
153
+ before(async () => {
154
+ page = new RedocApisPage(
155
+ 'docs/service/single-oas-redoc/references/redoc-orders-api1#tag/Vision-Models/operation/getTrainedModels_1',
156
+ );
157
+ page.open();
158
+ await page.waitPageLoad();
159
+ });
160
+
161
+ it('should display the correct heading, when hit the bookmark url', async () => {
162
+ const urlHash = (await browser.getUrl()).split('#')[1];
163
+
164
+ const content = await page.getContent();
165
+ const heading = await content.$(`div[data-section-id="${urlHash}"] h2`);
166
+
167
+ expect(await heading.isDisplayedInViewport()).toBe(true);
168
+ });
169
+ });
170
+ });