@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.73 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConfirmTransaction = void 0;
const dapp_driver_1 = require("../../session/dapp-driver");
/**
*
*
* @export
* @class ConfirmTransaction
* @implements {IConfirmation}
*/
class ConfirmTransaction {
url;
title;
confirmTx;
constructor() {
this.confirmTx = new dapp_driver_1.DappDriver.Instance.Extension.pages.ConfirmTransaction();
this.url = this.confirmTx.url;
this.title = this.confirmTx.title;
}
async callIfMethodExists(methodName, args = []) {
return await this.confirmTx[methodName](...args);
}
/**
*
*
* @template TPage
* @param {new () => TPage} page
* @return {*} {Promise<TPage>}
* @memberof ConfirmTransaction
*/
async accept(page) {
return await this.callIfMethodExists('accept', [page]);
}
/**
*
*
* @return {*} {Promise<any[]>}
* @memberof ConfirmTransaction
*/
async getAllWindowHandles() {
return await this.callIfMethodExists('getAllWindowHandles');
}
/**
*
*
* @template TPage
* @param {new () => TPage} page
* @return {*} {Promise<TPage>}
* @memberof ConfirmTransaction
*/
async reject(page) {
return await this.callIfMethodExists('reject', [page]);
}
/**
*
*
* @template TPage
* @param {*} nameOrHandle
* @param {new () => TPage} page
* @return {*} {Promise<TPage>}
* @memberof ConfirmTransaction
*/
async switchToWindow(page) {
return await this.callIfMethodExists('switchToWindow', [page]);
}
}
exports.ConfirmTransaction = ConfirmTransaction;