integrate nightwatch

This commit is contained in:
RVKen
2017-06-19 22:43:12 +02:00
parent 62785d11ad
commit 622ce14195
6 changed files with 98 additions and 1 deletions

View File

@@ -32,7 +32,8 @@
"test": "npm run lint-errors && npm run just-test-in-node",
"test-in-node": "npm run lint-errors && npm run just-test-in-node",
"just-test": "karma start --config karma.conf.js",
"just-test-in-node": "mocha --recursive --compilers js:babel-core/register test/core test/components test/bugs test/swagger-ui-dist-package"
"just-test-in-node": "mocha --recursive --compilers js:babel-core/register test/core test/components test/bugs test/swagger-ui-dist-package",
"e2e": "nightwatch test/e2e/scenarios --config test/e2e/nightwatch.json --verbose"
},
"dependencies": {
"babel-polyfill": "^6.23.0",
@@ -109,6 +110,7 @@
"less-loader": "2.2.1",
"license-checker": "^8.0.4",
"mocha": "^2.5.3",
"nightwatch": "^0.9.16",
"node-sass": "^4.5.0",
"npm-run-all": "3.1.1",
"null-loader": "0.1.1",

BIN
test/e2e/bin/chromedriver Executable file

Binary file not shown.

Binary file not shown.

63
test/e2e/nightwatch.json Normal file
View File

@@ -0,0 +1,63 @@
{
"src_folders" : ["test/e2e/scenarios"],
"output_folder" : "reports",
"live_output": true,
"custom_commands_path" : "",
"custom_assertions_path" : "",
"page_objects_path" : "",
"globals_path" : "",
"test_workers" : {
"enabled" : true,
"workers" : "auto"
},
"test_runner" : {
"type" : "mocha",
"options" : {
"ui" : "bdd",
"reporter" : "list"
}
},
"selenium" : {
"start_process" : true,
"server_path" : "test/e2e/bin/selenium-server-standalone-3.4.0.jar",
"log_path" : "",
"host" : "127.0.0.1",
"port" : 4444,
"cli_args" : {
"webdriver.chrome.driver" : "test/e2e/bin/chromedriver",
"webdriver.firefox.profile" : "",
"webdriver.ie.driver" : ""
}
},
"test_settings" : {
"default" : {
"launch_url" : "http://localhost",
"selenium_port" : 4444,
"selenium_host" : "localhost",
"silent": true,
"screenshots" : {
"enabled" : false,
"path" : ""
},
"desiredCapabilities": {
"browserName": "chrome",
"marionette": true
}
},
"chrome" : {
"desiredCapabilities": {
"browserName": "chrome"
}
},
"edge" : {
"desiredCapabilities": {
"browserName": "MicrosoftEdge"
}
}
}
}

View File

@@ -0,0 +1,31 @@
describe('Google demo test for Mocha', function () {
describe('with Nightwatch', function () {
before(function (client, done) {
done()
})
after(function (client, done) {
client.end(function () {
done()
})
})
afterEach(function (client, done) {
done()
})
beforeEach(function (client, done) {
done()
})
it('uses TDD to run the Google simple test', function (client) {
client
.url('http://google.com')
.expect.element('body').to.be.present.before(1000)
client.setValue('input[type=text]', ['nightwatch', client.Keys.ENTER])
.pause(1000)
.assert.containsText('#main', 'Night Watch')
})
})
})

1
test/e2e/specs/1.json Normal file

File diff suppressed because one or more lines are too long