Skip to content

Commit

Permalink
Merge pull request #3582 from input-output-hk/piotr/e2e-testing-share…
Browse files Browse the repository at this point in the history
…d-wallets

E2e testing shared wallets
  • Loading branch information
piotr-iohk authored Nov 23, 2022
2 parents 999e7e1 + 96948f8 commit ab1cfe9
Show file tree
Hide file tree
Showing 9 changed files with 1,492 additions and 620 deletions.
2 changes: 1 addition & 1 deletion test/e2e/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

source 'https://rubygems.org'

gem 'cardano_wallet', '~> 0.3.27'
gem 'cardano_wallet', '~> 0.4.0'
# gem 'cardano_wallet', path: "~/wb/cardano_wallet"
gem 'blake2b', '0.10.0'
gem 'cbor', '0.5.9.6'
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ GEM
specs:
bip_mnemonic (0.0.4)
blake2b (0.10.0)
cardano_wallet (0.3.27)
cardano_wallet (0.4.0)
bip_mnemonic (~> 0.0.4)
httparty (~> 0.18.0)
cbor (0.5.9.6)
Expand Down Expand Up @@ -36,7 +36,7 @@ PLATFORMS

DEPENDENCIES
blake2b (= 0.10.0)
cardano_wallet (~> 0.3.27)
cardano_wallet (~> 0.4.0)
cbor (= 0.5.9.6)
mustache (= 1.1.1)
rake (= 12.3.3)
Expand Down
38 changes: 19 additions & 19 deletions test/e2e/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,30 +50,30 @@ task :fixture_wallets_template do
log ">> Creating #{FIXTURES_FILE}"
utils = CardanoWallet.new.utils
fixture_wallets = { linux: {
fixture: { shelley: utils.mnemonic_sentence(24),
icarus: utils.mnemonic_sentence(15),
random: utils.mnemonic_sentence(12),
shelley_light: utils.mnemonic_sentence(24) },
target: { shelley: utils.mnemonic_sentence(24),
shared: utils.mnemonic_sentence(24) }
fixture: { shelley: { mnemonics: utils.mnemonic_sentence(24) },
icarus: { mnemonics: utils.mnemonic_sentence(24) },
random: { mnemonics: utils.mnemonic_sentence(24) },
shared: { mnemonics: utils.mnemonic_sentence(24) },
shared2: { mnemonics: utils.mnemonic_sentence(24) } },
target: { shelley: { mnemonics: utils.mnemonic_sentence(24) } }
},
macos: {
fixture: { shelley: utils.mnemonic_sentence(24),
icarus: utils.mnemonic_sentence(15),
random: utils.mnemonic_sentence(12),
shelley_light: utils.mnemonic_sentence(24) },
target: { shelley: utils.mnemonic_sentence(24),
shared: utils.mnemonic_sentence(24) }
fixture: { shelley: { mnemonics: utils.mnemonic_sentence(24) },
icarus: { mnemonics: utils.mnemonic_sentence(24) },
random: { mnemonics: utils.mnemonic_sentence(24) },
shared: { mnemonics: utils.mnemonic_sentence(24) },
shared2: { mnemonics: utils.mnemonic_sentence(24) } },
target: { shelley: { mnemonics: utils.mnemonic_sentence(24) } }
},
windows: {
fixture: { shelley: utils.mnemonic_sentence(24),
icarus: utils.mnemonic_sentence(15),
random: utils.mnemonic_sentence(12),
shelley_light: utils.mnemonic_sentence(24) },
target: { shelley: utils.mnemonic_sentence(24),
shared: utils.mnemonic_sentence(24) }
fixture: { shelley: { mnemonics: utils.mnemonic_sentence(24) },
icarus: { mnemonics: utils.mnemonic_sentence(24) },
random: { mnemonics: utils.mnemonic_sentence(24) },
shared: { mnemonics: utils.mnemonic_sentence(24) },
shared2: { mnemonics: utils.mnemonic_sentence(24) } },
target: { shelley: { mnemonics: utils.mnemonic_sentence(24) } }
},
currency_contract_wallet: utils.mnemonic_sentence(24) }
currency_contract_wallet: { mnemonics: utils.mnemonic_sentence(24) } }
if File.exist?(FIXTURES_FILE)
err = "
File #{FIXTURES_FILE} already exists!
Expand Down
Binary file modified test/e2e/fixtures/fixture_wallets.json.gpg
Binary file not shown.
28 changes: 14 additions & 14 deletions test/e2e/gemset.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1ay11nh7wcri87zzvn4i3n9lx0wnv2d5wfknk5nx8zyvlk8305r7";
sha256 = "1az3d89mlkvy53mfdaxd73y91m1v9z96zsilvkdgagfcf21ywisj";
type = "gem";
};
version = "0.3.27";
version = "0.4.0";
};
cbor = {
groups = ["default"];
Expand All @@ -45,10 +45,10 @@
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0m925b8xc6kbpnif9dldna24q1szg4mk0fvszrki837pfn46afmz";
sha256 = "0rwvjahnp7cpmracd8x732rjgnilqv2sx7d1gfrysslc3h039fa9";
type = "gem";
};
version = "1.4.4";
version = "1.5.0";
};
httparty = {
dependencies = ["mime-types" "multi_xml"];
Expand Down Expand Up @@ -118,52 +118,52 @@
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1dwai7jnwmdmd7ajbi2q0k0lx1dh88knv5wl7c34wjmf94yv8w5q";
sha256 = "19dyb6rcvgi9j2mksd29wfdhfdyzqk7yjhy1ai77559hbhpg61w9";
type = "gem";
};
version = "3.10.0";
version = "3.11.0";
};
rspec-core = {
dependencies = ["rspec-support"];
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0wwnfhxxvrlxlk1a3yxlb82k2f9lm0yn0598x7lk8fksaz4vv6mc";
sha256 = "118hkfw9b11hvvalr7qlylwal5h8dihagm9xg7k4gskg7587hca6";
type = "gem";
};
version = "3.10.1";
version = "3.11.0";
};
rspec-expectations = {
dependencies = ["diff-lcs" "rspec-support"];
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1sz9bj4ri28adsklnh257pnbq4r5ayziw02qf67wry0kvzazbb17";
sha256 = "0l1bzk6a68i1b2qix83vs40r0pbjawv67hixiq2qxsja19bbq3bc";
type = "gem";
};
version = "3.10.1";
version = "3.11.1";
};
rspec-mocks = {
dependencies = ["diff-lcs" "rspec-support"];
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1d13g6kipqqc9lmwz5b244pdwc97z15vcbnbq6n9rlf32bipdz4k";
sha256 = "07vagjxdm5a6s103y8zkcnja6avpl8r196hrpiffmg7sk83dqdsm";
type = "gem";
};
version = "3.10.2";
version = "3.11.1";
};
rspec-support = {
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "15j52parvb8cgvl6s0pbxi2ywxrv6x0764g222kz5flz0s4mycbl";
sha256 = "1c01iicvrjk6vv744jgh0y4kk9d0kg2rd2ihdyzvg5p06xm2fpzq";
type = "gem";
};
version = "3.10.2";
version = "3.11.1";
};
}
21 changes: 12 additions & 9 deletions test/e2e/helpers/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,27 +76,30 @@ def absolute_path(path)
end
end

# Get wallet mnemonics from fixures file
# Get wallet mnemonics/payment template/delegation template from fixures file
# @param kind [Symbol] :fixture or :target (fixture wallet with funds or target wallet)
# @param type [Symbol] wallet type = :shelley, :shared, :icarus, :random
def get_fixture_wallet_mnemonics(kind, type)
# @param wallet_type [Symbol] wallet type = :shelley, :shared, :icarus, :random
# @param info_type [Symbol] wallet type = :mnemonics, :payment_template, :delegation_template
def get_fixture_wallet(kind, wallet_type, info_type = :mnemonics)
fixture = ENV.fetch('TESTS_E2E_FIXTURES_FILE', nil)
raise "File #{fixture} does not exist! (Hint: Template fixture file can be created with 'rake fixture_wallets_template'). Make sure to feed it with mnemonics of wallets with funds and assets." unless File.exist? fixture

wallets = JSON.parse File.read(fixture)
k = kind.to_s
t = type.to_s
wallets = from_json(fixture)
if linux?
wallets['linux'][k][t]
wallets[:linux][kind][wallet_type][info_type]
elsif mac?
wallets['macos'][k][t]
wallets[:macos][kind][wallet_type][info_type]
elsif win?
wallets['windows'][k][t]
wallets[:windows][kind][wallet_type][info_type]
else
raise 'Unsupported platform!'
end
end

def from_json(file)
JSON.parse(File.read(file), { symbolize_names: true })
end

def wget(url, file = nil)
file ||= File.basename(url)
resp = HTTParty.get(url)
Expand Down
Loading

0 comments on commit ab1cfe9

Please sign in to comment.