@allwright.dev/vitest 0.2.0 → 0.2.1
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/index.d.ts +3 -3
- package/dist/index.js +14 -4
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PageExpectMatchers, LocatorExpectMatchers, MobilePageExpectMatchers, MobileLocatorExpectMatchers } from "./expectations.js";
|
|
2
2
|
export type { RetryExpectationOptions, TextExpectationOptions, VisibleExpectationOptions, SelectedOptionExpectation, PageExpectMatchers, LocatorExpectMatchers, MobilePageExpectMatchers, MobileLocatorExpectMatchers } from "./expectations.js";
|
|
3
|
-
import { type MobileAndroidConnectOptions, type MobileAndroidDevice, type MobileAndroidLaunchOptions, type MobileAndroidApp, type NativeApp, type NativeAppLocator, type MobileIosConnectOptions, type MobileIosDevice, type MobileIosLaunchOptions, type MobileIosApp, type DesktopMacApp, type DesktopMacConnectOptions, type DesktopMacDesktop, type DesktopMacLaunchOptions, type DesktopWindowsApp, type DesktopWindowsConnectOptions, type DesktopWindowsDesktop, type DesktopWindowsLaunchOptions, type Browser, type BrowserKind, type LaunchOptions, type Locator, type Page } from "@allwright.dev/core";
|
|
3
|
+
import { type MobileAndroidConnectOptions, type MobileAndroidDevice, type MobileAndroidLaunchOptions, type MobileAndroidApp, type NativeApp, type DesktopApp, type NativeAppLocator, type MobileIosConnectOptions, type MobileIosDevice, type MobileIosLaunchOptions, type MobileIosApp, type DesktopMacApp, type DesktopMacConnectOptions, type DesktopMacDesktop, type DesktopMacLaunchOptions, type DesktopWindowsApp, type DesktopWindowsConnectOptions, type DesktopWindowsDesktop, type DesktopWindowsLaunchOptions, type Browser, type BrowserKind, type LaunchOptions, type Locator, type Page } from "@allwright.dev/core";
|
|
4
4
|
import { expect as vitestExpect, type Assertion } from "vitest";
|
|
5
5
|
export interface AllwrightVitestOptions {
|
|
6
6
|
launchOptions?: LaunchOptions;
|
|
@@ -51,9 +51,9 @@ export declare const test: import("vitest").TestAPI<{
|
|
|
51
51
|
ios: MobileIosDevice;
|
|
52
52
|
iosApp: NativeApp;
|
|
53
53
|
macos: DesktopMacDesktop;
|
|
54
|
-
macosApp:
|
|
54
|
+
macosApp: DesktopApp;
|
|
55
55
|
windows: DesktopWindowsDesktop;
|
|
56
|
-
windowsApp:
|
|
56
|
+
windowsApp: DesktopApp;
|
|
57
57
|
allwright: AllwrightVitestOptions;
|
|
58
58
|
_browserResource: LazyResource<Browser>;
|
|
59
59
|
_androidResource: LazyResource<MobileAndroidDevice>;
|
package/dist/index.js
CHANGED
|
@@ -416,6 +416,16 @@ function createLazyMobileApp(appResource) {
|
|
|
416
416
|
};
|
|
417
417
|
return lazyApp;
|
|
418
418
|
}
|
|
419
|
+
function createLazyDesktopApp(appResource) {
|
|
420
|
+
return Object.assign(createLazyMobileApp(appResource), {
|
|
421
|
+
async windows() {
|
|
422
|
+
return (await appResource.get()).windows();
|
|
423
|
+
},
|
|
424
|
+
async mainWindow() {
|
|
425
|
+
return (await appResource.get()).mainWindow();
|
|
426
|
+
},
|
|
427
|
+
});
|
|
428
|
+
}
|
|
419
429
|
function createLazyMobileLocator(appResource, selectorFactory) {
|
|
420
430
|
const lazyLocator = {
|
|
421
431
|
get page() {
|
|
@@ -520,7 +530,7 @@ function createLazyMacosDesktop(desktopResource) {
|
|
|
520
530
|
return getLazySyncProperty(desktopResource, "sessionId");
|
|
521
531
|
},
|
|
522
532
|
app() {
|
|
523
|
-
return
|
|
533
|
+
return createLazyDesktopApp(initialAppResource);
|
|
524
534
|
},
|
|
525
535
|
async launch(options) {
|
|
526
536
|
return (await desktopResource.get()).launch(options);
|
|
@@ -534,7 +544,7 @@ function createLazyWindowsDesktop(desktopResource) {
|
|
|
534
544
|
return getLazySyncProperty(desktopResource, "sessionId");
|
|
535
545
|
},
|
|
536
546
|
app() {
|
|
537
|
-
return
|
|
547
|
+
return createLazyDesktopApp(initialAppResource);
|
|
538
548
|
},
|
|
539
549
|
async launch(options) {
|
|
540
550
|
return (await desktopResource.get()).launch(options);
|
|
@@ -636,7 +646,7 @@ export const test = base.extend({
|
|
|
636
646
|
const launchOptions = resolveMacosLaunchOptions(config, allwright);
|
|
637
647
|
return (await _macosResource.get()).launch(launchOptions);
|
|
638
648
|
});
|
|
639
|
-
await use(
|
|
649
|
+
await use(createLazyDesktopApp(appResource));
|
|
640
650
|
},
|
|
641
651
|
windows: async ({ _windowsResource }, use) => {
|
|
642
652
|
await use(createLazyWindowsDesktop(_windowsResource));
|
|
@@ -647,7 +657,7 @@ export const test = base.extend({
|
|
|
647
657
|
const launchOptions = resolveWindowsLaunchOptions(config, allwright);
|
|
648
658
|
return (await _windowsResource.get()).launch(launchOptions);
|
|
649
659
|
});
|
|
650
|
-
await use(
|
|
660
|
+
await use(createLazyDesktopApp(appResource));
|
|
651
661
|
},
|
|
652
662
|
});
|
|
653
663
|
function isPage(value) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allwright.dev/vitest",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Vitest fixtures for the allwright TypeScript client.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"prepublishOnly": "bun run build"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@allwright.dev/core": "0.2.
|
|
50
|
+
"@allwright.dev/core": "0.2.1"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"typescript": "^5.9.2",
|