@coveo/quantic 3.38.0 → 3.38.2
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/force-app/main/default/lwc/quanticSort/e2e/pageObject.ts +29 -18
- package/force-app/main/default/lwc/quanticSort/e2e/quanticSort.e2e.ts +6 -8
- package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +2 -2
- package/force-app/main/default/staticresources/coveoheadless/headless.js +2 -2
- package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +2 -2
- package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +2 -2
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import {expect, type Locator, type Page, type Request} from '@playwright/test';
|
|
2
2
|
import {isUaSearchEvent} from '../../../../../../playwright/utils/requests';
|
|
3
3
|
|
|
4
4
|
export class SortObject {
|
|
@@ -32,7 +32,20 @@ export class SortObject {
|
|
|
32
32
|
} else {
|
|
33
33
|
await this.sortDropDown.press('Space');
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
const overlay = this.page.locator('div[part="dropdown overlay"]');
|
|
36
|
+
await overlay.waitFor({state: 'visible'});
|
|
37
|
+
await overlay
|
|
38
|
+
.locator('[role="option"]')
|
|
39
|
+
.first()
|
|
40
|
+
.waitFor({state: 'visible'});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async selectNextSortOptionUsingKeyboard(
|
|
44
|
+
expectedLabel: string
|
|
45
|
+
): Promise<void> {
|
|
46
|
+
await this.sortDropDown.press('ArrowDown');
|
|
47
|
+
await this.sortDropDown.press('Enter');
|
|
48
|
+
await expect(this.sortDropDown).toHaveText(expectedLabel);
|
|
36
49
|
}
|
|
37
50
|
|
|
38
51
|
async waitForSortUaAnalytics(eventValue: any): Promise<Request> {
|
|
@@ -60,24 +73,22 @@ export class SortObject {
|
|
|
60
73
|
return uaRequest;
|
|
61
74
|
}
|
|
62
75
|
|
|
63
|
-
async
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return arrSort;
|
|
69
|
-
}
|
|
76
|
+
async getSortLabelValue(): Promise<{label: string; value: string | null}[]> {
|
|
77
|
+
const sortOptions = this.page.locator(
|
|
78
|
+
'div[part="dropdown overlay"] [role="option"]'
|
|
79
|
+
);
|
|
80
|
+
await sortOptions.first().waitFor({state: 'visible'});
|
|
70
81
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
82
|
+
return sortOptions.evaluateAll((options) =>
|
|
83
|
+
options.map((option) => ({
|
|
84
|
+
label: (
|
|
85
|
+
(option as HTMLElement).innerText ||
|
|
86
|
+
option.getAttribute('aria-label') ||
|
|
87
|
+
option.getAttribute('title') ||
|
|
88
|
+
''
|
|
89
|
+
).trim(),
|
|
90
|
+
value: option.getAttribute('data-value'),
|
|
79
91
|
}))
|
|
80
92
|
);
|
|
81
|
-
return sortLabelwithValueList;
|
|
82
93
|
}
|
|
83
94
|
}
|
|
@@ -11,8 +11,8 @@ const fixtures = {
|
|
|
11
11
|
|
|
12
12
|
useCaseTestCases.forEach((useCase) => {
|
|
13
13
|
let test;
|
|
14
|
-
let sortArrOptions;
|
|
15
|
-
let sortLabelWithValue;
|
|
14
|
+
let sortArrOptions: string[];
|
|
15
|
+
let sortLabelWithValue: {label: string; value: string | null}[];
|
|
16
16
|
if (useCase.value === useCaseEnum.search) {
|
|
17
17
|
test = fixtures[useCase.value] as typeof testSearch;
|
|
18
18
|
} else {
|
|
@@ -22,8 +22,8 @@ useCaseTestCases.forEach((useCase) => {
|
|
|
22
22
|
test.describe(`quantic sort ${useCase.label}`, () => {
|
|
23
23
|
test.beforeEach(async ({sort}) => {
|
|
24
24
|
await sort.clickSortDropDown();
|
|
25
|
-
sortArrOptions = await sort.allSortLabelOptions();
|
|
26
25
|
sortLabelWithValue = await sort.getSortLabelValue();
|
|
26
|
+
sortArrOptions = sortLabelWithValue.map(({label}) => label);
|
|
27
27
|
await sort.clickSortDropDown();
|
|
28
28
|
});
|
|
29
29
|
|
|
@@ -53,15 +53,13 @@ useCaseTestCases.forEach((useCase) => {
|
|
|
53
53
|
// Selecting the next sort using Enter to open dropdown, the ArrowDown, then ENTER key
|
|
54
54
|
await sort.focusSortDropDown();
|
|
55
55
|
await sort.openSortDropdownUsingKeyboardEnter();
|
|
56
|
-
await sort.
|
|
57
|
-
await sort.sortDropDown.press('Enter');
|
|
56
|
+
await sort.selectNextSortOptionUsingKeyboard(sortArrOptions[1]);
|
|
58
57
|
await expect(sort.sortDropDown).toHaveText(sortArrOptions[1]);
|
|
59
58
|
|
|
60
59
|
// Selecting the next sort using Space to open dropdown, the ArrowDown, then ENTER key
|
|
61
60
|
await sort.focusSortDropDown();
|
|
62
61
|
await sort.openSortDropdownUsingKeyboardEnter(false);
|
|
63
|
-
await sort.
|
|
64
|
-
await sort.sortDropDown.press('Enter');
|
|
62
|
+
await sort.selectNextSortOptionUsingKeyboard(sortArrOptions[2]);
|
|
65
63
|
await expect(sort.sortDropDown).toHaveText(sortArrOptions[2]);
|
|
66
64
|
});
|
|
67
65
|
});
|
|
@@ -76,7 +74,7 @@ useCaseTestCases.forEach((useCase) => {
|
|
|
76
74
|
sortLabelWithValue[2]; // Assuming 0 is the first sort option
|
|
77
75
|
|
|
78
76
|
const currentUrl = await page.url();
|
|
79
|
-
const urlHash = `#sortCriteria=${encodeURI(expectedSortValue)}`;
|
|
77
|
+
const urlHash = `#sortCriteria=${encodeURI(expectedSortValue!)}`;
|
|
80
78
|
|
|
81
79
|
await page.goto(`${currentUrl}/${urlHash}`);
|
|
82
80
|
await page.getByRole('button', {name: 'Try it now'}).click();
|