mirror of
https://github.com/cryptoadvance/specter-desktop.git
synced 2026-08-13 12:33:29 +02:00
cypress tests: wallet utxo (part 2)
This commit is contained in:
parent
0f2e445e8b
commit
876856bbdb
2 changed files with 34 additions and 35 deletions
|
|
@ -2,8 +2,8 @@
|
|||
describe('Test the actions in UTXO list', () => {
|
||||
|
||||
before(() => {
|
||||
cy.viewport(1200,660)
|
||||
cy.visit('/')
|
||||
cy.viewport(1200,660)
|
||||
Cypress.config('includeShadowDom', true)
|
||||
const device_name = "UTXO device"
|
||||
const wallet_name = "UTXO wallet"
|
||||
|
|
@ -11,17 +11,21 @@ describe('Test the actions in UTXO list', () => {
|
|||
cy.addHotWallet(wallet_name, device_name, "bitcoin", "segwit")
|
||||
cy.get('#fullbalance_amount').then(($span) => {
|
||||
const balance = parseFloat($span.text())
|
||||
if (balance <= 20) {
|
||||
cy.log("balance " + balance + " too low. Mining!")
|
||||
if (balance === 20) {
|
||||
cy.mine2wallet("btc")
|
||||
cy.mine2wallet("btc")
|
||||
// We are having 3 UTXO in the end (addHotWallet creates one automatically)
|
||||
}
|
||||
else {
|
||||
return
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
// Keeps the session cookie alive, Cypress by default clears all cookies before each test
|
||||
beforeEach(() => {
|
||||
cy.visit('/')
|
||||
cy.viewport(1200,660)
|
||||
Cypress.Cookies.preserveOnce('session')
|
||||
})
|
||||
|
||||
|
|
@ -67,8 +71,7 @@ describe('Test the actions in UTXO list', () => {
|
|||
cy.selectWallet('UTXO wallet')
|
||||
cy.get('[data-cy="utxo-list-btn"]').click()
|
||||
cy.wait(500)
|
||||
// Make a transaction with the first UTXO in the list
|
||||
// Unfreeze it
|
||||
// Unfreeze the first UTXO in the list (Address #2) and try to make a transaction with it
|
||||
cy.get('tx-table').find('tx-row').eq(0).find('.select-tx-img').click( {position: 'top'} )
|
||||
cy.wait(100)
|
||||
cy.get('tx-table').find('.freeze-tx-btn').click()
|
||||
|
|
@ -88,9 +91,13 @@ describe('Test the actions in UTXO list', () => {
|
|||
// Make an unsigned tx
|
||||
cy.selectWallet('UTXO wallet')
|
||||
cy.get('#btn_send').click()
|
||||
cy.get('[data-cy="coin-selection-toggle"]').click()
|
||||
// Let's select the first UTXO (which is the second one here since the frozen output isn't included in the returned array from Cypress)
|
||||
cy.get('[data-cy="selectable-utxo-checkbox"]').eq(1).click();
|
||||
cy.get('[data-cy="coin-selection-toggle"]').click()
|
||||
// Make an alias of the tx row with Address #0 label
|
||||
cy.get('address-label[data-label="Address #0"]').closest('tr').as('unsignedTxRow')
|
||||
cy.get('address-label[data-label="Address #1"]').closest('tr').as('frozenTxRow')
|
||||
cy.get('address-label[data-label="Address #2"]').closest('tr').as('normalTxRow')
|
||||
// Select this UTXO in the coin selection
|
||||
cy.get('@unsignedTxRow').find('[data-cy="selectable-utxo-checkbox"]').click()
|
||||
cy.get('#recipient_0').find('#address').type("bcrt1qvtdx75y4554ngrq6aff3xdqnvjhmct5wck95qs") // address from "Ghost wallet"
|
||||
cy.get('#recipient_0').get('#send_max').click()
|
||||
cy.get('#create_psbt_btn').click()
|
||||
|
|
@ -98,38 +105,30 @@ describe('Test the actions in UTXO list', () => {
|
|||
cy.get('#btn_transactions').click()
|
||||
cy.wait(1000)
|
||||
cy.get('[data-cy="utxo-list-btn"]').click()
|
||||
cy.get('tx-table').find('tx-row').find('#column-category').eq(2).should('contain', 'Unsigned')
|
||||
cy.get('@unsignedTxRow').should('contain', 'Unsigned')
|
||||
// Check that only the checkbox of the unsigned UTXO are visible if it is selected
|
||||
cy.get('tx-table').find('tx-row').eq(2).find('.select-tx-img').click( {position: 'top'} )
|
||||
cy.get('@unsignedTxRow').find('.select-tx-img').click( {position: 'top'} )
|
||||
cy.get('@unsignedTxRow').find('.select-tx-img').should('be.visible')
|
||||
cy.get('@frozenTxRow').find('.select-tx-img').should('be.hidden')
|
||||
cy.get('@normalTxRow').find('.select-tx-img').should('be.hidden')
|
||||
// Unselect the UTXO again and check that all checkboxes are visible and none are selected
|
||||
cy.get('@unsignedTxRow').find('.select-tx-img').click( {position: 'top'} )
|
||||
cy.get('tx-table').find('tx-row').each(($el, index, $list) => {
|
||||
if (index == 0 || index == 1) {
|
||||
cy.wrap($el).find('.tx-row').find('.select-tx-img').should('be.hidden').should('have.attr', 'src').and('contain', 'untick')
|
||||
}
|
||||
cy.wrap($el).find('.tx-row').find('.select-tx-img').should('be.visible')
|
||||
})
|
||||
// Unselect the third UTXO again and check that all checkboxes are visible and none are selected
|
||||
cy.get('tx-table').find('tx-row').eq(2).find('.select-tx-img').click( {position: 'top'} )
|
||||
cy.get('tx-table').find('tx-row').each(($el, index, $list) => {
|
||||
cy.wrap($el).find('.tx-row').find('.select-tx-img').should('not.be.hidden')
|
||||
})
|
||||
// Select a normal UTXO, select an unsigned UTXO and then unselect the unsigned again
|
||||
cy.get('tx-table').find('tx-row').eq(0).find('.select-tx-img').click( {position: 'top'} )
|
||||
cy.get('tx-table').find('tx-row').eq(0).find('.select-tx-value').invoke('attr', 'value').should('eq', 'true')
|
||||
cy.wait(100)
|
||||
cy.get('tx-table').find('tx-row').eq(2).find('.select-tx-img').click( {position: 'top'} )
|
||||
cy.get('tx-table').find('tx-row').eq(2).find('.select-tx-value').invoke('attr', 'value').should('eq', 'true')
|
||||
cy.wait(100)
|
||||
cy.get('tx-table').find('tx-row').eq(2).find('.select-tx-img').click( {position: 'top'} )
|
||||
cy.get('tx-table').find('tx-row').eq(2).find('.select-tx-value').invoke('attr', 'value').should('eq', '')
|
||||
cy.wait(100)
|
||||
// Select a normal UTXO and select an unsigned UTXO, then check that the checkbox for the normal UTXO is hidden
|
||||
cy.get('@normalTxRow').find('.select-tx-img').click()
|
||||
cy.get('@unsignedTxRow').find('.select-tx-img').click( {position: 'top'} )
|
||||
cy.get('@normalTxRow').find('.select-tx-img').should('be.hidden')
|
||||
// Unselect the unsigned UTXO again
|
||||
cy.get('@unsignedTxRow').find('.select-tx-img').click( {position: 'top'} )
|
||||
// Check that all checkboxes are visible again and none are selected
|
||||
cy.get('tx-table').find('tx-row').each(($el, index, $list) => {
|
||||
cy.wrap($el).find('[data-cy="select-img-for-utxo-actions"]').should('be.visible')
|
||||
cy.get('tx-table').find('tr.tx-row').each(($el) => {
|
||||
cy.wrap($el).find('[data-cy="checkbox-utxo-actions"]').should('be.visible')
|
||||
})
|
||||
// Check that the manage PSBT button is working
|
||||
cy.get('tx-table').find('tx-row').eq(2).find('.select-tx-img').click( {position: 'top'} )
|
||||
cy.wait(100)
|
||||
cy.get('tx-table').find('#manage-psbt-btn').should('not.be.hidden').click()
|
||||
cy.wait(200)
|
||||
cy.get('@unsignedTxRow').find('.select-tx-img').click( {position: 'top'} )
|
||||
cy.get('tx-table').find('#manage-psbt-btn').should('be.visible').click()
|
||||
cy.contains("Here you can manage PSBTs")
|
||||
})
|
||||
})
|
||||
|
|
@ -115,7 +115,7 @@
|
|||
<td class="hidden optional blockhash"></td>
|
||||
<td id="column-action" class="highlight-box">
|
||||
<input class="select-tx-value" type="hidden" value="">
|
||||
<img data-style="vertical-align: middle;" class="select-tx-img" src="{{ url_for('static', filename='img/checkbox-untick.svg') }}" width="25px" data-cy="select-img-for-utxo-actions">
|
||||
<img data-style="vertical-align: middle;" class="select-tx-img" src="{{ url_for('static', filename='img/checkbox-untick.svg') }}" width="25px" data-cy="checkbox-utxo-actions">
|
||||
<div data-style="display: flex; justify-content: center; align-items: center; flex-wrap: wrap;">
|
||||
<button class="rbf btn optional hidden" data-style="width: 130px; margin: 2px;" type="button">{{ _("Speed up") }}</button>
|
||||
<button class="rbf-cancel danger btn optional hidden" data-style="width: 130px; margin: 2px;" type="button">{{ _("Cancel transaction") }}</button>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue