Skip to content

Automated Tests to cover Stake Pool Settings and Wallet Currency Display Settings screens #2622

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 54 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
bd3a212
Added tests for Stake-pool Settings and Wallet Currency Display Settings
ManusMcCole Jul 14, 2021
57bee26
Deleted old comments and unneeded timeout
ManusMcCole Jul 14, 2021
8d51456
Fixing typo in stakepool-settings.feature that was preventing code fr…
ManusMcCole Jul 14, 2021
7e43bdd
Minor Code reorganising
ManusMcCole Jul 14, 2021
27f3f13
Merge branch 'develop' into chore/manus-automation
ManusMcCole Jul 14, 2021
45593b2
Minor Code reorganisation
ManusMcCole Jul 14, 2021
7eb5338
Correcting lint spelling errors
ManusMcCole Jul 14, 2021
7788106
Added entry to CHANGELOG.md
ManusMcCole Jul 14, 2021
f822ed5
Adding an extra feature step to improve code reliability
ManusMcCole Jul 14, 2021
f26c24d
Added link to CHANGELOG.md
ManusMcCole Jul 14, 2021
96bb304
Some code review code improvements
ManusMcCole Jul 16, 2021
c07285e
Added PR number to CHANGELOG.md
ManusMcCole Jul 19, 2021
579f202
Code review enhancements
ManusMcCole Jul 19, 2021
7dbcd18
Merge branch 'develop' into chore/manus-automation
ManusMcCole Jul 19, 2021
fe946ab
Added new custom error messages "The url should start with" and "prot…
ManusMcCole Jul 22, 2021
14214a2
Resaving changes
ManusMcCole Jul 22, 2021
9ba9b73
Added template literals for all embedded expressions
ManusMcCole Jul 23, 2021
e429627
Removed @watch annotation
ManusMcCole Jul 23, 2021
daf2d09
Minor code improvements
ManusMcCole Jul 29, 2021
3f3adc1
Adding ternary operators
ManusMcCole Aug 4, 2021
c880921
Removed Watch Flags
ManusMcCole Aug 4, 2021
2a678ae
Created constant SERVER_URL
ManusMcCole Aug 4, 2021
00fce2a
Removed step I clicked outside of the input-box to change focus
ManusMcCole Aug 4, 2021
f5f4dc7
Merge branch 'develop' into chore/manus-automation
thedanheller Aug 5, 2021
3501c5a
Updating stakepool-settings.feature
ManusMcCole Aug 5, 2021
0f68d01
Code improvements
ManusMcCole Aug 5, 2021
f3df743
Updated CHANGELOG.MD entry to vNext category
ManusMcCole Aug 16, 2021
e30e36f
Deleted file __tests__/numbers.specs.js
ManusMcCole Aug 16, 2021
41c342e
Merge branch 'develop' into chore/manus-automation
nikolaglumac Aug 23, 2021
6284b6c
Reorder CHANGELOG
nikolaglumac Aug 23, 2021
e1b67fb
Importing Daedalus text and labels from file en-US.json
ManusMcCole Aug 24, 2021
3d6c606
Merge branch 'develop' into chore/manus-automation
ManusMcCole Aug 24, 2021
1dcbe14
Merge remote-tracking branch 'origin/chore/manus-automation' into cho…
ManusMcCole Aug 24, 2021
37d678b
Added 'Your changes have been saved' success message from en-US.json …
ManusMcCole Aug 30, 2021
da08491
Removed @watch flags
ManusMcCole Aug 30, 2021
5091d6a
Merge branch 'develop' into chore/manus-automation
ManusMcCole Aug 30, 2021
671f211
Readding entry to CHANGELOG.md
ManusMcCole Aug 30, 2021
bb44af7
Merge branch 'develop' into chore/manus-automation
ManusMcCole Sep 3, 2021
b97a867
Merges develop
nikolaglumac Sep 13, 2021
fb3d023
Updating constant name for linking to en-US.json' file
ManusMcCole Sep 13, 2021
56a4dc8
Merge branch 'develop' into chore/manus-automation
nikolaglumac Sep 14, 2021
9132303
Merge branch 'develop' into chore/manus-automation
ManusMcCole Sep 20, 2021
ff47a9e
Upgraded cucumber and spectron
danielmain Sep 21, 2021
b3d951c
Fix wrong path for starting electron
danielmain Sep 21, 2021
a54f6e3
Code refactor.Adding condition for testnet
ManusMcCole Sep 21, 2021
a20c465
Merge remote-tracking branch 'origin/chore/manus-automation' into cho…
ManusMcCole Sep 21, 2021
9c723b9
Minor formatting
ManusMcCole Sep 21, 2021
f5aee02
Starting Spectron like the official documentation suggests
danielmain Sep 22, 2021
b5dced4
Merge branch 'develop' into chore/manus-automation
ManusMcCole Sep 28, 2021
88970fb
Merges develop
nikolaglumac Oct 21, 2021
a4335f2
Merge branch 'develop' into chore/manus-automation
ManusMcCole Oct 22, 2021
be36f43
Merge branch 'chore/manus-automation' of https://github.com/input-out…
ManusMcCole Oct 22, 2021
f668343
Merge branch 'develop' into chore/manus-automation
ManusMcCole Jan 25, 2022
fdcff17
Renamed all js files to ts
danielmain Jan 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Changelog
- Updated `cardano-wallet` to version `2021-08-11` which includes `cardano-node` alonzo-purple-1.0.1 ([PR 2641](https://github.com/input-output-hk/daedalus/pull/2641))
- Updated `cardano-wallet` to version `2021-07-30` which includes `cardano-node` 1.28.0 ([PR 2635](https://github.com/input-output-hk/daedalus/pull/2635), [PR 2638](https://github.com/input-output-hk/daedalus/pull/2638))
- Removed "Decentralization countdown" tada icon and info tab ([PR 2625](https://github.com/input-output-hk/daedalus/pull/2625))
- Added tests for currency display settings and stake-pool settings screens ([PR 2622](https://github.com/input-output-hk/daedalus/pull/2622))

## 4.2.1

Expand Down
32 changes: 32 additions & 0 deletions tests/settings/e2e/features/currency-display-settings.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
@e2e
Feature: Wallet currency display settings

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

Scenario Outline: User selects alternative currency's to display wallet balance
Given I am on the General Settings "wallets" screen
And I open currency selection dropdown
When I select "<currency>" as the selected displayed currency
And I am on the "Test Wallet" wallet "summary" screen
Then I should see "<ticker>" displayed beside wallet balance

Examples:
| currency | ticker |
| Litecoin | LTC |
| Stellar | XLM |

Scenario: User hits toggle button to show/not show ada wallet balance in other currency's
Given I am on the General Settings "wallets" screen
When I toggle the button off to change if I want to see my ada balance in other currency's
Then the currency selection box is hidden
And I am on the "Test Wallet" wallet "summary" screen
Then The wallet summary screen does not show ada balance in other currency's placeholder
When I am on the General Settings "wallets" screen
And I toggle the button on to change if I want to see my ada balance in other currency's
Then the currency selection box is visible
And I am on the "Test Wallet" wallet "summary" screen
Then The wallet summary screen does show ada balance in other currency's placeholder
34 changes: 34 additions & 0 deletions tests/settings/e2e/features/stakepool-settings.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
@e2e
Feature: Stake-pool server settings

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

Scenario: Navigating to Stake-pool settings screen and selecting custom stake-pool server
Given I am on the General Settings "stake-pools" screen
When custom server is the default option
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This step is not very clear. In case another option is selected, is it supposed to select the Custom option? If so, it should instead click the dropdown, then click the Custom option, rather than select the input element

And The smash server input textBox is visible
And And I enter a custom server URL as custom server option
And I focus the stake-pool custom server input box submit button and then click it
And I see the "Your changes have been saved" success message
And I am on the Delegation "stake-pools" screen
Then The custom server I chose earlier is visible on stake-pool screen above stake-pool list and is clickable
And I am brought back to the stake-pool server settings screen

Scenario: Verify stake-pool custom server text box is visible and error message verification
Given I am on the General Settings "stake-pools" screen
When I open stake pool server dropdown
And I select custom server option
Then The smash server input textBox is visible
And I enter invalid url "www.test" in to the custom server input-box
Then Stake-pool custom input box error message "https://" is displayed
And I delete values in smash server custom url input box
And I enter invalid url "https://test.com/path" in to the custom server input-box
Then Stake-pool custom input box error message "protocol and hostname" is displayed
And I delete values in smash server custom url input box
And I enter invalid server "https://www.google.ie" containing https
And I focus the stake-pool custom server input box submit button and then click it
Then I see the "This url is not a valid SMASH server" error message displayed
36 changes: 36 additions & 0 deletions tests/settings/e2e/steps/currency-display-settings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// @flow
import { When, Then } from 'cucumber';

const CONVERTED_CURRENCY_WALLET_DISPLAY_GENERAL = '//*[@class="WalletSummaryCurrency_currencyRate"]';
const DISPLAY_BALANCE_OTHER_CURRENCY_TOGGLE_STATUS_OFF = '//*[@class="SimpleSwitch_switch SwitchOverrides_switch"]';
const DISPLAY_BALANCE_OTHER_CURRENCY_TOGGLE_STATUS_ON = '//*[@class="NormalSwitch_component SimpleSwitch_root SwitchOverrides_root SimpleSwitch_checked SwitchOverrides_checked"]';
const SELECT_CURRENCY_DROPDOWN = '//*[@label="Select currency"]';

When(/^I open currency selection dropdown$/, function() {
return this.client.click(SELECT_CURRENCY_DROPDOWN);
});

When(/^I select "([^"]*)" as the selected displayed currency$/, function(currency) {
return this.client.click(`//*[contains(text(), "${currency}")]`);
});

Then(/^I should see "([^"]*)" displayed beside wallet balance$/, function(ticker) {
return this.client.waitForVisible(`//*[@class="WalletSummaryCurrency_currencyRate" and text()="${ticker}"]`);
});

When(/^I toggle the button (on|off) to change if I want to see my ada balance in other currency's$/, function(switchStatus) {
const selector = switchStatus === 'on'
? DISPLAY_BALANCE_OTHER_CURRENCY_TOGGLE_STATUS_OFF
: DISPLAY_BALANCE_OTHER_CURRENCY_TOGGLE_STATUS_ON;
return this.waitAndClick(selector);
});

Then(/^the currency selection box is (hidden|visible)$/, function(state) {
const invisibility:boolean = state !== 'visible'
return this.client.waitForVisible(SELECT_CURRENCY_DROPDOWN, null, invisibility);
});

Then(/^The wallet summary screen (does|does not) show ada balance in other currency's placeholder$/, function(status) {
const invisible:boolean = status !== 'does'
return this.client.waitForVisible(CONVERTED_CURRENCY_WALLET_DISPLAY_GENERAL, null, invisible);
});
75 changes: 75 additions & 0 deletions tests/settings/e2e/steps/stakepool-settings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import { When, Then } from 'cucumber';

const CUSTOM_SERVER_DROPDOWN_OPTION = '//*[@class="SimpleInput_customValueWrapper"]//*[@value="Custom server"]';
const DAEDALUS_TOP_BAR_LOGO = '//*[@class="TopBar_topBar TopBar_withoutWallet"]';
const NOT_A_VALID_SMASH_SERVER_ERROR_MESSAGE_ACTIVATED = '//*[@class="InlineEditingInput_errorMessage" and text()="This URL is not a valid SMASH server"]';
const OFF_CHAIN_METADATA_SERVER_SMASH_LABEL = '//*[contains(text(), "Off-chain metadata server (SMASH)")]';
const SERVER_URL = "https://smash.cardano-testnet.iohkdev.io/";
const SMASH_SERVER_URL_INPUT_BOX = '//*[@label="SMASH server URL"]';
const STAKE_POOL_CUSTOM_SERVER_INPUT_BOX_SUBMIT_BUTTON = '//*[@class="InlineEditingInput_button InlineEditingInput_okButton SimpleButton_root ButtonOverrides_root"]';
const STAKE_POOL_CUSTOM_SERVER_INPUT_BOX_X_BUTTON = '//*[@class="InlineEditingInput_button InlineEditingInput_cancelButton SimpleButton_root ButtonOverrides_root"]';
const STAKE_POOL_SERVER_DROPDOWN = '//*[@class="SimpleFormField_inputWrapper"]';
const STAKE_POOL_SERVER_DROPDOWN_CUSTOM_OPTION = '//*[@class="ScrollbarsCustom-Content"]//span[text()="Custom server"]';
const STAKE_POOLS_SUBMENU_SETTINGS = '//*[@class="SettingsMenu_component"]//button[text()="Stake pools"]';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ManusMcCole we should avoid using text in selectors. If it can not be avoided then we should use rather use the translation directly. @daniloprates can assist you with this.


When(/^custom server is the default option$/, function() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Custom Server option should not be the default one. It should be IOHK (Recommended). If Custom Server is appearing by default there might be a problem with environment variables.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @daniloprates. Thank you for the review. On my side in selfnode all i can see are options for custom and "None fetch the data directly screenshot I had presumed that it was the same for everybody. What environment variables do i need to update ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where are these environment variables set ? @daniloprates

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manus the variable can be found at daedalus.stores.staking.smashServerUrl.

For testnet, the default server url is https://smash.cardano-testnet.iohkdev.io. For mainnet, it's something like https://smash.cardano.iohk.io, but I didn't have time to check, because mainnet was too outdated in my computer.

You can indeed use this URL for testing a custom server, but you need to check the network, because if it's testnet, it will lead to a different behaviour in the app, as it's the default server, not a custom one. In this case, you need to use another URL, like the mainnet one.

Screen Shot 2021-09-17 at 17 21 32

return this.waitAndClick(CUSTOM_SERVER_DROPDOWN_OPTION);
});

Then(/^The custom server I chose earlier is visible on stake-pool screen above stake-pool list and is clickable$/, function() {
return this.waitAndClick(`//*[@class="StakePools_smashSettings"]//span[text()="Moderated by ${SERVER_URL}"]`);
});

Then(/^I am brought back to the stake-pool server settings screen$/, function() {
return this.client.waitForVisible(OFF_CHAIN_METADATA_SERVER_SMASH_LABEL);
});

When(/^I select custom server option$/, function() {
return this.waitAndClick(STAKE_POOL_SERVER_DROPDOWN_CUSTOM_OPTION);
});

When(/^I open stake pool server dropdown$/, function() {
return this.waitAndClick(STAKE_POOL_SERVER_DROPDOWN);
});

Then(/^The smash server input textBox is visible$/, function() {
return this.client.waitForVisible(SMASH_SERVER_URL_INPUT_BOX);
});

When(/^And I enter a custom server URL as custom server option$/, function() {
this.client.setValue(SMASH_SERVER_URL_INPUT_BOX, SERVER_URL);
});

When(/^I enter invalid url "([^"]*)" in to the custom server input-box$/, function(invalidUrl) {
this.client.setValue(SMASH_SERVER_URL_INPUT_BOX, invalidUrl);
});

Then(/^Stake-pool custom input box error message "([^"]*)" is displayed$/, function(message) {
return this.client.waitForVisible(`//div[contains(text(), "${message}")]`);
});

When(/^I enter invalid server "([^"]*)" containing https$/, function(value) {
this.client.setValue(SMASH_SERVER_URL_INPUT_BOX, value);
});

When(/^I delete values in smash server custom url input box$/, function() {
return this.waitAndClick(STAKE_POOL_CUSTOM_SERVER_INPUT_BOX_X_BUTTON);
});

When(/^I focus the stake-pool custom server input box submit button and then click it$/, async function() {
// This step is necessary as otherwise the error message receives the click
await this.waitAndClick(DAEDALUS_TOP_BAR_LOGO);
return this.waitAndClick(STAKE_POOL_CUSTOM_SERVER_INPUT_BOX_SUBMIT_BUTTON);
});

Then(/^I see the "This url is not a valid SMASH server" error message displayed$/, function() {
return this.client.waitForVisible(NOT_A_VALID_SMASH_SERVER_ERROR_MESSAGE_ACTIVATED);
});

When(/^I click on stakepool subtab$/, function() {
return this.waitAndClick(STAKE_POOLS_SUBMENU_SETTINGS);
});

Then(/^I see the "([^"]*)" success message$/, function(message) {
return this.client.waitForVisible(`//*[@class="StakePoolsSettings_savingResultLabel" and text()="${message}"]`);
});