@vuu-ui/vuu-playwright-helpers 3.5.21 → 3.5.23
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 +2 -2
- package/src/PwColumnPicker.js +44 -0
- package/src/PwTable.js +57 -0
- package/src/PwTableFooter.js +16 -0
- package/src/PwTableHeaderCell.js +8 -0
- package/src/index.js +2 -0
- package/types/PwColumnPicker.d.ts +116 -0
- package/types/PwTable.d.ts +110 -0
- package/types/PwTableFooter.d.ts +40 -0
- package/types/PwTableHeaderCell.d.ts +14 -0
- package/types/index.d.ts +3 -1
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "3.5.
|
|
2
|
+
"version": "3.5.23",
|
|
3
3
|
"author": "heswell",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./src/index.js",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"type-defs": "node ../../scripts/build-type-defs.mjs"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@vuu-ui/vuu-protocol-types": "3.5.
|
|
12
|
+
"@vuu-ui/vuu-protocol-types": "3.5.23"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
15
|
"@playwright/test": "^1.62.1"
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { expect } from "@playwright/test";
|
|
2
|
+
import { PwComponent } from "./PwComponent.js";
|
|
3
|
+
import { cssAttributeValue } from "./selector-utils.js";
|
|
4
|
+
class PwColumnPicker extends PwComponent {
|
|
5
|
+
defaultCssSelector = ".vuuColumnPicker";
|
|
6
|
+
get selectedOptions() {
|
|
7
|
+
return this.locator.locator(".vuuItemPicker-selectedList [role='option']");
|
|
8
|
+
}
|
|
9
|
+
get availableOptions() {
|
|
10
|
+
return this.locator.locator(".vuuItemPicker-availableList [role='option']");
|
|
11
|
+
}
|
|
12
|
+
selectedColumns() {
|
|
13
|
+
return this.optionNames(this.selectedOptions);
|
|
14
|
+
}
|
|
15
|
+
availableColumns() {
|
|
16
|
+
return this.optionNames(this.availableOptions);
|
|
17
|
+
}
|
|
18
|
+
async addColumn(columnName) {
|
|
19
|
+
await this.clickAction(this.option(this.availableOptions, columnName));
|
|
20
|
+
}
|
|
21
|
+
async removeColumn(columnName) {
|
|
22
|
+
await this.clickAction(this.option(this.selectedOptions, columnName));
|
|
23
|
+
}
|
|
24
|
+
async search(text) {
|
|
25
|
+
await this.locator.getByRole("search").getByRole("textbox").fill(text);
|
|
26
|
+
}
|
|
27
|
+
async assertSelectedColumns(columnNames) {
|
|
28
|
+
await expect.poll(()=>this.selectedColumns()).toEqual(columnNames);
|
|
29
|
+
}
|
|
30
|
+
async assertAvailableColumns(columnNames) {
|
|
31
|
+
await expect.poll(()=>this.availableColumns()).toEqual(expect.arrayContaining(columnNames));
|
|
32
|
+
}
|
|
33
|
+
async clickAction(option) {
|
|
34
|
+
await option.hover();
|
|
35
|
+
await option.locator(".vuuItemPickerListItem-action").click();
|
|
36
|
+
}
|
|
37
|
+
option(options, columnName) {
|
|
38
|
+
return options.and(this.page.locator(`[data-name="${cssAttributeValue(columnName)}"]`));
|
|
39
|
+
}
|
|
40
|
+
optionNames(options) {
|
|
41
|
+
return options.evaluateAll((elements)=>elements.map((element)=>element.getAttribute("data-name") ?? ""));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export { PwColumnPicker };
|
package/src/PwTable.js
CHANGED
|
@@ -3,6 +3,7 @@ import { PwComponent } from "./PwComponent.js";
|
|
|
3
3
|
import { PwContextMenu } from "./PwContextMenu.js";
|
|
4
4
|
import { PwTableHeaderCell } from "./PwTableHeaderCell.js";
|
|
5
5
|
import { byDataIcon, cssAttributeValue } from "./selector-utils.js";
|
|
6
|
+
const SCROLL_TOLERANCE = 1;
|
|
6
7
|
const byAriaRowIndex = (ariaRowIndex)=>`[aria-rowindex="${ariaRowIndex}"]:scope`;
|
|
7
8
|
const xpathStringLiteral = (value)=>{
|
|
8
9
|
if (!value.includes("'")) return `'${value}'`;
|
|
@@ -17,6 +18,56 @@ class PwTable extends PwComponent {
|
|
|
17
18
|
get scrollbarContainer() {
|
|
18
19
|
return this.locator.locator(".vuuTable-scrollbarContainer");
|
|
19
20
|
}
|
|
21
|
+
scrollPosition() {
|
|
22
|
+
return this.scrollbarContainer.evaluate(({ scrollLeft, scrollTop })=>({
|
|
23
|
+
scrollLeft,
|
|
24
|
+
scrollTop
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
scrollUp(distance) {
|
|
28
|
+
return this.scroll("vertical", -1, distance);
|
|
29
|
+
}
|
|
30
|
+
scrollDown(distance) {
|
|
31
|
+
return this.scroll("vertical", 1, distance);
|
|
32
|
+
}
|
|
33
|
+
scrollLeft(distance) {
|
|
34
|
+
return this.scroll("horizontal", -1, distance);
|
|
35
|
+
}
|
|
36
|
+
scrollRight(distance) {
|
|
37
|
+
return this.scroll("horizontal", 1, distance);
|
|
38
|
+
}
|
|
39
|
+
async scroll(axis, direction, distance) {
|
|
40
|
+
if ("number" == typeof distance && distance < 0) throw Error("PwTable, scroll, distance must not be negative, use the opposite direction");
|
|
41
|
+
await this.scrollbarContainer.evaluate((el, { axis, direction, distance })=>{
|
|
42
|
+
const vertical = "vertical" === axis;
|
|
43
|
+
const current = vertical ? el.scrollTop : el.scrollLeft;
|
|
44
|
+
const max = vertical ? el.scrollHeight - el.clientHeight : el.scrollWidth - el.clientWidth;
|
|
45
|
+
const pos = "start" === distance ? 0 : "end" === distance ? max : current + direction * ("page" === distance ? el.clientHeight : distance);
|
|
46
|
+
el.scrollTo({
|
|
47
|
+
[vertical ? "top" : "left"]: Math.min(max, Math.max(0, pos)),
|
|
48
|
+
behavior: "instant"
|
|
49
|
+
});
|
|
50
|
+
}, {
|
|
51
|
+
axis,
|
|
52
|
+
direction,
|
|
53
|
+
distance
|
|
54
|
+
});
|
|
55
|
+
await expect.poll(()=>this.isContentScrollSynced(), {
|
|
56
|
+
message: "PwTable, content container scroll position not synced"
|
|
57
|
+
}).toBe(true);
|
|
58
|
+
}
|
|
59
|
+
isContentScrollSynced() {
|
|
60
|
+
return this.locator.evaluate((table, tolerance)=>{
|
|
61
|
+
const scrollbar = table.querySelector(".vuuTable-scrollbarContainer");
|
|
62
|
+
const content = table.querySelector(".vuuTable-contentContainer");
|
|
63
|
+
if (!scrollbar || !content) return false;
|
|
64
|
+
const isSynced = (sourcePos, sourceMax, targetPos, targetMax)=>{
|
|
65
|
+
const expected = sourceMax > 0 ? sourcePos / sourceMax * targetMax : 0;
|
|
66
|
+
return Math.abs(targetPos - expected) <= tolerance;
|
|
67
|
+
};
|
|
68
|
+
return isSynced(scrollbar.scrollTop, scrollbar.scrollHeight - scrollbar.clientHeight, content.scrollTop, content.scrollHeight - content.clientHeight) && isSynced(scrollbar.scrollLeft, scrollbar.scrollWidth - scrollbar.clientWidth, content.scrollLeft, content.scrollWidth - content.clientWidth);
|
|
69
|
+
}, SCROLL_TOLERANCE);
|
|
70
|
+
}
|
|
20
71
|
row(row) {
|
|
21
72
|
return this.locator.locator(`[aria-rowindex="${row}"]`);
|
|
22
73
|
}
|
|
@@ -34,6 +85,12 @@ class PwTable extends PwComponent {
|
|
|
34
85
|
async columnNames() {
|
|
35
86
|
return this.locator.locator(".vuuTableHeaderCell .vuuTableHeaderCell-label").allTextContents();
|
|
36
87
|
}
|
|
88
|
+
headerColumnNames() {
|
|
89
|
+
return this.locator.locator(".vuuTableHeaderCell[data-column-name]").evaluateAll((elements)=>elements.map((element)=>element.getAttribute("data-column-name") ?? ""));
|
|
90
|
+
}
|
|
91
|
+
async assertColumns(columnNames) {
|
|
92
|
+
await expect.poll(()=>this.headerColumnNames()).toEqual(columnNames);
|
|
93
|
+
}
|
|
37
94
|
async rowCount() {
|
|
38
95
|
const ariaRowCount = await this.locator.getByRole("table").getAttribute("aria-rowcount");
|
|
39
96
|
if (null === ariaRowCount) throw Error("PwTable, rowCount, table does not have an aria-rowcount");
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PwColumnPicker } from "./PwColumnPicker.js";
|
|
2
|
+
import { PwComponent } from "./PwComponent.js";
|
|
3
|
+
class PwTableFooter extends PwComponent {
|
|
4
|
+
defaultCssSelector = ".vuuTableFooter";
|
|
5
|
+
action(name) {
|
|
6
|
+
return this.locator.getByRole("button", {
|
|
7
|
+
name,
|
|
8
|
+
exact: true
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
async showColumnPicker(name = "Show column picker") {
|
|
12
|
+
await this.action(name).click();
|
|
13
|
+
return new PwColumnPicker(this.page).isReady();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export { PwTableFooter };
|
package/src/PwTableHeaderCell.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { expect } from "@playwright/test";
|
|
2
2
|
import { PwComponent } from "./PwComponent.js";
|
|
3
|
+
import { PwContextMenu } from "./PwContextMenu.js";
|
|
3
4
|
class PwTableHeaderCell extends PwComponent {
|
|
4
5
|
defaultCssSelector = ".vuuTableHeaderCell";
|
|
5
6
|
constructor(page, target){
|
|
@@ -11,5 +12,12 @@ class PwTableHeaderCell extends PwComponent {
|
|
|
11
12
|
async assertSelected() {
|
|
12
13
|
await expect(this.locator).toContainClass("vuuTableHeaderCell-selected");
|
|
13
14
|
}
|
|
15
|
+
async showColumnMenu() {
|
|
16
|
+
await this.locator.getByRole("button", {
|
|
17
|
+
name: "Open Column Menu",
|
|
18
|
+
exact: true
|
|
19
|
+
}).click();
|
|
20
|
+
return new PwContextMenu(this.page, this.page.locator(".saltMenuPanel[role='menu']")).isReady();
|
|
21
|
+
}
|
|
14
22
|
}
|
|
15
23
|
export { PwTableHeaderCell };
|
package/src/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export { PlaywrightPageObject } from "./PlaywrightPageObject.js";
|
|
2
2
|
export { PwChart } from "./PwChart.js";
|
|
3
3
|
export { PwChartDataPoint } from "./PwChartDataPoint.js";
|
|
4
|
+
export { PwColumnPicker } from "./PwColumnPicker.js";
|
|
4
5
|
export { PwComponent } from "./PwComponent.js";
|
|
5
6
|
export { PwContextMenu } from "./PwContextMenu.js";
|
|
6
7
|
export { PwMenuItem } from "./PwMenuItem.js";
|
|
7
8
|
export { PwTable } from "./PwTable.js";
|
|
9
|
+
export { PwTableFooter } from "./PwTableFooter.js";
|
|
8
10
|
export { PwTableHeaderCell } from "./PwTableHeaderCell.js";
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { type Locator } from "@playwright/test";
|
|
2
|
+
import { PwComponent } from "./PwComponent";
|
|
3
|
+
/**
|
|
4
|
+
* A ColumnPicker. The upper list holds the columns in view (selected), the
|
|
5
|
+
* lower list the columns available to add. Columns are identified by name
|
|
6
|
+
* (the data-name of the list option), not by display label.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* test("add a column", async ({ page }) => {
|
|
10
|
+
* const picker = await new PwTableFooter(page).showColumnPicker();
|
|
11
|
+
* await picker.addColumn("lotSize");
|
|
12
|
+
* await picker.assertSelectedColumns(["bbg", "currency", "lotSize"]);
|
|
13
|
+
* });
|
|
14
|
+
*/
|
|
15
|
+
export declare class PwColumnPicker extends PwComponent {
|
|
16
|
+
protected readonly defaultCssSelector = ".vuuColumnPicker";
|
|
17
|
+
/**
|
|
18
|
+
* Locator for the options in the list of selected columns (columns in view).
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* test("four columns in view", async ({ page }) => {
|
|
22
|
+
* const picker = await new PwTableFooter(page).showColumnPicker();
|
|
23
|
+
* await expect(picker.selectedOptions).toHaveCount(4);
|
|
24
|
+
* });
|
|
25
|
+
*/
|
|
26
|
+
get selectedOptions(): Locator;
|
|
27
|
+
/**
|
|
28
|
+
* Locator for the options in the list of available columns.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* test("three columns available", async ({ page }) => {
|
|
32
|
+
* const picker = await new PwTableFooter(page).showColumnPicker();
|
|
33
|
+
* await expect(picker.availableOptions).toHaveCount(3);
|
|
34
|
+
* });
|
|
35
|
+
*/
|
|
36
|
+
get availableOptions(): Locator;
|
|
37
|
+
/**
|
|
38
|
+
* The names of the selected columns (columns in view), in list order.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* test("columns in view", async ({ page }) => {
|
|
42
|
+
* const picker = await new PwTableFooter(page).showColumnPicker();
|
|
43
|
+
* expect(await picker.selectedColumns()).toEqual(["bbg", "currency"]);
|
|
44
|
+
* });
|
|
45
|
+
*/
|
|
46
|
+
selectedColumns(): Promise<string[]>;
|
|
47
|
+
/**
|
|
48
|
+
* The names of the available columns, in list order.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* test("columns available", async ({ page }) => {
|
|
52
|
+
* const picker = await new PwTableFooter(page).showColumnPicker();
|
|
53
|
+
* expect(await picker.availableColumns()).toContain("lotSize");
|
|
54
|
+
* });
|
|
55
|
+
*/
|
|
56
|
+
availableColumns(): Promise<string[]>;
|
|
57
|
+
/**
|
|
58
|
+
* Add a column to the view. Hovers the column in the available list, then
|
|
59
|
+
* clicks its add button.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* test("add lotSize", async ({ page }) => {
|
|
63
|
+
* const picker = await new PwTableFooter(page).showColumnPicker();
|
|
64
|
+
* await picker.addColumn("lotSize");
|
|
65
|
+
* });
|
|
66
|
+
*/
|
|
67
|
+
addColumn(columnName: string): Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* Remove a column from the view. Hovers the column in the selected list,
|
|
70
|
+
* then clicks its remove button.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* test("remove currency", async ({ page }) => {
|
|
74
|
+
* const picker = await new PwTableFooter(page).showColumnPicker();
|
|
75
|
+
* await picker.removeColumn("currency");
|
|
76
|
+
* });
|
|
77
|
+
*/
|
|
78
|
+
removeColumn(columnName: string): Promise<void>;
|
|
79
|
+
/**
|
|
80
|
+
* Enter text in the search input, filtering both lists.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* test("search for lot", async ({ page }) => {
|
|
84
|
+
* const picker = await new PwTableFooter(page).showColumnPicker();
|
|
85
|
+
* await picker.search("lot");
|
|
86
|
+
* expect(await picker.availableColumns()).toEqual(["lotSize"]);
|
|
87
|
+
* });
|
|
88
|
+
*/
|
|
89
|
+
search(text: string): Promise<void>;
|
|
90
|
+
/**
|
|
91
|
+
* Assert the names of the selected columns, in order, retrying until the
|
|
92
|
+
* expect timeout.
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* test("columns in view", async ({ page }) => {
|
|
96
|
+
* const picker = await new PwTableFooter(page).showColumnPicker();
|
|
97
|
+
* await picker.assertSelectedColumns(["bbg", "currency"]);
|
|
98
|
+
* });
|
|
99
|
+
*/
|
|
100
|
+
assertSelectedColumns(columnNames: string[]): Promise<void>;
|
|
101
|
+
/**
|
|
102
|
+
* Assert that the named columns are in the available list, retrying until
|
|
103
|
+
* the expect timeout. Other columns may also be available.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* test("currency is available again", async ({ page }) => {
|
|
107
|
+
* const picker = await new PwTableFooter(page).showColumnPicker();
|
|
108
|
+
* await picker.removeColumn("currency");
|
|
109
|
+
* await picker.assertAvailableColumns(["currency"]);
|
|
110
|
+
* });
|
|
111
|
+
*/
|
|
112
|
+
assertAvailableColumns(columnNames: string[]): Promise<void>;
|
|
113
|
+
private clickAction;
|
|
114
|
+
private option;
|
|
115
|
+
private optionNames;
|
|
116
|
+
}
|
package/types/PwTable.d.ts
CHANGED
|
@@ -4,6 +4,20 @@ import { PwComponent } from "./PwComponent";
|
|
|
4
4
|
import { PwContextMenu } from "./PwContextMenu";
|
|
5
5
|
import { PwTableHeaderCell } from "./PwTableHeaderCell";
|
|
6
6
|
type AriaRole = "cell" | "textbox" | "combobox";
|
|
7
|
+
/**
|
|
8
|
+
* How far to scroll: 'start' or 'end' scroll to that end of the axis, a number
|
|
9
|
+
* scrolls by that many pixels in the direction of the method.
|
|
10
|
+
*/
|
|
11
|
+
export type ScrollDistance = "start" | "end" | number;
|
|
12
|
+
/**
|
|
13
|
+
* As ScrollDistance, plus 'page' to scroll vertically by the height of the
|
|
14
|
+
* viewport (as the PageUp and PageDown keys do).
|
|
15
|
+
*/
|
|
16
|
+
export type VerticalScrollDistance = ScrollDistance | "page";
|
|
17
|
+
export interface ScrollPosition {
|
|
18
|
+
scrollLeft: number;
|
|
19
|
+
scrollTop: number;
|
|
20
|
+
}
|
|
7
21
|
/**
|
|
8
22
|
* A Vuu Table. Rows are located by 1-based aria row index, which includes
|
|
9
23
|
* header rows (with one header, the first data row is 2).
|
|
@@ -39,6 +53,80 @@ export declare class PwTable extends PwComponent {
|
|
|
39
53
|
* });
|
|
40
54
|
*/
|
|
41
55
|
get scrollbarContainer(): Locator;
|
|
56
|
+
/**
|
|
57
|
+
* The scroll position of the scrollbar container.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* test("scrolled to top", async ({ page }) => {
|
|
61
|
+
* const table = new PwTable(page);
|
|
62
|
+
* expect((await table.scrollPosition()).scrollTop).toBe(0);
|
|
63
|
+
* });
|
|
64
|
+
*/
|
|
65
|
+
scrollPosition(): Promise<ScrollPosition>;
|
|
66
|
+
/**
|
|
67
|
+
* Scroll up, by a number of pixels, a page (the height of the viewport), or
|
|
68
|
+
* to the 'start' (top) or 'end' (bottom). Scrolls the scrollbar container,
|
|
69
|
+
* as a user dragging the scrollbar would, and resolves once the content
|
|
70
|
+
* container has been scrolled to match.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* test("scroll back to top", async ({ page }) => {
|
|
74
|
+
* const table = new PwTable(page);
|
|
75
|
+
* await table.scrollDown("page");
|
|
76
|
+
* await table.scrollUp("start");
|
|
77
|
+
* await expect(table.row(2)).toBeInViewport();
|
|
78
|
+
* });
|
|
79
|
+
*/
|
|
80
|
+
scrollUp(distance: VerticalScrollDistance): Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* Scroll down, by a number of pixels, a page (the height of the viewport),
|
|
83
|
+
* or to the 'start' (top) or 'end' (bottom). Scrolls the scrollbar
|
|
84
|
+
* container, as a user dragging the scrollbar would, and resolves once the
|
|
85
|
+
* content container has been scrolled to match.
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* test("scroll to last row", async ({ page }) => {
|
|
89
|
+
* const table = new PwTable(page);
|
|
90
|
+
* await table.scrollDown("end");
|
|
91
|
+
* await expect(table.row(1001)).toBeInViewport();
|
|
92
|
+
* });
|
|
93
|
+
*/
|
|
94
|
+
scrollDown(distance: VerticalScrollDistance): Promise<void>;
|
|
95
|
+
/**
|
|
96
|
+
* Scroll left, by a number of pixels, or to the 'start' (leftmost) or 'end'
|
|
97
|
+
* (rightmost). Scrolls the scrollbar container, as a user dragging the
|
|
98
|
+
* scrollbar would, and resolves once the content container has been
|
|
99
|
+
* scrolled to match.
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* test("scroll back to first column", async ({ page }) => {
|
|
103
|
+
* const table = new PwTable(page);
|
|
104
|
+
* await table.scrollRight("end");
|
|
105
|
+
* await table.scrollLeft("start");
|
|
106
|
+
* await expect(table.locateCell(2, 1)).toBeInViewport();
|
|
107
|
+
* });
|
|
108
|
+
*/
|
|
109
|
+
scrollLeft(distance: ScrollDistance): Promise<void>;
|
|
110
|
+
/**
|
|
111
|
+
* Scroll right, by a number of pixels, or to the 'start' (leftmost) or
|
|
112
|
+
* 'end' (rightmost). Scrolls the scrollbar container, as a user dragging the
|
|
113
|
+
* scrollbar would, and resolves once the content container has been
|
|
114
|
+
* scrolled to match.
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* test("scroll right by 200px", async ({ page }) => {
|
|
118
|
+
* const table = new PwTable(page);
|
|
119
|
+
* await table.scrollRight(200);
|
|
120
|
+
* expect((await table.scrollPosition()).scrollLeft).toBe(200);
|
|
121
|
+
* });
|
|
122
|
+
*/
|
|
123
|
+
scrollRight(distance: ScrollDistance): Promise<void>;
|
|
124
|
+
private scroll;
|
|
125
|
+
/**
|
|
126
|
+
* The table keeps the content container at the same proportional scroll
|
|
127
|
+
* position as the scrollbar container.
|
|
128
|
+
*/
|
|
129
|
+
private isContentScrollSynced;
|
|
42
130
|
/**
|
|
43
131
|
* Row Locator by 1-based aria row index, including headers.
|
|
44
132
|
*
|
|
@@ -89,6 +177,28 @@ export declare class PwTable extends PwComponent {
|
|
|
89
177
|
* });
|
|
90
178
|
*/
|
|
91
179
|
columnNames(): Promise<string[]>;
|
|
180
|
+
/**
|
|
181
|
+
* The names (not labels) of the columns in the table, from the
|
|
182
|
+
* data-column-name of the header cells, in rendered order.
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* test("renders expected columns", async ({ page }) => {
|
|
186
|
+
* const table = new PwTable(page);
|
|
187
|
+
* expect(await table.headerColumnNames()).toEqual(["ccy", "exchange"]);
|
|
188
|
+
* });
|
|
189
|
+
*/
|
|
190
|
+
headerColumnNames(): Promise<string[]>;
|
|
191
|
+
/**
|
|
192
|
+
* Assert the names (not labels) of the columns in the table, in order,
|
|
193
|
+
* retrying until the expect timeout.
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* test("column added", async ({ page }) => {
|
|
197
|
+
* const table = new PwTable(page);
|
|
198
|
+
* await table.assertColumns(["ccy", "exchange", "lotSize"]);
|
|
199
|
+
* });
|
|
200
|
+
*/
|
|
201
|
+
assertColumns(columnNames: string[]): Promise<void>;
|
|
92
202
|
/**
|
|
93
203
|
* The total row count, read from aria-rowcount on the element with role="table".
|
|
94
204
|
* This is the dataSource size, not the number of rendered rows.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Locator } from "@playwright/test";
|
|
2
|
+
import { PwColumnPicker } from "./PwColumnPicker";
|
|
3
|
+
import { PwComponent } from "./PwComponent";
|
|
4
|
+
/**
|
|
5
|
+
* A TableFooter, usually rendered below a Table. Holds DataSourceStats and
|
|
6
|
+
* a tray of actions, e.g. the ColumnPickerAction.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* test("footer shows column picker", async ({ page }) => {
|
|
10
|
+
* const footer = new PwTableFooter(page);
|
|
11
|
+
* const picker = await footer.showColumnPicker();
|
|
12
|
+
* await picker.assertVisible();
|
|
13
|
+
* });
|
|
14
|
+
*/
|
|
15
|
+
export declare class PwTableFooter extends PwComponent {
|
|
16
|
+
protected readonly defaultCssSelector = ".vuuTableFooter";
|
|
17
|
+
/**
|
|
18
|
+
* An action button in the footer, by accessible name.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* test("column picker action", async ({ page }) => {
|
|
22
|
+
* const footer = new PwTableFooter(page);
|
|
23
|
+
* await expect(footer.action("Show column picker")).toBeVisible();
|
|
24
|
+
* });
|
|
25
|
+
*/
|
|
26
|
+
action(name: string): Locator;
|
|
27
|
+
/**
|
|
28
|
+
* Click the ColumnPickerAction. Resolves with the ColumnPicker once it is
|
|
29
|
+
* visible.
|
|
30
|
+
*
|
|
31
|
+
* @param name accessible name of the action, if not the default
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* test("open column picker", async ({ page }) => {
|
|
35
|
+
* const picker = await new PwTableFooter(page).showColumnPicker();
|
|
36
|
+
* expect(await picker.selectedColumns()).toContain("bbg");
|
|
37
|
+
* });
|
|
38
|
+
*/
|
|
39
|
+
showColumnPicker(name?: string): Promise<PwColumnPicker>;
|
|
40
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Page } from "@playwright/test";
|
|
2
2
|
import { PwComponent, type PwComponentTarget } from "./PwComponent";
|
|
3
|
+
import { PwContextMenu } from "./PwContextMenu";
|
|
3
4
|
/**
|
|
4
5
|
* A Table column header cell. Usually obtained from PwTable.headerCell.
|
|
5
6
|
*
|
|
@@ -38,4 +39,17 @@ export declare class PwTableHeaderCell extends PwComponent {
|
|
|
38
39
|
* });
|
|
39
40
|
*/
|
|
40
41
|
assertSelected(): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Click the column menu button in the header cell. Resolves with the column
|
|
44
|
+
* menu once it is visible.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* test("remove column from column menu", async ({ page }) => {
|
|
48
|
+
* const table = new PwTable(page);
|
|
49
|
+
* const menu = await table.headerCell("exchange").showColumnMenu();
|
|
50
|
+
* await menu.menuItem("Remove exchange column").click();
|
|
51
|
+
* await table.assertColumns(["bbg", "currency"]);
|
|
52
|
+
* });
|
|
53
|
+
*/
|
|
54
|
+
showColumnMenu(): Promise<PwContextMenu>;
|
|
41
55
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export { PlaywrightPageObject } from "./PlaywrightPageObject";
|
|
2
2
|
export { PwChart } from "./PwChart";
|
|
3
3
|
export { type ChartDataPointInfo, PwChartDataPoint } from "./PwChartDataPoint";
|
|
4
|
+
export { PwColumnPicker } from "./PwColumnPicker";
|
|
4
5
|
export { PwComponent, type PwComponentTarget } from "./PwComponent";
|
|
5
6
|
export { PwContextMenu } from "./PwContextMenu";
|
|
6
7
|
export { PwMenuItem } from "./PwMenuItem";
|
|
7
|
-
export { PwTable } from "./PwTable";
|
|
8
|
+
export { PwTable, type ScrollDistance, type ScrollPosition, type VerticalScrollDistance, } from "./PwTable";
|
|
9
|
+
export { PwTableFooter } from "./PwTableFooter";
|
|
8
10
|
export { PwTableHeaderCell } from "./PwTableHeaderCell";
|