@tobelabs/chainwright 0.6.1-alpha.1 → 0.6.1-alpha.2
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/core/index.d.ts +1 -1
- package/dist/{types-dJRYhQT9.d.ts → types-COvLLLoP.d.ts} +3 -1
- package/dist/wallets/index.d.ts +34 -0
- package/dist/wallets/index.js +1 -0
- package/dist/wallets/keplr/index.d.ts +2 -2
- package/dist/wallets/metamask/index.d.ts +2 -2
- package/dist/wallets/meteor/index.d.ts +2 -2
- package/dist/wallets/petra/index.d.ts +2 -2
- package/dist/wallets/phantom/index.d.ts +2 -2
- package/dist/wallets/solflare/index.d.ts +2 -2
- package/package.json +5 -1
- package/dist/worker-scope-context-ze2hEh79.d.ts +0 -12
package/dist/core/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { W as WalletSetupFunction, a as WalletSetupConfig } from '../types-
|
|
1
|
+
import { W as WalletSetupFunction, a as WalletSetupConfig } from '../types-COvLLLoP.js';
|
|
2
2
|
import { Fixtures, TestType } from '@playwright/test';
|
|
3
3
|
|
|
4
4
|
declare function defineWalletSetup(password: string, fn: WalletSetupFunction, config?: WalletSetupConfig): Promise<{
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { BrowserContext, Page } from '@playwright/test';
|
|
2
2
|
|
|
3
|
+
type CLIOptions = "metamask" | "solflare" | "petra" | "phantom" | "meteor" | "keplr" | "all";
|
|
4
|
+
type SupportedWallets = Exclude<CLIOptions, "all">;
|
|
3
5
|
type Args = {
|
|
4
6
|
context: BrowserContext;
|
|
5
7
|
walletPage: Page;
|
|
@@ -19,4 +21,4 @@ type WalletProfileFixtureArgs = {
|
|
|
19
21
|
profileName?: string;
|
|
20
22
|
};
|
|
21
23
|
|
|
22
|
-
export type { WalletSetupFunction as W, WalletSetupConfig as a, WalletProfileFixtureArgs as b, WorkerScopeFixtureArgs as c };
|
|
24
|
+
export type { SupportedWallets as S, WalletSetupFunction as W, WalletSetupConfig as a, WalletProfileFixtureArgs as b, WorkerScopeFixtureArgs as c };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Page, BrowserContext, WorkerInfo } from '@playwright/test';
|
|
2
|
+
import { S as SupportedWallets } from '../types-COvLLLoP.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Core wallet interface
|
|
6
|
+
*/
|
|
7
|
+
declare abstract class BaseWallet {
|
|
8
|
+
abstract name: SupportedWallets;
|
|
9
|
+
abstract onboardingPath: string;
|
|
10
|
+
abstract indexUrl(): Promise<string>;
|
|
11
|
+
abstract extensionId(): Promise<string>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
type WorkerScopeContext<W> = {
|
|
15
|
+
workerInfo: WorkerInfo;
|
|
16
|
+
wallet: W;
|
|
17
|
+
profileName?: string;
|
|
18
|
+
slowMo?: number;
|
|
19
|
+
};
|
|
20
|
+
type WorkerScopeFixture<Wallet> = {
|
|
21
|
+
workerScopeContents: {
|
|
22
|
+
wallet: Wallet;
|
|
23
|
+
walletPage: Page;
|
|
24
|
+
context: BrowserContext;
|
|
25
|
+
};
|
|
26
|
+
dappPage: Page;
|
|
27
|
+
};
|
|
28
|
+
declare function workerScopeContext<T extends BaseWallet>({ wallet, workerInfo, profileName, slowMo, }: WorkerScopeContext<T>): Promise<{
|
|
29
|
+
context: BrowserContext;
|
|
30
|
+
walletPage: Page;
|
|
31
|
+
contextPath: string;
|
|
32
|
+
}>;
|
|
33
|
+
|
|
34
|
+
export { type WorkerScopeFixture, workerScopeContext };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import W from"fs";import C from"path";import{chromium as S}from"@playwright/test";import D from"path";var f=".wallet-cache",h=".wallet-context";var w="13.22.0",a="https://github.com/amaify/chainwright/releases/download/v0.1.0/",g=`https://github.com/MetaMask/metamask-extension/releases/download/v${w}/metamask-chrome-${w}.zip`,R=`${a}solflare-wallet-extension-v2.19.1.zip`,N=`${a}petra-wallet-extension-v2.4.8.zip`,O=`${a}phantom-wallet-extension-v26.10.0.zip`,P=`${a}meteor-wallet-extension-v0.7.0.zip`,T=`${a}keplr-wallet-extension-v0.13.3.zip`;async function m(e){return D.resolve(process.cwd(),h,e)}import L from"path";function n(e){return L.resolve(process.cwd(),f,e)}import d from"fs";import y from"path";async function E(e){try{let t=n(e),s=y.resolve(t,"extension-path.txt");if(!d.existsSync(s))throw new Error("\u274C extension-path.txt not found. Run setup script first.");let p=d.readFileSync(s,"utf-8").trim();if(!p)throw new Error("\u274C extension-path.txt is empty. Run setup script first.");return p}catch(t){throw new Error(`\u274C Failed to get ${e} extension path: ${t.message}`)}}async function ee({wallet:e,workerInfo:t,profileName:s,slowMo:p}){let l=await m(t.workerIndex.toString()),_=n(e.name),x=C.resolve(_,s??"wallet-data");if(!W.existsSync(x))throw new Error(`Cache for ${e.name} does not exist. Create it first!`);W.cpSync(x,l,{recursive:!0,force:!0});let u=await E(e.name),c=await S.launchPersistentContext(l,{headless:!1,args:[`--disable-extensions-except=${u}`],slowMo:process.env.HEADLESS?0:p}),A=await e.indexUrl(),i=c.pages()[0];return i||(i=await c.newPage()),await i.goto(A),{context:c,walletPage:i,contextPath:l}}export{ee as workerScopeContext};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as _playwright_test from '@playwright/test';
|
|
2
2
|
import { BrowserContext, Page } from '@playwright/test';
|
|
3
3
|
import z from 'zod';
|
|
4
|
-
import { b as WalletProfileFixtureArgs, c as WorkerScopeFixtureArgs } from '../../types-
|
|
5
|
-
import {
|
|
4
|
+
import { b as WalletProfileFixtureArgs, c as WorkerScopeFixtureArgs } from '../../types-COvLLLoP.js';
|
|
5
|
+
import { WorkerScopeFixture } from '../index.js';
|
|
6
6
|
|
|
7
7
|
declare class KeplrProfile {
|
|
8
8
|
readonly name: "keplr";
|
|
@@ -2,8 +2,8 @@ import * as _playwright_test from '@playwright/test';
|
|
|
2
2
|
import { Page, BrowserContext } from '@playwright/test';
|
|
3
3
|
import { Instance } from 'prool';
|
|
4
4
|
import z from 'zod';
|
|
5
|
-
import { b as WalletProfileFixtureArgs, c as WorkerScopeFixtureArgs } from '../../types-
|
|
6
|
-
import {
|
|
5
|
+
import { b as WalletProfileFixtureArgs, c as WorkerScopeFixtureArgs } from '../../types-COvLLLoP.js';
|
|
6
|
+
import { WorkerScopeFixture } from '../index.js';
|
|
7
7
|
|
|
8
8
|
type RenameAccount = {
|
|
9
9
|
page: Page;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _playwright_test from '@playwright/test';
|
|
2
2
|
import { BrowserContext, Page } from '@playwright/test';
|
|
3
|
-
import { b as WalletProfileFixtureArgs, c as WorkerScopeFixtureArgs } from '../../types-
|
|
4
|
-
import {
|
|
3
|
+
import { b as WalletProfileFixtureArgs, c as WorkerScopeFixtureArgs } from '../../types-COvLLLoP.js';
|
|
4
|
+
import { WorkerScopeFixture } from '../index.js';
|
|
5
5
|
|
|
6
6
|
declare class MeteorProfile {
|
|
7
7
|
readonly name: "meteor";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _playwright_test from '@playwright/test';
|
|
2
2
|
import { Page, BrowserContext } from '@playwright/test';
|
|
3
|
-
import { b as WalletProfileFixtureArgs, c as WorkerScopeFixtureArgs } from '../../types-
|
|
4
|
-
import {
|
|
3
|
+
import { b as WalletProfileFixtureArgs, c as WorkerScopeFixtureArgs } from '../../types-COvLLLoP.js';
|
|
4
|
+
import { WorkerScopeFixture } from '../index.js';
|
|
5
5
|
|
|
6
6
|
type RenameAccount = {
|
|
7
7
|
page: Page;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _playwright_test from '@playwright/test';
|
|
2
2
|
import { BrowserContext, Page } from '@playwright/test';
|
|
3
|
-
import { b as WalletProfileFixtureArgs, c as WorkerScopeFixtureArgs } from '../../types-
|
|
4
|
-
import {
|
|
3
|
+
import { b as WalletProfileFixtureArgs, c as WorkerScopeFixtureArgs } from '../../types-COvLLLoP.js';
|
|
4
|
+
import { WorkerScopeFixture } from '../index.js';
|
|
5
5
|
|
|
6
6
|
declare class PhantomProfile {
|
|
7
7
|
readonly name: "phantom";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as _playwright_test from '@playwright/test';
|
|
2
2
|
import { BrowserContext, Page } from '@playwright/test';
|
|
3
3
|
import z from 'zod';
|
|
4
|
-
import { b as WalletProfileFixtureArgs, c as WorkerScopeFixtureArgs } from '../../types-
|
|
5
|
-
import {
|
|
4
|
+
import { b as WalletProfileFixtureArgs, c as WorkerScopeFixtureArgs } from '../../types-COvLLLoP.js';
|
|
5
|
+
import { WorkerScopeFixture } from '../index.js';
|
|
6
6
|
|
|
7
7
|
declare class SolflareProfile {
|
|
8
8
|
readonly name: "solflare";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tobelabs/chainwright",
|
|
3
|
-
"version": "0.6.1-alpha.
|
|
3
|
+
"version": "0.6.1-alpha.2",
|
|
4
4
|
"description": "An end-to-end testing framework built on top of Playwright for Web3 wallet interactions",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,6 +23,10 @@
|
|
|
23
23
|
"dapp"
|
|
24
24
|
],
|
|
25
25
|
"exports": {
|
|
26
|
+
"./wallet": {
|
|
27
|
+
"types": "./dist/wallets/index.d.ts",
|
|
28
|
+
"import": "./dist/wallets/index.js"
|
|
29
|
+
},
|
|
26
30
|
"./keplr": {
|
|
27
31
|
"types": "./dist/wallets/keplr/index.d.ts",
|
|
28
32
|
"import": "./dist/wallets/keplr/index.js"
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Page, BrowserContext } from '@playwright/test';
|
|
2
|
-
|
|
3
|
-
type WorkerScopeFixture<Wallet> = {
|
|
4
|
-
workerScopeContents: {
|
|
5
|
-
wallet: Wallet;
|
|
6
|
-
walletPage: Page;
|
|
7
|
-
context: BrowserContext;
|
|
8
|
-
};
|
|
9
|
-
dappPage: Page;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export type { WorkerScopeFixture as W };
|