UNPKG

@assert-equals/dappdriver

Version:

DappDriver is an e2e testing framework designed for testing decentralized applications (dApps) using MetaMask, Rainbow or Zerion

69 lines (68 loc) 1.7 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SignInRequest = void 0; const dapp_driver_1 = require("../../session/dapp-driver"); /** * * * @export * @class SignInRequest * @implements {IConfirmation} */ class SignInRequest { url; title; signInRequest; constructor() { this.signInRequest = new dapp_driver_1.DappDriver.Instance.Extension.pages.SignInRequest(); this.url = this.signInRequest.url; this.title = this.signInRequest.title; } async callIfMethodExists(methodName, args = []) { return await this.signInRequest[methodName](...args); } /** * * * @template TPage * @param {new () => TPage} page * @return {*} {Promise<TPage>} * @memberof SignInRequest */ async accept(page) { return await this.callIfMethodExists('accept', [page]); } /** * * * @return {*} {Promise<any[]>} * @memberof SignInRequest */ async getAllWindowHandles() { return await this.callIfMethodExists('getAllWindowHandles'); } /** * * * @template TPage * @param {new () => TPage} page * @return {*} {Promise<TPage>} * @memberof SignInRequest */ async reject(page) { return await this.callIfMethodExists('reject', [page]); } /** * * * @template TPage * @param {*} nameOrHandle * @param {new () => TPage} page * @return {*} {Promise<TPage>} * @memberof SignInRequest */ async switchToWindow(page) { return await this.callIfMethodExists('switchToWindow', [page]); } } exports.SignInRequest = SignInRequest;