@tstdl/base 0.84.21 → 0.84.22
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.
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { ElementHandle, Frame, Page } from 'playwright';
|
|
1
|
+
import type { ElementHandle, Frame, FrameLocator, Page } from 'playwright';
|
|
2
2
|
import type { Delay } from './element-controller.js';
|
|
3
|
+
import { ElementController } from './element-controller.js';
|
|
3
4
|
import type { FrameController, FrameControllerOptions } from './frame-controller.js';
|
|
4
5
|
import { LocatorController } from './locator-controller.js';
|
|
5
6
|
import type { PageControllerOptions } from './page-controller.js';
|
|
@@ -11,16 +12,16 @@ export type DocumentControllerForwardOptions = {
|
|
|
11
12
|
pageControllerOptions: PageControllerOptions;
|
|
12
13
|
frameControllerOptions: FrameControllerOptions;
|
|
13
14
|
};
|
|
14
|
-
export declare class DocumentController extends LocatorController {
|
|
15
|
+
export declare class DocumentController<T extends Page | Frame = Page | Frame> extends LocatorController<T> {
|
|
15
16
|
protected readonly forwardOptions: DocumentControllerForwardOptions;
|
|
16
17
|
/** @deprecated should be avoided */
|
|
17
|
-
readonly document:
|
|
18
|
-
constructor(document:
|
|
18
|
+
readonly document: T;
|
|
19
|
+
constructor(document: T, options: DocumentControllerOptions, forwardOptions: DocumentControllerForwardOptions);
|
|
19
20
|
setContent(...args: Parameters<Page['setContent']>): Promise<void>;
|
|
20
21
|
navigate(...args: Parameters<Page['goto']>): Promise<void>;
|
|
21
22
|
waitForLoadState(...args: Parameters<Page['waitForLoadState']>): Promise<void>;
|
|
22
23
|
waitForUrl(...args: Parameters<Page['waitForURL']>): Promise<void>;
|
|
23
|
-
waitForElement(selector: string, options?: Parameters<Page['waitForSelector']>[1]): Promise<ElementHandle
|
|
24
|
-
locateInFrame(frameSelector: string): LocatorController
|
|
24
|
+
waitForElement(selector: string, options?: Parameters<Page['waitForSelector']>[1]): Promise<ElementController<ElementHandle<SVGElement | HTMLElement>>>;
|
|
25
|
+
locateInFrame(frameSelector: string): LocatorController<FrameLocator>;
|
|
25
26
|
waitForFrame(selector: string, options?: Parameters<Page['waitForSelector']>[1]): Promise<FrameController>;
|
|
26
27
|
}
|
|
@@ -32,6 +32,7 @@ __export(document_controller_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(document_controller_exports);
|
|
34
34
|
var import_type_guards = require("../utils/type-guards.js");
|
|
35
|
+
var import_element_controller = require("./element-controller.js");
|
|
35
36
|
var import_locator_controller = require("./locator-controller.js");
|
|
36
37
|
class DocumentController extends import_locator_controller.LocatorController {
|
|
37
38
|
forwardOptions;
|
|
@@ -59,7 +60,7 @@ class DocumentController extends import_locator_controller.LocatorController {
|
|
|
59
60
|
if ((0, import_type_guards.isNull)(element)) {
|
|
60
61
|
throw new Error("Element not found.");
|
|
61
62
|
}
|
|
62
|
-
return element;
|
|
63
|
+
return new import_element_controller.ElementController(element, this.elementControllerOptions);
|
|
63
64
|
}
|
|
64
65
|
locateInFrame(frameSelector) {
|
|
65
66
|
const locator = this.document.frameLocator(frameSelector);
|
|
@@ -67,7 +68,7 @@ class DocumentController extends import_locator_controller.LocatorController {
|
|
|
67
68
|
}
|
|
68
69
|
async waitForFrame(selector, options) {
|
|
69
70
|
const element = await this.waitForElement(selector, options);
|
|
70
|
-
const frame = await element.contentFrame();
|
|
71
|
+
const frame = await element.locatorOrHandle.contentFrame();
|
|
71
72
|
if ((0, import_type_guards.isNull)(frame)) {
|
|
72
73
|
throw new Error("Element is not a frame.");
|
|
73
74
|
}
|
|
@@ -16,10 +16,10 @@ export type ElementControllerOptions = {
|
|
|
16
16
|
typeDelay?: Delay;
|
|
17
17
|
};
|
|
18
18
|
type LocatorOptions<K extends keyof Locator, I extends keyof Parameters<Locator[K]>> = NonUndefinable<Parameters<Locator[K]>[I]>;
|
|
19
|
-
export declare class ElementController {
|
|
20
|
-
readonly locatorOrHandle:
|
|
19
|
+
export declare class ElementController<T extends Locator | ElementHandle = Locator | ElementHandle> {
|
|
20
|
+
readonly locatorOrHandle: T;
|
|
21
21
|
readonly options: ElementControllerOptions;
|
|
22
|
-
constructor(locatorOrHandle:
|
|
22
|
+
constructor(locatorOrHandle: T, options?: ElementControllerOptions);
|
|
23
23
|
waitFor(options?: Parameters<Locator['waitFor']>[0]): Promise<void>;
|
|
24
24
|
fill(text: string, options?: Merge<LocatorOptions<'fill', 1>, ActionDelayOptions>): Promise<void>;
|
|
25
25
|
type(text: string, options?: Merge<TypedOmit<LocatorOptions<'type', 1>, 'delay'>, ActionDelayOptions & TypeDelayOptions>): Promise<void>;
|
|
@@ -7,7 +7,7 @@ export type FrameControllerOptions = DocumentControllerOptions;
|
|
|
7
7
|
export type FrameControllerForwardOptions = {
|
|
8
8
|
pageControllerOptions: PageControllerOptions;
|
|
9
9
|
};
|
|
10
|
-
export declare class FrameController extends DocumentController {
|
|
10
|
+
export declare class FrameController extends DocumentController<Frame> {
|
|
11
11
|
private readonly frameControllerForwardOptions;
|
|
12
12
|
/** @deprecated should be avoided */
|
|
13
13
|
readonly frame: Frame;
|
|
@@ -2,15 +2,15 @@ import type { Frame, FrameLocator, Locator, Page } from 'playwright';
|
|
|
2
2
|
import type { NonUndefinable, SimplifyObject } from '../types.js';
|
|
3
3
|
import type { ElementControllerOptions } from './element-controller.js';
|
|
4
4
|
import { ElementController } from './element-controller.js';
|
|
5
|
-
export declare class LocatorController {
|
|
5
|
+
export declare class LocatorController<T extends Page | Frame | Locator | FrameLocator = Page | Frame | Locator | FrameLocator> {
|
|
6
6
|
protected readonly elementControllerOptions: ElementControllerOptions;
|
|
7
|
-
readonly locatable:
|
|
8
|
-
constructor(locatable:
|
|
9
|
-
getBySelector(selector: string, options?: SimplifyObject<Pick<NonUndefinable<Parameters<Page['locator']>[1]>, 'hasText' | 'hasNotText'>>): ElementController
|
|
10
|
-
getByRole(role: Parameters<Page['getByRole']>[0], options?: Parameters<Page['getByRole']>[1]): ElementController
|
|
11
|
-
getByLabel(text: Parameters<Page['getByLabel']>[0], options?: Parameters<Page['getByLabel']>[1]): ElementController
|
|
12
|
-
getByAltText(text: Parameters<Page['getByAltText']>[0], options?: Parameters<Page['getByAltText']>[1]): ElementController
|
|
13
|
-
getByPlaceholder(text: Parameters<Page['getByPlaceholder']>[0], options?: Parameters<Page['getByPlaceholder']>[1]): ElementController
|
|
14
|
-
getByText(text: Parameters<Page['getByText']>[0], options?: Parameters<Page['getByText']>[1]): ElementController
|
|
15
|
-
getByTitle(text: Parameters<Page['getByTitle']>[0], options?: Parameters<Page['getByTitle']>[1]): ElementController
|
|
7
|
+
readonly locatable: T;
|
|
8
|
+
constructor(locatable: T, elementControllerOptions: ElementControllerOptions);
|
|
9
|
+
getBySelector(selector: string, options?: SimplifyObject<Pick<NonUndefinable<Parameters<Page['locator']>[1]>, 'hasText' | 'hasNotText'>>): ElementController<Locator>;
|
|
10
|
+
getByRole(role: Parameters<Page['getByRole']>[0], options?: Parameters<Page['getByRole']>[1]): ElementController<Locator>;
|
|
11
|
+
getByLabel(text: Parameters<Page['getByLabel']>[0], options?: Parameters<Page['getByLabel']>[1]): ElementController<Locator>;
|
|
12
|
+
getByAltText(text: Parameters<Page['getByAltText']>[0], options?: Parameters<Page['getByAltText']>[1]): ElementController<Locator>;
|
|
13
|
+
getByPlaceholder(text: Parameters<Page['getByPlaceholder']>[0], options?: Parameters<Page['getByPlaceholder']>[1]): ElementController<Locator>;
|
|
14
|
+
getByText(text: Parameters<Page['getByText']>[0], options?: Parameters<Page['getByText']>[1]): ElementController<Locator>;
|
|
15
|
+
getByTitle(text: Parameters<Page['getByTitle']>[0], options?: Parameters<Page['getByTitle']>[1]): ElementController<Locator>;
|
|
16
16
|
}
|
|
@@ -10,7 +10,7 @@ import type { Abortable } from './types.js';
|
|
|
10
10
|
export type PageControllerOptions = DocumentControllerOptions & {
|
|
11
11
|
defaultFrameControllerOptions?: FrameControllerOptions;
|
|
12
12
|
};
|
|
13
|
-
export declare class PageController extends DocumentController implements AsyncDisposable {
|
|
13
|
+
export declare class PageController extends DocumentController<Page> implements AsyncDisposable {
|
|
14
14
|
/** @deprecated should be avoided */
|
|
15
15
|
readonly page: Page;
|
|
16
16
|
readonly options: PageControllerOptions;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tstdl/base",
|
|
3
|
-
"version": "0.84.
|
|
3
|
+
"version": "0.84.22",
|
|
4
4
|
"author": "Patrick Hein",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@types/chroma-js": "2.4",
|
|
30
30
|
"@types/koa__router": "12.0",
|
|
31
31
|
"@types/luxon": "3.3",
|
|
32
|
-
"@types/minio": "7.
|
|
32
|
+
"@types/minio": "7.1",
|
|
33
33
|
"@types/mjml": "4.7",
|
|
34
34
|
"@types/node": "20",
|
|
35
35
|
"@types/nodemailer": "6.4",
|