diff --git a/nym-wallet/wallet-fe-tests/common/helper.ts b/nym-wallet/wallet-fe-tests/common/helper.ts index b88066b71e..cc77e09718 100644 --- a/nym-wallet/wallet-fe-tests/common/helper.ts +++ b/nym-wallet/wallet-fe-tests/common/helper.ts @@ -23,8 +23,9 @@ class Helpers { // click the mnemonic words by index position // TO-DO find the best approach - mnemonicWordTileIndex = async (browser: WebdriverIO.Browser) => { + mnemonicWordTileIndex = async () => { let mnemonic = await browser.execute(() => { + // @ts-ignore: Object is possibly 'null'. return document.getElementById('mnemonicPhrase').innerHTML; }); @@ -33,8 +34,8 @@ class Helpers { await this.navigateAndClick(Auth.copyMnemonic); await this.navigateAndClick(Auth.iSavedMnemonic); // verify the mnemonic words in the correct order - let mnemonicWordTiles = await await Auth.mnemonicWordTile; - let wordTileIndex = await await Auth.wordIndex; + let mnemonicWordTiles = await Auth.mnemonicWordTile; + let wordTileIndex = await Auth.wordIndex; const wordsArray: any[] = []; @@ -52,6 +53,7 @@ class Helpers { } const nextButton = await Auth.nextToStep3; + //something needs checking over here const isNextDisabled = await nextButton.getAttribute('disabled'); expect(isNextDisabled).toBe(null); await this.navigateAndClick(Auth.nextToStep3); @@ -119,4 +121,4 @@ class Helpers { }; } -module.exports = new Helpers(); +export default new Helpers(); diff --git a/nym-wallet/wallet-fe-tests/common/user-data.json b/nym-wallet/wallet-fe-tests/common/user-data.json index c01e8a1777..42581ab0ee 100644 --- a/nym-wallet/wallet-fe-tests/common/user-data.json +++ b/nym-wallet/wallet-fe-tests/common/user-data.json @@ -1,3 +1,3 @@ { - "mnemonic": "" + "mnemonic": "Y2FsbCBub2JsZSBhdWN0aW9uIHNhdGlzZnkgZHVzdCBzdWRkZW4gbWF0aCBsb2FuIHVzdWFsIHBpenphIG95c3RlciBkd2FyZiB2ZXNzZWwgZm9vdCBuZXh0IGFnZSBsaW5rIHN0b29sIGZsdWlkIGxpemFyZCBzaHkgaGVuIHNlY3VyaXR5IHllbGxvdw==" } diff --git a/nym-wallet/wallet-fe-tests/package.json b/nym-wallet/wallet-fe-tests/package.json index a1b1646510..597e2b4f6e 100644 --- a/nym-wallet/wallet-fe-tests/package.json +++ b/nym-wallet/wallet-fe-tests/package.json @@ -22,6 +22,7 @@ "test-signup": "wdio run test/wdio.conf.ts --suite signup", "test-general": "wdio run test/wdio.conf.ts --suite general", "test-balance": "wdio run test/wdio.conf.ts --suite balance", + "test-helper": "wdio run test/wdio.conf.ts --suite helper", "test-delegation": "wdio run test/wdio.conf.ts --suite delegation", "run:prettier": "prettier --write ." } diff --git a/nym-wallet/wallet-fe-tests/scripts/killprocess.sh b/nym-wallet/wallet-fe-tests/scripts/killprocess.sh index 4626d0cf81..0b1dae2f50 100644 --- a/nym-wallet/wallet-fe-tests/scripts/killprocess.sh +++ b/nym-wallet/wallet-fe-tests/scripts/killprocess.sh @@ -1,5 +1,5 @@ #!/bin/bash #kill existing process -kill -9 $(ps aux | egrep "WebKitWeb|tauri-dri" | awk '{print $2}') +kill -9 "$(pgrep aux | grep -E "WebKitWeb|tauri-dri" | awk '{print $2}')" exit 0; diff --git a/nym-wallet/wallet-fe-tests/test/pageobjects/authScreens.ts b/nym-wallet/wallet-fe-tests/test/pageobjects/authScreens.ts index 5f10f26d4d..e3e72755b9 100644 --- a/nym-wallet/wallet-fe-tests/test/pageobjects/authScreens.ts +++ b/nym-wallet/wallet-fe-tests/test/pageobjects/authScreens.ts @@ -1,4 +1,6 @@ import Balance from '../pageobjects/balanceScreen'; +import Helper from '../../common/helper'; +const deleteScript = require('../../scripts/deletesavedwallet'); class Auth { //Welcome landing page @@ -137,11 +139,24 @@ class Auth { await (await this.signInMnemonic).click(); await (await this.mnemonicInput).waitForDisplayed(); await (await this.revealMnemonic).click(); - console.log('--------------- ' + mnemonic); await (await this.mnemonicInput).addValue(mnemonic); await (await this.signIn).click(); await (await Balance.nymBalance).waitForDisplayed({ timeout: 4000 }); }; + + newMnemonicCreation = async () => { + deleteScript; + + await Helper.navigateAndClick(this.createAccount); + + await Helper.mnemonicWordTileIndex(); + + const nextButton = await this.nextToStep3; + const isNextDisabled = await nextButton.getAttribute('disabled'); + + expect(isNextDisabled).toBe(null); + await Helper.navigateAndClick(this.nextToStep3); + }; } export default new Auth(); diff --git a/nym-wallet/wallet-fe-tests/test/specs/balance/balance.spec.ts b/nym-wallet/wallet-fe-tests/test/specs/balance/balance.spec.ts index 036f545a25..3a77a9ab79 100644 --- a/nym-wallet/wallet-fe-tests/test/specs/balance/balance.spec.ts +++ b/nym-wallet/wallet-fe-tests/test/specs/balance/balance.spec.ts @@ -1,7 +1,5 @@ import Balance from '../../pageobjects/balanceScreen'; -import Auth from '../../pageobjects/authScreens'; const textConstants = require('../../../common/text-constants'); -const userData = require('../../../common/user-data.json'); const Helper = require('../../../common/helper'); describe('Balance screen displays correctly', () => { diff --git a/nym-wallet/wallet-fe-tests/test/specs/helpers/helper.spec.ts b/nym-wallet/wallet-fe-tests/test/specs/helpers/helper.spec.ts index 2d74a365e3..aeddc295c6 100644 --- a/nym-wallet/wallet-fe-tests/test/specs/helpers/helper.spec.ts +++ b/nym-wallet/wallet-fe-tests/test/specs/helpers/helper.spec.ts @@ -1,31 +1,11 @@ import Auth from '../../pageobjects/authScreens'; -const deleteScript = require('../../../scripts/deletesavedwallet'); -const Helper = require('../../../common/helper'); -export function newMnemonicLogin() { - // TO-DO find the best approach +describe('Create a new account and verify login', () => { + it('generate new mnemonic and verify mnemonic words', async () => { + // test to check new mnemonic creation + // will refine shortly + await browser.pause(1500); - describe('Create a new account and verify login', () => { - it('generate new mnemonic and verify mnemonic words', async () => { - // delete an existing saved-wallet - deleteScript; - // click through create account flow - console.log('--------------------'); - console.log('step1'); - await Helper.navigateAndClick(Auth.createAccount); - await browser.pause(1500); - console.log('--------------------'); - console.log('step2'); - // save and verify mnemonic - const mnemonic = await browser.execute(() => { - return document.getElementById('mnemonicPhrase').innerHTML; - }); - await Helper.mnemonicWordTileIndex(mnemonic); - // ensure that once the task above is complete, the 'next' button is enabled - const nextButton = await Auth.nextToStep3; - const isNextDisabled = await nextButton.getAttribute('disabled'); - expect(isNextDisabled).toBe(null); - await Helper.navigateAndClick(Auth.nextToStep3); - }); + await Auth.newMnemonicCreation(); }); -} +}); diff --git a/nym-wallet/wallet-fe-tests/test/wdio.conf.ts b/nym-wallet/wallet-fe-tests/test/wdio.conf.ts index 673a4c9219..f82b2a49d8 100644 --- a/nym-wallet/wallet-fe-tests/test/wdio.conf.ts +++ b/nym-wallet/wallet-fe-tests/test/wdio.conf.ts @@ -26,6 +26,7 @@ exports.config = { general: ['./test/specs/general/*.ts'], send: ['./test/specs/bond/*.ts'], delegation: ['./test/specs/delegation/*.ts'], + helper: ['./test/specs/helpers/*.ts'], }, exclude: [