Skip to content

Commit

Permalink
[DDW-931] Import wallet with funds for E2E tests purposes (#1579)
Browse files Browse the repository at this point in the history
* [DDW-931] Introduce import wallet with funds E2E helper

* Remove unnecessary @watch flag

* Run prettier

* Remove faked data from createWallet utils script

* [DDW-931] CHANGELOG update

* [DDW-931] E2E failing tests improvements

* [DDW-931] Small code cleanup and removing unnecessary @watch flag

* [DDW-931] Code cleanup

* [DDW-931] Code cleanup

* [DDW-931] Update tests

* [DDW-931] Invalid Address while calculating transaction fee error handler improvement

* [DDW-931] Improve E2E test addresses list scroll and used address recognition

* [DDW-931] Fix failing E2E test

* [DDW-931] Code cleanup
  • Loading branch information
Tomislav Horaček authored and nikolaglumac committed Oct 17, 2019
1 parent a7855f9 commit d25a235
Show file tree
Hide file tree
Showing 42 changed files with 200 additions and 263 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Expand Up @@ -7,7 +7,7 @@ Changelog

- Add "frontend-only" mode utility that has no dependency on nix ([PR 1583](https://github.com/input-output-hk/daedalus/pull/1583))
- Added Jormungandr support for Cardano V2 API ([PR 1567](https://github.com/input-output-hk/daedalus/pull/1567)
- Integrated Cardano V2 API endpoints ([PR 1548](https://github.com/input-output-hk/daedalus/pull/1548), [PR 1551](https://github.com/input-output-hk/daedalus/pull/1551), [PR 1552](https://github.com/input-output-hk/daedalus/pull/1552), [PR 1553](https://github.com/input-output-hk/daedalus/pull/1553), [PR 1555](https://github.com/input-output-hk/daedalus/pull/1555), [PR 1556](https://github.com/input-output-hk/daedalus/pull/1556), [PR 1557](https://github.com/input-output-hk/daedalus/pull/1557), [PR 1558](https://github.com/input-output-hk/daedalus/pull/1558), [PR 1559](https://github.com/input-output-hk/daedalus/pull/1559), [PR 1560](https://github.com/input-output-hk/daedalus/pull/1560), [PR 1575](https://github.com/input-output-hk/daedalus/pull/1575), [PR 1577](https://github.com/input-output-hk/daedalus/pull/1577))
- Integrated Cardano V2 API endpoints ([PR 1548](https://github.com/input-output-hk/daedalus/pull/1548), [PR 1551](https://github.com/input-output-hk/daedalus/pull/1551), [PR 1552](https://github.com/input-output-hk/daedalus/pull/1552), [PR 1553](https://github.com/input-output-hk/daedalus/pull/1553), [PR 1555](https://github.com/input-output-hk/daedalus/pull/1555), [PR 1556](https://github.com/input-output-hk/daedalus/pull/1556), [PR 1557](https://github.com/input-output-hk/daedalus/pull/1557), [PR 1558](https://github.com/input-output-hk/daedalus/pull/1558), [PR 1559](https://github.com/input-output-hk/daedalus/pull/1559), [PR 1560](https://github.com/input-output-hk/daedalus/pull/1560), [PR 1575](https://github.com/input-output-hk/daedalus/pull/1575), [PR 1577](https://github.com/input-output-hk/daedalus/pull/1577), [PR 1579](https://github.com/input-output-hk/daedalus/pull/1579))

## 0.15.0

Expand Down
2 changes: 1 addition & 1 deletion features/add-wallet-via-sidebar.feature
Expand Up @@ -5,7 +5,7 @@ Feature: Add Wallet via Sidebar
Given I have completed the basic setup
And I have the following wallets:
| name |
| Test wallet |
| Test Wallet |

Scenario: Successfully Adding a Wallet with spending password
Given The sidebar shows the "wallets" category
Expand Down
3 changes: 2 additions & 1 deletion features/app-version-difference.feature
@@ -1,4 +1,5 @@
@e2e
@e2e @skip
# @API TODO - we don't have API endpoint for app update check
Feature: Manual Software Update Overlay

Background:
Expand Down
3 changes: 2 additions & 1 deletion features/block-consolidation-page.feature
@@ -1,4 +1,5 @@
@e2e
@e2e @skip
# @API TODO - Rust node stores block data in a different directory so this has to be handled first
Feature: Display Block Consolidation Page

Background:
Expand Down
6 changes: 3 additions & 3 deletions features/delete-wallet-via-settings.feature
Expand Up @@ -5,13 +5,13 @@ Feature: Delete Wallet via Settings
Given I have completed the basic setup
And I have the following wallets:
| name |
| Test wallet |
| Test Wallet |

Scenario: Successfully Deleting a Wallet
Given I am on the "Test wallet" wallet "settings" screen
Given I am on the "Test Wallet" wallet "settings" screen
When I click on delete wallet button
And I see delete wallet dialog
And I click on the "Make sure you have access to backup before continuing" checkbox
And I enter "Test wallet" as name of the wallet to confirm
And I enter "Test Wallet" as name of the wallet to confirm
And I submit the delete wallet dialog
Then I should not see the delete wallet dialog anymore
18 changes: 8 additions & 10 deletions features/import-wallet-via-sidebar.feature
@@ -1,13 +1,13 @@
@e2e
@e2e @skip
# @API TODO - We don't have API endpoint for import wallet from key
Feature: Import Wallet via Sidebar

Background:
Given I have completed the basic setup
And I have the following wallets:
| name |
| Test wallet |
| Test Wallet |

@skip
Scenario: Successfully Importing a Wallet
Given The sidebar shows the "wallets" category
When I click on the add wallet button in the sidebar
Expand All @@ -17,18 +17,16 @@ Feature: Import Wallet via Sidebar
And I select a valid wallet import key file
And I click on the import wallet button in import wallet dialog
Then I should not see the import wallet dialog anymore
And I should have newly created "Imported Wallet" wallet loaded
And I should be on the "Imported Wallet" wallet "summary" screen
And I should have newly created "Test Wallet" wallet loaded
And I should be on the "Test Wallet" wallet "summary" screen
And I should see the restore status notification while import is running
And I should not see the restore status notification once import is finished

@skip
Scenario: Wallet Already Imported Error
Given I have a "Imported Wallet" with funds
Given I have a "Test Wallet" wallet with funds
When I try to import the wallet with funds again
Then I see the import wallet dialog with an error that the wallet already exists

@skip
Scenario: Successfully Importing a Wallet with spending password
Given The sidebar shows the "wallets" category
When I click on the add wallet button in the sidebar
Expand All @@ -43,7 +41,7 @@ Feature: Import Wallet via Sidebar
| Secret1234 | Secret1234 |
And I click on the import wallet button in import wallet dialog
Then I should not see the import wallet dialog anymore
And I should have newly created "Imported Wallet" wallet loaded
And I should be on the "Imported Wallet" wallet "summary" screen
And I should have newly created "Test Wallet" wallet loaded
And I should be on the "Test Wallet" wallet "summary" screen
And I should see the restore status notification while import is running
And I should not see the restore status notification once import is finished
3 changes: 2 additions & 1 deletion features/local-time-difference.feature
@@ -1,4 +1,5 @@
@e2e
@e2e @skip
# @API TODO - We don't have API endpoint for NTP check
Feature: Local Time Difference

Scenario: Wrong local time
Expand Down
2 changes: 1 addition & 1 deletion features/navigate-general-settings-menu.feature
Expand Up @@ -5,7 +5,7 @@ Feature: General Settings
Given I have completed the basic setup
And I have the following wallets:
| name |
| Test wallet |
| Test Wallet |

Scenario Outline: Navigating through General Settings secondary menu
Given I am on the General Settings "<FROM>" screen
Expand Down
6 changes: 3 additions & 3 deletions features/navigate-sidebar-categories.feature
Expand Up @@ -5,7 +5,7 @@ Feature: Navigate Sidebar Categories
Given I have completed the basic setup
And I have the following wallets:
| name |
| Test wallet |
| Test Wallet |

Scenario Outline: Navigate Between Sidebar Categories
Given The sidebar shows the "<FROM>" category
Expand All @@ -18,7 +18,7 @@ Feature: Navigate Sidebar Categories
| settings | wallets |

Scenario: Navigate from a Wallet to Settings screen
Given I am on the "Test wallet" wallet "summary" screen
Given I am on the "Test Wallet" wallet "summary" screen
And The sidebar shows the "wallets" category
When I click on the "settings" category in the sidebar
Then I should be on the "settings/general" screen
Expand All @@ -28,4 +28,4 @@ Feature: Navigate Sidebar Categories
And The sidebar shows the "settings" category
When I click on the "wallets" category in the sidebar
Then The "wallets" category should be active
But I should be on the "Test wallet" wallet "summary" screen
But I should be on the "Test Wallet" wallet "summary" screen
6 changes: 4 additions & 2 deletions features/newsfeed.feature
Expand Up @@ -9,12 +9,14 @@ Feature: Newsfeed
Background:
Given I have completed the basic setup

@reconnectApp
@reconnectApp @skip
# @API TODO - We don't have network api endpoint
Scenario: Newsfeed icon is visible on the connecting screen
Given im on the connecting screen
Then i should see the newsfeed icon

@reconnectApp
@reconnectApp @skip
# @API TODO - We don't have network api endpoint
Scenario: Newsfeed icon is visible on the syncing screen
Given im on the syncing screen
Then i should see the newsfeed icon
Expand Down
7 changes: 4 additions & 3 deletions features/node-update-exit.feature
@@ -1,4 +1,5 @@
@e2e
@e2e @skip
# @API TODO - We don't have app update endpoints
Feature: Node Update Exit

Background:
Expand All @@ -15,15 +16,15 @@ Feature: Node Update Exit

# TODO: clarify what should happen when cardano exits with wrong code!
# Currently Daedalus thinks that cardano-node crashed and restarts it …
@skip @slow @restartApp
@slow @restartApp @skip
Scenario: apply-update endpoint triggered, and node exits with wrong exit code, that's still handled
When I inject fault named "FInjApplyUpdateWrongExitCode"
When I trigger the apply-update endpoint
Then I should see the loading screen with "Updating Cardano node"
And Daedalus should quit

# TODO: Daedalus doesn't handle ignored api calls atm
@skip @slow @restartApp
@slow @restartApp @skip
Scenario: apply-update endpoint triggered, and node ignores the endpoint call, that's still handled
Given Daedalus is running
And cardano-node is running
Expand Down
11 changes: 6 additions & 5 deletions features/paper-wallets-certificate.feature
@@ -1,9 +1,10 @@
@e2e
@e2e @skip
# @API TODO - We don't have API endpoint for paper wallets and whole feature existence needs to be discussed
Feature: Paper Wallets Certificate generation

Background:
Given I have completed the basic setup
And I have a "Imported Wallet" with funds
And I have a "Test wallet" wallet with funds

Scenario: Paper wallets certificate success generation
Given The sidebar shows the "wallets" category
Expand All @@ -25,16 +26,16 @@ Feature: Paper Wallets Certificate generation
And Cardano explorer link and wallet address should be valid
And I click on the finish button
And I should not see the create paper wallet certificate dialog anymore
When I click on the "Imported Wallet" wallet in the sidebar
And I am on the "Imported Wallet" wallet "send" screen
When I click on the "Test wallet" wallet in the sidebar
And I am on the "Test wallet" wallet "send" screen
And I fill out the send form:
| amount |
| 0.000010 |
And the transaction fees are calculated
And I click on the next button in the wallet send form
And I see send money confirmation dialog
And I submit the wallet send form
Then I should be on the "Imported Wallet" wallet "summary" screen
Then I should be on the "Test wallet" wallet "summary" screen
And the latest transaction should show:
| title | amountWithoutFees |
| wallet.transaction.sent | -0.000010 |
Expand Down
3 changes: 2 additions & 1 deletion features/quit-app.feature
Expand Up @@ -12,7 +12,8 @@ Feature: Quitting Daedalus
Then cardano-node process is not running
And Daedalus process is not running

@slow @restartApp
@slow @restartApp @skip
# @API TODO - New wallet backend doesn't support fault injection
Scenario: Closing the main window, while cardano ignores exit request
Given Daedalus is running
And cardano-node is running
Expand Down
26 changes: 7 additions & 19 deletions features/receive-money.feature
Expand Up @@ -3,28 +3,16 @@ Feature: Receive money

Background:
Given I have completed the basic setup
And I have a "Imported Wallet" with funds
And I have a "Test Wallet" wallet with funds
And I have the following wallets:
| name |
| TargetWallet |
| name |
| Target Wallet |

Scenario: Hide/show used addresses
Given I am on the "TargetWallet" wallet "receive" screen
And I generate 1 addresses
Given I am on the "Target Wallet" wallet "receive" screen
And I have made the following transactions:
| source | destination | amount |
| Imported Wallet | TargetWallet | 1 |
Then I should see 2 addresses
| source | destination | amount |
| Test Wallet | Target Wallet | 1 |
And I should see 1 used addresses
When I click the ShowUsed switch
Then I should see 1 addresses

Scenario: Addresses ordering
Given I am on the "TargetWallet" wallet "receive" screen
And I generate 2 addresses
Then I should see the following addresses:
| ClassName |
| generatedAddress-1 |
| generatedAddress-2 |
| generatedAddress-3 |
And The active address should be the newest one
Then I should see 20 addresses
2 changes: 1 addition & 1 deletion features/restore-wallet-via-sidebar.feature
Expand Up @@ -5,7 +5,7 @@ Feature: Add Wallet via Sidebar
Given I have completed the basic setup
And I have the following wallets:
| name |
| Test wallet |
| Test Wallet |

Scenario: Successfully Restoring a Wallet with spending password
Given The sidebar shows the "wallets" category
Expand Down
29 changes: 6 additions & 23 deletions features/send-money-to-receiver.feature
Expand Up @@ -8,27 +8,8 @@ Feature: Send Money to Receiver
| first |

Scenario: User Sends Money to Receiver
Given I have a "Imported Wallet" with funds
And I am on the "Imported Wallet" wallet "send" screen
And I can see the send form
When I fill out the send form with a transaction to "first" wallet:
| amount |
| 0.000010 |
And the transaction fees are calculated
And I click on the next button in the wallet send form
And I see send money confirmation dialog
And I submit the wallet send form
Then I should be on the "Imported Wallet" wallet "summary" screen
And the latest transaction should show:
| title | amountWithoutFees |
| wallet.transaction.sent | -0.000010 |
And the balance of "first" wallet should be:
| balance |
| 0.000010 |

Scenario: User Sends Money from wallet with spending password to Receiver
Given I have a "Imported Wallet" with funds and password
And I am on the "Imported Wallet" wallet "send" screen
Given I have a "Test Wallet" wallet with funds
And I am on the "Test Wallet" wallet "send" screen
And I can see the send form
When I fill out the send form with a transaction to "first" wallet:
| amount |
Expand All @@ -38,7 +19,7 @@ Feature: Send Money to Receiver
And I see send money confirmation dialog
And I enter wallet spending password in confirmation dialog "Secret1234"
And I submit the wallet send form
Then I should be on the "Imported Wallet" wallet "summary" screen
Then I should be on the "Test Wallet" wallet "summary" screen
And the latest transaction should show:
| title | amountWithoutFees |
| wallet.transaction.sent | -0.000010 |
Expand All @@ -48,15 +29,17 @@ Feature: Send Money to Receiver

Scenario: User Enters Wrong Receiver Address
Given I am on the "first" wallet "send" screen
And I can see the send form
When I fill out the wallet send form with:
| address | amount |
| invalid | 0.000010 |
Then I should see the following error messages on the wallet send form:
| message |
| wallet.send.form.errors.invalidAddress |
| api.errors.invalidAddress |

Scenario Outline: User Enters Wrong Amount
Given I am on the "first" wallet "send" screen
And I can see the send form
When I fill out the send form with a transaction to "first" wallet:
| title | amount |
| my transaction | <WRONG_AMOUNT> |
Expand Down
14 changes: 0 additions & 14 deletions features/tests/e2e/documents/default-wallet.json

This file was deleted.

Binary file removed features/tests/e2e/documents/default-wallet.key
Binary file not shown.
Empty file.
36 changes: 17 additions & 19 deletions features/tests/e2e/helpers/wallets-helpers.js
Expand Up @@ -73,25 +73,23 @@ export const addOrSetWalletsForScenario = function(wallet) {
}
};

export const importWalletWithFunds = async (
client,
{ keyFilePath, password }
) =>
client.executeAsync(
(filePath, spendingPassword, done) => {
daedalus.api.ada
.importWalletFromKey({ filePath, spendingPassword })
.then(() =>
daedalus.stores.wallets
.refreshWalletsData()
.then(done)
.catch(error => done(error))
)
.catch(error => done(error));
},
keyFilePath,
password
);
export const restoreWalletWithFunds = async (client, { walletName }) =>
client.executeAsync((name, done) => {
daedalus.api.ada
.restoreWallet({
walletName: name,
recoveryPhrase:
'pass proud clarify cargo control fancy question option bring recall dolphin meat comic version pitch',
spendingPassword: 'Secret1234',
})
.then(() =>
daedalus.stores.wallets
.refreshWalletsData()
.then(done)
.catch(error => done(error))
)
.catch(error => done(error));
}, walletName);

const createWalletsAsync = async (table, context) => {
const result = await context.client.executeAsync((wallets, done) => {
Expand Down

0 comments on commit d25a235

Please sign in to comment.