@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.
@@ -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-image-snapshot" />
4
- import type { Browser, ClickOptions, ElementHandle, HTTPRequest, Page, ResponseForRequest, ScreenshotOptions, Viewport } from 'puppeteer';
5
- declare type CustomScreenshotOptions = ScreenshotOptions & {
6
- skipNetworkWait?: boolean;
7
- };
8
- export declare const getGlobalBrowser: () => Browser;
9
- export declare const getGlobalPage: () => Page;
10
- export declare const serverHostName: string;
11
- export declare const serverPort: any;
12
- export interface PageApi extends Omit<Page, 'click' | 'type' | 'select'> {
13
- clear: (selector: ElementHandle) => Promise<void>;
14
- type: (selector: ElementHandle, text: string, options?: {
15
- delay: number;
16
- }) => Promise<void>;
17
- click: (selector: ElementHandle, options?: ClickOptions) => Promise<void>;
18
- select: (selector: ElementHandle, ...values: string[]) => Promise<string[]>;
19
- screenshot: (options?: CustomScreenshotOptions) => Promise<Buffer | string | void>;
20
- }
21
- export declare const getPageApi: (page: Page) => PageApi;
22
- declare type RequestMatcherFn = (req: HTTPRequest) => boolean;
23
- export declare const interceptRequest: (matcher: RequestMatcherFn) => jest.Mock<Partial<ResponseForRequest>, [HTTPRequest]>;
24
- declare type ApiEndpointMock = {
25
- spyOn(path: string, method?: string): jest.Mock<unknown, [HTTPRequest]>;
26
- };
27
- export declare const createApiEndpointMock: ({ origin, baseUrl, }?: {
28
- origin?: string | undefined;
29
- /** @deprecated use origin */
30
- baseUrl?: string | undefined;
31
- }) => ApiEndpointMock;
32
- declare type CookieConfig = {
33
- name: string;
34
- value: string;
35
- url?: string;
36
- domain?: string;
37
- path?: string;
38
- secure?: boolean;
39
- httpOnly?: boolean;
40
- sameSite?: 'Strict' | 'Lax' | 'None';
41
- expires?: number;
42
- priority?: 'Low' | 'Medium' | 'High';
43
- sameParty?: boolean;
44
- sourceScheme?: 'Unset' | 'NonSecure' | 'Secure';
45
- sourcePort?: number;
46
- };
47
- export interface TestViewport extends Viewport {
48
- safeAreaInset?: {
49
- top?: number | string;
50
- right?: number | string;
51
- bottom?: number | string;
52
- left?: number | string;
53
- };
54
- }
55
- interface OpenPageCommonConfig {
56
- userAgent?: string;
57
- viewport?: TestViewport;
58
- isDarkMode?: boolean;
59
- cookies?: Array<CookieConfig>;
60
- }
61
- interface OpenPageUrlConfig extends OpenPageCommonConfig {
62
- url: string;
63
- }
64
- interface OpenPagePathConfig extends OpenPageCommonConfig {
65
- url?: undefined;
66
- path?: string;
67
- port?: number;
68
- protocol?: string;
69
- hostname?: string;
70
- }
71
- declare type OpenPageConfig = OpenPageUrlConfig | OpenPagePathConfig;
72
- export declare const openPage: ({ userAgent, isDarkMode, viewport, cookies, ...urlConfig }: OpenPageConfig) => Promise<PageApi>;
73
- export declare const getScreen: (page: Page) => import("pptr-testing-library/dist/typedefs").IQueryUtils & import("pptr-testing-library/dist/typedefs").IScopedQueryUtils;
74
- export declare const screen: import("pptr-testing-library/dist/typedefs").IQueryUtils & import("pptr-testing-library/dist/typedefs").IScopedQueryUtils;
75
- export declare const within: (element: ElementHandle) => import("pptr-testing-library/dist/typedefs").IQueryUtils & import("pptr-testing-library/dist/typedefs").IScopedQueryUtils;
76
- export type { ElementHandle, Viewport } from 'puppeteer';
77
- /**
78
- * Returns a new path to the file that can be used by chromium in acceptance tests
79
- *
80
- * To be able to use `element.uploadFile()` in a dockerized chromium, the file must exist in the
81
- * host and the docker, and both sides must use the same path.
82
- *
83
- * To workaround this bug or limitation, this function prepares the file by copying it to /tmp in
84
- * the host and the container.
85
- */
86
- export declare const prepareFile: (filepath: string) => string;
87
- /**
88
- * A convenience method to defer an expectation
89
- */
90
- export declare const wait: <T>(expectation: () => T | Promise<T>, timeout?: number, interval?: number) => Promise<T>;
91
- export declare const waitForElementToBeRemoved: (element: ElementHandle<Element>, timeout?: number, interval?: number) => Promise<void>;
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;
@@ -2,6 +2,6 @@ version: '3'
2
2
 
3
3
  services:
4
4
  acceptance-tests-chromium:
5
- image: telefonica/web-builder:chromium93.0.4577-node18-1.1.0
5
+ image: telefonica/web-builder:chromium124.0.6367-node20.13-1.0.0
6
6
  ports:
7
7
  - '9223:9222'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telefonica/acceptance-testing",
3
- "version": "2.23.1",
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": ">=12"
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": "^4.4.4"
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.6.5",
51
- "puppeteer": "^10.4.0"
50
+ "pptr-testing-library": "^0.8.0",
51
+ "puppeteer": "^22.8.0"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "jest": ">=26",