Open anthanh opened 3 years ago
Is there a type library already?
I checked but couldn't find any typings, so there is no proper way right now to use it with playwright in typescript?
Edit: Ok found this:https://github.com/CryptKeeperZK/crypt-keeper-extension/blob/master/packages/e2e/%40types/synpress.d.ts
Is there a more complete type document?
I wrote this thanks to chatGPT, but I can't figure out how to get ts to use it:
import type { BrowserType } from "@playwright/test";
declare module "@synthetixio/synpress/helpers" {
export function prepareMetamask(version: string): Promise<string>;
}
declare module "@synthetixio/synpress/commands/playwright" {
export function setExpectInstance(expect: Expect): Promise<void>;
}
type AcceptAccessOptions = {
allAccounts?: boolean;
signInSignature?: boolean;
confirmSignatureRequest?: boolean;
confirmDataSignatureRequest?: boolean;
};
type Network = {
name: string;
rpcUrl: string;
chainId: number;
symbol: string;
isTestnet?: boolean;
blockExplorer?: string;
};
declare module "@synthetixio/synpress/commands/metamask" {
export function acceptAccess(options?: AcceptAccessOptions): Promise<boolean>;
export function initialSetup(
browser: BrowserType,
options: {
secretWordsOrPrivateKey: string;
network: Network;
password: string;
enableAdvancedSettings: boolean;
},
): Promise<void>;
export function addNetwork(network: string | Network): Promise<boolean>;
export function changeNetwork(network: string | Network): Promise<boolean>;
export function confirmSignatureRequest(): Promise<boolean>;
}
Would be nice to have typescript support