Fix ui tests
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "yarn rebuild && webpack --mode production",
|
"build": "yarn rebuild && webpack --mode production",
|
||||||
"dev": "node_modules/.bin/webpack-dev-server --mode development --progress",
|
"dev": "node_modules/.bin/webpack-dev-server --mode development --progress",
|
||||||
"rebuild": "cd node_modules/heapdump && node-gyp rebuild --target=5.0.0 --arch=x64 --dist-url=https://atom.io/download/electron; cd -"
|
"rebuild": "cd node_modules/heapdump && node-gyp rebuild --target=5.0.0 --arch=x64 --dist-url=https://atom.io/download/electron || echo Could not build heapdump; cd -"
|
||||||
},
|
},
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "CC-BY-ND-4.0",
|
"license": "CC-BY-ND-4.0",
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
import * as FileAsync from 'lowdb/adapters/FileAsync'
|
import * as FileAsync from 'lowdb/adapters/FileAsync'
|
||||||
|
import * as fs from 'fs-extra'
|
||||||
import * as lowdb from 'lowdb'
|
import * as lowdb from 'lowdb'
|
||||||
|
import * as path from 'path'
|
||||||
import { backendEvents } from '../../events'
|
import { backendEvents } from '../../events'
|
||||||
import {
|
import {
|
||||||
|
makeStorageAcknowledgementEvent,
|
||||||
makeStorageResponseEvent,
|
makeStorageResponseEvent,
|
||||||
storageClearEvent,
|
storageClearEvent,
|
||||||
storageLoadEvent,
|
storageLoadEvent,
|
||||||
storageStoreEvent,
|
storageStoreEvent
|
||||||
makeStorageAcknowledgementEvent
|
} from '../../events/StorageEvents'
|
||||||
} from '../../events/StorageEvents'
|
|
||||||
|
|
||||||
export default class ConfigStorage {
|
export default class ConfigStorage {
|
||||||
private file: string
|
private file: string
|
||||||
@@ -17,6 +19,10 @@ export default class ConfigStorage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async getDb() {
|
private async getDb() {
|
||||||
|
const pathInfo = path.parse(this.file)
|
||||||
|
|
||||||
|
// Ensure that Settings dir exists
|
||||||
|
await fs.mkdirp(pathInfo.dir)
|
||||||
const adapter = new FileAsync(this.file)
|
const adapter = new FileAsync(this.file)
|
||||||
if (!this.database) {
|
if (!this.database) {
|
||||||
this.database = await lowdb(adapter)
|
this.database = await lowdb(adapter)
|
||||||
|
|||||||
@@ -24,9 +24,6 @@ import {
|
|||||||
hideText,
|
hideText,
|
||||||
showText,
|
showText,
|
||||||
sleep,
|
sleep,
|
||||||
getHeapDump,
|
|
||||||
countInstancesOf,
|
|
||||||
ClassNameMapping
|
|
||||||
} from './util'
|
} from './util'
|
||||||
|
|
||||||
process.on('unhandledRejection', (error: Error) => {
|
process.on('unhandledRejection', (error: Error) => {
|
||||||
@@ -59,7 +56,12 @@ async function doStuff() {
|
|||||||
await createFakeMousePointer(browser)
|
await createFakeMousePointer(browser)
|
||||||
|
|
||||||
// Wait for Username input to be visible
|
// Wait for Username input to be visible
|
||||||
await browser.$(`//label[contains(text(), "Username")]/..//input`)
|
let inputField = undefined
|
||||||
|
let start = Date.now()
|
||||||
|
let maxWaitDuration = 30000
|
||||||
|
while ((!inputField || !inputField.isExisting) && ((Date.now() - start) < maxWaitDuration)) {
|
||||||
|
inputField = await browser.$(`//label[contains(text(), "Username")]/..//input`)
|
||||||
|
}
|
||||||
const scenes = new SceneBuilder()
|
const scenes = new SceneBuilder()
|
||||||
await scenes.record('connect', async () => {
|
await scenes.record('connect', async () => {
|
||||||
await connectTo('127.0.0.1', browser)
|
await connectTo('127.0.0.1', browser)
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ export async function moveToCenterOfElement(element: Element<void>, browser: Bro
|
|||||||
const js = `window.demo.moveMouse(${targetX}, ${targetY}, ${duration});`
|
const js = `window.demo.moveMouse(${targetX}, ${targetY}, ${duration});`
|
||||||
await browser.execute(js)
|
await browser.execute(js)
|
||||||
await sleep(duration)
|
await sleep(duration)
|
||||||
await sleep(20, true)
|
await sleep(250, true)
|
||||||
|
|
||||||
await element.moveTo()
|
await element.moveTo()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user