@telefonica/acceptance-testing 2.23.1 → 3.0.0-beta0
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/__tests__/utils.test.d.ts +1 -0
- package/dist/acceptance-testing.cjs.development.js +31 -24
- package/dist/acceptance-testing.cjs.development.js.map +1 -1
- package/dist/acceptance-testing.cjs.production.min.js +1 -1
- package/dist/acceptance-testing.cjs.production.min.js.map +1 -1
- package/dist/acceptance-testing.esm.js +31 -24
- package/dist/acceptance-testing.esm.js.map +1 -1
- package/dist/coverage.d.ts +8 -8
- package/dist/index.d.ts +92 -91
- package/dist/utils.d.ts +4 -4
- package/docker-compose.yaml +1 -1
- package/package.json +5 -5
package/dist/coverage.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export declare const getRootPath: () => any;
|
|
2
|
-
/**
|
|
3
|
-
* Asumes the code was instrumented with istanbul and the coverage report stored in `window.__coverage__`.
|
|
4
|
-
* If not, this function does nothing.
|
|
5
|
-
*/
|
|
6
|
-
export declare const collectCoverageIfAvailable: ({ coveragePath }: {
|
|
7
|
-
coveragePath: string;
|
|
8
|
-
}) => Promise<void>;
|
|
1
|
+
export declare const getRootPath: () => any;
|
|
2
|
+
/**
|
|
3
|
+
* Asumes the code was instrumented with istanbul and the coverage report stored in `window.__coverage__`.
|
|
4
|
+
* If not, this function does nothing.
|
|
5
|
+
*/
|
|
6
|
+
export declare const collectCoverageIfAvailable: ({ coveragePath }: {
|
|
7
|
+
coveragePath: string;
|
|
8
|
+
}) => Promise<void>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,91 +1,92 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="jest" />
|
|
3
|
-
/// <reference types="jest
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
declare
|
|
23
|
-
|
|
24
|
-
declare
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
export declare const
|
|
74
|
-
export declare const
|
|
75
|
-
export declare const
|
|
76
|
-
export
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
export declare const
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="jest" />
|
|
3
|
+
/// <reference types="jest" />
|
|
4
|
+
/// <reference types="jest-image-snapshot" />
|
|
5
|
+
import type { Browser, ClickOptions, ElementHandle, HTTPRequest, Page, ResponseForRequest, ScreenshotOptions, Viewport } from 'puppeteer';
|
|
6
|
+
type CustomScreenshotOptions = ScreenshotOptions & {
|
|
7
|
+
skipNetworkWait?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const getGlobalBrowser: () => Browser;
|
|
10
|
+
export declare const getGlobalPage: () => Page;
|
|
11
|
+
export declare const serverHostName: string;
|
|
12
|
+
export declare const serverPort: any;
|
|
13
|
+
export interface PageApi extends Omit<Page, 'click' | 'type' | 'select' | 'screenshot'> {
|
|
14
|
+
clear: (selector: ElementHandle) => Promise<void>;
|
|
15
|
+
type: (selector: ElementHandle, text: string, options?: {
|
|
16
|
+
delay: number;
|
|
17
|
+
}) => Promise<void>;
|
|
18
|
+
click: (selector: ElementHandle, options?: ClickOptions) => Promise<void>;
|
|
19
|
+
select: (selector: ElementHandle, ...values: string[]) => Promise<string[]>;
|
|
20
|
+
screenshot: (options?: CustomScreenshotOptions) => Promise<Buffer>;
|
|
21
|
+
}
|
|
22
|
+
export declare const getPageApi: (page: Page) => PageApi;
|
|
23
|
+
type RequestMatcherFn = (req: HTTPRequest) => boolean;
|
|
24
|
+
export declare const interceptRequest: (matcher: RequestMatcherFn) => jest.Mock<Partial<ResponseForRequest>, [HTTPRequest]>;
|
|
25
|
+
type ApiEndpointMock = {
|
|
26
|
+
spyOn(path: string, method?: string): jest.Mock<unknown, [HTTPRequest]>;
|
|
27
|
+
};
|
|
28
|
+
export declare const createApiEndpointMock: ({ origin, baseUrl, }?: {
|
|
29
|
+
origin?: string;
|
|
30
|
+
/** @deprecated use origin */
|
|
31
|
+
baseUrl?: string;
|
|
32
|
+
}) => ApiEndpointMock;
|
|
33
|
+
type CookieConfig = {
|
|
34
|
+
name: string;
|
|
35
|
+
value: string;
|
|
36
|
+
url?: string;
|
|
37
|
+
domain?: string;
|
|
38
|
+
path?: string;
|
|
39
|
+
secure?: boolean;
|
|
40
|
+
httpOnly?: boolean;
|
|
41
|
+
sameSite?: 'Strict' | 'Lax' | 'None';
|
|
42
|
+
expires?: number;
|
|
43
|
+
priority?: 'Low' | 'Medium' | 'High';
|
|
44
|
+
sameParty?: boolean;
|
|
45
|
+
sourceScheme?: 'Unset' | 'NonSecure' | 'Secure';
|
|
46
|
+
sourcePort?: number;
|
|
47
|
+
};
|
|
48
|
+
export interface TestViewport extends Viewport {
|
|
49
|
+
safeAreaInset?: {
|
|
50
|
+
top?: number | string;
|
|
51
|
+
right?: number | string;
|
|
52
|
+
bottom?: number | string;
|
|
53
|
+
left?: number | string;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
interface OpenPageCommonConfig {
|
|
57
|
+
userAgent?: string;
|
|
58
|
+
viewport?: TestViewport;
|
|
59
|
+
isDarkMode?: boolean;
|
|
60
|
+
cookies?: Array<CookieConfig>;
|
|
61
|
+
}
|
|
62
|
+
interface OpenPageUrlConfig extends OpenPageCommonConfig {
|
|
63
|
+
url: string;
|
|
64
|
+
}
|
|
65
|
+
interface OpenPagePathConfig extends OpenPageCommonConfig {
|
|
66
|
+
url?: undefined;
|
|
67
|
+
path?: string;
|
|
68
|
+
port?: number;
|
|
69
|
+
protocol?: string;
|
|
70
|
+
hostname?: string;
|
|
71
|
+
}
|
|
72
|
+
type OpenPageConfig = OpenPageUrlConfig | OpenPagePathConfig;
|
|
73
|
+
export declare const openPage: ({ userAgent, isDarkMode, viewport, cookies, ...urlConfig }: OpenPageConfig) => Promise<PageApi>;
|
|
74
|
+
export declare const getScreen: (page: Page) => import("pptr-testing-library/dist/typedefs").IQueryUtils & import("pptr-testing-library/dist/typedefs").IScopedQueryUtils;
|
|
75
|
+
export declare const screen: import("pptr-testing-library/dist/typedefs").IQueryUtils & import("pptr-testing-library/dist/typedefs").IScopedQueryUtils;
|
|
76
|
+
export declare const within: (element: ElementHandle) => import("pptr-testing-library/dist/typedefs").IQueryUtils & import("pptr-testing-library/dist/typedefs").IScopedQueryUtils;
|
|
77
|
+
export type { ElementHandle, Viewport } from 'puppeteer';
|
|
78
|
+
/**
|
|
79
|
+
* Returns a new path to the file that can be used by chromium in acceptance tests
|
|
80
|
+
*
|
|
81
|
+
* To be able to use `element.uploadFile()` in a dockerized chromium, the file must exist in the
|
|
82
|
+
* host and the docker, and both sides must use the same path.
|
|
83
|
+
*
|
|
84
|
+
* To workaround this bug or limitation, this function prepares the file by copying it to /tmp in
|
|
85
|
+
* the host and the container.
|
|
86
|
+
*/
|
|
87
|
+
export declare const prepareFile: (filepath: string) => string;
|
|
88
|
+
/**
|
|
89
|
+
* A convenience method to defer an expectation
|
|
90
|
+
*/
|
|
91
|
+
export declare const wait: <T>(expectation: () => Promise<T> | T, timeout?: number, interval?: number) => Promise<T>;
|
|
92
|
+
export declare const waitForElementToBeRemoved: (element: ElementHandle<Element>, timeout?: number, interval?: number) => Promise<void>;
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns true if the current path matches the spied path, including parameters
|
|
3
|
-
*/
|
|
4
|
-
export declare const matchPath: (spiedPath: string, currentPath: string) => boolean;
|
|
1
|
+
/**
|
|
2
|
+
* Returns true if the current path matches the spied path, including parameters
|
|
3
|
+
*/
|
|
4
|
+
export declare const matchPath: (spiedPath: string, currentPath: string) => boolean;
|
package/docker-compose.yaml
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telefonica/acceptance-testing",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-beta0",
|
|
4
4
|
"author": "Telefonica",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"module": "dist/acceptance-testing.esm.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"jest-puppeteer-config.js"
|
|
17
17
|
],
|
|
18
18
|
"engines": {
|
|
19
|
-
"node": ">=
|
|
19
|
+
"node": ">=20"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
22
|
"start": "tsdx watch",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"babel-jest": "^29.7.0",
|
|
35
35
|
"tsdx": "^0.14.1",
|
|
36
36
|
"tslib": "^2.3.1",
|
|
37
|
-
"typescript": "^
|
|
37
|
+
"typescript": "^5.4.5"
|
|
38
38
|
},
|
|
39
39
|
"repository": "git@github.com:Telefonica/js-toolbox.git",
|
|
40
40
|
"publishConfig": {
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"glob-to-regexp": "^0.4.1",
|
|
48
48
|
"jest-image-snapshot": "^4.5.1",
|
|
49
49
|
"node-fetch": "^2.6.5",
|
|
50
|
-
"pptr-testing-library": "^0.
|
|
51
|
-
"puppeteer": "^
|
|
50
|
+
"pptr-testing-library": "^0.8.0",
|
|
51
|
+
"puppeteer": "^22.8.0"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"jest": ">=26",
|