UNPKG

@assert-equals/dappdriver

Version:

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

26 lines (25 loc) 1.41 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.rainbow = void 0; const constants_1 = require("../constants"); const log_1 = require("../log"); const install_1 = require("../wallet/install"); async function rainbow(directory, version = constants_1.DEFAULT_RAINBOW_VERSION) { try { const workflowName = 'Publish to Chrome (Prod)'; (0, install_1.checkEnvVariable)('GITHUB_TOKEN'); (0, install_1.compareVersion)(constants_1.RAINBOW, version, constants_1.RECOMMENDED_RAINBOW_VERSIONS); await (0, install_1.fetchGithubTags)(constants_1.RAINBOW, version, constants_1.RAINBOW_GITHUB_API); const workflow = await (0, install_1.fetchGithubWorkflow)(workflowName, constants_1.RAINBOW_GITHUB_API); const run = await (0, install_1.fetchGithubRun)(version, workflowName, workflow, constants_1.RAINBOW_GITHUB_API); const artifact = await (0, install_1.fetchGithubArtifact)(version, run, constants_1.RAINBOW_GITHUB_API); (0, install_1.createDirectory)(directory); const fileName = await (0, install_1.downloadArtifactZipFile)(artifact, directory); const destDir = (0, install_1.extractZipContents)(fileName); (0, log_1.logSuccess)(`Installed Rainbow version <v${version}>\n${destDir}`); } catch (error) { (0, log_1.logError)(error.message); } } exports.rainbow = rainbow;