-
Notifications
You must be signed in to change notification settings - Fork 297
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
Automated Tests to cover Stake Pool Settings and Wallet Currency Display Settings screens #2622
base: develop
Are you sure you want to change the base?
Conversation
…om knowing which function to run
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good! 😎
@@ -0,0 +1,43 @@ | |||
// @flow | |||
import { When, Then} from 'cucumber'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you execute prettier in this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ManusMcCole add a space after "Then"
e.g. import { When, Then } from 'cucumber';
or run yarn prettier:format
}); | ||
|
||
Then(/^The wallet summary screen (does|does not) show ada balance in other currency's placeholder$/, function(switchstatus) { | ||
let invisible = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could write this in one line const invisible:boolean = switchstatus !== 'does'
The return of a comparison is always a boolean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this solution very much. It condenses 4 lines of code in to 1 awesome 👍
}); | ||
|
||
Then(/^"([^"]*)" is visible on stake-pool screen above stake-pool list and is clickable$/, function(serverUrl) { | ||
return this.waitAndClick('//*[@class="StakePools_smashSettings"]//span[text()="Moderated by '+ serverUrl + '"]'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to write modern Javascript you could use Template_literals this instead string concatenation https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals 😉
@daniloprates @tomislavhoracek please review this one 🙏 |
@@ -0,0 +1,33 @@ | |||
@e2e @watch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ManusMcCole Please remove the watch flag
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 | ||
When I am on the General Settings "wallets" screen |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ManusMcCole I don't think we need multiple of these When I am on the General Settings "wallets" screen
steps?
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 | ||
When I am on the General Settings "wallets" screen |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ManusMcCole you can remove this, you are already there
And I enter custom server "https://smash.cardano-testnet.iohkdev.io/" as the custom server option | ||
And I click on Daedalus logo to change focus | ||
And I click the stake-pool custom server input box submit button | ||
And I see the your changes have been saved success message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can declare a message like "your changes have been saved" and check if that is correct.
e.g. And I see the "Your changes have been saved" success message
And I select custom server option | ||
Then The smash server input textBox is visible | ||
And I enter invalid url "www.test" without https | ||
Then Stake-pool custom input box error message is displayed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe would be good to check if correct error message is shown
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, you could have something like this
Then Stake-pool custom input box "https" error message is displayed
And in the JS you capture "https"
and check if it's the correct error message. In other tests you could have something like
Then Stake-pool custom input box "invalidUrl" error message is displayed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed now :)
Then Stake-pool custom input box error message 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 click on Daedalus logo to change focus |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of declaring where you exactly clicked you can say, "I clicked outside something"
const SELECT_CURRENCY_DROPDOWN = '//*[@label="Select currency"]'; | ||
|
||
When(/^I open currency selection dropdown$/, function() { | ||
return this.waitAndClick(SELECT_CURRENCY_DROPDOWN); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that you can use just click
since you don't need to wait for something. Please try... :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ManusMcCole for native methods, it needs this.client. ...
. waitAndClick
is a helper method created by us, therefore client
is not needed.
…re/manus-automation
Hi @input-output-hk/daedalus-dev. If somebody could review and possibly approve this PR soon it would be much appreciated. @nikolaglumac is keen to get it merged soon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work @ManusMcCole. I've left some comments.
@@ -0,0 +1,83 @@ | |||
import { When, Then } from 'cucumber'; | |||
import en from '../../../../source/renderer/app/i18n/locales/en-US.json'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's important to give variables meaningful and easy-to-understand names. In this case, it could be something a bit less vague, like enLocales
or enCopy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed 👍
const STAKE_POOL_SERVER_DROPDOWN_CUSTOM_OPTION = `//*[@class="ScrollbarsCustom-Content"]//span[text()="${CUSTOM_SERVER_TEXT}"]`; | ||
const STAKE_POOLS_SUBMENU_SETTINGS = `//*[@class="SettingsMenu_component"]//button[text()="${STAKE_POOL_TEXT}"]`; | ||
|
||
When(/^custom server is the default option$/, function() { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
|
||
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 |
There was a problem hiding this comment.
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
@ManusMcCole please try to get this one done today 🙏 |
FYI. @ManusMcCole I have merged in latest develop branch so please pull before committing new changes 🙏 |
This PR adds automated tests for the Stake-pool server settings and also the Wallet currency display settings screens.
Testing Checklist
Review Checklist
Basics
feature
/bug
/chore
,release-x.x.x
)yarn test
)yarn dev
)yarn package
/ CI builds)yarn flow:test
)yarn lint
)yarn prettier:check
)yarn manage:translations
produces no changes)yarn storybook
)yarn.lock
file is updatedCode Quality
Testing
After Review
done
column on the YouTrack board