Skip to content
Snippets Groups Projects
Verified Commit 56884224 authored by Mark's avatar Mark
Browse files

Add e2e testing boilerplate

parent f500daff
No related branches found
No related tags found
1 merge request!2Minimal frontend
......@@ -9,6 +9,7 @@
"build": "nuxt build",
"start": "nuxt start",
"post-update": "yarn upgrade --latest",
"test": "nightwatch --config ./test/nightwatch.json",
"build-start": "nuxt build; nuxt start"
},
"author": "",
......@@ -20,5 +21,9 @@
"cookie-parser": "^1.4.4",
"nuxt": "latest",
"openid-client": "^3.7.3"
},
"devDependencies": {
"chromedriver": "^77.0.0",
"nightwatch": "^1.2.4"
}
}
module.exports = {
'Demo test Index' : function (browser) {
console.log(this)
browser
.url(browser.globals.url)
.waitForElementVisible('body')
.assert.containsText('.jumbotron', 'Welcome to OpenAppStack')
.end();
}
};
{
"src_folders" : ["e2e"],
"webdriver" : {
"start_process": true,
"server_path": "node_modules/.bin/chromedriver",
"port": 9515
},
"test_settings" : {
"default" : {
"desiredCapabilities": {
"browserName": "chrome"
},
"globals_path": "nightwatch_globals.js"
}
}
}
var resolve = require('path').resolve
var Nuxt = require('nuxt').Nuxt
var Builder = require('nuxt').Builder
const rootDir = resolve(__dirname, '..')
const port = 4000
const host = "localhost"
const url = "http://"+host+":"+port.toString()
let config = {}
try { config = require(resolve(rootDir, 'nuxt.config.js')) } catch (e) {}
const nuxt = new Nuxt(config)
var nuxtIsBuild = false
module.exports = {
'default' : {
asyncHookTimeout: 20000,
url: url,
nuxt: nuxt,
serverHost: host,
serverPort: port,
},
before : async function(cb){
if (!nuxtIsBuild){
console.log("Building nuxt components");
await new Builder(nuxt).build();
nuxtIsBuild = true
}
console.log("Starting nuxt server");
nuxt.listen(port, host)
cb();
},
after : async function(cb){
console.log("Shutting down nuxt");
await nuxt.close()
cb();
}
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment