@empiricalrun/playwright-utils 0.15.4 → 0.15.6
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/CHANGELOG.md +12 -0
- package/dist/auth/index.d.ts +1 -1
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +3 -2
- package/dist/playwright-extensions.d.ts +4 -0
- package/dist/playwright-extensions.d.ts.map +1 -1
- package/dist/test/index.d.ts +3 -3
- package/dist/test/index.d.ts.map +1 -1
- package/dist/test/types.d.ts +0 -43
- package/dist/test/types.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @empiricalrun/playwright-utils
|
|
2
2
|
|
|
3
|
+
## 0.15.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b16b12c: fix: close new page opened for auth store
|
|
8
|
+
|
|
9
|
+
## 0.15.5
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 5715b75: fix: type errors in playwright utils
|
|
14
|
+
|
|
3
15
|
## 0.15.4
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export declare class AuthStore<T extends WithKey<{}>> {
|
|
|
17
17
|
appType?: AppType;
|
|
18
18
|
});
|
|
19
19
|
loginIfRequired(): Promise<void>;
|
|
20
|
-
private
|
|
20
|
+
private newPageWithAuthState;
|
|
21
21
|
private saveAuthState;
|
|
22
22
|
static location(userContext: {
|
|
23
23
|
key: string;
|
package/dist/auth/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAU,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE/D,KAAK,OAAO,CAA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AO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,IAAI,CAAC;IACX,WAAW,EAAE,CAAC,CAAC;IACf,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,iBAAiB,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;gBACxD,EACV,IAAI,EACJ,WAAW,EACX,SAAS,EACT,iBAAiB,EACjB,OAAmB,GACpB,EAAE;QACD,IAAI,EAAE,IAAI,CAAC;QACX,WAAW,EAAE,CAAC,CAAC;QACf,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;QACzD,iBAAiB,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;QACpE,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB;IAQK,eAAe;YA6BP,oBAAoB;YAsBpB,aAAa;IA6B3B,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM;WAIxC,eAAe,CAC1B,OAAO,EAAE,cAAc,EACvB,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC;CAoB5B"}
|
package/dist/auth/index.js
CHANGED
|
@@ -27,10 +27,11 @@ class AuthStore {
|
|
|
27
27
|
shouldDoLogin = true;
|
|
28
28
|
}
|
|
29
29
|
else {
|
|
30
|
-
const page = await this.
|
|
30
|
+
const page = await this.newPageWithAuthState(this.page, storagePath);
|
|
31
31
|
try {
|
|
32
32
|
const hasLoggedIn = await this.checkLoggedInFunc(page, this.userContext);
|
|
33
33
|
shouldDoLogin = !hasLoggedIn;
|
|
34
|
+
await page.close();
|
|
34
35
|
}
|
|
35
36
|
catch (err) {
|
|
36
37
|
if (err instanceof playwright_core_1.errors.TimeoutError) {
|
|
@@ -46,7 +47,7 @@ class AuthStore {
|
|
|
46
47
|
await this.saveAuthState(storagePath);
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
|
-
async
|
|
50
|
+
async newPageWithAuthState(page, storagePath) {
|
|
50
51
|
if (this.appType === "web-app") {
|
|
51
52
|
// Load state from the file in a new context
|
|
52
53
|
// We create a new context because of Playwright APIs
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playwright-extensions.d.ts","sourceRoot":"","sources":["../src/playwright-extensions.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7C,CAAC;AAEF,OAAO,QAAQ,iBAAiB,CAAC;IAC/B,UAAU,OAAQ,SAAQ,eAAe;KAAG;CAC7C"}
|
|
1
|
+
{"version":3,"file":"playwright-extensions.d.ts","sourceRoot":"","sources":["../src/playwright-extensions.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7C,CAAC;AAEF,OAAO,QAAQ,iBAAiB,CAAC;IAC/B,UAAU,OAAQ,SAAQ,eAAe;KAAG;CAC7C;AAED,OAAO,QAAQ,kBAAkB,CAAC;IAChC,UAAU,OAAQ,SAAQ,eAAe;KAAG;CAC7C"}
|
package/dist/test/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, TestType } from "@playwright/test";
|
|
1
|
+
import type { PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, TestType } from "@playwright/test";
|
|
2
2
|
import { injectLocatorHighlightScripts } from "./scripts";
|
|
3
|
-
import {
|
|
4
|
-
export declare const baseTestFixture: (testFn: TestType<
|
|
3
|
+
import { HighlighterOpts } from "./types";
|
|
4
|
+
export declare const baseTestFixture: (testFn: TestType<PlaywrightTestArgs & PlaywrightTestOptions, PlaywrightWorkerArgs & PlaywrightWorkerOptions>, options?: HighlighterOpts) => TestType<PlaywrightTestArgs & PlaywrightTestOptions & {
|
|
5
5
|
[key: string]: any;
|
|
6
6
|
}, PlaywrightWorkerArgs & PlaywrightWorkerOptions>;
|
|
7
7
|
export { injectLocatorHighlightScripts };
|
package/dist/test/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,EACvB,QAAQ,EACT,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,6BAA6B,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,EACvB,QAAQ,EACT,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,6BAA6B,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,eAAO,MAAM,eAAe,WAClB,SACN,kBAAkB,GAAG,qBAAqB,EAC1C,oBAAoB,GAAG,uBAAuB,CAC/C,YACQ,eAAe;;kDAYzB,CAAC;AAEF,OAAO,EAAE,6BAA6B,EAAE,CAAC"}
|
package/dist/test/types.d.ts
CHANGED
|
@@ -1,49 +1,6 @@
|
|
|
1
|
-
import type { Locator, Page, PlaywrightTestArgs } from "@playwright/test";
|
|
2
1
|
export type HighlighterOpts = {
|
|
3
2
|
mousePointerHighlighter?: boolean;
|
|
4
3
|
locatorHighlighter?: boolean;
|
|
5
4
|
visionMethods?: boolean;
|
|
6
5
|
};
|
|
7
|
-
interface EnhancedLocator extends Locator {
|
|
8
|
-
query(instruction: string): Promise<string>;
|
|
9
|
-
}
|
|
10
|
-
interface EnhancedPage extends Page {
|
|
11
|
-
locator(selector: string, options?: {
|
|
12
|
-
has?: Locator;
|
|
13
|
-
hasNot?: Locator;
|
|
14
|
-
hasNotText?: string | RegExp;
|
|
15
|
-
hasText?: string | RegExp;
|
|
16
|
-
}): EnhancedLocator;
|
|
17
|
-
getByRole(role: "alert" | "alertdialog" | "application" | "article" | "banner" | "blockquote" | "button" | "caption" | "cell" | "checkbox" | "code" | "columnheader" | "combobox" | "complementary" | "contentinfo" | "definition" | "deletion" | "dialog" | "directory" | "document" | "emphasis" | "feed" | "figure" | "form" | "generic" | "grid" | "gridcell" | "group" | "heading" | "img" | "insertion" | "link" | "list" | "listbox" | "listitem" | "log" | "main" | "marquee" | "math" | "meter" | "menu" | "menubar" | "menuitem" | "menuitemcheckbox" | "menuitemradio" | "navigation" | "none" | "note" | "option" | "paragraph" | "presentation" | "progressbar" | "radio" | "radiogroup" | "region" | "row" | "rowgroup" | "rowheader" | "scrollbar" | "search" | "searchbox" | "separator" | "slider" | "spinbutton" | "status" | "strong" | "subscript" | "superscript" | "switch" | "tab" | "table" | "tablist" | "tabpanel" | "term" | "textbox" | "time" | "timer" | "toolbar" | "tooltip" | "tree" | "treegrid" | "treeitem", options?: {
|
|
18
|
-
checked?: boolean;
|
|
19
|
-
disabled?: boolean;
|
|
20
|
-
exact?: boolean;
|
|
21
|
-
expanded?: boolean;
|
|
22
|
-
includeHidden?: boolean;
|
|
23
|
-
level?: number;
|
|
24
|
-
name?: string | RegExp;
|
|
25
|
-
pressed?: boolean;
|
|
26
|
-
selected?: boolean;
|
|
27
|
-
}): EnhancedLocator;
|
|
28
|
-
getByLabel(text: string | RegExp, options?: {
|
|
29
|
-
exact?: boolean;
|
|
30
|
-
}): EnhancedLocator;
|
|
31
|
-
getByPlaceholder(text: string | RegExp, options?: {
|
|
32
|
-
exact?: boolean;
|
|
33
|
-
}): EnhancedLocator;
|
|
34
|
-
getByText(text: string | RegExp, options?: {
|
|
35
|
-
exact?: boolean;
|
|
36
|
-
}): EnhancedLocator;
|
|
37
|
-
getByTestId(testId: string | RegExp): EnhancedLocator;
|
|
38
|
-
getByAltText(text: string | RegExp, options?: {
|
|
39
|
-
exact?: boolean;
|
|
40
|
-
}): EnhancedLocator;
|
|
41
|
-
getByTitle(text: string | RegExp, options?: {
|
|
42
|
-
exact?: boolean;
|
|
43
|
-
}): EnhancedLocator;
|
|
44
|
-
}
|
|
45
|
-
export interface EnhancedPlaywrightTestArgs extends PlaywrightTestArgs {
|
|
46
|
-
page: EnhancedPage;
|
|
47
|
-
}
|
|
48
|
-
export {};
|
|
49
6
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/test/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/test/types.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/test/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC5B,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC"}
|