Skip to content
This repository has been archived by the owner on May 19, 2020. It is now read-only.

Add HMI test for tci #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/data/
__pycache__/
/settings.py
/node_modules/
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@
"version": "1.0.0",
"main": "index.js",
"repository": {},
"license": "MIT"
"license": "MIT",
"devDependencies": {
"nightmare": "^2.10.0",
"vo": "^4.0.2"
}
}
31 changes: 31 additions & 0 deletions test/hmi/tci.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const Nightmare = require('nightmare')
const vo = require('vo')

vo(run)((err, result) => {
if (err) throw err
})

function* run() {
const nightmare = Nightmare({ show:true })
let nextExists = true
let testIsRunning = false

yield nightmare
.goto('http://127.0.0.1:5000/fec9e3fe73e6be021619071e30fc6ecb')

nextExists = yield nightmare.visible('label');
while (nextExists) {
testIsRunning = true
yield nightmare
.click('label')
.wait(501)
nextExists = yield nightmare.visible('label')
}
if (testIsRunning) {
nightmare.end()
.then(console.log('Survey has been successfully completed'))
} else {
nightmare.end()
.then(console.log('Survey has not been completed'))
}
}