@rickcedwhat/playwright-smart-table 2.3.0 → 2.3.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/dist/useTable.d.ts +7 -21
- package/dist/useTable.js +3 -33
- package/package.json +1 -1
package/dist/useTable.d.ts
CHANGED
|
@@ -1,34 +1,20 @@
|
|
|
1
1
|
import type { Locator } from '@playwright/test';
|
|
2
|
-
import { TableConfig,
|
|
2
|
+
import { TableConfig, Selector, TableResult } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* A collection of pre-built pagination strategies.
|
|
5
5
|
*/
|
|
6
6
|
export declare const PaginationStrategies: {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*/
|
|
11
|
-
NextButton: (selector: string) => ((context: TableContext) => Promise<boolean>);
|
|
12
|
-
/**
|
|
13
|
-
* Clicks numbered page links.
|
|
14
|
-
* @param selector - The CSS selector for the page number links.
|
|
15
|
-
*/
|
|
16
|
-
NumberedPages: (selector: string) => ((context: TableContext) => Promise<boolean>);
|
|
7
|
+
clickNext: (nextButtonSelector: Selector, timeout?: number) => import("./types").PaginationStrategy;
|
|
8
|
+
clickLoadMore: (buttonSelector: Selector, timeout?: number) => import("./types").PaginationStrategy;
|
|
9
|
+
infiniteScroll: (timeout?: number) => import("./types").PaginationStrategy;
|
|
17
10
|
};
|
|
18
11
|
/**
|
|
19
12
|
* @deprecated Use `PaginationStrategies` instead. This alias will be removed in a future major version.
|
|
20
13
|
*/
|
|
21
14
|
export declare const TableStrategies: {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
*/
|
|
26
|
-
NextButton: (selector: string) => ((context: TableContext) => Promise<boolean>);
|
|
27
|
-
/**
|
|
28
|
-
* Clicks numbered page links.
|
|
29
|
-
* @param selector - The CSS selector for the page number links.
|
|
30
|
-
*/
|
|
31
|
-
NumberedPages: (selector: string) => ((context: TableContext) => Promise<boolean>);
|
|
15
|
+
clickNext: (nextButtonSelector: Selector, timeout?: number) => import("./types").PaginationStrategy;
|
|
16
|
+
clickLoadMore: (buttonSelector: Selector, timeout?: number) => import("./types").PaginationStrategy;
|
|
17
|
+
infiniteScroll: (timeout?: number) => import("./types").PaginationStrategy;
|
|
32
18
|
};
|
|
33
19
|
/**
|
|
34
20
|
* A collection of pre-built sorting strategies.
|
package/dist/useTable.js
CHANGED
|
@@ -12,45 +12,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.useTable = exports.SortingStrategies = exports.TableStrategies = exports.PaginationStrategies = void 0;
|
|
13
13
|
const typeContext_1 = require("./typeContext");
|
|
14
14
|
const sorting_1 = require("./strategies/sorting");
|
|
15
|
+
const pagination_1 = require("./strategies/pagination");
|
|
15
16
|
/**
|
|
16
17
|
* A collection of pre-built pagination strategies.
|
|
17
18
|
*/
|
|
18
|
-
exports.PaginationStrategies =
|
|
19
|
-
/**
|
|
20
|
-
* Clicks a "Next" button.
|
|
21
|
-
* @param selector - The CSS selector for the "Next" button.
|
|
22
|
-
*/
|
|
23
|
-
NextButton: (selector) => {
|
|
24
|
-
return (_a) => __awaiter(void 0, [_a], void 0, function* ({ root }) {
|
|
25
|
-
const nextButton = root.locator(selector);
|
|
26
|
-
if ((yield nextButton.isVisible()) && (yield nextButton.isEnabled())) {
|
|
27
|
-
yield nextButton.click();
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
|
-
return false;
|
|
31
|
-
});
|
|
32
|
-
},
|
|
33
|
-
/**
|
|
34
|
-
* Clicks numbered page links.
|
|
35
|
-
* @param selector - The CSS selector for the page number links.
|
|
36
|
-
*/
|
|
37
|
-
NumberedPages: (selector) => {
|
|
38
|
-
let currentPage = 1;
|
|
39
|
-
return (_a) => __awaiter(void 0, [_a], void 0, function* ({ root }) {
|
|
40
|
-
currentPage++;
|
|
41
|
-
const pageLink = root.locator(selector).filter({ hasText: String(currentPage) });
|
|
42
|
-
if (yield pageLink.isVisible()) {
|
|
43
|
-
yield pageLink.click();
|
|
44
|
-
return true;
|
|
45
|
-
}
|
|
46
|
-
return false;
|
|
47
|
-
});
|
|
48
|
-
},
|
|
49
|
-
};
|
|
19
|
+
exports.PaginationStrategies = pagination_1.PaginationStrategies;
|
|
50
20
|
/**
|
|
51
21
|
* @deprecated Use `PaginationStrategies` instead. This alias will be removed in a future major version.
|
|
52
22
|
*/
|
|
53
|
-
exports.TableStrategies =
|
|
23
|
+
exports.TableStrategies = pagination_1.TableStrategies;
|
|
54
24
|
/**
|
|
55
25
|
* A collection of pre-built sorting strategies.
|
|
56
26
|
*/
|
package/package.json
CHANGED