Skip to content
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

Open
wants to merge 54 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@

### Chores

- Added tests for currency display settings and stake-pool settings screens ([PR 2622](https://github.com/input-output-hk/daedalus/pull/2622))
- Removed "Alonzo tada" icon and "Alonzo countdown" screen ([PR 2708](https://github.com/input-output-hk/daedalus/pull/2708))
- Improved the Daedalus startup by avoiding unnecessary Cardano Node restarts ([PR 2716](https://github.com/input-output-hk/daedalus/pull/2716))
- Updated README with solution steps for the nix SSL issue ([PR 2727](https://github.com/input-output-hk/daedalus/pull/2727))
Expand Down Expand Up @@ -134,6 +135,7 @@

### Chores

- Added tests for currency display settings and stake-pool settings screens ([PR 2622](https://github.com/input-output-hk/daedalus/pull/2622))
- Updated `cardano-wallet` to version `2021-09-29` which includes `cardano-node` 1.30.1
- Updated `trezor-connect` dependency to version `8.2.0` ([PR 2675](https://github.com/input-output-hk/daedalus/pull/2675))

Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"test:e2e:rerun:fail-fast": "yarn cucumber:rerun --require 'tests/setup-e2e.js' --require 'tests/**/e2e/**/*.js' --tags '@e2e and not @skip and not @wip'",
"test:e2e:watch": "gulp test:e2e:watch",
"test:e2e:watch:once": "KEEP_APP_AFTER_TESTS=true yarn test:e2e --tags '@e2e and @watch'",
"cucumber": "cross-env NODE_ENV=test cucumber-js --require 'tests/setup-common.js' --require-module @babel/register -f json:tests-report/report-data.json -f summary:tests-report/summary.log -f node_modules/cucumber-pretty:tests-report/results.log --format-options '{\"snippetInterface\": \"async-await\"}' -f node_modules/cucumber-pretty --format-options '{\"snippetInterface\": \"async-await\"}' -f rerun:tests/@rerun.txt",
"cucumber": "cross-env NODE_ENV=test cucumber-js --require 'tests/setup-common.js' --require-module @babel/register -f json:tests-report/report-data.json -f summary:tests-report/summary.log --format-options '{\"snippetInterface\": \"async-await\"}' -f @cucumber/pretty-formatter --format-options '{\"snippetInterface\": \"async-await\"}' -f rerun:tests/@rerun.txt",
"cucumber:run": "yarn cucumber tests",
"cucumber:fail-fast": "yarn cucumber tests --fail-fast",
"cucumber:rerun": "yarn cucumber tests-report/@rerun.txt",
Expand Down Expand Up @@ -81,6 +81,8 @@
"@babel/preset-flow": "7.16.0",
"@babel/preset-react": "7.0.0",
"@babel/register": "7.0.0",
"@cucumber/cucumber": "7.3.1",
"@cucumber/pretty-formatter": "1.0.0-alpha.1",
"@dump247/storybook-state": "1.6.1",
"@storybook/addon-actions": "5.3.14",
"@storybook/addon-knobs": "5.3.14",
Expand All @@ -102,8 +104,6 @@
"concurrently": "5.3.0",
"cross-env": "7.0.2",
"css-loader": "2.0.1",
"cucumber": "6.0.5",
"cucumber-pretty": "6.0.0",
"del": "6.0.0",
"electron-chromedriver": "16.0.0",
"electron-connect": "0.6.3",
Expand Down Expand Up @@ -159,7 +159,7 @@
"seedrandom": "3.0.5",
"sinon": "9.2.2",
"spawn-sync": "2.0.0",
"spectron": "14.0.0",
"spectron": "15.0.0",
"style-loader": "0.23.1",
"stylelint": "13.7.2",
"stylelint-order": "4.1.0",
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @flow
import { Given, Then, When } from 'cucumber';
import { Given, Then, When } from '@cucumber/cucumber';
import { expect } from 'chai';
import { find } from 'lodash';
import { getVisibleElementsCountForSelector } from '../../../common/e2e/steps/helpers';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @flow
import { Given, When, Then } from 'cucumber';
import { Given, When, Then } from '@cucumber/cucumber';
import { expect } from 'chai';
import packageJson from '../../../../package.json';
import type { Daedalus } from '../../../types';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @flow
import { Given, When, Then } from 'cucumber';
import { Given, When, Then } from '@cucumber/cucumber';
import { expect } from 'chai';
import { environment } from '../../../../source/main/environment';
import { getVisibleTextsForSelector } from '../../../common/e2e/steps/helpers';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @flow
import { Given, Then } from 'cucumber';
import { Given, Then } from '@cucumber/cucumber';
import { CardanoNodeStates } from '../../../../source/common/types/cardano-node.types';
import { getCardanoNodeState, waitForCardanoNodeToExit } from './helpers';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @flow
import { Given, When, Then } from 'cucumber';
import { Given, When, Then } from '@cucumber/cucumber';
import { expect } from 'chai';
import { waitUntilTextInSelector } from '../../../common/e2e/steps/helpers';
import { refreshClient, waitForCardanoNodeToExit, waitForDaedalusToExit } from './helpers';
Expand Down Expand Up @@ -69,4 +69,4 @@ When(/^I disconnect app$/, function() {
this.client.execute(() => {
daedalus.stores.networkStatus._setDisconnected(true);
});
});
});
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @flow
import { Given, When, Then } from 'cucumber';
import { Given, When, Then } from '@cucumber/cucumber';
import type { Daedalus } from '../../../types';

declare var daedalus: Daedalus;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @flow
import { When } from 'cucumber';
import { When } from '@cucumber/cucumber';
import { getProcessesByName } from '../../../../source/main/utils/processes';
import type { Daedalus } from '../../../types';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @flow
import { When } from 'cucumber';
import { When } from '@cucumber/cucumber';
import type { Daedalus } from '../../../types';

declare var daedalus: Daedalus;
Expand All @@ -13,4 +13,4 @@ When(/^I inject fault named "([^"]*)"$/, async function(faultName) {
throw e;
});
}, faultName);
});
});
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @flow
import { Given, Then } from 'cucumber';
import { Given, Then } from '@cucumber/cucumber';
import { expectTextInSelector } from '../../../common/e2e/steps/helpers';
import type { Daedalus } from '../../../types';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @flow
import { Given, When, Then } from 'cucumber';
import { Given, When, Then } from '@cucumber/cucumber';
import { waitUntilTextInSelector } from '../../../common/e2e/steps/helpers';
import type { Daedalus } from '../../../types';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @flow
import { Then } from 'cucumber';
import { Then } from '@cucumber/cucumber';
import { waitUntilTextInSelector } from '../../../common/e2e/steps/helpers';
import type { Daedalus } from '../../../types';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @flow
import { Then } from 'cucumber';
import { Then } from '@cucumber/cucumber';
import { waitUntilTextInSelector } from '../../../common/e2e/steps/helpers';
import type { Daedalus } from '../../../types';

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @flow
import { Given, When, Then } from 'cucumber';
import { Given, When, Then } from '@cucumber/cucumber';
import { expect } from 'chai';
import { sampleSize } from 'lodash';
import sinon from 'sinon';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @flow
import { Given, Then } from 'cucumber';
import { Given, Then } from '@cucumber/cucumber';
import { expect } from 'chai';
import { last } from 'lodash';
import type { Daedalus } from '../../../types';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @flow
import { Given, Then } from 'cucumber';
import { Given, Then } from '@cucumber/cucumber';
import { expect } from 'chai';
import BigNumber from 'bignumber.js';
import { navigateTo } from '../../../navigation/e2e/steps/helpers';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow
import fs from 'fs';
import { When, Then } from 'cucumber';
import { When, Then } from '@cucumber/cucumber';
import path from 'path';
import moment from 'moment';
import type { Daedalus } from '../../../types';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @flow
import { Given, When, Then } from 'cucumber';
import { Given, When, Then } from '@cucumber/cucumber';
import { expect } from 'chai';
import BigNumber from 'bignumber.js/bignumber';
import { delegationCentreStakingHelper, getStakePoolByRanking } from './helpers';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @flow
import { Given, Then } from 'cucumber';
import { Given, Then } from '@cucumber/cucumber';
import { navigateTo, waitUntilUrlEquals } from './helpers';

Given(/^I am on the General Settings "([^"]*)" screen$/, async function(
Expand All @@ -12,4 +12,4 @@ Then(/^I should see General Settings "([^"]*)" screen$/, async function(
screenName
) {
return waitUntilUrlEquals.call(this, `/settings/${screenName}`);
});
});
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @flow
import { Given, When, Then } from 'cucumber';
import { Given, When, Then } from '@cucumber/cucumber';
import { sidebarHelpers } from './helpers';
import type { Daedalus } from '../../../types';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from 'chai';
import { get } from 'lodash';
import { Given, When, Then } from 'cucumber';
import { Given, When, Then } from '@cucumber/cucumber';
import moment from 'moment';

import newsDummyJson from '../documents/dummy-news.json';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @flow
import { Given, When, Then } from 'cucumber';
import { Given, When, Then } from '@cucumber/cucumber';
import { expect } from 'chai';
import path from 'path';
import { fillOutWalletSendForm } from '../../../wallets/e2e/steps/helpers';
Expand Down
File renamed without changes.
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
35 changes: 35 additions & 0 deletions tests/settings/e2e/features/stakepool-settings.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@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 I open stake pool server dropdown
When I select custom server
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @flow
import { Given } from 'cucumber';
import { Given } from '@cucumber/cucumber';
import { initialSettingsHelpers, migrationHelpers, termsOfUseHelpers } from './helpers';

const { acceptMigration } = migrationHelpers;
Expand Down
39 changes: 39 additions & 0 deletions tests/settings/e2e/steps/currency-display-settings.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// @flow
import { When, Then } from '@cucumber/cucumber';
import en from '../../../../source/renderer/app/i18n/locales/en-US.json';

const SELECT_CURRENCY_TEXT = en['settings.wallets.currency.selectLabel'];

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_TEXT}"]`;

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);
});
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @flow
import { Given, When, Then } from 'cucumber';
import { Given, When, Then } from '@cucumber/cucumber';
import { expect } from 'chai';
import {
chooseCustomOptionsByValue,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @flow
import { When, Then } from 'cucumber';
import { When, Then } from '@cucumber/cucumber';
import { expect } from 'chai';
import { camelCase } from 'lodash';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @flow
import { Given, When, Then } from 'cucumber';
import { Given, When, Then } from '@cucumber/cucumber';
import { expect } from 'chai';
import { initialSettingsHelpers } from './helpers';
import type { Daedalus } from '../../../types';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @flow
import { Given, When, Then } from 'cucumber';
import { Given, When, Then } from '@cucumber/cucumber';
import { expect } from 'chai';
import { navigateTo } from '../../../navigation/e2e/steps/helpers';
import { waitUntilWaletNamesEqual } from '../../../wallets/e2e/steps/helpers';
Expand Down
Loading