From f683b9e770b3e10161eb42dbc10fea786e371119 Mon Sep 17 00:00:00 2001 From: Tommy Date: Fri, 15 Oct 2021 17:05:00 +0100 Subject: [PATCH 01/21] Tauri Wallet Test . Currently developed against a Linux machine . POM design . README.md states how to get up and running on Linux WIP - areas of focus inbound -> . CI . Test suite configuration . Working on multiple platforms . Improve selector selection to reduce fragility in the future --- .../.github/workflows/nym_wallet.yml | 51 +++++++++++ tauri-wallet/webdriver/.gitignore | 4 + tauri-wallet/webdriver/README.md | 72 ++++++++++++++++ tauri-wallet/webdriver/babel.config.js | 12 +++ .../common/constants/text-constants.js | 29 +++++++ .../webdriver/common/data/user-data.js | 8 ++ .../webdriver/common/helpers/helper.js | 38 ++++++++ tauri-wallet/webdriver/package.json | 25 ++++++ .../webdriver/tests/pages/wallet.bond.js | 62 +++++++++++++ .../webdriver/tests/pages/wallet.delegate.js | 79 +++++++++++++++++ .../webdriver/tests/pages/wallet.homepage.js | 49 +++++++++++ .../webdriver/tests/pages/wallet.login.js | 42 +++++++++ .../webdriver/tests/pages/wallet.receive.js | 40 +++++++++ .../webdriver/tests/pages/wallet.send.js | 76 ++++++++++++++++ .../tests/pages/wallet.undelegate.js | 23 +++++ .../specs/existinguser/test.wallet.bond.js | 57 ++++++++++++ .../existinguser/test.wallet.delegate.js | 86 +++++++++++++++++++ .../specs/existinguser/test.wallet.home.js | 48 +++++++++++ .../specs/existinguser/test.wallet.receive.js | 31 +++++++ .../specs/existinguser/test.wallet.send.js | 45 ++++++++++ .../existinguser/test.wallet.undelegate.js | 34 ++++++++ .../tests/specs/newuser/test.wallet.create.js | 12 +++ tauri-wallet/webdriver/wdio.conf.cjs | 65 ++++++++++++++ 23 files changed, 988 insertions(+) create mode 100644 tauri-wallet/webdriver/.github/workflows/nym_wallet.yml create mode 100644 tauri-wallet/webdriver/.gitignore create mode 100644 tauri-wallet/webdriver/README.md create mode 100644 tauri-wallet/webdriver/babel.config.js create mode 100644 tauri-wallet/webdriver/common/constants/text-constants.js create mode 100644 tauri-wallet/webdriver/common/data/user-data.js create mode 100644 tauri-wallet/webdriver/common/helpers/helper.js create mode 100644 tauri-wallet/webdriver/package.json create mode 100644 tauri-wallet/webdriver/tests/pages/wallet.bond.js create mode 100644 tauri-wallet/webdriver/tests/pages/wallet.delegate.js create mode 100644 tauri-wallet/webdriver/tests/pages/wallet.homepage.js create mode 100644 tauri-wallet/webdriver/tests/pages/wallet.login.js create mode 100644 tauri-wallet/webdriver/tests/pages/wallet.receive.js create mode 100644 tauri-wallet/webdriver/tests/pages/wallet.send.js create mode 100644 tauri-wallet/webdriver/tests/pages/wallet.undelegate.js create mode 100644 tauri-wallet/webdriver/tests/specs/existinguser/test.wallet.bond.js create mode 100644 tauri-wallet/webdriver/tests/specs/existinguser/test.wallet.delegate.js create mode 100644 tauri-wallet/webdriver/tests/specs/existinguser/test.wallet.home.js create mode 100644 tauri-wallet/webdriver/tests/specs/existinguser/test.wallet.receive.js create mode 100644 tauri-wallet/webdriver/tests/specs/existinguser/test.wallet.send.js create mode 100644 tauri-wallet/webdriver/tests/specs/existinguser/test.wallet.undelegate.js create mode 100644 tauri-wallet/webdriver/tests/specs/newuser/test.wallet.create.js create mode 100644 tauri-wallet/webdriver/wdio.conf.cjs diff --git a/tauri-wallet/webdriver/.github/workflows/nym_wallet.yml b/tauri-wallet/webdriver/.github/workflows/nym_wallet.yml new file mode 100644 index 0000000000..2e559c8ac8 --- /dev/null +++ b/tauri-wallet/webdriver/.github/workflows/nym_wallet.yml @@ -0,0 +1,51 @@ +on: [ push ] + +name: webdriverio tests for nym wallet + +jobs: + test: + name: wallet tests + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Tauri dependencies + run: > + sudo apt-get update && + sudo apt-get install -y + libgtk-3-dev + libgtksourceview-3.0-dev + webkit2gtk-4.0 + libappindicator3-dev + webkit2gtk-driver + xvfb + + - name: Rust stable + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + components: clippy, rustfmt + + - name: Node v16 + uses: actions/setup-node@v1 + with: + node-version: 16.x + + - name: Build application + run : yarn run webpack:build & yarn run tauri:build + working-directory: ./ + + - name: Yarn install + run: yarn install + working-directory: webdriver/ + + - name: Install tauri-driver + uses: actions-rs/cargo@v1 + with: + command: install + args: tauri-driver + + - name: Launch tests + run: xvfb-run yarn test:login + working-directory: webdriver/ \ No newline at end of file diff --git a/tauri-wallet/webdriver/.gitignore b/tauri-wallet/webdriver/.gitignore new file mode 100644 index 0000000000..2c6857cd13 --- /dev/null +++ b/tauri-wallet/webdriver/.gitignore @@ -0,0 +1,4 @@ +reports +node_modules +.vscode +.idea \ No newline at end of file diff --git a/tauri-wallet/webdriver/README.md b/tauri-wallet/webdriver/README.md new file mode 100644 index 0000000000..3f5a6a4249 --- /dev/null +++ b/tauri-wallet/webdriver/README.md @@ -0,0 +1,72 @@ + + +# Nym Tauri Wallet Webdriver testsuite + +A webdriverio test suite implementation using tauri driver +with a page object model design. This project is to provide quick iterative feedback +on the UI of the tauri nym wallet. + +Currently, tauri-driver is available to run on Windows and Linux machines. + +## Installation prerequisites +* `Yarn` +* `NodeJS >= v16.8.0` +* `Rust & cargo >= v1.51` +* `tauri-driver` +* `That you have an existing mnemonic and you can login to the app` +* `Have the details listed below to provide the user-data.js file` + + +## Key Information +* Please read the instructions on the `nym/tauri-wallet/README.md` in the root of the project on how to build the application +* Please ensure you have the relevant Webdriver kits installed on your machine - +``` +linux: + sudo apt-get install -y webkit2gtk-driver + ``` + ``` + windows: +download msedgedriver.exe from https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ +``` +please visit [Tauri Studio](https://tauri.studio/en/docs/usage/guides/webdriver/introduction), this will specify the additional drivers you need) +* The path to run the application is set in the `wdio.conf.js` which lives in the root directory +* Before running the suite you need to build the application and check that the application has +built successfully, if so, you will have an executable sitting in the target directory in `src-tauri/*/nym_wallet` (refer to point 1) +* The suite will not be able to detect elements on screen if you select a release build, however you can run tests against a release target + + +## Installation & usage +* `test excution happens inside /webdriver directory` +* `test data needs to be provided inside the user-data.js module` +* `check the wdio.conf.js to see the activities and path location of the binary` +``` +example: +//mnemonic is a base64 enconded value, which is your 24 character passphrase, these values are for illustration purposes + { + "mnemonic" : "dGhpcyBpcyBhIHBhc3NwaHJhc2UK", + "punk_address" : "punk1f3dzkhmunma5ze5q952daxca6371989189", + "receiver_address" : "punk1p0ce82jxxglpmutvhq4mdwgcwf4avm5n1821982", + "amount_to_send" : "5", + "identity_key_to_delegate":"value", + "identity_key_to_delegate_gateway" : "value" + "delegate_amount" : "1" + } +``` +* `yarn test:runall` - the first test run will take some time to spin up be patient +* You can run tests individually by passing through the script situated in the package.json for example `yarn test:delegate` + +## Updates + +Disclaimer: As this project is WIP, there's a lot due to be updated and modified. This is to get the project up and running. + + +Refactoring needs to take place in certain areas to reduce code duplication, tidying up selectors and improving performance, implement error handling + + +Configuration for happy path and non happy path (non bonded users needs to happen) + + +Currently this project has been dev'd against a Linux based OS, not currently tested against Windows. diff --git a/tauri-wallet/webdriver/babel.config.js b/tauri-wallet/webdriver/babel.config.js new file mode 100644 index 0000000000..8073490996 --- /dev/null +++ b/tauri-wallet/webdriver/babel.config.js @@ -0,0 +1,12 @@ +module.exports = { + "presets": [ + [ + "@babel/preset-env", + { + "targets": { + "node": "14" + } + } + ] + ] +} \ No newline at end of file diff --git a/tauri-wallet/webdriver/common/constants/text-constants.js b/tauri-wallet/webdriver/common/constants/text-constants.js new file mode 100644 index 0000000000..8d7600fad0 --- /dev/null +++ b/tauri-wallet/webdriver/common/constants/text-constants.js @@ -0,0 +1,29 @@ +module.exports = { + //receivePage + "recievePageInformation" : "You can receive tokens by providing this address to the sender", + "receivePageHeaderText": "Receive Nym", + + //sendPage + "sendPunk" : "Send PUNK", + + //homePage + "homePageErrorMnemonic": "Error parsing bip39 mnemonic", + "homePageSignIn" : "Sign in", + "createOne" : "Create one", + + //bondPage // unbondPage + "bondAlreadyNoded" : "Looks like you already have a mixnode bonded.", + "bondNodeHeaderText": "Bond a node or gateway", + "unbondNodeHeaderText" : "Unbond a mixnode or gateway", + "unbondMixNodeText": "Looks like you already have a mixnode bonded.", + + //balancePage + + //delegatePage // undelegatePage + "delegateHeaderText" : "Delegate to mixnode or gateway", + "nodeIdentityValidationText" : "identity is a required field", + "amountValidationText": "amount is a required field", + //"transferFeeAmount" : "A fee of 0.004375 PUNK will apply to this transaction", + "undelegateHeaderText" : "Undelegate from a mixnode or gateway", + "delegationComplete" : "Delegation complete" +} \ No newline at end of file diff --git a/tauri-wallet/webdriver/common/data/user-data.js b/tauri-wallet/webdriver/common/data/user-data.js new file mode 100644 index 0000000000..c040eba101 --- /dev/null +++ b/tauri-wallet/webdriver/common/data/user-data.js @@ -0,0 +1,8 @@ +module.exports = { + "mnemonic": "", + "punk_address": "", + "receiver_address": "", + "amount_to_send": "", + "identity_key_to_delegate": "", + "delegate_amount": "" +} \ No newline at end of file diff --git a/tauri-wallet/webdriver/common/helpers/helper.js b/tauri-wallet/webdriver/common/helpers/helper.js new file mode 100644 index 0000000000..63515e8388 --- /dev/null +++ b/tauri-wallet/webdriver/common/helpers/helper.js @@ -0,0 +1,38 @@ +class Helpers { + + //helper to decode mnemonic so plain 24 character passphrase isn't in sight albeit it is presented when ruunning the scripts + //maybe a show passphrase toggle button? + decodeBase = async (input) => { + var m = Buffer.from(input, 'base64').toString(); + return m; + } + + navigateAndClick = async (element) => { + await element.click(); + } + + scrollIntoView = async (element) => { + await element.scrollIntoView(); + } + + + currentBalance = async (value) => { + return parseFloat(value.split(/\s+/)[0].toString()).toFixed(5); + } + + //this can be better - todo (fix) + calculateFees = async (beforeBalance, transactionFee, amount) => { + const fee = transactionFee.split(/\s+/)[3].toString(); + const currentBalance = beforeBalance.split(/\s+/)[0].toString(); + + //cast existing balance to decimal + const castCurrentBalance = parseFloat(parseFloat(currentBalance).toFixed(5)); + + const transCost = +parseFloat(parseFloat(fee).toFixed(5)) + + +parseFloat(parseFloat(amount)); + + return parseFloat(castCurrentBalance - transCost).toFixed(5); + } +} + +module.exports = new Helpers() \ No newline at end of file diff --git a/tauri-wallet/webdriver/package.json b/tauri-wallet/webdriver/package.json new file mode 100644 index 0000000000..6a66190665 --- /dev/null +++ b/tauri-wallet/webdriver/package.json @@ -0,0 +1,25 @@ +{ + "name": "tauri_nym_wallet", + "version": "1.0.0", + "private": false, + "license": "MIT", + "scripts": { + "test:runall": "wdio run wdio.conf.cjs", + "test:sendreceive": "wdio run wdio.conf.cjs --suite sendAndReceive", + "test:login": "wdio run wdio.conf.cjs --suite login", + "test:bond": "wdio run wdio.conf.cjs --suite bond", + "test:delegate": "wdio run wdio.conf.cjs --suite delegate", + "test:newaccounts": "wdio run wdio.conf.cjs --suite nonExsistingUser" + }, + "dependencies": { + "@types/node": "^16.11.0", + "@wdio/cli": "^7.9.1", + "@zxing/browser": "^0.0.9" + }, + "devDependencies": { + "@wdio/local-runner": "^7.14.1", + "@wdio/mocha-framework": "^7.14.1", + "@wdio/spec-reporter": "^7.14.1", + "wdio-chromedriver-service": "^7.2.2" + } +} diff --git a/tauri-wallet/webdriver/tests/pages/wallet.bond.js b/tauri-wallet/webdriver/tests/pages/wallet.bond.js new file mode 100644 index 0000000000..55b7cba724 --- /dev/null +++ b/tauri-wallet/webdriver/tests/pages/wallet.bond.js @@ -0,0 +1,62 @@ +class WalletBond { + + get header() { + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardHeader-root > div > span.MuiTypography-root.MuiCardHeader-subheader.MuiTypography-subtitle1.MuiTypography-colorTextSecondary.MuiTypography-displayBlock"); + } + + get identityKey() { + return $("#identityKey"); + } + + get sphinxKey() { + return $("#sphinxKey"); + } + + get amountToBond() { + return $("#amount"); + } + + get hostInput() { + return $("#host") + } + + get versionInput() { + return $("version"); + } + + get advancedOptions() { + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardContent-root > div.MuiFormControl-root.MuiFormControl-fullWidth > div:nth-child(1) > div > div:nth-child(8) > label > span.MuiButtonBase-root.MuiIconButton-root.PrivateSwitchBase-root-13.MuiCheckbox-root.MuiCheckbox-colorSecondary.MuiIconButton-colorSecondary > span.MuiIconButton-label > input"); + } + + get selectAdvancedOptions() { + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardContent-root > div.MuiFormControl-root.MuiFormControl-fullWidth > div:nth-child(1) > div > div:nth-child(8) > label > span.MuiButtonBase-root.MuiIconButton-root.PrivateSwitchBase-root-7.MuiCheckbox-root.MuiCheckbox-colorSecondary.MuiIconButton-colorSecondary"); + + } + + get mixPort() { + return $("#mixPort"); + } + + get verlocPort() { + return $("#verlocPort"); + } + + get httpApiPort() { + return $("#httpApiPort"); + } + + get bondButton() { + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardContent-root > div.MuiFormControl-root.MuiFormControl-fullWidth > div:nth-child(2) > button"); + } + + get unBondButton() { + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardContent-root > div > div.MuiAlert-action > button > span.MuiButton-label"); + } + + get unBondInformation(){ + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardContent-root > div > div.MuiAlert-message"); + } + +} + +module.exports = new WalletBond() \ No newline at end of file diff --git a/tauri-wallet/webdriver/tests/pages/wallet.delegate.js b/tauri-wallet/webdriver/tests/pages/wallet.delegate.js new file mode 100644 index 0000000000..35b1e149eb --- /dev/null +++ b/tauri-wallet/webdriver/tests/pages/wallet.delegate.js @@ -0,0 +1,79 @@ +class WalletDelegate { + + get header() { + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardHeader-root > div > span.MuiTypography-root.MuiCardHeader-subheader.MuiTypography-subtitle1.MuiTypography-colorTextSecondary.MuiTypography-displayBlock") + } + + get nodeIdentity() { + return $("#identity"); + } + + get accountBalance() { + return $("#root > div > div:nth-child(1) > div:nth-child(3) > div:nth-child(1) > div > div.MuiCardContent-root > div > div > h6"); + } + + get amountToDelegate() { + return $("#amount"); + } + + get identityValidation() { + return $("#identity-helper-text"); + } + + get amountToDelegateValidation() { + return $("#amount-helper-text"); + } + + get delegateStakeButton() { + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardContent-root > div > div:nth-child(2) > button > span.MuiButton-label"); + } + + get mixNodeRadioButton() { + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardContent-root > div > div:nth-child(1) > div > div.MuiGrid-root.MuiGrid-container.MuiGrid-item.MuiGrid-justify-content-xs-space-between.MuiGrid-grid-xs-12 > div:nth-child(1) > fieldset > div > label:nth-child(1) > span.MuiButtonBase-root.MuiIconButton-root.PrivateSwitchBase-root-8.MuiRadio-root.MuiRadio-colorSecondary.PrivateSwitchBase-checked-9.Mui-checked.MuiIconButton-colorSecondary > span.MuiIconButton-label > input"); + } + + get gateWayRadioButton() { + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardContent-root > div > div:nth-child(1) > div > div.MuiGrid-root.MuiGrid-container.MuiGrid-item.MuiGrid-justify-content-xs-space-between.MuiGrid-grid-xs-12 > div:nth-child(1) > fieldset > div > label:nth-child(2) > span.MuiButtonBase-root.MuiIconButton-root.PrivateSwitchBase-root-8.MuiRadio-root.MuiRadio-colorSecondary.MuiIconButton-colorSecondary > span.MuiIconButton-label > input"); + } + + get transactionFeeAmount() { + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardContent-root > div > div:nth-child(1) > div > div.MuiGrid-root.MuiGrid-container.MuiGrid-item.MuiGrid-justify-content-xs-space-between.MuiGrid-grid-xs-12 > div:nth-child(2) > div > div.MuiAlert-message"); + } + + get successfullyDelegate() { + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardContent-root > div:nth-child(1) > div > div.MuiAlert-message > div"); + } + + get finishSuccessDelegation() { + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardContent-root > div:nth-child(2) > button"); + } + + //Undelegate + + get unDelegateHeader(){ + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardHeader-root > div > span.MuiTypography-root.MuiCardHeader-subheader.MuiTypography-subtitle1.MuiTypography-colorTextSecondary.MuiTypography-displayBlock"); + } + + get unNodeIdentity(){ + return $("#mui-52147"); + } + + get unDelegateFeeText(){ + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardContent-root > div > div:nth-child(1) > div > div.MuiGrid-root.MuiGrid-container.MuiGrid-item.MuiGrid-justify-content-xs-space-between.MuiGrid-grid-xs-12 > div:nth-child(2) > div > div.MuiAlert-message"); + } + + get unDelegateGatewayRadioButton(){ + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardContent-root > div > div:nth-child(1) > div > div.MuiGrid-root.MuiGrid-container.MuiGrid-item.MuiGrid-justify-content-xs-space-between.MuiGrid-grid-xs-12 > div:nth-child(1) > fieldset > div > label:nth-child(2) > span.MuiButtonBase-root.MuiIconButton-root.PrivateSwitchBase-root-8.MuiRadio-root.MuiRadio-colorSecondary.MuiIconButton-colorSecondary > span.MuiIconButton-label > input"); + } + + get unMixNodeRadioButton(){ + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardContent-root > div > div:nth-child(1) > div > div.MuiGrid-root.MuiGrid-container.MuiGrid-item.MuiGrid-justify-content-xs-space-between.MuiGrid-grid-xs-12 > div:nth-child(1) > fieldset > div > label:nth-child(1) > span.MuiButtonBase-root.MuiIconButton-root.PrivateSwitchBase-root-8.MuiRadio-root.MuiRadio-colorSecondary.MuiIconButton-colorSecondary > span.MuiIconButton-label > input"); + } + + get unDelegateButton(){ + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardContent-root > div > div:nth-child(2) > button > span.MuiButton-label"); + } + +} + +module.exports = new WalletDelegate() \ No newline at end of file diff --git a/tauri-wallet/webdriver/tests/pages/wallet.homepage.js b/tauri-wallet/webdriver/tests/pages/wallet.homepage.js new file mode 100644 index 0000000000..52a3375923 --- /dev/null +++ b/tauri-wallet/webdriver/tests/pages/wallet.homepage.js @@ -0,0 +1,49 @@ +class WalletHome { + + get balanceCheck() { + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardHeader-root > div > span"); + } + + get punkBalance() { + return $("#root > div > div:nth-child(1) > div:nth-child(3) > div:nth-child(1) > div > div.MuiCardContent-root > div > div > h6"); + } + + get punkAddress() { + return $("#root > div > div:nth-child(1) > div:nth-child(3) > div:nth-child(2) > div > div.MuiCardContent-root > div > p"); + } + + get sendButton() { + return $("#root > div > div:nth-child(1) > div:nth-child(4) > div > ul > a:nth-child(2) > div.MuiListItemText-root > span"); + } + + get receiveButton() { + return $("#root > div > div:nth-child(1) > div:nth-child(4) > div > ul > a:nth-child(3) > div.MuiListItemText-root > span"); + } + + get bondButton(){ + return $("#root > div > div:nth-child(1) > div:nth-child(4) > div > ul > a:nth-child(4) > div.MuiListItemText-root > span"); + } + + get unBondButton(){ + return $("#root > div > div:nth-child(1) > div:nth-child(4) > div > ul > a:nth-child(5) > div.MuiListItemText-root > span"); + } + + get delegateButton(){ + return $("#root > div > div:nth-child(1) > div:nth-child(4) > div > ul > a:nth-child(6) > div.MuiListItemText-root > span"); + } + + get unDelegateButton(){ + return $("#root > div > div:nth-child(1) > div:nth-child(4) > div > ul > a:nth-child(7) > div.MuiListItemText-root > span"); + } + + get docsButton(){ + return $("#root > div > div:nth-child(1) > div:nth-child(4) > div > ul > a:nth-child(8) > div.MuiListItemText-root > span"); + } + + get logOutButton(){ + return $("#root > div > div:nth-child(1) > div:nth-child(4) > div > ul > div > div.MuiListItemText-root > span"); + } + +} + +module.exports = new WalletHome() \ No newline at end of file diff --git a/tauri-wallet/webdriver/tests/pages/wallet.login.js b/tauri-wallet/webdriver/tests/pages/wallet.login.js new file mode 100644 index 0000000000..58e2f149c7 --- /dev/null +++ b/tauri-wallet/webdriver/tests/pages/wallet.login.js @@ -0,0 +1,42 @@ +class WalletLogin { + + get signInLabel() { + return $("#root > div > div:nth-child(2) > div > h4"); + } + + get mnemonic() { + return $("#mnemonic"); + } + + get signInButton() { + return $("#root > div > div:nth-child(2) > div > form > div > div:nth-child(2) > button > span.MuiButton-label"); + } + + get errorValidation() { + return $("#root > div > div:nth-child(2) > div > form > div > div:nth-child(3) > div > div.MuiAlert-message"); + } + + get accountBalance() { + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardHeader-root > div > span"); + } + + get accountBalanceText() { + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardContent-root > div > div > div > div.MuiAlert-message"); + } + + get walletAddress() { + return $("#root > div > div:nth-child(1) > div:nth-child(3) > div:nth-child(2) > div > div.MuiCardContent-root > div > p"); + } + + get createNewAccount(){ + return $("#root > div > div:nth-child(2) > div > form > div > div:nth-child(3) > a"); + } + + //login to the application + enterMnemonic = async(mnemonic) => { + await this.mnemonic.addValue(mnemonic); + await this.signInButton.click(); + await this.accountBalance.isExisting(); + } +} +module.exports = new WalletLogin() \ No newline at end of file diff --git a/tauri-wallet/webdriver/tests/pages/wallet.receive.js b/tauri-wallet/webdriver/tests/pages/wallet.receive.js new file mode 100644 index 0000000000..68737c5e10 --- /dev/null +++ b/tauri-wallet/webdriver/tests/pages/wallet.receive.js @@ -0,0 +1,40 @@ +class WalletReceive { + + //can these selectors be nicer like the id's? + get header() { + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardHeader-root > div > span"); + } + + get walletAddress() { + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardContent-root > div > div:nth-child(2) > div > div > div:nth-child(1) > span"); + } + + get copyButton() { + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardContent-root > div > div:nth-child(2) > div > div > div:nth-child(1) > button > span.MuiButton-label"); + } + + get qrCode() { + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardContent-root > div > div:nth-child(2) > div > div > div:nth-child(2) > div > canvas"); + } + + get information() { + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardContent-root > div > div:nth-child(1) > div > div.MuiAlert-message"); + } + + + WaitForButtonChangeOnCopy = async () => { + await this.copyButton.click(); + + await this.copyButton.waitForDisplayed({ timeout: 1500 }); + + await this.copyButton.waitUntil(async function () { + return (await this.getText()) === 'COPIED' + }, { + timeout: 1500, + timeoutMsg: 'expected text to be different after 1.5s' + }); + } + +} + +module.exports = new WalletReceive() \ No newline at end of file diff --git a/tauri-wallet/webdriver/tests/pages/wallet.send.js b/tauri-wallet/webdriver/tests/pages/wallet.send.js new file mode 100644 index 0000000000..7846eca64c --- /dev/null +++ b/tauri-wallet/webdriver/tests/pages/wallet.send.js @@ -0,0 +1,76 @@ +class WalletSend { + + + get fromAddress(){ + return $("#from"); + } + + get toAddress(){ + return $("#to"); + } + + get amount(){ + return $("#amount") + } + + //can these selectors be nicer like the id's? + get nextButton(){ + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardContent-root > div > div:nth-child(3) > button > span.MuiButton-label"); + } + + get sendHeader(){ + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardHeader-root > div > span"); + } + + get transferAmount(){ + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardContent-root > div > div:nth-child(2) > div > div > div:nth-child(7) > p:nth-child(2)"); + } + + get accountBalance(){ + return $("#root > div > div:nth-child(1) > div:nth-child(3) > div:nth-child(1) > div > div.MuiCardContent-root > div > div > h6"); + } + + get amountReviewAndSend(){ + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardContent-root > div > div:nth-child(2) > div > div > div:nth-child(5) > p:nth-child(2)"); + } + + get toAddressReviewAndSend(){ + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardContent-root > div > div:nth-child(2) > div > div > div:nth-child(3) > p:nth-child(2)"); + } + + get fromAddressReviewAndSend(){ + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardContent-root > div > div:nth-child(2) > div > div > div:nth-child(1) > p:nth-child(2)"); + } + + get transferFeeAmount(){ + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardContent-root > div > div:nth-child(2) > div > div > div:nth-child(7) > p:nth-child(2)"); + } + + get reviewAndSendBackButton(){ + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardContent-root > div > div:nth-child(3) > button.MuiButtonBase-root.MuiButton-root.MuiButton-text.MuiButton-disableElevation > span.MuiButton-label"); + } + + get sendButton(){ + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardContent-root > div > div:nth-child(3) > button.MuiButtonBase-root.MuiButton-root.MuiButton-contained.MuiButton-containedPrimary.MuiButton-disableElevation > span.MuiButton-label"); + } + + get transactionComplete(){ + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardContent-root > div > div:nth-child(2) > div > div:nth-child(1) > p"); + } + + get transactionCompleteRecipient(){ + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardContent-root > div > div:nth-child(2) > div > div.MuiPaper-root.MuiCard-root.MuiPaper-outlined.MuiPaper-rounded > div:nth-child(1) > div:nth-child(2) > p"); + + } + + get transactionCompleteAmount(){ + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardContent-root > div > div:nth-child(2) > div > div.MuiPaper-root.MuiCard-root.MuiPaper-outlined.MuiPaper-rounded > div:nth-child(2) > div:nth-child(2) > p"); + } + + get finishButton(){ + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardContent-root > div > div:nth-child(3) > button"); + } + +} + +module.exports = new WalletSend() \ No newline at end of file diff --git a/tauri-wallet/webdriver/tests/pages/wallet.undelegate.js b/tauri-wallet/webdriver/tests/pages/wallet.undelegate.js new file mode 100644 index 0000000000..6b368ba4b1 --- /dev/null +++ b/tauri-wallet/webdriver/tests/pages/wallet.undelegate.js @@ -0,0 +1,23 @@ +class WallentUndelegate { + //todo + get transactionFee() { + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardContent-root > div > div:nth-child(1) > div > div.MuiGrid-root.MuiGrid-container.MuiGrid-item.MuiGrid-justify-content-xs-space-between.MuiGrid-grid-xs-12 > div:nth-child(2) > div > div.MuiAlert-message"); + } + get mixNodeRadioButton() { + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardContent-root > div > div:nth-child(1) > div > div.MuiGrid-root.MuiGrid-container.MuiGrid-item.MuiGrid-justify-content-xs-space-between.MuiGrid-grid-xs-12 > div:nth-child(1) > fieldset > div > label:nth-child(1) > span.MuiButtonBase-root.MuiIconButton-root.PrivateSwitchBase-root-20.MuiRadio-root.MuiRadio-colorSecondary.PrivateSwitchBase-checked-21.Mui-checked.MuiIconButton-colorSecondary > span.MuiIconButton-label > input"); + } + + get gatewayRadionButton() { + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardContent-root > div > div:nth-child(1) > div > div.MuiGrid-root.MuiGrid-container.MuiGrid-item.MuiGrid-justify-content-xs-space-between.MuiGrid-grid-xs-12 > div:nth-child(1) > fieldset > div > label:nth-child(2) > span.MuiButtonBase-root.MuiIconButton-root.PrivateSwitchBase-root-20.MuiRadio-root.MuiRadio-colorSecondary.MuiIconButton-colorSecondary > span.MuiIconButton-label > input"); + } + + get nodeIdentity() { + return $("#mui-55011"); + } + + get stakeButtonConfirmation() { + return $("#root > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div.MuiCardContent-root > div > div:nth-child(2) > button > span.MuiButton-label"); + } +} + +module.exports = new WallentUndelegate() \ No newline at end of file diff --git a/tauri-wallet/webdriver/tests/specs/existinguser/test.wallet.bond.js b/tauri-wallet/webdriver/tests/specs/existinguser/test.wallet.bond.js new file mode 100644 index 0000000000..756416b655 --- /dev/null +++ b/tauri-wallet/webdriver/tests/specs/existinguser/test.wallet.bond.js @@ -0,0 +1,57 @@ +const userData = require('../../../common/data/user-data'); +const helper = require('../../../common/helpers/helper'); +const walletLogin = require('../../pages/wallet.login'); +const textConstants = require('../../../common/constants/text-constants'); +const walletHomepage = require('../../pages/wallet.homepage'); +const bondPage = require('../../pages/wallet.bond'); + +describe("bonding and unbonding nodes", () => { + it("should have a node already bonded and validate no input fields are enabled", async () => { + + const mnemonic = await helper.decodeBase(userData.mnemonic); + + await walletLogin.enterMnemonic(mnemonic); + + await helper.navigateAndClick(walletHomepage.bondButton); + + await helper.scrollIntoView(bondPage.selectAdvancedOptions); + + await bondPage.selectAdvancedOptions.click(); + + //as bond node is mixed expect all the fields to be disabled + const getText = await bondPage.header.getText(); + const getIdentity = await bondPage.identityKey.isEnabled(); + const getSphinxKey = await bondPage.sphinxKey.isEnabled(); + const amountToBond = await bondPage.amountToBond.isEnabled(); + const hostInput = await bondPage.hostInput.isEnabled(); + const bondButton = await bondPage.bondButton.isEnabled(); + const verlocPort = await bondPage.verlocPort.isEnabled(); + const httpApiPort = await bondPage.httpApiPort.isEnabled(); + const mixPort = await bondPage.mixPort.isEnabled(); + + //assert all field are not functional + expect(getText).toEqual(textConstants.bondNodeHeaderText); + expect(getIdentity).toEqual(false); + expect(getSphinxKey).toEqual(false); + expect(amountToBond).toEqual(false); + expect(hostInput).toEqual(false); + expect(bondButton).toEqual(false); + expect(verlocPort).toEqual(false); + expect(httpApiPort).toEqual(false); + expect(mixPort).toEqual(false); + }) + + it("unbond mix monde screen should be present with the option to unbond", async () => { + //we do not want to unbond our node, check that elements are selectable + await helper.navigateAndClick(walletHomepage.unBondButton); + + const getText = await bondPage.header.getText(); + const unbondButton = await bondPage.unBondButton.isEnabled(); + const unbondText = await bondPage.unBondInformation.getText(); + + //assert all field are not functional + expect(getText).toEqual(textConstants.unbondNodeHeaderText); + expect(unbondButton).toEqual(true); + expect(unbondText).toEqual(textConstants.unbondMixNodeText); + }) +}); diff --git a/tauri-wallet/webdriver/tests/specs/existinguser/test.wallet.delegate.js b/tauri-wallet/webdriver/tests/specs/existinguser/test.wallet.delegate.js new file mode 100644 index 0000000000..9b9bb83324 --- /dev/null +++ b/tauri-wallet/webdriver/tests/specs/existinguser/test.wallet.delegate.js @@ -0,0 +1,86 @@ +const userData = require('../../../common/data/user-data'); +const helper = require('../../../common/helpers/helper'); +const walletLogin = require('../../pages/wallet.login'); +const textConstants = require('../../../common/constants/text-constants'); +const walletHomepage = require('../../pages/wallet.homepage'); +const delegatePage = require('../../pages/wallet.delegate'); + +describe("delegate to a mix node or gateway", () => { + it("ensure that fields are enabled for existing user", async () => { + + const mnemonic = await helper.decodeBase(userData.mnemonic); + + await walletLogin.enterMnemonic(mnemonic); + + await helper.navigateAndClick(walletHomepage.delegateButton); + + const getText = await delegatePage.header.getText(); + + expect(getText).toEqual(textConstants.delegateHeaderText); + }) + + it("submitting the form without input prompts validation errors", async () => { + + await delegatePage.delegateStakeButton.click(); + + const getIdentityValidation = await delegatePage.identityValidation.getText(); + const getAmountValidation = await delegatePage.amountToDelegateValidation.getText(); + const getText = await delegatePage.header.getText(); + + expect(getText).toEqual(textConstants.delegateHeaderText); + expect(getIdentityValidation).toEqual(textConstants.nodeIdentityValidationText); + expect(getAmountValidation).toEqual(textConstants.amountValidationText); + }) + + it("input delegate amount and stake whilst checking account balances", async () => { + const balanceText = await delegatePage.accountBalance.getText(); + + const getTransfeeAmount = await delegatePage.transactionFeeAmount.getText(); + + await delegatePage.nodeIdentity.setValue(userData.identity_key_to_delegate); + + await delegatePage.amountToDelegate.setValue(userData.delegate_amount); + + //transfer fee + amount delegation + const sumCost = await helper.calculateFees(balanceText, getTransfeeAmount, userData.delegate_amount); + + await delegatePage.delegateStakeButton.click(); + + await delegatePage.finishSuccessDelegation.waitForClickable({ timeout: 10000 }); + + const getConfirmationText = await delegatePage.successfullyDelegate.getText(); + expect(getConfirmationText).toContain(textConstants.delegationComplete); + + const availablePunk = await delegatePage.accountBalance.getText(); + //expect new account balance - the fee calculation above + expect(await helper.currentBalance(availablePunk)).toEqual(sumCost); + + }) + //currently skipping, investigating gateway bonding + it.skip("input gateway amount and stake then check account balances", async () => { + const balanceText = await delegatePage.accountBalance.getText(); + + const getTransfeeAmount = await delegatePage.transactionFeeAmount.getText(); + + await delegatePage.gateWayRadioButton.click(); + + await delegatePage.nodeIdentity.setValue(userData.identity_key_to_delegate_gateway); + + await delegatePage.amountToDelegate.setValue(userData.delegate_amount); + + //transfer fee + amount delegation + const sumCost = await helper.calculateFees(balanceText, getTransfeeAmount, userData.delegate_amount); + + await delegatePage.delegateStakeButton.click(); + + await delegatePage.finishSuccessDelegation.waitForClickable({ timeout: 10000 }); + + const getConfirmationText = await delegatePage.successfullyDelegate.getText(); + expect(getConfirmationText).toContain(textConstants.delegationComplete); + + const availablePunk = await delegatePage.accountBalance.getText(); + //expect new account balance - the fee calculation above + expect(await helper.currentBalance(availablePunk)).toEqual(sumCost); + + }) +}); diff --git a/tauri-wallet/webdriver/tests/specs/existinguser/test.wallet.home.js b/tauri-wallet/webdriver/tests/specs/existinguser/test.wallet.home.js new file mode 100644 index 0000000000..772aa0cd44 --- /dev/null +++ b/tauri-wallet/webdriver/tests/specs/existinguser/test.wallet.home.js @@ -0,0 +1,48 @@ +const userData = require('../../../common/data/user-data'); +const helper = require('../../../common/helpers/helper'); +const walletLogin = require('../../pages/wallet.login'); +const homepPage = require('../../pages/wallet.homepage'); +const textConstants = require('../../../common/constants/text-constants'); + +describe("Simple navigational and input tests on the wallet home page", () => { + it("should have the sign in header", async () => { + + const signInText = await walletLogin.signInLabel.getText(); + + expect(signInText).toEqual(textConstants.homePageSignIn); + }); + + it("submitting the sign in button with no input throws a validation error", async () => { + + await walletLogin.signInButton.click(); + + const errorResponseText = await walletLogin.errorValidation.getText(); + + expect(errorResponseText).toEqual(textConstants.homePageErrorMnemonic); + }); + + //currently the punk_address is not fully displayed on the wallet ui wallet + it("successfully input a bip39 mnemonic and log in", async () => { + + const mnemonic = await helper.decodeBase(userData.mnemonic); + + await walletLogin.enterMnemonic(mnemonic); + + const getWalletAddress = await walletLogin.walletAddress.getText(); + + expect(userData.punk_address).toContain(getWalletAddress); + + }); + + //log out to homepage + it("successfully log out the application", async () => { + + await helper.scrollIntoView(homepPage.logOutButton); + + await homepPage.logOutButton.click(); + + const isNewAccountPresent = await walletLogin.createNewAccount.getText(); + + expect(isNewAccountPresent).toEqual(textConstants.createOne); + }); +}); \ No newline at end of file diff --git a/tauri-wallet/webdriver/tests/specs/existinguser/test.wallet.receive.js b/tauri-wallet/webdriver/tests/specs/existinguser/test.wallet.receive.js new file mode 100644 index 0000000000..a05386fd8a --- /dev/null +++ b/tauri-wallet/webdriver/tests/specs/existinguser/test.wallet.receive.js @@ -0,0 +1,31 @@ +const userData = require('../../../common/data/user-data'); +const textConstants = require('../../../common/constants/text-constants'); +const helper = require('../../../common/helpers/helper'); +const walletLogin = require('../../pages/wallet.login'); +const receive = require('../../pages/wallet.receive'); +const walletHomepage = require('../../pages/wallet.homepage'); + +describe("provide the relevant information about a user nym wallet address", () => { + it("should have the receivers address and a qr code present", async () => { + + const mnemonic = await helper.decodeBase(userData.mnemonic); + + await walletLogin.enterMnemonic(mnemonic); + + await walletHomepage.receiveButton.click(); + + await receive.header.waitForDisplayed({ timeout: 1500 }); + + await receive.WaitForButtonChangeOnCopy(); + + //implement qr code scanner here + + const textHeader = await receive.header.getText(); + const getInformationText = await receive.information.getText(); + const getPunkAddress = await receive.walletAddress.getText(); + + expect(getPunkAddress).toEqual(userData.punk_address); + expect(getInformationText).toEqual(textConstants.recievePageInformation); + expect(textConstants.receivePageHeaderText).toEqual(textHeader); + }); +}); diff --git a/tauri-wallet/webdriver/tests/specs/existinguser/test.wallet.send.js b/tauri-wallet/webdriver/tests/specs/existinguser/test.wallet.send.js new file mode 100644 index 0000000000..9b3db5f247 --- /dev/null +++ b/tauri-wallet/webdriver/tests/specs/existinguser/test.wallet.send.js @@ -0,0 +1,45 @@ +const userData = require('../../../common/data/user-data'); +const helper = require('../../../common/helpers/helper'); +const textConstants = require('../../../common/constants/text-constants'); +const walletLogin = require('../../pages/wallet.login'); +const sendWallet = require('../../pages/wallet.send'); +const walletHomepage = require('../../pages/wallet.homepage'); + +describe("send punk to another a wallet", () => { + it("expect send screen to display the data", async () => { + + const mnemonic = await helper.decodeBase(userData.mnemonic); + + await walletLogin.enterMnemonic(mnemonic); + + await walletHomepage.sendButton.click(); + + const textHeader = await sendWallet.sendHeader.getText(); + + expect(textHeader).toContain(textConstants.sendPunk); + + }); + + //continue sequential flow for test + //be wary about production - be wary of funds allocation factor in gas fees + it("send funds correctly to another punk address", async () => { + + //already logged in due to the previous test + await sendWallet.toAddress.addValue(userData.receiver_address); + + await sendWallet.amount.addValue(userData.amount_to_send); + + await sendWallet.nextButton.waitForEnabled({ timeout: 3000 }); + + await sendWallet.nextButton.click(); + + await sendWallet.sendButton.click(); + + await sendWallet.finishButton.waitForClickable({ timeout: 10000 }); + + await sendWallet.finishButton.click(); + + //todo implement asserts around account balance at the start vs the end + }); +}); + diff --git a/tauri-wallet/webdriver/tests/specs/existinguser/test.wallet.undelegate.js b/tauri-wallet/webdriver/tests/specs/existinguser/test.wallet.undelegate.js new file mode 100644 index 0000000000..2f6fe3071c --- /dev/null +++ b/tauri-wallet/webdriver/tests/specs/existinguser/test.wallet.undelegate.js @@ -0,0 +1,34 @@ +const userData = require('../../../common/data/user-data'); +const helper = require('../../../common/helpers/helper'); +const walletLogin = require('../../pages/wallet.login'); +const walletHomepage = require('../../pages/wallet.homepage'); +const unDelegatePage = require('../../pages/wallet.delegate'); + +describe("un-delegate to a mix node or gateway", () => { + it("ensure that fields are enabled for existing user", async () => { + + //we are ensuring that the fields are selectable for undelegation + //not proceeding to undelegate a node or gateway + + const mnemonic = await helper.decodeBase(userData.mnemonic); + + await walletLogin.enterMnemonic(mnemonic); + + await helper.scrollIntoView(walletHomepage.unDelegateButton); + + await helper.navigateAndClick(walletHomepage.unDelegateButton); + + await unDelegatePage.unDelegateButton.waitForClickable({ timeout: 3000}); + + const button = await unDelegatePage.unDelegateButton.isEnabled(); + expect(button).toEqual(true); + + await unDelegatePage.unDelegateGatewayRadioButton.click(); + const gateWaySelected = await unDelegatePage.unDelegateGatewayRadioButton.isSelected(); + + expect(gateWaySelected).toEqual(true); + + const mixNodeRadioButton = await unDelegatePage.unMixNodeRadioButton.isSelected(); + expect(mixNodeRadioButton).toEqual(false); + }) +}); diff --git a/tauri-wallet/webdriver/tests/specs/newuser/test.wallet.create.js b/tauri-wallet/webdriver/tests/specs/newuser/test.wallet.create.js new file mode 100644 index 0000000000..4295305551 --- /dev/null +++ b/tauri-wallet/webdriver/tests/specs/newuser/test.wallet.create.js @@ -0,0 +1,12 @@ +const walletLogin = require('../../pages/wallet.login'); +const textConstants = require('../../../common/constants/text-constants'); + +describe("non existing wallet holder", () => { + it("create new account", async () => { + const signInText = await walletLogin.signInLabel.getText(); + expect(signInText).toEqual(textConstants.homePageSignIn); + + await walletLogin.createNewAccount.click(); + + }) +}); \ No newline at end of file diff --git a/tauri-wallet/webdriver/wdio.conf.cjs b/tauri-wallet/webdriver/wdio.conf.cjs new file mode 100644 index 0000000000..5b82e08895 --- /dev/null +++ b/tauri-wallet/webdriver/wdio.conf.cjs @@ -0,0 +1,65 @@ +const os = require("os"); +const path = require("path"); +const { spawn, spawnSync } = require("child_process"); +const nym_path = "../target/release/tauri-wallet"; + +exports.config = { + //run sequentially, as using one default user may cause issues for parallel test runs for now + specs: [ + "./tests/specs/existinguser/test.wallet.home.js", + "./tests/specs/existinguser/test.wallet.send.js", + "./tests/specs/existinguser/test.wallet.receive.js", + "./tests/specs/existinguser/test.wallet.bond.js", + "./tests/specs/existinguser/test.wallet.delegate.js", + "./tests/specs/newuser/test.wallet.create.js" + ], + + //run tests by providing --suite {{login}} + suites: { + login: ["./tests/specs/existinguser/test.wallet.home.js"], + sendAndReceive: ["./tests/specs/existinguser/test.wallet.send.js", + "./tests/specs/existinguser/test.wallet.receive.js"], + bond: ["./tests/specs/existinguser/test.wallet.bond.js"], + delegate: ["./tests/specs/existinguser/test.wallet.delegate.js", + "./tests/specs/existinguser/test.wallet.undelegate.js"], + nonExsistingUser : ["./tests/specs/newuser/test.wallet.create.js"] + }, + maxInstances: 1, + capabilities: [ + { + maxInstances: 1, + "tauri:options": { + application: nym_path, + }, + }, + ], + // =================== + // Test Configurations + // =================== + // Define all options that are relevant for the WebdriverIO instance here + // + // Level of logging verbosity: trace | debug | info | warn | error | silent + logLevel: 'info', + bail: 0, + framework: 'mocha', + reporters: ['spec'], + mochaOpts: { + ui: 'bdd', + timeout: 60000 + }, + logLevel: 'debug', + // this is documentented in the readme - you will need to build the project first + // ensure the rust project is built since we expect this binary to exist for the webdriver sessions + //onPrepare: () => spawnSync("cargo", ["build", "--release"]), + + // ensure we are running `tauri-driver` before the session starts so that we can proxy the webdriver requests + beforeSession: () => + (tauriDriver = spawn( + path.resolve(os.homedir(), ".cargo", "bin", "tauri-driver"), + [], + { stdio: [null, process.stdout, process.stderr] } + )), + + // clean up the `tauri-driver` process we spawned at the start of the session + afterSession: () => tauriDriver.kill() +} From 84b426042edcf25b2dc24d94b5ea0aab50906c82 Mon Sep 17 00:00:00 2001 From: Tommy Date: Fri, 15 Oct 2021 17:24:35 +0100 Subject: [PATCH 02/21] wrong workflow check in --- .../.github/workflows/nym_wallet.yml | 51 ------------------- 1 file changed, 51 deletions(-) delete mode 100644 tauri-wallet/webdriver/.github/workflows/nym_wallet.yml diff --git a/tauri-wallet/webdriver/.github/workflows/nym_wallet.yml b/tauri-wallet/webdriver/.github/workflows/nym_wallet.yml deleted file mode 100644 index 2e559c8ac8..0000000000 --- a/tauri-wallet/webdriver/.github/workflows/nym_wallet.yml +++ /dev/null @@ -1,51 +0,0 @@ -on: [ push ] - -name: webdriverio tests for nym wallet - -jobs: - test: - name: wallet tests - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Tauri dependencies - run: > - sudo apt-get update && - sudo apt-get install -y - libgtk-3-dev - libgtksourceview-3.0-dev - webkit2gtk-4.0 - libappindicator3-dev - webkit2gtk-driver - xvfb - - - name: Rust stable - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - components: clippy, rustfmt - - - name: Node v16 - uses: actions/setup-node@v1 - with: - node-version: 16.x - - - name: Build application - run : yarn run webpack:build & yarn run tauri:build - working-directory: ./ - - - name: Yarn install - run: yarn install - working-directory: webdriver/ - - - name: Install tauri-driver - uses: actions-rs/cargo@v1 - with: - command: install - args: tauri-driver - - - name: Launch tests - run: xvfb-run yarn test:login - working-directory: webdriver/ \ No newline at end of file From 9555f3a2cdca0007647cb9c5afec76f573964d33 Mon Sep 17 00:00:00 2001 From: Tommy Date: Fri, 15 Oct 2021 18:06:24 +0100 Subject: [PATCH 03/21] testing tauri-wallet-tests.yml --- .github/workflows/nym-wallet-tests.yml | 57 ++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/workflows/nym-wallet-tests.yml diff --git a/.github/workflows/nym-wallet-tests.yml b/.github/workflows/nym-wallet-tests.yml new file mode 100644 index 0000000000..1cbe4c3f55 --- /dev/null +++ b/.github/workflows/nym-wallet-tests.yml @@ -0,0 +1,57 @@ +name: webdriverio tests for nym wallet + +on: + push: + paths: + - '/tauri-wallet/*' +defaults: + run: + working-directory: tauri-wallet + +jobs: + test: + name: wallet tests + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Tauri dependencies + run: > + sudo apt-get update && + sudo apt-get install -y + libgtk-3-dev + libgtksourceview-3.0-dev + webkit2gtk-4.0 + libappindicator3-dev + webkit2gtk-driver + xvfb + + - name: Rust stable + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + components: clippy, rustfmt + + - name: Node v16 + uses: actions/setup-node@v1 + with: + node-version: 16.x + + - name: Build application + run: yarn run webpack:build & yarn run tauri:build + working-directory: tauri-wallet + + - name: Yarn install + run: yarn install + working-directory: webdriver/ + + - name: Install tauri-driver + uses: actions-rs/cargo@v1 + with: + command: install + args: tauri-driver + + - name: Launch tests + run: xvfb-run yarn test:login + working-directory: webdriver/ \ No newline at end of file From dd590e8779957dc063d8257b504775cac27a1fdc Mon Sep 17 00:00:00 2001 From: Tommy Date: Fri, 15 Oct 2021 18:17:51 +0100 Subject: [PATCH 04/21] Update Readme for windows. --- tauri-wallet/README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tauri-wallet/README.md b/tauri-wallet/README.md index 465cd18132..5cd0fdd60a 100644 --- a/tauri-wallet/README.md +++ b/tauri-wallet/README.md @@ -7,12 +7,19 @@ SPDX-License-Identifier: Apache-2.0 A Rust and Tauri desktop wallet implementation. -## Installation prerequisites +## Installation prerequisites Linux / Mac - `Yarn` - `NodeJS >= v16.8.0` - `Rust & cargo >= v1.51` +## Installation prerequisites Windows + +- When running on Windows you will need to install c++ build tools +- An easy guide to get rust up and running [Installation]("http://kennykerr.ca/2019/11/18/rust-getting-started/") +- When installing NodeJS please use the `current features` version +- Using a package manager like [Chocolatey]("chocolatey.org") is recommended + ## Installation Inside of the `tauri-wallet` folder, run the following commands From 666c233d6ce08b95ed647371dc97d89086cf7fd4 Mon Sep 17 00:00:00 2001 From: Tommy Date: Mon, 18 Oct 2021 12:14:57 +0100 Subject: [PATCH 05/21] remove workflow --- .github/workflows/nym-wallet-tests.yml | 57 -------------------------- 1 file changed, 57 deletions(-) delete mode 100644 .github/workflows/nym-wallet-tests.yml diff --git a/.github/workflows/nym-wallet-tests.yml b/.github/workflows/nym-wallet-tests.yml deleted file mode 100644 index 1cbe4c3f55..0000000000 --- a/.github/workflows/nym-wallet-tests.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: webdriverio tests for nym wallet - -on: - push: - paths: - - '/tauri-wallet/*' -defaults: - run: - working-directory: tauri-wallet - -jobs: - test: - name: wallet tests - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Tauri dependencies - run: > - sudo apt-get update && - sudo apt-get install -y - libgtk-3-dev - libgtksourceview-3.0-dev - webkit2gtk-4.0 - libappindicator3-dev - webkit2gtk-driver - xvfb - - - name: Rust stable - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - components: clippy, rustfmt - - - name: Node v16 - uses: actions/setup-node@v1 - with: - node-version: 16.x - - - name: Build application - run: yarn run webpack:build & yarn run tauri:build - working-directory: tauri-wallet - - - name: Yarn install - run: yarn install - working-directory: webdriver/ - - - name: Install tauri-driver - uses: actions-rs/cargo@v1 - with: - command: install - args: tauri-driver - - - name: Launch tests - run: xvfb-run yarn test:login - working-directory: webdriver/ \ No newline at end of file From e6c5a97f8ca3faacda53df2a95929bd18202d9f1 Mon Sep 17 00:00:00 2001 From: Tommy Date: Mon, 18 Oct 2021 12:18:18 +0100 Subject: [PATCH 06/21] set to silent logging --- tauri-wallet/webdriver/wdio.conf.cjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tauri-wallet/webdriver/wdio.conf.cjs b/tauri-wallet/webdriver/wdio.conf.cjs index 5b82e08895..744ef25314 100644 --- a/tauri-wallet/webdriver/wdio.conf.cjs +++ b/tauri-wallet/webdriver/wdio.conf.cjs @@ -39,7 +39,7 @@ exports.config = { // Define all options that are relevant for the WebdriverIO instance here // // Level of logging verbosity: trace | debug | info | warn | error | silent - logLevel: 'info', + logLevel: 'silent', bail: 0, framework: 'mocha', reporters: ['spec'], From 5a270f64892c0269ed118936c3b142c0427a2eb2 Mon Sep 17 00:00:00 2001 From: Tommy Date: Thu, 21 Oct 2021 11:02:28 +0100 Subject: [PATCH 07/21] pushing new wallet create - WIP --- .../webdriver/tests/pages/wallet.create.js | 19 +++++++++++++++++++ .../tests/specs/newuser/test.wallet.create.js | 14 ++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 tauri-wallet/webdriver/tests/pages/wallet.create.js diff --git a/tauri-wallet/webdriver/tests/pages/wallet.create.js b/tauri-wallet/webdriver/tests/pages/wallet.create.js new file mode 100644 index 0000000000..ca35690be6 --- /dev/null +++ b/tauri-wallet/webdriver/tests/pages/wallet.create.js @@ -0,0 +1,19 @@ +class WalletCreate { + + get createAccount() {return $('#root > div > div:nth-child(2) > div > div > div:nth-child(2) > button.MuiButtonBase-root.MuiButton-root.MuiButton-contained.MuiButton-containedPrimary.MuiButton-disableElevation.MuiButton-fullWidth > span.MuiButton-label')} + + get accountCreatedSuccessfully() { return $('#root > div > div:nth-child(2) > div > div > div.MuiGrid-root.MuiGrid-container.MuiGrid-item.MuiGrid-justify-content-xs-center > div:nth-child(1) > p')} + + get walletMnemonicCreated() {return $('#root > div > div:nth-child(2) > div > p')} + + get walletMnemonicValue(){ return $('#root > div > div:nth-child(2) > div > div > div.MuiGrid-root.MuiGrid-container.MuiGrid-item.MuiGrid-justify-content-xs-center > div.MuiPaper-root.MuiCard-root.MuiPaper-outlined.MuiPaper-rounded > div > div:nth-child(2) > p')} + + get punkAddress(){ return $('#root > div > div:nth-child(2) > div > div > div.MuiGrid-root.MuiGrid-container.MuiGrid-item.MuiGrid-justify-content-xs-center > div.MuiPaper-root.MuiCard-root.MuiPaper-outlined.MuiPaper-rounded > div > div:nth-child(5) > p')} + + get backToSignIn() {return $('#root > div > div:nth-child(2) > div > div > div:nth-child(2) > button > span.MuiButton-label')} + + get signInButton() {return $('[data-testid="signButton"]')} + + +} +module.exports = new WalletCreate() \ No newline at end of file diff --git a/tauri-wallet/webdriver/tests/specs/newuser/test.wallet.create.js b/tauri-wallet/webdriver/tests/specs/newuser/test.wallet.create.js index 4295305551..692453559b 100644 --- a/tauri-wallet/webdriver/tests/specs/newuser/test.wallet.create.js +++ b/tauri-wallet/webdriver/tests/specs/newuser/test.wallet.create.js @@ -1,12 +1,26 @@ const walletLogin = require('../../pages/wallet.login'); +const walletSignUp = require('../../pages/wallet.create') const textConstants = require('../../../common/constants/text-constants'); +const WALLET_SUCCESS = "Please store your mnemonic in a safe place. You'll need it to access your wallet" + describe("non existing wallet holder", () => { it("create new account", async () => { + const signInText = await walletLogin.signInLabel.getText(); expect(signInText).toEqual(textConstants.homePageSignIn); await walletLogin.createNewAccount.click(); + await walletSignUp.createAccount.click(); + + await walletSignUp.accountCreatedSuccessfully.waitForEnabled({ timeout: 6000 }); + + const getWalletText = await walletSignUp.punkAddress.getText() + expect(getWalletText.length).toEqual(43) + + const getMnemonic = await walletSignUp.walletMnemonicCreated.getText() + expect(getMnemonic).toEqual(WALLET_SUCCESS) + }) }); \ No newline at end of file From c882487d01067117c1b04a7d76d527fb34d6859b Mon Sep 17 00:00:00 2001 From: Tommy Date: Thu, 21 Oct 2021 11:18:45 +0100 Subject: [PATCH 08/21] change casing on identifiers to kebab-casing --- tauri-wallet/src/components/Confirmation.tsx | 2 +- .../src/components/CopyToClipboard.tsx | 2 +- tauri-wallet/src/components/Error.tsx | 4 +- tauri-wallet/src/components/Nav.tsx | 2 +- .../src/components/NavigationCards.tsx | 6 +- tauri-wallet/src/components/NoClientError.tsx | 2 +- .../src/components/NodeTypeSelector.tsx | 4 +- tauri-wallet/src/routes/balance.tsx | 7 +- tauri-wallet/src/routes/bond/BondForm.tsx | 4 +- tauri-wallet/src/routes/bond/index.tsx | 4 +- .../src/routes/delegate/DelegateForm.tsx | 4 +- tauri-wallet/src/routes/delegate/index.tsx | 4 +- tauri-wallet/src/routes/receive.tsx | 6 +- .../src/routes/send/SendConfirmation.tsx | 6 +- tauri-wallet/src/routes/send/SendError.tsx | 2 +- tauri-wallet/src/routes/send/SendReview.tsx | 8 +- tauri-wallet/src/routes/send/SendWizard.tsx | 2 +- tauri-wallet/src/routes/sign-in.tsx | 10 +- tauri-wallet/src/routes/unbond/index.tsx | 6 +- .../src/routes/undelegate/UndelegateForm.tsx | 4 +- tauri-wallet/src/routes/undelegate/index.tsx | 6 +- .../webdriver/tests/pages/wallet.create.js | 2 +- tauri-wallet/webdriver/yarn.lock | 2584 +++++++++++++++++ 23 files changed, 2633 insertions(+), 48 deletions(-) create mode 100644 tauri-wallet/webdriver/yarn.lock diff --git a/tauri-wallet/src/components/Confirmation.tsx b/tauri-wallet/src/components/Confirmation.tsx index 87c570b84c..e227021d0b 100644 --- a/tauri-wallet/src/components/Confirmation.tsx +++ b/tauri-wallet/src/components/Confirmation.tsx @@ -33,7 +33,7 @@ export const Confirmation = ({ {error === null ? ( SuccessMessage ) : ( - + {error.name} {failureMessage} - {error.message} diff --git a/tauri-wallet/src/components/CopyToClipboard.tsx b/tauri-wallet/src/components/CopyToClipboard.tsx index c09edfe287..9e4cd4ae71 100644 --- a/tauri-wallet/src/components/CopyToClipboard.tsx +++ b/tauri-wallet/src/components/CopyToClipboard.tsx @@ -40,7 +40,7 @@ export const CopyToClipboard = ({ text }: { text: string }) => { size="small" variant={copied ? 'text' : 'outlined'} aria-label="save" - data-testid="copyButton" + data-testid="copy-button" onClick={() => handleCopy({ text, cb: updateCopyStatus })} endIcon={copied && } style={copied ? { background: green[500], color: 'white' } : {}} diff --git a/tauri-wallet/src/components/Error.tsx b/tauri-wallet/src/components/Error.tsx index cb211269d4..d1947bac31 100644 --- a/tauri-wallet/src/components/Error.tsx +++ b/tauri-wallet/src/components/Error.tsx @@ -6,11 +6,11 @@ import { Button } from '@material-ui/core' export const ErrorFallback = ({ error, resetErrorBoundary }: FallbackProps) => { return (
- + {error.name} {error.message} - + Stack trace {error.stack} diff --git a/tauri-wallet/src/components/Nav.tsx b/tauri-wallet/src/components/Nav.tsx index ba60e4d162..4af636f53f 100644 --- a/tauri-wallet/src/components/Nav.tsx +++ b/tauri-wallet/src/components/Nav.tsx @@ -131,7 +131,7 @@ export const Nav = () => { )} - + { noPadding Action={ - + @@ -71,7 +71,7 @@ export const AddressCard = () => { title="Address" subheader="Wallet payments address" noPadding - data-testid="walletAddressHeader" + data-testid="wallet-address-header" Action={ @@ -107,7 +107,7 @@ export const AddressCard = () => { } > - {truncate(clientDetails?.client_address!, 35)} diff --git a/tauri-wallet/src/components/NoClientError.tsx b/tauri-wallet/src/components/NoClientError.tsx index b703832aee..cf65ae0904 100644 --- a/tauri-wallet/src/components/NoClientError.tsx +++ b/tauri-wallet/src/components/NoClientError.tsx @@ -5,7 +5,7 @@ import { Alert, AlertTitle } from '@material-ui/lab' export const NoClientError = () => { return ( - No client detected + No client detected Have you signed in? Try to go back to{' '} the main page and try again diff --git a/tauri-wallet/src/components/NodeTypeSelector.tsx b/tauri-wallet/src/components/NodeTypeSelector.tsx index 3f068680b3..e36432a637 100644 --- a/tauri-wallet/src/components/NodeTypeSelector.tsx +++ b/tauri-wallet/src/components/NodeTypeSelector.tsx @@ -34,13 +34,13 @@ export const NodeTypeSelector = ({ value={EnumNodeType.mixnode} control={} label="Mixnode" - data-testid="mixNode" + data-testid="mix-node" disabled={disabled} /> } - data-testid="gateWay" + data-testid="gate-way" label="Gateway" disabled={disabled} /> diff --git a/tauri-wallet/src/routes/balance.tsx b/tauri-wallet/src/routes/balance.tsx index 6ffbf480b9..488890c3bf 100644 --- a/tauri-wallet/src/routes/balance.tsx +++ b/tauri-wallet/src/routes/balance.tsx @@ -18,6 +18,7 @@ export const Balance = () => { size="small" color="primary" type="submit" + data-testid="refresh-button" onClick={fetchBalance} disabled={isLoading} disableElevation @@ -31,13 +32,13 @@ export const Balance = () => { return ( - + {error && ( } style={{ padding: theme.spacing(2) }} > @@ -47,7 +48,7 @@ export const Balance = () => { {!error && ( } > diff --git a/tauri-wallet/src/routes/bond/BondForm.tsx b/tauri-wallet/src/routes/bond/BondForm.tsx index 06936f86ee..ea689aa7db 100644 --- a/tauri-wallet/src/routes/bond/BondForm.tsx +++ b/tauri-wallet/src/routes/bond/BondForm.tsx @@ -142,7 +142,7 @@ export const BondForm = ({ {fees && ( - + {`A fee of ${ watchNodeType === EnumNodeType.mixnode ? fees.mixnode.amount @@ -369,7 +369,7 @@ export const BondForm = ({ color="primary" type="submit" size="large" - data-testid="submitButton" + data-testid="submit-button" disableElevation onClick={handleSubmit(onSubmit)} endIcon={isSubmitting && } diff --git a/tauri-wallet/src/routes/bond/index.tsx b/tauri-wallet/src/routes/bond/index.tsx index cf11a2c712..0e89ae070f 100644 --- a/tauri-wallet/src/routes/bond/index.tsx +++ b/tauri-wallet/src/routes/bond/index.tsx @@ -94,10 +94,10 @@ export const Bond = () => { Successfully bonded node + Successfully bonded node } Error={ - + An error occurred with the request: {message} } diff --git a/tauri-wallet/src/routes/delegate/DelegateForm.tsx b/tauri-wallet/src/routes/delegate/DelegateForm.tsx index 2aabc04ae7..0a32c08395 100644 --- a/tauri-wallet/src/routes/delegate/DelegateForm.tsx +++ b/tauri-wallet/src/routes/delegate/DelegateForm.tsx @@ -97,7 +97,7 @@ export const DelegateForm = ({ /> - + {`A fee of ${ watchNodeType === EnumNodeType.mixnode ? fees.mixnode.amount @@ -153,7 +153,7 @@ export const DelegateForm = ({
- {data.to_address} + {data.to_address}
@@ -70,7 +70,7 @@ export const SendConfirmation = ({
- {data.amount.amount + ' punks'} + {data.amount.amount + ' punks'}
diff --git a/tauri-wallet/src/routes/send/SendError.tsx b/tauri-wallet/src/routes/send/SendError.tsx index 644067e432..f90c9b9df5 100644 --- a/tauri-wallet/src/routes/send/SendError.tsx +++ b/tauri-wallet/src/routes/send/SendError.tsx @@ -37,7 +37,7 @@ export const SendError = ({ message }: { message?: string }) => { variant="outlined" style={{ width: '100%', padding: theme.spacing(2) }} > - + An error occured during the request {message} diff --git a/tauri-wallet/src/routes/send/SendReview.tsx b/tauri-wallet/src/routes/send/SendReview.tsx index 0b31454d3d..de7072d370 100644 --- a/tauri-wallet/src/routes/send/SendReview.tsx +++ b/tauri-wallet/src/routes/send/SendReview.tsx @@ -44,19 +44,19 @@ export const SendReview = () => { ) : ( - + - + - + @@ -65,7 +65,7 @@ export const SendReview = () => { diff --git a/tauri-wallet/src/routes/send/SendWizard.tsx b/tauri-wallet/src/routes/send/SendWizard.tsx index 65ed2f9c97..2f41946157 100644 --- a/tauri-wallet/src/routes/send/SendWizard.tsx +++ b/tauri-wallet/src/routes/send/SendWizard.tsx @@ -148,7 +148,7 @@ export const SendWizard = () => { disableElevation style={{ marginRight: theme.spacing(1) }} onClick={handlePreviousStep} - data-testid="backButton" + data-testid="back-button" > Back diff --git a/tauri-wallet/src/routes/sign-in.tsx b/tauri-wallet/src/routes/sign-in.tsx index 14670f9b63..690e921cea 100644 --- a/tauri-wallet/src/routes/sign-in.tsx +++ b/tauri-wallet/src/routes/sign-in.tsx @@ -239,7 +239,7 @@ const CreateAccountContent = ({ showSignIn }: { showSignIn: () => void }) => { /> Wallet setup complete - + Please store your mnemonic in a safe place. You'll need it to access your wallet @@ -257,7 +257,7 @@ const CreateAccountContent = ({ showSignIn }: { showSignIn: () => void }) => { - {accountDetails.mnemonic} + {accountDetails.mnemonic}
@@ -273,7 +273,7 @@ const CreateAccountContent = ({ showSignIn }: { showSignIn: () => void }) => { - {accountDetails.client_address} + {accountDetails.client_address} @@ -293,7 +293,7 @@ const CreateAccountContent = ({ showSignIn }: { showSignIn: () => void }) => { variant="contained" color="primary" type="submit" - data-testid="createButton" + data-testid="create-button" disableElevation style={{ marginBottom: theme.spacing(1) }} disabled={isLoading} @@ -305,7 +305,7 @@ const CreateAccountContent = ({ showSignIn }: { showSignIn: () => void }) => { fullWidth variant="text" onClick={showSignIn} - data-testid="signInButton" + data-testid="sign-in-button" startIcon={} > Sign in diff --git a/tauri-wallet/src/routes/unbond/index.tsx b/tauri-wallet/src/routes/unbond/index.tsx index 36b7756603..2edca71138 100644 --- a/tauri-wallet/src/routes/unbond/index.tsx +++ b/tauri-wallet/src/routes/unbond/index.tsx @@ -29,10 +29,10 @@ export const Unbond = () => { {ownership?.hasOwnership && ( { setIsLoading(true) @@ -50,7 +50,7 @@ export const Unbond = () => { )} {!ownership.hasOwnership && ( - + You don't currently have a bonded node )} diff --git a/tauri-wallet/src/routes/undelegate/UndelegateForm.tsx b/tauri-wallet/src/routes/undelegate/UndelegateForm.tsx index f897851da0..4be7bacf45 100644 --- a/tauri-wallet/src/routes/undelegate/UndelegateForm.tsx +++ b/tauri-wallet/src/routes/undelegate/UndelegateForm.tsx @@ -84,7 +84,7 @@ export const UndelegateForm = ({ /> - + {`A fee of ${ watchNodeType === EnumNodeType.mixnode ? fees.mixnode.amount @@ -140,7 +140,7 @@ export const UndelegateForm = ({ variant="contained" color="primary" type="submit" - data-testid="submitButton" + data-testid="submit-button" disableElevation disabled={isSubmitting} endIcon={isSubmitting && } diff --git a/tauri-wallet/src/routes/undelegate/index.tsx b/tauri-wallet/src/routes/undelegate/index.tsx index bd9208f1ba..98b6319b08 100644 --- a/tauri-wallet/src/routes/undelegate/index.tsx +++ b/tauri-wallet/src/routes/undelegate/index.tsx @@ -102,14 +102,14 @@ export const Undelegate = () => { + An error occurred with the request: {message} } Success={ {' '} - Undelegation complete + Undelegation complete {message} } @@ -125,7 +125,7 @@ export const Undelegate = () => { }} >