implement base changes for updating wallet-tests to use typescript
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
reports
|
||||
allure-results
|
||||
node_modules
|
||||
.vscode
|
||||
.idea
|
||||
@@ -0,0 +1,2 @@
|
||||
build
|
||||
coverage
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"trailingComma": "all",
|
||||
"singleQuote": true,
|
||||
"printWidth": 120,
|
||||
"tabWidth": 2,
|
||||
"semi": false
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "wallet-ui-test",
|
||||
"version": "1.0.0",
|
||||
"description": "wallet ui tests for the nym wallet",
|
||||
"scripts": {
|
||||
"test": "wdio run wdio.conf.ts"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"-": "^0.0.1",
|
||||
"@wdio/cli": "^7.16.16",
|
||||
"save-dev": "^0.0.1-security",
|
||||
"ts-node": "^10.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@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"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
class WalletLogin {
|
||||
get signInLabel(): Promise<WebdriverIO.Element> {
|
||||
return $("[data-testid='sign-in']")
|
||||
}
|
||||
get mnemonic(): Promise<WebdriverIO.Element> {
|
||||
return $('#mnemonic')
|
||||
}
|
||||
get signInButton(): Promise<WebdriverIO.Element> {
|
||||
return $("[type='submit']")
|
||||
}
|
||||
|
||||
get errorValidation(): Promise<WebdriverIO.Element> {
|
||||
return $("[class='MuiAlert-message']")
|
||||
}
|
||||
|
||||
enterMnemonic = async (mnemonic: string): Promise<void> => {
|
||||
await (await this.mnemonic).addValue(mnemonic)
|
||||
await (await this.signInButton).click()
|
||||
}
|
||||
}
|
||||
export default new WalletLogin()
|
||||
@@ -0,0 +1,9 @@
|
||||
import walletLogin from '../pageobjects/wallet.login'
|
||||
|
||||
describe('My Login application', () => {
|
||||
it('should login with valid credentials', async () => {
|
||||
let test = 'enter new mnemonic for the test'
|
||||
|
||||
await walletLogin.enterMnemonic(test)
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"types": ["node", "webdriverio/async", "@wdio/mocha-framework", "expect-webdriverio"],
|
||||
"target": "ES5"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
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'
|
||||
|
||||
let tauriDriver: any
|
||||
|
||||
exports.config = {
|
||||
autoCompileOpts: {
|
||||
autoCompile: true,
|
||||
tsNodeOpts: {
|
||||
transpileOnly: true,
|
||||
project: 'test/tsconfig.json',
|
||||
},
|
||||
},
|
||||
specs: ['./test/specs/**/*.ts'],
|
||||
// Patterns to exclude.
|
||||
exclude: [
|
||||
// 'path/to/excluded/files'
|
||||
],
|
||||
maxInstances: 1,
|
||||
capabilities: [
|
||||
{
|
||||
maxInstances: 1,
|
||||
'tauri:options': {
|
||||
application: nym_path,
|
||||
},
|
||||
},
|
||||
],
|
||||
//
|
||||
// ===================
|
||||
// Test Configurations
|
||||
// ===================
|
||||
// Define all options that are relevant for the WebdriverIO instance here
|
||||
//
|
||||
// Level of logging verbosity: trace | debug | info | warn | error | silent
|
||||
logLevel: 'info',
|
||||
bail: 0,
|
||||
framework: 'mocha',
|
||||
reporters: ['spec'],
|
||||
mochaOpts: {
|
||||
ui: 'bdd',
|
||||
timeout: 60000,
|
||||
},
|
||||
// ===================
|
||||
// Test Reporters
|
||||
// ===================
|
||||
// reporters: [
|
||||
// [
|
||||
// "allure",
|
||||
// {
|
||||
// outputDir: "allure-results",
|
||||
// disableWebdriverStepsReporting: true,
|
||||
// disableWebdriverScreenshotsReporting: true,
|
||||
// },
|
||||
// ],
|
||||
// ],
|
||||
|
||||
// this is documentented in the readme - you will need to build the project first
|
||||
// ensure the rust project is built since we expect this binary to exist for the webdriver sessions
|
||||
//onPrepare: () => spawnSync("cargo", ["build", "--release"]),
|
||||
|
||||
// ensure we are running `tauri-driver` before the session starts so that we can proxy the webdriver requests
|
||||
beforeSession: () =>
|
||||
(tauriDriver = spawn(path.resolve(os.homedir(), '.cargo', 'bin', 'tauri-driver'), [], {
|
||||
stdio: [null, process.stdout, process.stderr],
|
||||
})),
|
||||
|
||||
// afterTest: function (
|
||||
// test,
|
||||
// context,
|
||||
// { error, result, duration, passed, retries }
|
||||
// ) {
|
||||
// if (error) {
|
||||
// browser.takeScreenshot();
|
||||
// }
|
||||
// },
|
||||
|
||||
// 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
Reference in New Issue
Block a user