run formatter and remove duplicate deleteFile

This commit is contained in:
tommy
2022-11-16 12:36:09 +01:00
parent cd6c68907c
commit ee8101db04
24 changed files with 7641 additions and 7634 deletions
+63 -71
View File
@@ -1,130 +1,122 @@
import Balance from '../test/pageobjects/balanceScreen'
import Auth from '../test/pageobjects/authScreens'
const userData = require("../common/user-data.json");
const deleteScript = require("../scripts/deletesavedwallet")
const savedWalletScript = require("../scripts/savedwalletexists")
import Balance from '../test/pageobjects/balanceScreen';
import Auth from '../test/pageobjects/authScreens';
const userData = require('../common/user-data.json');
const deleteScript = require('../scripts/deletesavedwallet');
const savedWalletScript = require('../scripts/savedwalletexists');
class Helpers {
// clear wallet data, login, and navigate to QA network
// clear wallet data, login, and navigate to QA network
freshMnemonicLoginQaNetwork = async () => {
await deleteScript
await savedWalletScript
await deleteScript;
await savedWalletScript;
// await Auth.loginWithMnemonic(userData.mnemonic)
await this.loginMnemonic()
await Balance.selectQa()
}
await this.loginMnemonic();
await Balance.selectQa();
};
// login with a mnemonic
loginMnemonic = async () => {
var decodedmnemonic = this.decodeBase(userData.mnemonic)
await Auth.loginWithMnemonic(decodedmnemonic)
}
var decodedmnemonic = this.decodeBase(userData.mnemonic);
await Auth.loginWithMnemonic(decodedmnemonic);
};
// click the mnemonic words by index position
// TO-DO find the best approach
mnemonicWordTileIndex = async (browser: WebdriverIO.Browser) => {
let mnemonic = await browser.execute(() => {
return document.getElementById("mnemonicPhrase").innerHTML;
return document.getElementById('mnemonicPhrase').innerHTML;
});
let arrayMnemonic = mnemonic.split(" ")
let arrayMnemonic = mnemonic.split(' ');
await this.navigateAndClick(Auth.copyMnemonic)
await this.navigateAndClick(Auth.iSavedMnemonic)
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 await Auth.mnemonicWordTile;
let wordTileIndex = await await Auth.wordIndex;
const wordsArray: any[] = []
const wordsArray: any[] = [];
for (const word of mnemonicWordTiles) {
const wordText = await word.getText()
const index = arrayMnemonic.indexOf(wordText)
wordsArray.push({ word, index })
const wordText = await word.getText();
const index = arrayMnemonic.indexOf(wordText);
wordsArray.push({ word, index });
}
for (const index of wordTileIndex) {
const indexValue = await index.getText()
const match = wordsArray.find((word) => +word.index === +indexValue - 1)
const indexValue = await index.getText();
const match = wordsArray.find((word) => +word.index === +indexValue - 1);
if (match) {
await match.word.click()
await match.word.click();
}
}
const nextButton = await Auth.nextToStep3
const isNextDisabled = await nextButton.getAttribute('disabled')
expect(isNextDisabled).toBe(null)
await this.navigateAndClick(Auth.nextToStep3)
}
const nextButton = await Auth.nextToStep3;
const isNextDisabled = await nextButton.getAttribute('disabled');
expect(isNextDisabled).toBe(null);
await this.navigateAndClick(Auth.nextToStep3);
};
// decode user data file
decodeBase = (input) => {
const m = Buffer.from(input, "base64").toString();
const m = Buffer.from(input, 'base64').toString();
return m;
}
};
// common actions
navigateAndClick = async (element) => {
await element.waitForClickable({ timeout: 6000 })
await element.waitForClickable({ timeout: 6000 });
await element.click();
}
};
elementVisible = async (element) => {
await element.waitForDisplayed({ timeout: 6000 })
}
await element.waitForDisplayed({ timeout: 6000 });
};
elementClickable = async (element) => {
await element.toBeClickable({ timeout: 8000 })
}
await element.toBeClickable({ timeout: 8000 });
};
addValueToTextField = async (element, value) => {
await element.addValue(value)
}
await element.addValue(value);
};
verifyStrictText = async (element, expectedText) => {
let error = await element.getText()
expect(error).toStrictEqual(expectedText)
}
let error = await element.getText();
expect(error).toStrictEqual(expectedText);
};
verifyPartialText = async (element, expectedText) => {
let error = await element.getText()
expect(error).toContain(expectedText)
}
let error = await element.getText();
expect(error).toContain(expectedText);
};
// token calculations
// token calculations
currentBalance = async (value) => {
return parseFloat(value.split(/\s+/)[0].toString()).toFixed(5)
}
return parseFloat(value.split(/\s+/)[0].toString()).toFixed(5);
};
calculateFees = async (beforeBalance, transactionFee, amount, isSend) => {
let fee
let fee;
if (isSend) {
//send transaction
fee = transactionFee.split(/\s+/)[0]
fee = transactionFee.split(/\s+/)[0];
} else {
//delegate transaction
fee = transactionFee.split(/\s+/)[3]
fee = transactionFee.split(/\s+/)[3];
}
const currentBalance = beforeBalance.split(/\s+/)[0]
console.log("currenttttt 2 ............. = " + currentBalance)
const castCurrentBalance = parseFloat(currentBalance).toFixed(5)
console.log("castttt ............. " + castCurrentBalance)
const transCost = +parseFloat(amount) + +parseFloat(fee).toFixed(5)
console.log("trans ............." + transCost)
let sum = +castCurrentBalance - transCost
return sum.toFixed(5)
}
const currentBalance = beforeBalance.split(/\s+/)[0];
console.log('currenttttt 2 ............. = ' + currentBalance);
const castCurrentBalance = parseFloat(currentBalance).toFixed(5);
console.log('castttt ............. ' + castCurrentBalance);
const transCost = +parseFloat(amount) + +parseFloat(fee).toFixed(5);
console.log('trans .............' + transCost);
let sum = +castCurrentBalance - transCost;
return sum.toFixed(5);
};
}
module.exports = new Helpers();
@@ -1,43 +1,41 @@
module.exports = {
//welcome, sign in, create account
homePageErrorMnemonic: 'Error parsing bip39 mnemonic',
signInWithoutMnemonic: 'A mnemonic must be provided',
signInRandomString: 'mnemonic has a word count that is not a multiple of 6:',
signInIncorrectMnemonic: 'mnemonic contains an unknown word',
incorrectMnemonicPasswordCreation: 'The mnemonic provided is not valid. Please check the mnemonic',
invalidPasswordOnSignIn: 'failed to decrypt the given data with the provided password',
signInWithoutPassword: 'A password must be provided',
failedToFindWalletFile: 'The wallet file is not found',
//welcome, sign in, create account
homePageErrorMnemonic: "Error parsing bip39 mnemonic",
signInWithoutMnemonic: "A mnemonic must be provided",
signInRandomString: "mnemonic has a word count that is not a multiple of 6:",
signInIncorrectMnemonic: "mnemonic contains an unknown word",
incorrectMnemonicPasswordCreation: "The mnemonic provided is not valid. Please check the mnemonic",
invalidPasswordOnSignIn: "failed to decrypt the given data with the provided password",
signInWithoutPassword: "A password must be provided",
failedToFindWalletFile: "The wallet file is not found",
//headers
mnemonicSignIn: "Enter a mnemonic to sign in",
passwordSignIn: "Enter a password to sign in",
//homePage
qaNetwork: "QA",
sandboxNetwork: "Testnet Sandbox",
mainnetNetwork: "Nym Mainnet",
noNym: "0 NYM",
//send
invalidRecipientAddress: "123",
recipientAddress: "n17tj0a0w6v7r2dc54rnkzfza6s8hxs87rj273a5",
amountToSend: "1",
negativeAmount: "-1",
inferiorAmount: "0.0000001",
confirmedAmount: "1 NYM",
sendDetails: "Send details",
// bond
host: "1.1.1.1",
version: "1.2.1",
// user incorrect data
incorrectMnemonic: "bottom crime humble able antique rural donkey guess parent potato tongue truly way disagree exile zebra someone else heat giraffe note order sun cradle",
randomString:"thisrandomstring",
password:"updownUPDOWN~#$2",
incorrectPassword:"123notvalid",
};
//headers
mnemonicSignIn: 'Enter a mnemonic to sign in',
passwordSignIn: 'Enter a password to sign in',
//homePage
qaNetwork: 'QA',
sandboxNetwork: 'Testnet Sandbox',
mainnetNetwork: 'Nym Mainnet',
noNym: '0 NYM',
//send
invalidRecipientAddress: '123',
recipientAddress: 'n17tj0a0w6v7r2dc54rnkzfza6s8hxs87rj273a5',
amountToSend: '1',
negativeAmount: '-1',
inferiorAmount: '0.0000001',
confirmedAmount: '1 NYM',
sendDetails: 'Send details',
// bond
host: '1.1.1.1',
version: '1.2.1',
// user incorrect data
incorrectMnemonic:
'bottom crime humble able antique rural donkey guess parent potato tongue truly way disagree exile zebra someone else heat giraffe note order sun cradle',
randomString: 'thisrandomstring',
password: 'updownUPDOWN~#$2',
incorrectPassword: '123notvalid',
};
@@ -1,4 +1,3 @@
{
"mnemonic": "Y2FsbCBub2JsZSBhdWN0aW9uIHNhdGlzZnkgZHVzdCBzdWRkZW4gbWF0aCBsb2FuIHVzdWFsIHBpenphIG95c3RlciBkd2FyZiB2ZXNzZWwgZm9vdCBuZXh0IGFnZSBsaW5rIHN0b29sIGZsdWlkIGxpemFyZCBzaHkgaGVuIHNlY3VyaXR5IHllbGxvdw=="
"mnemonic": ""
}
+6870 -6870
View File
File diff suppressed because it is too large Load Diff
+26 -25
View File
@@ -1,27 +1,28 @@
{
"name": "webdriverio-tests",
"version": "0.1.0",
"description": "",
"private": true,
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@wdio/cli": "^7.25.4",
"@wdio/local-runner": "^7.16.16",
"@wdio/mocha-framework": "^7.16.15",
"@types/mocha": "^9.1.1",
"prettier": "2.5.1",
"typescript": "^4.6.2",
"@nymproject/nym-validator-client": "0.18.0",
"@wdio/allure-reporter": "^7.0.0"
},
"scripts": {
"test": "wdio run test/wdio.conf.ts",
"test-login": "wdio run test/wdio.conf.ts --suite login",
"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-delegation": "wdio run test/wdio.conf.ts --suite delegation"
}
"name": "webdriverio-tests",
"version": "0.1.0",
"description": "",
"private": true,
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@wdio/cli": "^7.25.4",
"@wdio/local-runner": "^7.16.16",
"@wdio/mocha-framework": "^7.16.15",
"@types/mocha": "^9.1.1",
"prettier": "2.5.1",
"typescript": "^4.6.2",
"@nymproject/nym-validator-client": "0.18.0",
"@wdio/allure-reporter": "^7.0.0"
},
"scripts": {
"test": "wdio run test/wdio.conf.ts",
"test-login": "wdio run test/wdio.conf.ts --suite login",
"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-delegation": "wdio run test/wdio.conf.ts --suite delegation",
"run:prettier": "prettier --write ."
}
}
@@ -1,9 +1,11 @@
const { exec } = require("child_process")
const { exec } = require('child_process');
const os = require('os');
const deleteSavedFile = exec("rm '/home/benedetta/.local/share/nym-wallet/saved-wallet.json'", (err, stdout, stderr) => {
if (err) {
console.error(`${err.message}`)
return
} else
console.log("File deleted")
})
let homedir = os.homedir();
const doesFileExist = exec(`test -f ${homedir}/.local/share/nym-wallet/saved-wallet.json`, (err, stdout, stderr) => {
if (err) {
console.error(`${err.message}`);
return;
} else console.log('File deleted');
});
@@ -1,14 +0,0 @@
const { exec } = require("child_process")
// const doesFileExist = exec("test -f /home/benedetta/.local/share/nym-wallet/saved-wallet.json" && "echo '$FILE exists.'" || "echo 'file doesn't exist'")
// scriptExist ? expect(getErrorWarning).toStrictEqual(textConstants.invalidPasswordOnSignIn) : expect(getErrorWarning).toStrictEqual(textConstants.failedToFindWalletFile)
const doesFileExist = exec("test -f /home/benedetta/.local/share/nym-wallet/saved-wallet.json", (err, stdout, stderr) => {
if (err) {
console.error(`${err.message}`)
return
} else
console.log("File: " + stdout)
})
@@ -1,21 +1,38 @@
class Nav {
get lightMode(): Promise<WebdriverIO.Element> {
return $("[data-testid='LightModeOutlinedIcon']");
}
get darkMode(): Promise<WebdriverIO.Element> {
return $("[data-testid='ModeNightOutlinedIcon']");
}
get terminalTitle(): Promise<WebdriverIO.Element> {
return $("[data-testid='terminal-header']");
}
get terminalIcon(): Promise<WebdriverIO.Element> {
return $("[data-testid='TerminalIcon']");
}
get lightMode(): Promise<WebdriverIO.Element> { return $("[data-testid='LightModeOutlinedIcon']") }
get darkMode(): Promise<WebdriverIO.Element> { return $("[data-testid='ModeNightOutlinedIcon']") }
get terminalTitle(): Promise<WebdriverIO.Element> { return $("[data-testid='terminal-header']") }
get terminalIcon(): Promise<WebdriverIO.Element> { return $("[data-testid='TerminalIcon']") }
get balance(): Promise<WebdriverIO.Element> { return $("[data-testid='Balance']") }
get send(): Promise<WebdriverIO.Element> { return $("[data-testid='Send']") }
get receive(): Promise<WebdriverIO.Element> { return $("[data-testid='Receive']") }
get bond(): Promise<WebdriverIO.Element> { return $("[data-testid='Bond']") }
get unbond(): Promise<WebdriverIO.Element> { return $("[data-testid='Unbond']") }
get delegation(): Promise<WebdriverIO.Element> { return $("[data-testid='Delegation']") }
get closeIcon(): Promise<WebdriverIO.Element> { return $("[data-testid='CloseIcon']") }
get balance(): Promise<WebdriverIO.Element> {
return $("[data-testid='Balance']");
}
get send(): Promise<WebdriverIO.Element> {
return $("[data-testid='Send']");
}
get receive(): Promise<WebdriverIO.Element> {
return $("[data-testid='Receive']");
}
get bond(): Promise<WebdriverIO.Element> {
return $("[data-testid='Bond']");
}
get unbond(): Promise<WebdriverIO.Element> {
return $("[data-testid='Unbond']");
}
get delegation(): Promise<WebdriverIO.Element> {
return $("[data-testid='Delegation']");
}
get closeIcon(): Promise<WebdriverIO.Element> {
return $("[data-testid='CloseIcon']");
}
}
export default new Nav()
export default new Nav();
@@ -1,80 +1,147 @@
import Balance from '../pageobjects/balanceScreen'
import Balance from '../pageobjects/balanceScreen';
class Auth {
//Welcome landing page
get signInButton(): Promise<WebdriverIO.Element> { return $("[data-testid='signIn']") }
get createAccount(): Promise<WebdriverIO.Element> { return $("[data-testid='createAccount']") }
get signInButton(): Promise<WebdriverIO.Element> {
return $("[data-testid='signIn']");
}
get createAccount(): Promise<WebdriverIO.Element> {
return $("[data-testid='createAccount']");
}
// Existing account sign in option page
get signInMnemonic(): Promise<WebdriverIO.Element> { return $("[data-testid='signInWithMnemonic']") }
get signInPassword(): Promise<WebdriverIO.Element> { return $("[data-testid='signInWithPassword']") }
get backToWelcomePage(): Promise<WebdriverIO.Element> { return $("[data-testid='backToWelcomePage']") }
get forgotPassword(): Promise<WebdriverIO.Element> { return $("[data-testid='forgotPassword']") }
get signInMnemonic(): Promise<WebdriverIO.Element> {
return $("[data-testid='signInWithMnemonic']");
}
get signInPassword(): Promise<WebdriverIO.Element> {
return $("[data-testid='signInWithPassword']");
}
get backToWelcomePage(): Promise<WebdriverIO.Element> {
return $("[data-testid='backToWelcomePage']");
}
get forgotPassword(): Promise<WebdriverIO.Element> {
return $("[data-testid='forgotPassword']");
}
// Sign in with mnemonic page
get mnemonicLoginScreenHeader(): Promise<WebdriverIO.Element> { return $("[data-testid='Enter a mnemonic to sign in']") }
get mnemonicInput(): Promise<WebdriverIO.Element> { return $("[data-testid='inputMnemonic']") }
get signIn(): Promise<WebdriverIO.Element> { return $("[data-testid='signInWithMnemonicButton']") }
get backToSignInOptions(): Promise<WebdriverIO.Element> { return $("[data-testid='backToSignInOptions']") }
get revealMnemonic(): Promise<WebdriverIO.Element> { return $("[data-testid='Reveal Mnemonic']") }
get createPassword(): Promise<WebdriverIO.Element> { return $("[data-testid='goToCreatePassword']") }
// Sign in with mnemonic page
get mnemonicLoginScreenHeader(): Promise<WebdriverIO.Element> {
return $("[data-testid='Enter a mnemonic to sign in']");
}
get mnemonicInput(): Promise<WebdriverIO.Element> {
return $("[data-testid='inputMnemonic']");
}
get signIn(): Promise<WebdriverIO.Element> {
return $("[data-testid='signInWithMnemonicButton']");
}
get backToSignInOptions(): Promise<WebdriverIO.Element> {
return $("[data-testid='backToSignInOptions']");
}
get revealMnemonic(): Promise<WebdriverIO.Element> {
return $("[data-testid='Reveal Mnemonic']");
}
get createPassword(): Promise<WebdriverIO.Element> {
return $("[data-testid='goToCreatePassword']");
}
// Create password step 1/2
get backToMnemonicSignIn(): Promise<WebdriverIO.Element> { return $("[data-testid='backToMnemonicSignIn']") }
get nextToPasswordCreation(): Promise<WebdriverIO.Element> { return $("[data-testid='nextToPasswordCreation']") }
get backToMnemonicSignIn(): Promise<WebdriverIO.Element> {
return $("[data-testid='backToMnemonicSignIn']");
}
get nextToPasswordCreation(): Promise<WebdriverIO.Element> {
return $("[data-testid='nextToPasswordCreation']");
}
// Create password step 2/2
get password(): Promise<WebdriverIO.Element> { return $("[data-testid='Password']") }
get confirmPassword(): Promise<WebdriverIO.Element> { return $("[data-testid='Confirm password']") }
get createPasswordButton(): Promise<WebdriverIO.Element> { return $("[data-testid='createPasswordButton']") }
get backToStep1PasswordCreation(): Promise<WebdriverIO.Element> { return $("[data-testid='backToStep1PasswordCreation']") }
get password(): Promise<WebdriverIO.Element> {
return $("[data-testid='Password']");
}
get confirmPassword(): Promise<WebdriverIO.Element> {
return $("[data-testid='Confirm password']");
}
get createPasswordButton(): Promise<WebdriverIO.Element> {
return $("[data-testid='createPasswordButton']");
}
get backToStep1PasswordCreation(): Promise<WebdriverIO.Element> {
return $("[data-testid='backToStep1PasswordCreation']");
}
// Create account step 1/3
get copyMnemonic(): Promise<WebdriverIO.Element> { return $("[data-testid='copyMnemonic']") }
get iSavedMnemonic(): Promise<WebdriverIO.Element> { return $("[data-testid='iSavedMnemonic']") }
get mnemonicPhrase(): Promise<WebdriverIO.Element> { return $("mnemonicPhrase") }
get copyMnemonic(): Promise<WebdriverIO.Element> {
return $("[data-testid='copyMnemonic']");
}
get iSavedMnemonic(): Promise<WebdriverIO.Element> {
return $("[data-testid='iSavedMnemonic']");
}
get mnemonicPhrase(): Promise<WebdriverIO.Element> {
return $('mnemonicPhrase');
}
// get mnemonicPhrase(): Promise<WebdriverIO.Element> { return $("[data-testid='mnemonicPhrase']") }
get backToWelcomePageFromCreate(): Promise<WebdriverIO.Element> { return $("[data-testid='backToWelcome']") }
get backToWelcomePageFromCreate(): Promise<WebdriverIO.Element> {
return $("[data-testid='backToWelcome']");
}
// Create account step 2/3
get wordIndex(): Promise<WebdriverIO.ElementArray> { return $$("[data-testid='wordIndex']") }
get mnemonicWordTile(): Promise<WebdriverIO.ElementArray> { return $$("[data-testid='mnemonicWordTile']") }
get wordIndex(): Promise<WebdriverIO.ElementArray> {
return $$("[data-testid='wordIndex']");
}
get mnemonicWordTile(): Promise<WebdriverIO.ElementArray> {
return $$("[data-testid='mnemonicWordTile']");
}
// get wordIndex(): Promise<WebdriverIO.Element> { return $("[data-testid='wordIndex']") }
// get mnemonicWordTile(): Promise<WebdriverIO.Element> { return $("[data-testid='mnemonicWordTile']") }
get nextToStep3(): Promise<WebdriverIO.Element> { return $("[data-testid='nextToStep3']") }
get backToStep1(): Promise<WebdriverIO.Element> { return $("[data-testid='backToStep1']") }
get nextToStep3(): Promise<WebdriverIO.Element> {
return $("[data-testid='nextToStep3']");
}
get backToStep1(): Promise<WebdriverIO.Element> {
return $("[data-testid='backToStep1']");
}
// Create account step 3/3
get nextStorePassword(): Promise<WebdriverIO.Element> { return $("[data-testid='nextStorePassword']") }
get skipPasswordAndSignInWithMnemonic(): Promise<WebdriverIO.Element> { return $("[data-testid='skipPasswordAndSignInWithMnemonic']") }
get nextStorePassword(): Promise<WebdriverIO.Element> {
return $("[data-testid='nextStorePassword']");
}
get skipPasswordAndSignInWithMnemonic(): Promise<WebdriverIO.Element> {
return $("[data-testid='skipPasswordAndSignInWithMnemonic']");
}
// Enter password to sign in
get passwordLoginScreenHeader(): Promise<WebdriverIO.Element> { return $("[data-testid='Enter a password to sign in']") }
get enterPassword(): Promise<WebdriverIO.Element> { return $("[data-testid='Enter password']") }
get signInPasswordButton(): Promise<WebdriverIO.Element> { return $("[data-testid='signInPasswordButton']") }
get backToSignInOptionsFromPassword(): Promise<WebdriverIO.Element> { return $("[data-testid='skipAndSignInWithMnemonic']") }
get forgotPasswordButton(): Promise<WebdriverIO.Element> { return $("[data-testid='forgotPasswordButton']") }
get passwordLoginScreenHeader(): Promise<WebdriverIO.Element> {
return $("[data-testid='Enter a password to sign in']");
}
get enterPassword(): Promise<WebdriverIO.Element> {
return $("[data-testid='Enter password']");
}
get signInPasswordButton(): Promise<WebdriverIO.Element> {
return $("[data-testid='signInPasswordButton']");
}
get backToSignInOptionsFromPassword(): Promise<WebdriverIO.Element> {
return $("[data-testid='skipAndSignInWithMnemonic']");
}
get forgotPasswordButton(): Promise<WebdriverIO.Element> {
return $("[data-testid='forgotPasswordButton']");
}
// Errors
get error(): Promise<WebdriverIO.Element> { return $("[data-testid='error']") } //check
//TO-DO get this bit below working
get error(): Promise<WebdriverIO.Element> {
return $("[data-testid='error']");
} //check
//TO-DO get this bit below working
getErrorMessage = async () => {
await (await this.error).waitForDisplayed({ timeout: 1500 })
await (await this.error).getText()
}
await (await this.error).waitForDisplayed({ timeout: 1500 });
await (await this.error).getText();
};
//login to the application
loginWithMnemonic = async (mnemonic) => {
await (await this.signInButton).click()
await (await this.signInMnemonic).click()
await (await this.mnemonicInput).waitForDisplayed()
await (await this.revealMnemonic).click()
console.log("--------------- " + mnemonic)
await (await this.signInButton).click();
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 });
};
}
export default new Auth()
export default new Auth();
@@ -1,23 +1,38 @@
class Balance {
get balance(): Promise<WebdriverIO.Element> {
return $("[data-testid='Balance']");
}
get checkBalance(): Promise<WebdriverIO.Element> {
return $("[data-testid='check-balance']");
}
get nymBalance(): Promise<WebdriverIO.Element> {
return $("[data-testid='nym-balance']");
}
get balance(): Promise<WebdriverIO.Element> { return $("[data-testid='Balance']") }
get checkBalance(): Promise<WebdriverIO.Element> { return $("[data-testid='check-balance']") }
get nymBalance(): Promise<WebdriverIO.Element> { return $("[data-testid='nym-balance']") }
get copyAccountId(): Promise<WebdriverIO.Element> {
return $("[data-testid='copyIcon']");
} // TO-DO check
get copyAccountId(): Promise<WebdriverIO.Element> { return $("[data-testid='copyIcon']") } // TO-DO check
get accountNumber(): Promise<WebdriverIO.Element> {
return $("[data-testid='accountNumber']");
} // TO-DO check
get accountNumber(): Promise<WebdriverIO.Element> { return $("[data-testid='accountNumber']") } // TO-DO check
get networkDropdown(): Promise<WebdriverIO.Element> {
return $("[data-testid='ArrowDropDownIcon']");
}
get networkEnv(): Promise<WebdriverIO.Element> {
return $("[data-testid='networkEnv']");
}
get networkSelectQa(): Promise<WebdriverIO.Element> {
return $("[data-testid='QA']");
}
get networkDropdown(): Promise<WebdriverIO.Element> { return $("[data-testid='ArrowDropDownIcon']") }
get networkEnv(): Promise<WebdriverIO.Element> { return $("[data-testid='networkEnv']") }
get networkSelectQa(): Promise<WebdriverIO.Element> { return $("[data-testid='QA']") }
selectQa = async () => {
await (await this.networkDropdown).waitForDisplayed({ timeout: 4000 })
await (await this.networkDropdown).click()
await (await this.networkSelectQa).waitForClickable({ timeout: 4000 })
await (await this.networkSelectQa).click()
await (await this.networkEnv).waitForClickable({ timeout: 2000 })
}
selectQa = async () => {
await (await this.networkDropdown).waitForDisplayed({ timeout: 4000 });
await (await this.networkDropdown).click();
await (await this.networkSelectQa).waitForClickable({ timeout: 4000 });
await (await this.networkSelectQa).click();
await (await this.networkEnv).waitForClickable({ timeout: 2000 });
};
}
export default new Balance()
export default new Balance();
@@ -1,17 +1,23 @@
class Bond {
// Bonding
// Bonding
get bondTitle() { return $("[data-testid='Bond']") }
get mixnodeRadio() { return $("[data-testid='mix-node']") }
get gatewayRadio() { return $("[data-testid='gate-way']") }
get fundsAlert() { return $("[data-testid='fundsAlert']") }
// Unbonding
get unbondTitle() { return $("[data-testid='Unbond']") }
get bondTitle() {
return $("[data-testid='Bond']");
}
get mixnodeRadio() {
return $("[data-testid='mix-node']");
}
get gatewayRadio() {
return $("[data-testid='gate-way']");
}
get fundsAlert() {
return $("[data-testid='fundsAlert']");
}
// Unbonding
get unbondTitle() {
return $("[data-testid='Unbond']");
}
}
export default new Bond()
export default new Bond();
@@ -1,9 +1,13 @@
class Delegation {
get delegationTitle() { return $("[data-testid='Delegation']") }
get delegateStakeButton() { return $("[data-testid='Delegate stake']") }
get delegateModalHeader() { return $("[data-testid='Delegate']") }
get delegationTitle() {
return $("[data-testid='Delegation']");
}
get delegateStakeButton() {
return $("[data-testid='Delegate stake']");
}
get delegateModalHeader() {
return $("[data-testid='Delegate']");
}
}
export default new Delegation()
export default new Delegation();
@@ -1,7 +1,7 @@
class Receive {
get receiveNymTitle() { return $("[data-testid='Receive NYM']") }
get receiveNymTitle() {
return $("[data-testid='Receive NYM']");
}
}
export default new Receive()
export default new Receive();
@@ -1,28 +1,46 @@
class Send {
// send nym form
get sendHeader() { return $("[data-testid='Send']") }
get recipientAddress() { return $("[data-testid='recipientAddress']") }
// get sendAmount() { return $("[data-testid='Amount']") }
get sendAmount() { return $("#mui-5") } // TO-DO fix this selector, using #mui-5 isn't a good solution
get next() { return $("[data-testid='Next']") }
// confirm transaction modal
get sendDetailsHeader() { return $("[data-testid='Send details']") }
get from() { return $("/html/body/div[2]/div[3]/div[2]/div[1]/div[1]") }
get to() { return $("/html/body/div[2]/div[3]/div[2]/div[2]") }
get amount() { return $("/html/body/div[2]/div[3]/div[2]/div[3]") }
get fee() { return $("/html/body/div[2]/div[3]/div[2]/div[4]") }
get confirm() { return $("[data-testid='Confirm']") }
// transaction sent
get viewOnBlockchain() { return $("[data-testid='viewOnBlockchain']") }
get done() { return $("[data-testid='Done']") }
// send nym form
get sendHeader() {
return $("[data-testid='Send']");
}
get recipientAddress() {
return $("[data-testid='recipientAddress']");
}
// get sendAmount() { return $("[data-testid='Amount']") }
get sendAmount() {
return $('#mui-5');
} // TO-DO fix this selector, using #mui-5 isn't a good solution
get next() {
return $("[data-testid='Next']");
}
// confirm transaction modal
get sendDetailsHeader() {
return $("[data-testid='Send details']");
}
get from() {
return $('/html/body/div[2]/div[3]/div[2]/div[1]/div[1]');
}
get to() {
return $('/html/body/div[2]/div[3]/div[2]/div[2]');
}
get amount() {
return $('/html/body/div[2]/div[3]/div[2]/div[3]');
}
get fee() {
return $('/html/body/div[2]/div[3]/div[2]/div[4]');
}
get confirm() {
return $("[data-testid='Confirm']");
}
// transaction sent
get viewOnBlockchain() {
return $("[data-testid='viewOnBlockchain']");
}
get done() {
return $("[data-testid='Done']");
}
}
export default new Send()
export default new Send();
@@ -1,32 +1,25 @@
import Balance from '../../pageobjects/balanceScreen'
import Auth from '../../pageobjects/authScreens'
const textConstants = require("../../../common/text-constants");
const userData = require("../../../common/user-data.json");
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', () => {
it('selecting qa network', async () => {
//log in
await Helper.loginMnemonic()
await Helper.loginMnemonic();
// select QA network
await Helper.navigateAndClick(Balance.networkDropdown)
await Helper.navigateAndClick(Balance.networkSelectQa)
await Helper.navigateAndClick(Balance.networkDropdown);
await Helper.navigateAndClick(Balance.networkSelectQa);
// verifty QA network has been selected properly
await Helper.verifyStrictText(Balance.networkEnv, textConstants.qaNetwork)
})
await Helper.verifyStrictText(Balance.networkEnv, textConstants.qaNetwork);
});
it('copy the account id', async () => {
// ensure the account number contains *something*
await Helper.elementVisible(Balance.accountNumber)
await Helper.verifyPartialText(Balance.accountNumber[1],'1')
await Helper.navigateAndClick(Balance.copyAccountId)
// TO-DO is there a way to verify that the copy worked, aka pasting it somewhere maybe?
})
})
// ensure the account number contains *something*
await Helper.elementVisible(Balance.accountNumber);
await Helper.verifyPartialText(Balance.accountNumber[1], '1');
await Helper.navigateAndClick(Balance.copyAccountId);
// TO-DO is there a way to verify that the copy worked, aka pasting it somewhere maybe?
});
});
@@ -1,21 +1,18 @@
import Balance from '../../pageobjects/balanceScreen'
import Auth from '../../pageobjects/authScreens'
import Nav from '../../pageobjects/appNavConstants'
import Delegation from '../../pageobjects/delegationScreen'
import Send from '../../pageobjects/sendScreen'
import Balance from '../../pageobjects/balanceScreen';
import Auth from '../../pageobjects/authScreens';
import Nav from '../../pageobjects/appNavConstants';
import Delegation from '../../pageobjects/delegationScreen';
import Send from '../../pageobjects/sendScreen';
const Helper = require('../../../common/helper');
const textConstants = require("../../../common/text-constants");
const userData = require("../../../common/user-data.json");
const textConstants = require('../../../common/text-constants');
const userData = require('../../../common/user-data.json');
describe('Delegate to a mixnode', () => {
it('entering an invalid node identity key', async () => {
//login and navigate to the screen
await Helper.freshMnemonicLoginQaNetwork()
await Helper.navigateAndClick(Nav.delegation)
await Helper.elementVisible(Delegation.delegationTitle)
// TO-DO enter an invalid node
})
})
it('entering an invalid node identity key', async () => {
//login and navigate to the screen
await Helper.freshMnemonicLoginQaNetwork();
await Helper.navigateAndClick(Nav.delegation);
await Helper.elementVisible(Delegation.delegationTitle);
// TO-DO enter an invalid node
});
});
@@ -1,72 +1,63 @@
import Auth from '../../pageobjects/authScreens'
import Nav from '../../pageobjects/appNavConstants'
import Balance from '../../pageobjects/balanceScreen'
import Send from '../../pageobjects/sendScreen'
import Receive from '../../pageobjects/receiveScreen'
import Bond from '../../pageobjects/bondScreen'
import Delegation from '../../pageobjects/delegationScreen'
const userData = require("../../../common/user-data.json");
import Auth from '../../pageobjects/authScreens';
import Nav from '../../pageobjects/appNavConstants';
import Balance from '../../pageobjects/balanceScreen';
import Send from '../../pageobjects/sendScreen';
import Receive from '../../pageobjects/receiveScreen';
import Bond from '../../pageobjects/bondScreen';
import Delegation from '../../pageobjects/delegationScreen';
const userData = require('../../../common/user-data.json');
const Helper = require('../../../common/helper');
describe('Nav Items behave correctly', () => {
it('switch from light to dark mode and back', async () => {
//log in()
await Helper.freshMnemonicLoginQaNetwork();
// click on different modes
await Helper.navigateAndClick(Nav.lightMode);
await Helper.navigateAndClick(Nav.darkMode);
await Helper.elementVisible(Nav.lightMode);
});
it('switch from light to dark mode and back', async () => {
//log in()
await Helper.freshMnemonicLoginQaNetwork()
// click on different modes
await Helper.navigateAndClick(Nav.lightMode)
await Helper.navigateAndClick(Nav.darkMode)
await Helper.elementVisible(Nav.lightMode)
})
it('clicking terminal opens the modal', async () => {
// ensure the terminal button opens the terminal
await Helper.elementVisible(Nav.terminalIcon)
await Helper.navigateAndClick(Nav.terminalIcon)
await Helper.elementVisible(Nav.terminalTitle)
await Helper.verifyPartialText(Nav.terminalTitle, 'Terminal')
})
})
it('clicking terminal opens the modal', async () => {
// ensure the terminal button opens the terminal
await Helper.elementVisible(Nav.terminalIcon);
await Helper.navigateAndClick(Nav.terminalIcon);
await Helper.elementVisible(Nav.terminalTitle);
await Helper.verifyPartialText(Nav.terminalTitle, 'Terminal');
});
});
describe('Menu items lead to correct screen', () => {
//TO-DO none of this works
//check each menu item opens the right screen/modal
it('check Balance link works', async () => {
await Helper.navigateAndClick(Nav.balance);
await Helper.verifyPartialText(Balance.balance, 'Balance');
});
//TO-DO none of this works
//check each menu item opens the right screen/modal
it('check Balance link works', async () => {
await Helper.navigateAndClick(Nav.balance)
await Helper.verifyPartialText(Balance.balance, 'Balance')
})
it('check Send link works', async () => {
await Helper.navigateAndClick(Nav.send);
await Helper.verifyPartialText(Send.sendHeader, 'Send');
await Helper.navigateAndClick(Nav.closeIcon);
});
it('check Send link works', async () => {
await Helper.navigateAndClick(Nav.send)
await Helper.verifyPartialText(Send.sendHeader, 'Send')
await Helper.navigateAndClick(Nav.closeIcon)
})
it('check Receive link works', async () => {
await Helper.navigateAndClick(Nav.receive);
await Helper.verifyPartialText(Receive.receiveNymTitle, 'Receive NYM');
});
it('check Receive link works', async () => {
await Helper.navigateAndClick(Nav.receive)
await Helper.verifyPartialText(Receive.receiveNymTitle, 'Receive NYM')
})
it('check Bond link works', async () => {
await Helper.navigateAndClick(Nav.bond);
await Helper.verifyPartialText(Bond.bondTitle, 'Bond');
});
it('check Bond link works', async () => {
await Helper.navigateAndClick(Nav.bond)
await Helper.verifyPartialText(Bond.bondTitle, 'Bond')
})
it('check Unbond link works', async () => {
await Helper.navigateAndClick(Nav.unbond);
await Helper.verifyPartialText(Bond.unbondTitle, 'Unbond');
});
it('check Unbond link works', async () => {
await Helper.navigateAndClick(Nav.unbond)
await Helper.verifyPartialText(Bond.unbondTitle, 'Unbond')
})
it('check Delegation link works', async () => {
await Helper.navigateAndClick(Nav.delegation)
await Helper.verifyPartialText(Delegation.delegationTitle, 'Delegation')
})
})
it('check Delegation link works', async () => {
await Helper.navigateAndClick(Nav.delegation);
await Helper.verifyPartialText(Delegation.delegationTitle, 'Delegation');
});
});
@@ -1,62 +1,57 @@
import Balance from '../../pageobjects/balanceScreen'
import Auth from '../../pageobjects/authScreens'
import Nav from '../../pageobjects/appNavConstants'
import Send from '../../pageobjects/sendScreen'
import Balance from '../../pageobjects/balanceScreen';
import Auth from '../../pageobjects/authScreens';
import Nav from '../../pageobjects/appNavConstants';
import Send from '../../pageobjects/sendScreen';
const Helper = require('../../../common/helper');
const textConstants = require("../../../common/text-constants");
const userData = require("../../../common/user-data.json");
const textConstants = require('../../../common/text-constants');
const userData = require('../../../common/user-data.json');
describe.skip('Send modal functions correctly', () => {
it('entering an invalid recipient address shows error', async () => {
// sign in with mnemonic and select QA
await Helper.freshMnemonicLoginQaNetwork();
// click on send and check modal appears
await Helper.navigateAndClick(Nav.send);
await Helper.elementVisible(Send.sendHeader);
// add an invalid recipient address
await Helper.addValueToTextField(Send.recipientAddress, textConstants.invalidRecipientAddress);
// TO-DO -- question: should there not be an error message before clicking on Next to warn that the address is invalid?
});
it('entering an invalid recipient address shows error', async () => {
it('entering an valid recipient address with negative amount value shows error', async () => {
await Helper.navigateAndClick(Send.recipientAddress);
// TO-DO figure out how to clear a text field before adding new value
await Send.recipientAddress.clearValue();
await Helper.addValueToTextField(Send.recipientAddress, userData.receiver_address);
await Helper.navigateAndClick(Send.sendAmount);
await Helper.addValueToTextField(Send.sendAmount, textConstants.negativeAmount);
//next button is still disabled and error message appears
const nextButton = await Send.next;
const isNextDisabled = await nextButton.getAttribute('disabled');
expect(isNextDisabled).toBe('true');
});
// sign in with mnemonic and select QA
await Helper.freshMnemonicLoginQaNetwork()
// click on send and check modal appears
await Helper.navigateAndClick(Nav.send)
await Helper.elementVisible(Send.sendHeader)
// add an invalid recipient address
await Helper.addValueToTextField(Send.recipientAddress, textConstants.invalidRecipientAddress)
// TO-DO -- question: should there not be an error message before clicking on Next to warn that the address is invalid?
})
it('enter a valid recipient and value', async () => {
// enter valid data
await Helper.addValueToTextField(Send.recipientAddress, userData.receiver_address);
const getCurrentBalance = await (await Balance.nymBalance).getText();
await Helper.addValueToTextField(Send.sendAmount, textConstants.amountToSend);
// click on next and verify details
await Helper.navigateAndClick(Send.next);
const fee = await (await Send.fee).getText();
await Helper.verifyPartialText(Send.sendDetailsHeader, textConstants.sendDetails);
await Helper.verifyPartialText(Send.amount, textConstants.confirmedAmount);
it('entering an valid recipient address with negative amount value shows error', async () => {
await Helper.navigateAndClick(Send.confirm);
await Helper.elementVisible(Send.viewOnBlockchain);
await Helper.elementClickable(Send.done);
await Helper.navigateAndClick(Send.recipientAddress)
// TO-DO figure out how to clear a text field before adding new value
await (Send.recipientAddress).clearValue()
await Helper.addValueToTextField(Send.recipientAddress, userData.receiver_address)
await Helper.navigateAndClick(Send.sendAmount)
await Helper.addValueToTextField(Send.sendAmount, textConstants.negativeAmount)
//next button is still disabled and error message appears
const nextButton = await Send.next
const isNextDisabled = await nextButton.getAttribute('disabled')
expect(isNextDisabled).toBe("true")
// calculate the transaction and verify it has been correctly executed
let sumCost = await Helper.calculateFees(getCurrentBalance, fee, textConstants.amountToSend, true);
const getNewBalance = await (await Balance.nymBalance).getText();
})
it('enter a valid recipient and value', async () => {
// enter valid data
await Helper.addValueToTextField(Send.recipientAddress, userData.receiver_address)
const getCurrentBalance = await (await Balance.nymBalance).getText()
await Helper.addValueToTextField(Send.sendAmount, textConstants.amountToSend)
// click on next and verify details
await Helper.navigateAndClick(Send.next)
const fee = await (await Send.fee).getText()
await Helper.verifyPartialText(Send.sendDetailsHeader, textConstants.sendDetails)
await Helper.verifyPartialText(Send.amount, textConstants.confirmedAmount)
await Helper.navigateAndClick(Send.confirm)
await Helper.elementVisible(Send.viewOnBlockchain)
await Helper.elementClickable(Send.done)
// calculate the transaction and verify it has been correctly executed
let sumCost = await Helper.calculateFees(getCurrentBalance, fee, textConstants.amountToSend, true)
const getNewBalance = await (await Balance.nymBalance).getText()
await Helper.navigateAndClick(Send.done)
// TO-DO the following fails with "TypeError: elem[prop] is not a function"
expect(getNewBalance).toEqual(sumCost)
})
})
await Helper.navigateAndClick(Send.done);
// TO-DO the following fails with "TypeError: elem[prop] is not a function"
expect(getNewBalance).toEqual(sumCost);
});
});
@@ -1,38 +1,33 @@
import Auth from '../../pageobjects/authScreens'
const deleteScript = require("../../../scripts/deletesavedwallet")
const walletExists = require("../../../scripts/savedwalletexists")
import Auth from '../../pageobjects/authScreens';
const deleteScript = require('../../../scripts/deletesavedwallet');
const walletExists = require('../../../scripts/savedwalletexists');
const Helper = require('../../../common/helper');
export function newMnemonicLogin() {
// TO-DO find the best approach
describe('Create a new account and verify login', () => {
describe('Create a new account and verify login', () => {
it('generate new mnemonic and verify mnemonic words', async () => {
// delete an existing saved-wallet.json
walletExists
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)
})
})
}
// delete an existing saved-wallet.json
walletExists;
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);
});
});
}
@@ -1,68 +1,55 @@
import Auth from '../../pageobjects/authScreens'
import Balance from '../../pageobjects/balanceScreen'
import Auth from '../../pageobjects/authScreens';
import Balance from '../../pageobjects/balanceScreen';
import ValidatorClient from '@nymproject/nym-validator-client';
const textConstants = require("../../../common/text-constants");
const userData = require("../../../common/user-data.json");
const textConstants = require('../../../common/text-constants');
const userData = require('../../../common/user-data.json');
const Helper = require('../../../common/helper');
describe('Wallet sign in functionality with mnemonic', () => {
it('get to the sign in with mnemonic screen', async () => {
// click through to reach the mnemonic sign in
await Helper.navigateAndClick(Auth.signInButton)
await Helper.navigateAndClick(Auth.signInMnemonic)
await Helper.navigateAndClick(Auth.signInButton);
await Helper.navigateAndClick(Auth.signInMnemonic);
// verify you are on the right screen by confirming the header
await Helper.verifyStrictText(Auth.mnemonicLoginScreenHeader, textConstants.mnemonicSignIn)
})
await Helper.verifyStrictText(Auth.mnemonicLoginScreenHeader, textConstants.mnemonicSignIn);
});
it('sign in with no mnemonic throws error', async () => {
await Helper.navigateAndClick(Auth.signIn)
await Helper.navigateAndClick(Auth.signIn);
// wait for error
await Helper.elementVisible(Auth.error)
await Helper.elementVisible(Auth.error);
// verify error has the correct message
await Helper.verifyStrictText(Auth.error, textConstants.signInWithoutMnemonic)
})
await Helper.verifyStrictText(Auth.error, textConstants.signInWithoutMnemonic);
});
it('sign in with incorrect mnemonic throws error', async () => {
// enter an incorrect mnemonic string
await Helper.navigateAndClick(Auth.revealMnemonic)
await Helper.addValueToTextField(Auth.mnemonicInput, textConstants.incorrectMnemonic)
await Helper.navigateAndClick(Auth.signIn)
await Helper.navigateAndClick(Auth.revealMnemonic);
await Helper.addValueToTextField(Auth.mnemonicInput, textConstants.incorrectMnemonic);
await Helper.navigateAndClick(Auth.signIn);
// verifty error message is correct
await Helper.verifyPartialText(Auth.error, textConstants.signInIncorrectMnemonic)
})
await Helper.verifyPartialText(Auth.error, textConstants.signInIncorrectMnemonic);
});
it('sign in with random string throws error', async () => {
await Helper.navigateAndClick(Auth.revealMnemonic)
await Helper.navigateAndClick(Auth.revealMnemonic);
// enter a random string not in mnemonic "format"
await Helper.addValueToTextField(Auth.mnemonicInput, textConstants.randomString)
await Helper.navigateAndClick(Auth.signIn)
await Helper.addValueToTextField(Auth.mnemonicInput, textConstants.randomString);
await Helper.navigateAndClick(Auth.signIn);
// verifty error message is correct
await Helper.verifyPartialText(Auth.error, textConstants.signInRandomString)
})
await Helper.verifyPartialText(Auth.error, textConstants.signInRandomString);
});
it('should sign in with valid credentials', async () => {
// create new mnemonic
const randomMnemonic = ValidatorClient.randomMnemonic();
// enter mnemonic
await Helper.navigateAndClick(Auth.revealMnemonic)
await Helper.addValueToTextField(Auth.mnemonicInput, randomMnemonic)
await Helper.navigateAndClick(Auth.signIn)
await Helper.navigateAndClick(Auth.revealMnemonic);
await Helper.addValueToTextField(Auth.mnemonicInput, randomMnemonic);
await Helper.navigateAndClick(Auth.signIn);
// verify successful login, balance is visible
await Helper.elementVisible(Balance.balance)
await Helper.elementVisible(Balance.balance);
// TO-DO this value below is sometimes returning ""
await Helper.verifyStrictText(Balance.nymBalance, textConstants.noNym)
})
})
await Helper.verifyStrictText(Balance.nymBalance, textConstants.noNym);
});
});
@@ -1,123 +1,103 @@
import Auth from '../../pageobjects/authScreens'
import Balance from '../../pageobjects/balanceScreen'
import ValidatorClient from '@nymproject/nym-validator-client'
const deleteScript = require("../../../scripts/deletesavedwallet");
const textConstants = require("../../../common/text-constants");
const userData = require("../../../common/user-data.json");
const deleteWallet = require("../../../scripts/deletesavedwallet");
const walletExists = require("../../../scripts/savedwalletexists");
import Auth from '../../pageobjects/authScreens';
import Balance from '../../pageobjects/balanceScreen';
import ValidatorClient from '@nymproject/nym-validator-client';
const deleteScript = require('../../../scripts/deletesavedwallet');
const textConstants = require('../../../common/text-constants');
const userData = require('../../../common/user-data.json');
const deleteWallet = require('../../../scripts/deletesavedwallet');
const walletExists = require('../../../scripts/savedwalletexists');
const Helper = require('../../../common/helper');
describe('Create password for existing account and use it to sign in', () => {
it('enter incorrect mnemonic', async () => {
//click through sign in
await Helper.navigateAndClick(Auth.signInButton);
await Helper.navigateAndClick(Auth.signInMnemonic);
//instead of entering mnemonic, click on create a password
await Helper.navigateAndClick(Auth.createPassword);
//enter incorrect mnemonic
await Helper.addValueToTextField(Auth.mnemonicInput, textConstants.incorrectMnemonic);
await Helper.navigateAndClick(Auth.nextToPasswordCreation);
it('enter incorrect mnemonic', async () => {
// assert error message is correct
await Helper.verifyStrictText(Auth.error, textConstants.incorrectMnemonicPasswordCreation);
});
//click through sign in
await Helper.navigateAndClick(Auth.signInButton)
await Helper.navigateAndClick(Auth.signInMnemonic)
//instead of entering mnemonic, click on create a password
await Helper.navigateAndClick(Auth.createPassword)
//enter incorrect mnemonic
await Helper.addValueToTextField(Auth.mnemonicInput, textConstants.incorrectMnemonic)
await Helper.navigateAndClick(Auth.nextToPasswordCreation)
it('enter random string', async () => {
// enter random string as mnemonic
await Helper.addValueToTextField(Auth.mnemonicInput, textConstants.randomString);
await Helper.navigateAndClick(Auth.nextToPasswordCreation);
// assert error is correct
await Helper.verifyStrictText(Auth.error, textConstants.incorrectMnemonicPasswordCreation);
});
// assert error message is correct
await Helper.verifyStrictText(Auth.error, textConstants.incorrectMnemonicPasswordCreation)
})
it('enter correct mnemonic', async () => {
// generate random mnemonic in the backend
const randomMnemonic = ValidatorClient.randomMnemonic();
deleteScript;
// use it to continue with password creation flow
await Helper.navigateAndClick(Auth.backToMnemonicSignIn);
await Helper.navigateAndClick(Auth.createPassword);
await Helper.navigateAndClick(Auth.revealMnemonic);
await Helper.addValueToTextField(Auth.mnemonicInput, randomMnemonic);
await Helper.navigateAndClick(Auth.nextToPasswordCreation);
await Helper.elementVisible(Auth.password);
});
it('enter random string', async () => {
it('create an invalid password', async () => {
// type an invalid password in both fields
await Helper.addValueToTextField(Auth.password, textConstants.incorrectPassword);
await Helper.navigateAndClick(Auth.confirmPassword);
await Helper.addValueToTextField(Auth.confirmPassword, textConstants.incorrectPassword);
// ensure the button to proceed is still disabled
const nextButton = await Auth.createPasswordButton;
const isNextDisabled = await nextButton.getAttribute('disabled');
expect(isNextDisabled).toBe('true');
});
// enter random string as mnemonic
await Helper.addValueToTextField(Auth.mnemonicInput, textConstants.randomString)
await Helper.navigateAndClick(Auth.nextToPasswordCreation)
// assert error is correct
await Helper.verifyStrictText(Auth.error, textConstants.incorrectMnemonicPasswordCreation)
it('create a valid password', async () => {
// type a valid password in both fields
await Helper.navigateAndClick(Auth.password);
await Helper.addValueToTextField(Auth.password, textConstants.password);
await Helper.navigateAndClick(Auth.confirmPassword);
await Helper.addValueToTextField(Auth.confirmPassword, textConstants.password);
// verify the password is created and the next screen is visible
await Helper.navigateAndClick(Auth.createPasswordButton);
await Helper.verifyStrictText(Auth.passwordLoginScreenHeader, textConstants.passwordSignIn);
});
})
it('enter correct mnemonic', async () => {
// generate random mnemonic in the backend
const randomMnemonic = ValidatorClient.randomMnemonic();
deleteScript
// use it to continue with password creation flow
await Helper.navigateAndClick(Auth.backToMnemonicSignIn)
await Helper.navigateAndClick(Auth.createPassword)
await Helper.navigateAndClick(Auth.revealMnemonic)
await Helper.addValueToTextField(Auth.mnemonicInput, randomMnemonic)
await Helper.navigateAndClick(Auth.nextToPasswordCreation)
await Helper.elementVisible(Auth.password)
})
it('create an invalid password', async () => {
// type an invalid password in both fields
await Helper.addValueToTextField(Auth.password, textConstants.incorrectPassword)
await Helper.navigateAndClick(Auth.confirmPassword)
await Helper.addValueToTextField(Auth.confirmPassword, textConstants.incorrectPassword)
// ensure the button to proceed is still disabled
const nextButton = await Auth.createPasswordButton
const isNextDisabled = await nextButton.getAttribute('disabled')
expect(isNextDisabled).toBe("true")
})
it('create a valid password', async () => {
// type a valid password in both fields
await Helper.navigateAndClick(Auth.password)
await Helper.addValueToTextField(Auth.password, textConstants.password)
await Helper.navigateAndClick(Auth.confirmPassword)
await Helper.addValueToTextField(Auth.confirmPassword, textConstants.password)
// verify the password is created and the next screen is visible
await Helper.navigateAndClick(Auth.createPasswordButton)
await Helper.verifyStrictText(Auth.passwordLoginScreenHeader, textConstants.passwordSignIn)
})
it('sign in with no password throws error', async () => {
//click sign without entering a password
await Helper.navigateAndClick(Auth.signInPasswordButton)
// wait for error
await Helper.elementVisible(Auth.error)
// verify error has the correct message
await Helper.verifyStrictText(Auth.error, textConstants.signInWithoutPassword)
})
it('sign in with invalid password throws error', async () => {
// enter invalid password
await Helper.addValueToTextField(Auth.enterPassword, textConstants.incorrectPassword)
await Helper.navigateAndClick(Auth.signInPasswordButton)
// wait for error
await Helper.elementVisible(Auth.error)
await Helper.verifyStrictText(Auth.error, textConstants.invalidPasswordOnSignIn)
})
})
it('sign in with no password throws error', async () => {
//click sign without entering a password
await Helper.navigateAndClick(Auth.signInPasswordButton);
// wait for error
await Helper.elementVisible(Auth.error);
// verify error has the correct message
await Helper.verifyStrictText(Auth.error, textConstants.signInWithoutPassword);
});
it('sign in with invalid password throws error', async () => {
// enter invalid password
await Helper.addValueToTextField(Auth.enterPassword, textConstants.incorrectPassword);
await Helper.navigateAndClick(Auth.signInPasswordButton);
// wait for error
await Helper.elementVisible(Auth.error);
await Helper.verifyStrictText(Auth.error, textConstants.invalidPasswordOnSignIn);
});
});
describe('Wallet sign in functionality without creating password', () => {
it('sign in with invalid password and no saved wallet.json file throws error', async () => {
// delete existing saved wallet file
deleteWallet
//click through sign without entering a password
await Helper.navigateAndClick(Auth.signInButton)
await Helper.navigateAndClick(Auth.signInPassword)
// enter invalid password
await Helper.addValueToTextField(Auth.enterPassword,textConstants.incorrectPassword)
await Helper.navigateAndClick(Auth.signInPasswordButton)
// wait for error
await Helper.elementVisible(Auth.error)
// verify error has the correct message
await Helper.verifyStrictText(Auth.error, textConstants.failedToFindWalletFile)
})
})
it('sign in with invalid password and no saved wallet.json file throws error', async () => {
// delete existing saved wallet file
deleteWallet;
//click through sign without entering a password
await Helper.navigateAndClick(Auth.signInButton);
await Helper.navigateAndClick(Auth.signInPassword);
// enter invalid password
await Helper.addValueToTextField(Auth.enterPassword, textConstants.incorrectPassword);
await Helper.navigateAndClick(Auth.signInPasswordButton);
// wait for error
await Helper.elementVisible(Auth.error);
// verify error has the correct message
await Helper.verifyStrictText(Auth.error, textConstants.failedToFindWalletFile);
});
});
@@ -1,101 +1,88 @@
import Auth from '../../pageobjects/authScreens'
import Balance from '../../pageobjects/balanceScreen'
const textConstants = require("../../../common/text-constants");
const userData = require("../../../common/user-data.json");
const deleteScript = require("../../../scripts/deletesavedwallet")
const walletExists = require("../../../scripts/savedwalletexists")
import Auth from '../../pageobjects/authScreens';
import Balance from '../../pageobjects/balanceScreen';
const textConstants = require('../../../common/text-constants');
const userData = require('../../../common/user-data.json');
const deleteScript = require('../../../scripts/deletesavedwallet');
const walletExists = require('../../../scripts/savedwalletexists');
const Helper = require('../../../common/helper');
import { newMnemonicLogin } from '../helpers/helper.spec'
import { newMnemonicLogin } from '../helpers/helper.spec';
// TO-DO figure out how to not repeat steps but also start a fresh test on each run
// TO-DO figure out how to not repeat steps but also start a fresh test on each run
describe('Create a new account negative scenarios', () => {
it('generate new mnemonic and verify mnemonic words', () => {
newMnemonicLogin();
it('generate new mnemonic and verify mnemonic words', () => {
// // delete an existing saved-wallet.json
// deleteScript
// // click through create account flow
// await Helper.navigateAndClick(Auth.createAccount)
// // await Helper.elementVisible(Auth.mnemonicPhrase)
// // 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)
});
newMnemonicLogin()
it('click skip password', async () => {
// click on skip password creation
await Helper.navigateAndClick(Auth.nextToStep3);
await Helper.navigateAndClick(Auth.skipPasswordAndSignInWithMnemonic);
// can see mnemonic login page
await Helper.elementVisible(Auth.mnemonicInput);
await Helper.navigateAndClick(Auth.backToSignInOptions);
});
// // delete an existing saved-wallet.json
// deleteScript
// // click through create account flow
// await Helper.navigateAndClick(Auth.createAccount)
// // await Helper.elementVisible(Auth.mnemonicPhrase)
// // 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)
})
it('click skip password', async () => {
// click on skip password creation
await Helper.navigateAndClick(Auth.nextToStep3)
await Helper.navigateAndClick(Auth.skipPasswordAndSignInWithMnemonic)
// can see mnemonic login page
await Helper.elementVisible(Auth.mnemonicInput)
await Helper.navigateAndClick(Auth.backToSignInOptions)
})
it('set up invalid password for new account', async () => {
// enter invalid password in both fields
await Helper.navigateAndClick(Auth.password)
await Helper.addValueToTextField(Auth.password, textConstants.incorrectPassword)
await Helper.navigateAndClick(Auth.confirmPassword)
await Helper.addValueToTextField(Auth.confirmPassword, textConstants.incorrectPassword)
// verify that the 'next' button is still disabled
const nextButton = await Auth.nextStorePassword
const isNextDisabled = await nextButton.getAttribute('disabled')
expect(isNextDisabled).toBe("true")
await browser.reloadSession()
})
})
it('set up invalid password for new account', async () => {
// enter invalid password in both fields
await Helper.navigateAndClick(Auth.password);
await Helper.addValueToTextField(Auth.password, textConstants.incorrectPassword);
await Helper.navigateAndClick(Auth.confirmPassword);
await Helper.addValueToTextField(Auth.confirmPassword, textConstants.incorrectPassword);
// verify that the 'next' button is still disabled
const nextButton = await Auth.nextStorePassword;
const isNextDisabled = await nextButton.getAttribute('disabled');
expect(isNextDisabled).toBe('true');
await browser.reloadSession();
});
});
describe.skip('Create a new account and verify login', () => {
it('generate new mnemonic and verify mnemonic words', async () => {
await newMnemonicLogin();
});
it('generate new mnemonic and verify mnemonic words', async () => {
await newMnemonicLogin()
})
it('set up valid password for new account', async () => {
// enter a valid password in both fields
await Helper.navigateAndClick(Auth.password);
await Helper.addValueToTextField(Auth.password, textConstants.password);
await browser.pause(3000);
await Helper.navigateAndClick(Auth.confirmPassword);
await Helper.addValueToTextField(Auth.confirmPassword, textConstants.password);
await browser.pause(3000);
// verify that the 'next' button is clickable
const nextButton = await Auth.nextStorePassword;
const isNextDisabled = await nextButton.getAttribute('disabled');
expect(isNextDisabled).toBe(null);
});
it('set up valid password for new account', async () => {
// enter a valid password in both fields
await Helper.navigateAndClick(Auth.password)
await Helper.addValueToTextField(Auth.password, textConstants.password)
await browser.pause(3000)
await Helper.navigateAndClick(Auth.confirmPassword)
await Helper.addValueToTextField(Auth.confirmPassword, textConstants.password)
await browser.pause(3000)
// verify that the 'next' button is clickable
const nextButton = await Auth.nextStorePassword
const isNextDisabled = await nextButton.getAttribute('disabled')
expect(isNextDisabled).toBe(null)
})
it('proceed to login with newly created password', async () => {
// login with a password
await Helper.navigateAndClick(Auth.nextStorePassword)
await browser.pause(3000)
await Helper.navigateAndClick(Auth.enterPassword)
await Helper.addValueToTextField(Auth.enterPassword, textConstants.password)
await browser.pause(3000)
await Helper.navigateAndClick(Auth.signInPasswordButton)
await browser.pause(3000)
await Helper.elementVisible(Balance.balance)
//new accounts will always default to mainnet, so 0 balance
await Helper.verifyStrictText(Balance.nymBalance, textConstants.noNym)
})
})
it('proceed to login with newly created password', async () => {
// login with a password
await Helper.navigateAndClick(Auth.nextStorePassword);
await browser.pause(3000);
await Helper.navigateAndClick(Auth.enterPassword);
await Helper.addValueToTextField(Auth.enterPassword, textConstants.password);
await browser.pause(3000);
await Helper.navigateAndClick(Auth.signInPasswordButton);
await browser.pause(3000);
await Helper.elementVisible(Balance.balance);
//new accounts will always default to mainnet, so 0 balance
await Helper.verifyStrictText(Balance.nymBalance, textConstants.noNym);
});
});
+6 -11
View File
@@ -1,12 +1,7 @@
{
"compilerOptions": {
"moduleResolution": "node",
"types": [
"node",
"webdriverio/async",
"@wdio/mocha-framework",
"expect-webdriverio"
],
"target": "ES5"
}
}
"compilerOptions": {
"moduleResolution": "node",
"types": ["node", "webdriverio/async", "@wdio/mocha-framework", "expect-webdriverio"],
"target": "ES5"
}
}
+18 -36
View File
@@ -1,13 +1,13 @@
const os = require('os')
const path = require('path')
const { spawn, spawnSync } = require('child_process')
const os = require('os');
const path = require('path');
const { spawn, spawnSync } = require('child_process');
//insert path to binary
const nym_path = '../target/debug/nym-wallet'
// this one below will run the prod version aka without QA netwo0rk option
const nym_path = '../target/debug/nym-wallet';
// this one below will run the prod version aka without QA netwo0rk option
// const nym_path = '../target/release/nym-wallet'
let tauriDriver: any
let tauriDriver: any;
exports.config = {
autoCompileOpts: {
@@ -20,24 +20,12 @@ exports.config = {
specs: ['./test/specs/**/*.ts'],
suites: {
signup: [
'./test/specs/signup/*.ts',
],
login: [
'./test/specs/login/*.ts',
],
balance: [
'./test/specs/balance/*.ts',
],
general: [
'./test/specs/general/*.ts',
],
send: [
'./test/specs/bond/*.ts',
],
delegation: [
'./test/specs/delegation/*.ts',
],
signup: ['./test/specs/signup/*.ts'],
login: ['./test/specs/login/*.ts'],
balance: ['./test/specs/balance/*.ts'],
general: ['./test/specs/general/*.ts'],
send: ['./test/specs/bond/*.ts'],
delegation: ['./test/specs/delegation/*.ts'],
},
exclude: [
@@ -67,7 +55,7 @@ exports.config = {
timeout: 60000,
},
// Reporting tool and settings
// Reporting tool and settings
// reporters: [
// [
@@ -89,15 +77,10 @@ exports.config = {
// spawn('bash', [scriptpath]);
// },
beforeSession: () => {
(tauriDriver = spawn(
path.resolve(os.homedir(), '.cargo', 'bin', 'tauri-driver'),
[],
{ stdio: [null, process.stdout, process.stderr] }
))
tauriDriver = spawn(path.resolve(os.homedir(), '.cargo', 'bin', 'tauri-driver'), [], {
stdio: [null, process.stdout, process.stderr],
});
},
// afterEach: function(test) {
@@ -106,6 +89,5 @@ exports.config = {
// },
// clean up the `tauri-driver` process we spawned at the start of the session
afterSession: () =>
tauriDriver.kill(),
}
afterSession: () => tauriDriver.kill(),
};