This commit is contained in:
benedettadavico
2022-11-09 14:28:49 +01:00
parent 8f49db1150
commit 9434cb266b
29 changed files with 10482 additions and 134 deletions
+4 -4
View File
@@ -160,9 +160,9 @@ mod qa {
pub(crate) const STAKE_DENOM: DenomDetails = DenomDetails::new("unyx", "nyx", 6);
pub(crate) const MIXNET_CONTRACT_ADDRESS: &str =
"n1qa4hswlcjmttulj0q9qa46jf64f93pecl6tydcsjldfe0hy5ju0sdmwzya";
pub(crate) const VESTING_CONTRACT_ADDRESS: &str =
"n14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sjyvg3g";
pub(crate) const VESTING_CONTRACT_ADDRESS: &str =
"n1nc5tatafv6eyq7llkr2gv50ff9e22mnf70qgjlv737ktmt4eswrq73f2nw";
pub(crate) const BANDWIDTH_CLAIM_CONTRACT_ADDRESS: &str =
"n19lc9u84cz0yz3fww5283nucc9yvr8gsjmgeul0";
pub(crate) const COCONUT_BANDWIDTH_CONTRACT_ADDRESS: &str =
@@ -177,8 +177,8 @@ mod qa {
//pub(crate) const STATISTICS_SERVICE_DOMAIN_ADDRESS: &str = "http://0.0.0.0";
pub(crate) fn validators() -> Vec<ValidatorDetails> {
vec![ValidatorDetails::new(
"https://v2-env-validator.qa.nymte.ch/",
Some("https://v2-env-val-api.qa.nymte.ch/api/"),
"https://qwerty-validator.qa.nymte.ch/",
Some("https://qwerty-validator-api.qa.nymte.ch/api/"),
)]
}
+1 -1
View File
@@ -19,5 +19,5 @@
"@assets/*": ["../assets/*"]
}
},
"exclude": ["node_modules", "dist", "jest.config.js", "webpack.config.js", "webpack.prod.js", "webpack.common.js", "target", "wallet-ui-tests"]
"exclude": ["node_modules", "dist", "jest.config.js", "webpack.config.js", "webpack.prod.js", "webpack.common.js", "target", "wallet-fe-tests"]
}
@@ -1,5 +1,5 @@
import Balance from '../tests/pageobjects/balanceScreen'
import Auth from '../tests/pageobjects/authScreens'
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")
File diff suppressed because it is too large Load Diff
+20
View File
@@ -0,0 +1,20 @@
{
"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"
},
"scripts": {
"wdio": "wdio run test/wdio.conf.ts"
}
}
@@ -0,0 +1,9 @@
const { exec } = require("child_process")
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")
})
@@ -0,0 +1,14 @@
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)
})
@@ -0,0 +1,74 @@
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']") }
// 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']") }
// 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='mnemonicInput']") }
get signIn(): Promise<WebdriverIO.Element> { return $("[data-testid='signInSubmitButton']") }
get backToSignInOptions(): Promise<WebdriverIO.Element> { return $("[data-testid='backToSignInOptions']") }
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']") }
// 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']") }
// 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 $("[data-testid='mnemonicPhrase']") }
get backToWelcomePageFromCreate(): Promise<WebdriverIO.Element> { return $("[data-testid='backToWelcome']") }
// Create account step 2/3
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']") }
// Create account step 3/3
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='backToSignInOptionsFromPassword']") }
get forgotPasswordButton(): Promise<WebdriverIO.Element> { return $("[data-testid='forgotPasswordButton']") }
// Errors
get error(): Promise<WebdriverIO.Element> { return $("[data-testid='error']") }
//TO-DO get this bit below working
getErrorMessage = async () => {
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.mnemonicInput).addValue(mnemonic);
await (await this.signIn).click();
await (await Balance.nymBalance).waitForDisplayed({ timeout: 4000 });
};
}
export default new Auth()
@@ -0,0 +1,23 @@
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 copyAccountId(): Promise<WebdriverIO.Element> { return $("[data-testid='copyIcon']") }
get accountNumber(): Promise<WebdriverIO.Element> { return $("[data-testid='accountNumber']") }
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 })
}
}
export default new Balance()
@@ -0,0 +1,17 @@
class Bond {
// 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']") }
}
export default new Bond()
@@ -0,0 +1,9 @@
class Delegation {
get delegationTitle() { return $("[data-testid='Delegation']") }
get delegateStakeButton() { return $("[data-testid='Delegate stake']") }
get delegateModalHeader() { return $("[data-testid='Delegate']") }
}
export default new Delegation()
@@ -0,0 +1,7 @@
class Receive {
get receiveNymTitle() { return $("[data-testid='Receive NYM']") }
}
export default new Receive()
@@ -0,0 +1,28 @@
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']") }
}
export default new Send()
@@ -0,0 +1,32 @@
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()
// select QA network
await Helper.navigateAndClick(Balance.networkDropdown)
await Helper.navigateAndClick(Balance.networkSelectQa)
// verifty QA network has been selected properly
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?
})
})
@@ -0,0 +1,21 @@
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");
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
})
})
@@ -0,0 +1,72 @@
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('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')
})
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 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 Delegation link works', async () => {
await Helper.navigateAndClick(Nav.delegation)
await Helper.verifyPartialText(Delegation.delegationTitle, 'Delegation')
})
})
@@ -0,0 +1,62 @@
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");
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 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")
})
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)
})
})
@@ -0,0 +1,67 @@
import Auth from '../../pageobjects/authScreens'
import Balance from '../../pageobjects/balanceScreen'
import ValidatorClient from '@nymproject/nym-validator-client';
import { text } from 'stream/consumers';
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)
// verify you are on the right screen by confirming the header
await Helper.verifyStrictText(Auth.mnemonicLoginScreenHeader, textConstants.mnemonicSignIn)
})
it('sign in with no mnemonic throws error', async () => {
await Helper.navigateAndClick(Auth.signIn)
// wait for error
await Helper.elementVisible(Auth.error)
// verify error has the correct message
await Helper.verifyStrictText(Auth.error, textConstants.signInWithoutMnemonic)
})
it('sign in with incorrect mnemonic throws error', async () => {
// enter an incorrect mnemonic string
await Helper.addValueToTextField(Auth.mnemonicInput, textConstants.incorrectMnemonic)
await Helper.navigateAndClick(Auth.signIn)
// verifty error message is correct
await Helper.verifyPartialText(Auth.error, textConstants.signInIncorrectMnemonic)
})
it('sign in with random string throws error', async () => {
// enter a random string not in mnemonic "format"
await Helper.addValueToTextField(Auth.mnemonicInput, textConstants.randomString)
await Helper.navigateAndClick(Auth.signIn)
// verifty error message is correct
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.addValueToTextField(Auth.mnemonicInput, randomMnemonic)
await Helper.navigateAndClick(Auth.signIn)
// verify successful login, balance is visible
await Helper.elementVisible(Balance.balance)
//new accounts will always default to mainnet, so 0 balance
// TO-DO this value sometimes returns " " instead of "0"
await Helper.verifyStrictText(Balance.nymBalance, textConstants.noNym)
})
})
@@ -0,0 +1,122 @@
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)
// assert error message is correct
await Helper.verifyStrictText(Auth.error, textConstants.incorrectMnemonicPasswordCreation)
})
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)
})
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.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)
})
})
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)
})
})
@@ -0,0 +1,101 @@
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 Helper = require('../../../common/helper');
describe.skip('Create a new account and verify it exists', () => {
it('generate new mnemonic and verify mnemonic words', async () => {
// delete any existing saved-wallet.json
deleteScript
// click through create account flow
await Helper.navigateAndClick(Auth.createAccount)
await Helper.elementVisible(Auth.mnemonicPhrase)
// save mnemonic phrase
let mnemonic = await (await Auth.mnemonicPhrase).getText()
let arrayMnemonic = mnemonic.split(" ")
await Helper.navigateAndClick(Auth.copyMnemonic)
await Helper.navigateAndClick(Auth.iSavedMnemonic)
// verify the mnemonic words in the correct order
let mnemonicWordTiles = await (await Auth.mnemonicWordTile)
let wordTileIndex = await (await Auth.wordIndex)
const wordsArray: any[] = []
for (const word of mnemonicWordTiles) {
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)
if (match) {
await match.word.click()
}
}
// 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")
})
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 Helper.navigateAndClick(Auth.confirmPassword)
await Helper.addValueToTextField(Auth.confirmPassword, textConstants.password)
// 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 Helper.navigateAndClick(Auth.enterPassword)
await Helper.addValueToTextField(Auth.enterPassword, textConstants.password)
await Helper.navigateAndClick(Auth.signInPasswordButton)
// TO-DO for some reason this is failing due to failed to decrypt the wallet etc error
await Helper.elementVisible(Balance.balance)
//new accounts will always default to mainnet, so 0 balance
await Helper.verifyStrictText(Balance.nymBalance, textConstants.noNym)
})
})
@@ -0,0 +1,12 @@
{
"compilerOptions": {
"moduleResolution": "node",
"types": [
"node",
"webdriverio/async",
"@wdio/mocha-framework",
"expect-webdriverio"
],
"target": "ES5"
}
}
@@ -2,7 +2,7 @@ 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'
const nym_path = '../target/debug/nym-wallet'
let tauriDriver: any
@@ -15,6 +15,27 @@ exports.config = {
},
},
specs: ['./test/specs/**/*.ts'],
// suites: {
// signup: [
// './test/specs/signup/*.ts',
// ],
// login: [
// './test/specs/login/*.ts',
// ],
// balance: [
// './test/specs/balance/*.ts',
// ],
// nav: [
// './test/specs/general/*.ts',
// ],
// send: [
// './test/specs/send/*.ts',
// ],
// delegation: [
// './test/specs/delegation/*.ts',
// ],
// },
// Patterns to exclude.
exclude: [
// 'path/to/excluded/files'
@@ -38,7 +59,7 @@ exports.config = {
logLevel: 'info',
bail: 0,
framework: 'mocha',
reporters: ['spec'],
// reporters: ['spec'],
mochaOpts: {
ui: 'bdd',
timeout: 60000,
@@ -61,21 +82,14 @@ exports.config = {
// 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],
})),
// afterTest: function (
// test,
// context,
// { error, result, duration, passed, retries }
// ) {
// if (error) {
// browser.takeScreenshot();
// }
// },
(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(),
File diff suppressed because it is too large Load Diff
-32
View File
@@ -1,32 +0,0 @@
{
"name": "wallet-ui-tests",
"version": "1.0.0",
"description": "ui tests for the nym wallet",
"scripts": {
"test": "wdio run wdio.conf.ts",
"test:signup": "wdio run wdio.conf.ts --suite signup",
"test:login": "wdio run wdio.conf.ts --suite login",
"test:balance": "wdio run wdio.conf.ts --suite balance",
"test:nav": "wdio run wdio.conf.ts --suite nav",
"test:send": "wdio run wdio.conf.ts --suite send",
"test:delegation": "wdio run wdio.conf.ts --suite delegation"
},
"author": "",
"license": "MIT",
"dependencies": {
"-": "^0.0.1",
"@types/mocha": "^9.1.1",
"save-dev": "^0.0.1-security",
"ts-node": "^10.6.0",
"wdio": "^6.0.1"
},
"devDependencies": {
"@wdio/cli": "^7.24.0",
"@wdio/local-runner": "^7.16.16",
"@wdio/mocha-framework": "^7.16.15",
"@wdio/spec-reporter": "^7.16.14",
"prettier": "2.5.1",
"typescript": "^4.6.2"
}
}
@@ -1,73 +0,0 @@
// 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 Unbond from '../../pageobjects/unbondScreen'
// 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('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')
// })
// 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 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(Unbond.unbondTitle, 'Unbond')
// })
// it('check Delegation link works', async () => {
// await Helper.navigateAndClick(Nav.delegation)
// await Helper.verifyPartialText(Delegation.delegationTitle, 'Delegation')
// })
// })
-7
View File
@@ -1,7 +0,0 @@
{
"compilerOptions": {
"types": ["node", "webdriverio/async", "@wdio/mocha-framework", "expect-webdriverio"],
"target": "ES5"
}
}