Skip to content

Commit

Permalink
refactor(e2e): replace ledger key agent for in memory key agent in th…
Browse files Browse the repository at this point in the history
…e wallet extension e2e test
  • Loading branch information
AngelCastilloB committed Jun 27, 2022
1 parent fd7f13b commit f06cae0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/e2e/.env.example
Expand Up @@ -3,7 +3,7 @@ FAUCET_PROVIDER="CardanoWalletFaucetProvider"
FAUCET_PROVIDER_PARAMS='{"url":"http://localhost:8090/v2","mnemonic":"fire method repair aware foot tray accuse brother popular olive find account sick rocket next"}'
KEY_MANAGEMENT_PROVIDER="InMemoryKeyAgent"
KEY_MANAGEMENT_PARAMS='{"accountIndex": 0, "networkId": 0, "password":"some_password","mnemonic":"actor scout worth mansion thumb device mass pave gospel secret height document merge text broom kind lesson invest across estate erase interest end century"}'
ASSET_PROVIDER="NullAssetProvider"
ASSET_PROVIDER="blockfrostAssetProvider"
ASSET_PROVIDER_PPARAMS='{"isTestnet": true, "projectId": "testnetNElagmhpQDubE6Ic4XBUVJjV5DROyijO"}'
CHAIN_HISTORY_PROVIDER="blockfrostChainHistoryProvider"
CHAIN_HISTORY_PROVIDER_PARAMS='{"isTestnet": true, "projectId": "testnetNElagmhpQDubE6Ic4XBUVJjV5DROyijO"}'
Expand Down
4 changes: 2 additions & 2 deletions packages/e2e/test/config.ts
Expand Up @@ -32,7 +32,7 @@ const loggerMethodNames = ['debug', 'error', 'fatal', 'info', 'trace', 'warn'] a

export const env = envalid.cleanEnv(process.env, {
ASSET_PROVIDER: envalid.str(),
ASSET_PROVIDER_PPARAMS: envalid.json(),
ASSET_PROVIDER_PARAMS: envalid.json(),
CHAIN_HISTORY_PROVIDER: envalid.str(),
CHAIN_HISTORY_PROVIDER_PARAMS: envalid.json(),
FAUCET_PROVIDER: envalid.str(),
Expand Down Expand Up @@ -87,7 +87,7 @@ export const keyAgent: Promise<KeyManagement.AsyncKeyAgent> = (() => keyAgentByI

export const assetProvider: Promise<AssetProvider> = assetProviderFactory.create(
env.ASSET_PROVIDER,
env.ASSET_PROVIDER_PPARAMS
env.ASSET_PROVIDER_PARAMS
);

export const chainHistoryProvider: Promise<ChainHistoryProvider> = chainHistoryProviderFactory.create(
Expand Down
10 changes: 5 additions & 5 deletions packages/e2e/test/web-extension/extension/ui.ts
Expand Up @@ -8,7 +8,6 @@ import {
userPromptServiceChannel,
walletName
} from './util';
import { Cardano } from '@cardano-sdk/core';
import { KeyManagement } from '@cardano-sdk/wallet';
import {
RemoteApiPropertyType,
Expand Down Expand Up @@ -75,10 +74,11 @@ document.querySelector('#createLedgerKeyAgent')!.addEventListener('click', async
exposeKeyAgent(
{
keyAgent: KeyManagement.util.createAsyncKeyAgent(
await KeyManagement.LedgerKeyAgent.createWithDevice({
communicationType: KeyManagement.CommunicationType.Web,
networkId: Cardano.NetworkId.testnet,
protocolMagic: 1_097_911_063
await KeyManagement.InMemoryKeyAgent.fromBip39MnemonicWords({
accountIndex: 0,
getPassword: async () => Buffer.from(''),
mnemonicWords: process.env.MNEMONIC_WORDS.split(' '),
networkId: 0
})
),
walletName
Expand Down
3 changes: 3 additions & 0 deletions packages/e2e/test/web-extension/tsconfig.json
Expand Up @@ -11,6 +11,9 @@
]
},
"references": [
{
"path": "../../src"
},
{
"path": "../../../web-extension/src"
},
Expand Down

0 comments on commit f06cae0

Please sign in to comment.