mirror of
https://github.com/cryptoadvance/specter-desktop.git
synced 2026-08-13 12:33:29 +02:00
Bugfix: Fixed Save Backup PDF Button after creating wallet (#2149)
* added fonts and changed childnode index * Adding pdf-tests * new parameter for wallet creation and fix nasty children logic --------- Co-authored-by: Manolis Mandrapilias <70536101+moneymanolis@users.noreply.github.com> Co-authored-by: Kim Neunert <k9ert@gmx.de>
This commit is contained in:
parent
3b6284b560
commit
4328c654a7
9 changed files with 46 additions and 12 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -40,3 +40,4 @@ signing_dir
|
|||
site
|
||||
docs/README.md
|
||||
cypresstest-output.xml
|
||||
cypress/downloads
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ describe('Test the rendering of balances and amounts', () => {
|
|||
|
||||
it('Unconfirmed balance', () => {
|
||||
cy.addHotDevice('Satoshis hot keys','bitcoin')
|
||||
cy.addWallet('Funding wallet', 'segwit', 'funded', 'btc', 'singlesig', 'Satoshis hot keys')
|
||||
cy.addWallet('Funding wallet', 'segwit', 'funded', true, 'btc', 'singlesig', 'Satoshis hot keys')
|
||||
cy.selectWallet('Funding wallet')
|
||||
cy.get('#btn_send').click()
|
||||
cy.get('#recipient_0').find('#address').invoke('val', 'bcrt1qvtdx75y4554ngrq6aff3xdqnvjhmct5wck95qs')
|
||||
|
|
|
|||
|
|
@ -6,11 +6,38 @@ describe('Ghost machine', () => {
|
|||
.then($body => {
|
||||
if ($body.find('[data-cy="no-core-connection"]').length) {
|
||||
cy.connect()
|
||||
cy.addWallet('Ghost wallet', 'segwit', 'funded', 'btc', 'singlesig', 'DIY ghost')
|
||||
cy.addWallet('Ghost wallet', 'segwit', false, false, 'btc', 'singlesig', 'DIY ghost')
|
||||
}
|
||||
else {
|
||||
cy.addWallet('Ghost wallet', 'segwit', 'funded', 'btc', 'singlesig', 'DIY ghost')
|
||||
cy.addWallet('Ghost wallet', 'segwit', false, false, 'btc', 'singlesig', 'DIY ghost')
|
||||
}
|
||||
cy.get('#pdf-wallet-download').click()
|
||||
cy.readFile(`./cypress/downloads/ghost_wallet_backup.pdf`)
|
||||
cy.get('[data-cy="new-wallet-added-overlay-close-btn"]').click()
|
||||
cy.mine2wallet('btc')
|
||||
})
|
||||
})
|
||||
|
||||
it('has downloadable artifacts', () => {
|
||||
cy.selectWallet('Ghost wallet')
|
||||
cy.get('#btn_settings').click()
|
||||
cy.contains("DIY ghost")
|
||||
|
||||
cy.get('#btn_settings').click()
|
||||
cy.get('#advanced_settings_tab_btn').click()
|
||||
cy.contains("Import address labels")
|
||||
|
||||
cy.get('#export_settings_tab_btn').click()
|
||||
cy.get('#export_specter_format').click()
|
||||
cy.readFile(`./cypress/downloads/Ghost wallet.json`)
|
||||
|
||||
cy.get('#pdf-wallet-download').click()
|
||||
cy.readFile(`./cypress/downloads/ghost_wallet_backup.pdf`)
|
||||
|
||||
cy.get('#pdf-paperxpub-download').click()
|
||||
cy.readFile(`./cypress/downloads/ghost_wallet_uj_backup.pdf`)
|
||||
|
||||
cy.get('#electrum_export').click()
|
||||
cy.readFile(`./cypress/downloads/ghost_wallet_electrum.backup`)
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ describe('Test the UI related to a blockchain rescan', () => {
|
|||
it('Go to the rescan section from a fresh wallet', () => {
|
||||
// Create a completely fresh wallet without any funds
|
||||
cy.addDevice('Trezor hold', 'Trezor', 'hold_accident')
|
||||
cy.addWallet('Fresh wallet', 'segwit', false, 'btc', 'singlesig', 'Trezor hold')
|
||||
cy.addWallet('Fresh wallet', 'segwit', false, true, 'btc', 'singlesig', 'Trezor hold')
|
||||
cy.get('#btn_transactions').click()
|
||||
cy.get('#go-to-rescan-btn').click()
|
||||
cy.get('#blockchain-rescan').should('be.visible')
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ describe('Test sending transactions', () => {
|
|||
|
||||
it('Send a standard transaction', () => {
|
||||
cy.addHotDevice("Hot Device 1","bitcoin")
|
||||
cy.addWallet('Test Hot Wallet 1', 'segwit', 'funded', 'btc', 'singlesig', 'Hot Device 1')
|
||||
cy.addWallet('Test Hot Wallet 1', 'segwit', 'funded', true, 'btc', 'singlesig', 'Hot Device 1')
|
||||
cy.selectWallet("Test Hot Wallet 1")
|
||||
cy.get('#btn_send').click()
|
||||
cy.get('#recipient_0').find('#address').type("bcrt1qsj30deg0fgzckvlrn5757yk55yajqv6dqx0x7u", { force: true })
|
||||
|
|
@ -242,7 +242,7 @@ describe('Test sending transactions', () => {
|
|||
it('Send a transaction from a multisig wallet', () => {
|
||||
// We need a second hot wallet
|
||||
cy.addHotDevice("Hot Device 2","bitcoin")
|
||||
cy.addWallet('Test Multisig Wallet', 'segwit', 'funded', 'btc', 'multisig', 'Hot Device 1', 'Hot Device 2', 'DIY ghost')
|
||||
cy.addWallet('Test Multisig Wallet', 'segwit', 'funded', true, 'btc', 'multisig', 'Hot Device 1', 'Hot Device 2', 'DIY ghost')
|
||||
cy.selectWallet('Test Multisig Wallet')
|
||||
cy.get('#btn_send').click()
|
||||
cy.get('#recipient_0').find('#address').type("bcrt1qsj30deg0fgzckvlrn5757yk55yajqv6dqx0x7u", { force: true })
|
||||
|
|
|
|||
|
|
@ -137,14 +137,18 @@ Cypress.Commands.add("addHotWallet", (wallet_name, device_name, node_type, walle
|
|||
})
|
||||
})
|
||||
|
||||
Cypress.Commands.add("addWallet", (walletName, walletType, funded, nodeType, keyType, deviceNameOne, deviceNameTwo, deviceNameThree) => {
|
||||
Cypress.Commands.add("addWallet", (walletName, walletType, funded, closeOverlay, nodeType, keyType, deviceNameOne, deviceNameTwo, deviceNameThree) => {
|
||||
if (walletType == null) {
|
||||
walletType = "segwit"
|
||||
}
|
||||
if (closeOverlay == null) {
|
||||
closeOverlay = true
|
||||
}
|
||||
if (deviceNameOne == null) {
|
||||
deviceNameOne = "DIY ghost"
|
||||
}
|
||||
cy.get('body').then(($body) => {
|
||||
var walletAlias = walletName.toLowerCase().replace(/ /g,"_")
|
||||
if ($body.text().includes(walletName)) {
|
||||
return
|
||||
}
|
||||
|
|
@ -181,7 +185,9 @@ Cypress.Commands.add("addWallet", (walletName, walletType, funded, nodeType, key
|
|||
}
|
||||
cy.get('[data-cy="create-wallet-btn"]').click()
|
||||
cy.get('[data-cy="new-wallet-added-headline"]')
|
||||
cy.get('[data-cy="new-wallet-added-overlay-close-btn"]').click()
|
||||
if (closeOverlay) {
|
||||
cy.get('[data-cy="new-wallet-added-overlay-close-btn"]').click()
|
||||
}
|
||||
if (funded) {
|
||||
cy.mine2wallet(nodeType)
|
||||
}
|
||||
|
|
|
|||
BIN
src/cryptoadvance/specter/static/fonts/RobotoMono-Bold.ttf
Normal file
BIN
src/cryptoadvance/specter/static/fonts/RobotoMono-Bold.ttf
Normal file
Binary file not shown.
BIN
src/cryptoadvance/specter/static/fonts/RobotoMono-Regular.ttf
Normal file
BIN
src/cryptoadvance/specter/static/fonts/RobotoMono-Regular.ttf
Normal file
Binary file not shown.
|
|
@ -57,7 +57,7 @@
|
|||
currentHeight = 20;
|
||||
}
|
||||
|
||||
let qrCode = document.getElementById('export-wallet-qr-code').shadowRoot.childNodes[3].children[1].children[1].src;
|
||||
let qrCode = document.getElementById('export-wallet-qr-code').el.children[1].src;
|
||||
doc.addImage(qrCode, 'PNG', 55, currentHeight, 100, 100)
|
||||
currentHeight += 110;
|
||||
|
||||
|
|
@ -180,7 +180,7 @@
|
|||
doc.setFontSize(18);
|
||||
doc.setFont("Roboto", "normal");
|
||||
|
||||
let qrCode = document.getElementById('export-wallet-qr-code').shadowRoot.childNodes[3].children[1].children[1].src;
|
||||
let qrCode = document.getElementById('export-wallet-qr-code').el.children[1].src;
|
||||
doc.addImage(qrCode, 'PNG', 5, currentHeight, 30, 30)
|
||||
doc.text({{ wallet.name | tojson | safe }}.replace(/(.{55})/g, "$1\n"), 105, currentHeight, {align: 'center'});
|
||||
doc.setFontSize(9);
|
||||
|
|
@ -202,7 +202,7 @@
|
|||
for (var row = 0; row <=3 ; row++) {
|
||||
let offset = 5
|
||||
for (var i = 1+row*6; i <= (row+1)*6; i++) {
|
||||
let addressqr = document.getElementById('address'+i).shadowRoot.childNodes[3].children[1].children[1].src;
|
||||
let addressqr = document.getElementById('address'+i).el.children[1].src;
|
||||
let address = wallet_addresses[i]
|
||||
doc.addImage(addressqr, 'PNG', offset, currentHeight, qr_size, qr_size)
|
||||
doc.text("[ ]", offset + qr_size +2, currentHeight + 3, {align: 'left'} )
|
||||
|
|
@ -251,7 +251,7 @@
|
|||
doc.text('{{ _("As this is a regtest-wallet, the addresses in") }}', 80, 205, {"angle": 10});
|
||||
doc.text('{{ _("the three rows are not usable and missing 2 chars.") }}', 80, 210, {"angle": 10});
|
||||
{% endif %}
|
||||
doc.save(({{ wallet.name.lower() | tojson | safe }} + "_backup.pdf").replace(" ", '_'));
|
||||
doc.save(({{ wallet.name.lower() | tojson | safe }} + "_uj_backup.pdf").replace(" ", '_'));
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue