hass-taste-test 0.1.0 → 0.2.0
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/lib/index.js +5 -1
- package/lib/integrations/playwright.d.ts +3 -2
- package/lib/integrations/playwright.js +5 -2
- package/lib/types.d.ts +2 -2
- package/package.json +19 -18
package/lib/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { ElementHandle, Page, LaunchOptions } from 'playwright';
|
|
2
|
+
import { Browser, ElementHandle, Page, LaunchOptions, BrowserContext } from 'playwright';
|
|
3
3
|
import { BrowserIntegration, BrowserPage, DashboardOptions, DiffOptions } from '../types';
|
|
4
|
-
export
|
|
4
|
+
export type PlaywrightElement = ElementHandle<Node>;
|
|
5
5
|
export declare class PlaywrightBrowser implements BrowserIntegration<PlaywrightElement> {
|
|
6
6
|
private static browsers;
|
|
7
7
|
private browserName;
|
|
8
8
|
private browserPromise;
|
|
9
9
|
constructor(browserName: string, options?: LaunchOptions);
|
|
10
|
+
newPage(browser: Browser | BrowserContext): Promise<Page>;
|
|
10
11
|
open(url: string, options: DashboardOptions): Promise<PlaywrightPage>;
|
|
11
12
|
openInHeaded(url: string): Promise<void>;
|
|
12
13
|
close(): Promise<void>;
|
|
@@ -14,6 +14,9 @@ class PlaywrightBrowser {
|
|
|
14
14
|
this.browserName = browserName;
|
|
15
15
|
this.browserPromise = PlaywrightBrowser.browsers[browserName].launch(options);
|
|
16
16
|
}
|
|
17
|
+
async newPage(browser) {
|
|
18
|
+
return await browser.newPage();
|
|
19
|
+
}
|
|
17
20
|
async open(url, options) {
|
|
18
21
|
let browser = await this.browserPromise;
|
|
19
22
|
if (options) {
|
|
@@ -21,7 +24,7 @@ class PlaywrightBrowser {
|
|
|
21
24
|
colorScheme: options.colorScheme,
|
|
22
25
|
});
|
|
23
26
|
}
|
|
24
|
-
const page = await
|
|
27
|
+
const page = await this.newPage(browser);
|
|
25
28
|
await page.goto(url);
|
|
26
29
|
return new PlaywrightPage(page);
|
|
27
30
|
}
|
|
@@ -29,7 +32,7 @@ class PlaywrightBrowser {
|
|
|
29
32
|
const browser = await PlaywrightBrowser.browsers[this.browserName].launch({
|
|
30
33
|
headless: false,
|
|
31
34
|
});
|
|
32
|
-
const page = await
|
|
35
|
+
const page = await this.newPage(browser);
|
|
33
36
|
await page.goto(url);
|
|
34
37
|
await page.waitForEvent('close', { timeout: 0 });
|
|
35
38
|
}
|
package/lib/types.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export interface DiffOptions {
|
|
|
21
21
|
/** whether to strip attributes from Lit & Polymer with undefined values */
|
|
22
22
|
stripUndefinedAttributes: boolean;
|
|
23
23
|
}
|
|
24
|
-
export
|
|
24
|
+
export type DashboardOptions = Partial<{
|
|
25
25
|
colorScheme: 'light' | 'dark' | 'no-preference';
|
|
26
26
|
}>;
|
|
27
27
|
export interface BrowserIntegration<E> {
|
|
@@ -36,7 +36,7 @@ export interface BrowserPage<E> {
|
|
|
36
36
|
screenshot(element: E): Promise<Buffer>;
|
|
37
37
|
find(element: E, selector: string): Promise<E | null | undefined>;
|
|
38
38
|
}
|
|
39
|
-
export
|
|
39
|
+
export type LovelaceResourceType = 'css' | 'js' | 'module' | 'html';
|
|
40
40
|
export interface LovelaceDashboardMutableParams {
|
|
41
41
|
require_admin: boolean;
|
|
42
42
|
show_in_sidebar: boolean;
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hass-taste-test",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Integration testing for Home Assistant cards",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "jest && ava",
|
|
8
8
|
"prepare": "husky install",
|
|
9
|
-
"
|
|
9
|
+
"prepublishOnly": "tsc"
|
|
10
10
|
},
|
|
11
11
|
"bin": {
|
|
12
12
|
"hass-taste-test": "lib/bin.js"
|
|
@@ -15,26 +15,27 @@
|
|
|
15
15
|
"homepage": "https://github.com/rianadon/hass-taste-test#readme",
|
|
16
16
|
"license": "AGPL-3.0-or-later",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"home-assistant-js-websocket": "^
|
|
18
|
+
"home-assistant-js-websocket": "^8.0.1",
|
|
19
19
|
"node-fetch": "^2.6.1",
|
|
20
|
-
"proper-lockfile": "^4.1.2"
|
|
20
|
+
"proper-lockfile": "^4.1.2",
|
|
21
|
+
"ws": "^8.11.0"
|
|
21
22
|
},
|
|
22
23
|
"devDependencies": {
|
|
23
|
-
"@types/jest": "^
|
|
24
|
-
"@types/jest-image-snapshot": "^
|
|
25
|
-
"@types/node-fetch": "^2.
|
|
24
|
+
"@types/jest": "^29.2.4",
|
|
25
|
+
"@types/jest-image-snapshot": "^6.1.0",
|
|
26
|
+
"@types/node-fetch": "^2.6.2",
|
|
26
27
|
"@types/proper-lockfile": "^4.1.2",
|
|
27
|
-
"@types/ws": "^8.
|
|
28
|
-
"ava": "^
|
|
29
|
-
"husky": "^
|
|
30
|
-
"jest": "^
|
|
31
|
-
"jest-image-snapshot": "^
|
|
32
|
-
"lint-staged": "^
|
|
33
|
-
"playwright": "^1.
|
|
34
|
-
"prettier": "^2.
|
|
35
|
-
"ts-jest": "^
|
|
36
|
-
"ts-node": "^10.
|
|
37
|
-
"typescript": "^4.4
|
|
28
|
+
"@types/ws": "^8.5.3",
|
|
29
|
+
"ava": "^5.1.0",
|
|
30
|
+
"husky": "^8.0.2",
|
|
31
|
+
"jest": "^29.3.1",
|
|
32
|
+
"jest-image-snapshot": "^6.1.0",
|
|
33
|
+
"lint-staged": "^13.1.0",
|
|
34
|
+
"playwright": "^1.29.0",
|
|
35
|
+
"prettier": "^2.8.1",
|
|
36
|
+
"ts-jest": "^29.0.3",
|
|
37
|
+
"ts-node": "^10.9.1",
|
|
38
|
+
"typescript": "^4.9.4"
|
|
38
39
|
},
|
|
39
40
|
"prettier": {
|
|
40
41
|
"printWidth": 100,
|