@tstdl/base 0.84.25 → 0.84.26
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/application/application.js +4 -1
- package/browser/browser-context-controller.d.ts +1 -0
- package/browser/browser-context-controller.js +13 -0
- package/browser/element-controller.d.ts +21 -1
- package/browser/element-controller.js +42 -2
- package/browser/utils.d.ts +3 -1
- package/browser/utils.js +8 -0
- package/http/server/node/node-http-server.d.ts +1 -1
- package/http/server/node/node-http-server.js +1 -1
- package/package.json +9 -9
- package/utils/iterable-helpers/assert.d.ts +1 -1
|
@@ -53,7 +53,10 @@ var __param = function(paramIndex, decorator) {
|
|
|
53
53
|
};
|
|
54
54
|
var Application_1;
|
|
55
55
|
(0, import_process_shutdown.initializeSignals)();
|
|
56
|
-
let Application =
|
|
56
|
+
let Application = class Application2 {
|
|
57
|
+
static {
|
|
58
|
+
Application_1 = this;
|
|
59
|
+
}
|
|
57
60
|
static _instance;
|
|
58
61
|
static get instance() {
|
|
59
62
|
if ((0, import_type_guards.isUndefined)(this._instance)) {
|
|
@@ -28,5 +28,6 @@ export declare class BrowserContextController implements AsyncDisposable, Inject
|
|
|
28
28
|
getState(): Promise<BrowserContextState>;
|
|
29
29
|
setExtraHttpHeaders(headers: Record<string, string | undefined>): Promise<void>;
|
|
30
30
|
newPage(options?: NewPageOptions): Promise<PageController>;
|
|
31
|
+
waitForNoPages(): Promise<void>;
|
|
31
32
|
waitForClose(): Promise<void>;
|
|
32
33
|
}
|
|
@@ -73,6 +73,19 @@ let BrowserContextController = class BrowserContextController2 {
|
|
|
73
73
|
}
|
|
74
74
|
return controller;
|
|
75
75
|
}
|
|
76
|
+
async waitForNoPages() {
|
|
77
|
+
while (true) {
|
|
78
|
+
const pages = this.context.pages();
|
|
79
|
+
if (pages.length == 0) {
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
for (const page of pages) {
|
|
83
|
+
if (!page.isClosed()) {
|
|
84
|
+
await new Promise((resolve) => page.once("close", () => resolve()));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
76
89
|
async waitForClose() {
|
|
77
90
|
return new Promise((resolve) => this.context.once("close", () => resolve()));
|
|
78
91
|
}
|
|
@@ -20,7 +20,27 @@ export declare class ElementController<T extends Locator | ElementHandle = Locat
|
|
|
20
20
|
readonly locatorOrHandle: T;
|
|
21
21
|
readonly options: ElementControllerOptions;
|
|
22
22
|
constructor(locatorOrHandle: T, options?: ElementControllerOptions);
|
|
23
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Wait for element state
|
|
25
|
+
* @param state some states may only be usable for either locator or handle
|
|
26
|
+
* @param options options
|
|
27
|
+
*/
|
|
28
|
+
waitFor(state?: Parameters<ElementHandle['waitForElementState']>[0] | NonNullable<LocatorOptions<'waitFor', '0'>['state']>, options?: Parameters<ElementHandle['waitForElementState']>[1]): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Check if element exists
|
|
31
|
+
* @param options.state which state is required in order to be deemed existing
|
|
32
|
+
* @param options.timeout how long to wait for the element before being deemed not existing (default: 250ms)
|
|
33
|
+
*/
|
|
34
|
+
exists(options?: {
|
|
35
|
+
state?: 'visible' | 'attached';
|
|
36
|
+
timeout?: number;
|
|
37
|
+
}): Promise<boolean>;
|
|
38
|
+
isVisible(): Promise<boolean>;
|
|
39
|
+
isHidden(): Promise<boolean>;
|
|
40
|
+
isEnabled(): Promise<boolean>;
|
|
41
|
+
isDisabled(): Promise<boolean>;
|
|
42
|
+
isChecked(): Promise<boolean>;
|
|
43
|
+
isEditable(): Promise<boolean>;
|
|
24
44
|
fill(text: string, options?: Merge<LocatorOptions<'fill', 1>, ActionDelayOptions>): Promise<void>;
|
|
25
45
|
type(text: string, options?: Merge<TypedOmit<LocatorOptions<'type', 1>, 'delay'>, ActionDelayOptions & TypeDelayOptions>): Promise<void>;
|
|
26
46
|
selectOption(value: string | string[], options?: Merge<LocatorOptions<'selectOption', 1>, ActionDelayOptions>): Promise<void>;
|
|
@@ -24,6 +24,7 @@ module.exports = __toCommonJS(element_controller_exports);
|
|
|
24
24
|
var import_timing = require("../utils/timing.js");
|
|
25
25
|
var import_type_guards = require("../utils/type-guards.js");
|
|
26
26
|
var import_value_or_provider = require("../utils/value-or-provider.js");
|
|
27
|
+
var import_utils = require("./utils.js");
|
|
27
28
|
class ElementController {
|
|
28
29
|
locatorOrHandle;
|
|
29
30
|
options;
|
|
@@ -31,8 +32,47 @@ class ElementController {
|
|
|
31
32
|
this.locatorOrHandle = locatorOrHandle;
|
|
32
33
|
this.options = options;
|
|
33
34
|
}
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Wait for element state
|
|
37
|
+
* @param state some states may only be usable for either locator or handle
|
|
38
|
+
* @param options options
|
|
39
|
+
*/
|
|
40
|
+
async waitFor(state = "visible", options) {
|
|
41
|
+
if ((0, import_utils.isLocator)(this.locatorOrHandle)) {
|
|
42
|
+
return this.locatorOrHandle.waitFor({ state, ...options });
|
|
43
|
+
}
|
|
44
|
+
return this.locatorOrHandle.waitForElementState(state, options);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Check if element exists
|
|
48
|
+
* @param options.state which state is required in order to be deemed existing
|
|
49
|
+
* @param options.timeout how long to wait for the element before being deemed not existing (default: 250ms)
|
|
50
|
+
*/
|
|
51
|
+
async exists(options) {
|
|
52
|
+
try {
|
|
53
|
+
await this.waitFor(options?.state ?? "visible", { timeout: options?.timeout ?? 250 });
|
|
54
|
+
return true;
|
|
55
|
+
} catch {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
async isVisible() {
|
|
60
|
+
return this.locatorOrHandle.isVisible();
|
|
61
|
+
}
|
|
62
|
+
async isHidden() {
|
|
63
|
+
return this.locatorOrHandle.isHidden();
|
|
64
|
+
}
|
|
65
|
+
async isEnabled() {
|
|
66
|
+
return this.locatorOrHandle.isEnabled();
|
|
67
|
+
}
|
|
68
|
+
async isDisabled() {
|
|
69
|
+
return this.locatorOrHandle.isDisabled();
|
|
70
|
+
}
|
|
71
|
+
async isChecked() {
|
|
72
|
+
return this.locatorOrHandle.isChecked();
|
|
73
|
+
}
|
|
74
|
+
async isEditable() {
|
|
75
|
+
return this.locatorOrHandle.isEditable();
|
|
36
76
|
}
|
|
37
77
|
async fill(text, options) {
|
|
38
78
|
await this.prepareAction(options);
|
package/browser/utils.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import type { LaunchOptions } from 'playwright';
|
|
1
|
+
import type { ElementHandle, LaunchOptions, Locator } from 'playwright';
|
|
2
2
|
import type { NewBrowserContextOptions } from './browser-controller.js';
|
|
3
3
|
import type { NewBrowserOptions } from './browser.service.js';
|
|
4
4
|
export declare function getLaunchOptions(options: NewBrowserOptions): LaunchOptions;
|
|
5
5
|
export declare function mergeNewBrowserContextOptions(a: NewBrowserContextOptions | undefined, b?: NewBrowserContextOptions, c?: NewBrowserContextOptions): NewBrowserContextOptions;
|
|
6
|
+
export declare function isLocator(locatorOrHandle: Locator | ElementHandle): locatorOrHandle is Locator;
|
|
7
|
+
export declare function isElementHandle(locatorOrHandle: Locator | ElementHandle): locatorOrHandle is Locator;
|
package/browser/utils.js
CHANGED
|
@@ -19,6 +19,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
var utils_exports = {};
|
|
20
20
|
__export(utils_exports, {
|
|
21
21
|
getLaunchOptions: () => getLaunchOptions,
|
|
22
|
+
isElementHandle: () => isElementHandle,
|
|
23
|
+
isLocator: () => isLocator,
|
|
22
24
|
mergeNewBrowserContextOptions: () => mergeNewBrowserContextOptions
|
|
23
25
|
});
|
|
24
26
|
module.exports = __toCommonJS(utils_exports);
|
|
@@ -45,3 +47,9 @@ function mergeNewBrowserContextOptions(a, b, c) {
|
|
|
45
47
|
extraHttpHeaders: (0, import_object.objectKeys)(mergedExtraHttpHeaders).length > 0 ? mergedExtraHttpHeaders : void 0
|
|
46
48
|
};
|
|
47
49
|
}
|
|
50
|
+
function isLocator(locatorOrHandle) {
|
|
51
|
+
return (0, import_object.hasOwnProperty)(locatorOrHandle, "count");
|
|
52
|
+
}
|
|
53
|
+
function isElementHandle(locatorOrHandle) {
|
|
54
|
+
return (0, import_object.hasOwnProperty)(locatorOrHandle, "asElement");
|
|
55
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
import * as Http from 'node:http';
|
|
2
3
|
import type { AfterResolve } from '../../../container/index.js';
|
|
3
4
|
import { afterResolve } from '../../../container/index.js';
|
|
4
5
|
import type { AsyncDisposable } from '../../../disposable/index.js';
|
|
5
6
|
import { disposeAsync } from '../../../disposable/index.js';
|
|
6
7
|
import { Logger } from '../../../logger/index.js';
|
|
7
|
-
import * as Http from 'node:http';
|
|
8
8
|
import type { HttpServerRequestContext } from '../http-server.js';
|
|
9
9
|
import { HttpServer } from '../http-server.js';
|
|
10
10
|
export type NodeHttpServerContext = {
|
|
@@ -31,6 +31,7 @@ __export(node_http_server_exports, {
|
|
|
31
31
|
NodeHttpServer: () => NodeHttpServer
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(node_http_server_exports);
|
|
34
|
+
var Http = __toESM(require("node:http"), 1);
|
|
34
35
|
var import_container = require("../../../container/index.js");
|
|
35
36
|
var import_core = require("../../../core.js");
|
|
36
37
|
var import_disposable = require("../../../disposable/index.js");
|
|
@@ -44,7 +45,6 @@ var import_readable_stream_adapter = require("../../../utils/stream/readable-str
|
|
|
44
45
|
var import_timer = require("../../../utils/timer.js");
|
|
45
46
|
var import_timing = require("../../../utils/timing.js");
|
|
46
47
|
var import_type_guards = require("../../../utils/type-guards.js");
|
|
47
|
-
var Http = __toESM(require("node:http"), 1);
|
|
48
48
|
var import_rxjs = require("rxjs");
|
|
49
49
|
var import_http_server_request = require("../http-server-request.js");
|
|
50
50
|
var import_http_server = require("../http-server.js");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tstdl/base",
|
|
3
|
-
"version": "0.84.
|
|
3
|
+
"version": "0.84.26",
|
|
4
4
|
"author": "Patrick Hein",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
"@types/nodemailer": "6.4",
|
|
36
36
|
"@typescript-eslint/eslint-plugin": "5.59",
|
|
37
37
|
"@typescript-eslint/parser": "5.59",
|
|
38
|
-
"concurrently": "8.
|
|
39
|
-
"esbuild": "0.
|
|
40
|
-
"eslint": "8.
|
|
38
|
+
"concurrently": "8.2",
|
|
39
|
+
"esbuild": "0.18",
|
|
40
|
+
"eslint": "8.42",
|
|
41
41
|
"eslint-import-resolver-typescript": "3.5",
|
|
42
42
|
"eslint-plugin-import": "2.27",
|
|
43
43
|
"tsc-alias": "1.8",
|
|
44
44
|
"typedoc": "0.24",
|
|
45
|
-
"typescript": "5.
|
|
45
|
+
"typescript": "5.1"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"@elastic/elasticsearch": "^8.8",
|
|
@@ -58,13 +58,13 @@
|
|
|
58
58
|
"koa": "^2.14",
|
|
59
59
|
"minio": "^7.1",
|
|
60
60
|
"mjml": "^4.14",
|
|
61
|
-
"mongodb": "^5.
|
|
61
|
+
"mongodb": "^5.6",
|
|
62
62
|
"nodemailer": "^6.9",
|
|
63
|
-
"playwright": "^1.
|
|
63
|
+
"playwright": "^1.35",
|
|
64
64
|
"preact": "^10.15",
|
|
65
|
-
"preact-render-to-string": "^6.
|
|
65
|
+
"preact-render-to-string": "^6.1",
|
|
66
66
|
"undici": "^5.22",
|
|
67
|
-
"urlpattern-polyfill": "^
|
|
67
|
+
"urlpattern-polyfill": "^9.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependenciesMeta": {
|
|
70
70
|
"@tstdl/angular": {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Predicate, TypePredicate } from './types.js';
|
|
2
|
-
export declare function assert<T, TPredicate extends T = T>(iterable: Iterable<T>, predicate:
|
|
2
|
+
export declare function assert<T, TPredicate extends T = T>(iterable: Iterable<T>, predicate: TypePredicate<T, TPredicate> | Predicate<T>): IterableIterator<TPredicate>;
|