implement base changes for updating wallet-tests to use typescript

This commit is contained in:
Tommy
2022-03-04 12:10:06 +00:00
parent b9ef848523
commit 8a84f9ff80
9 changed files with 3101 additions and 0 deletions
+5
View File
@@ -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
}
+23
View File
@@ -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"
}
}
+82
View File
@@ -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