I'm Dom. Check out my resume to find out more about me.
aberonni / nightwatch-coverage Goto Github PK
View Code? Open in Web Editor NEWCoverage collection utility for nightwatch.js
Coverage collection utility for nightwatch.js
I'm Dom. Check out my resume to find out more about me.
Nightwatch conf.js :
var browserstack = require('browserstack-local');
nightwatch_config = {
src_folders : [ "tests/local" ],
selenium : {
"start_process" : false,
"host" : "hub-cloud.browserstack.com",
"port" : 80
},
custom_commands_path: [
'node_modules/nightwatch-coverage/commands',
],
globals_path: "globals.js",
test_settings: {
default: {
desiredCapabilities: {
'build': 'nightwatch-browserstack',
'browserstack.user': process.env.BROWSERSTACK_USERNAME || 'BROWSERSTACK_USERNAME',
'browserstack.key': process.env.BROWSERSTACK_ACCESS_KEY || 'BROWSERSTACK_ACCESS_KEY',
'browserstack.debug': true,
'browserstack.local': true,
'browser': 'chrome'
}
}
}
};
// Code to copy seleniumhost/port into test settings
for(var i in nightwatch_config.test_settings){
var config = nightwatch_config.test_settings[i];
config['selenium_host'] = nightwatch_config.selenium.host;
config['selenium_port'] = nightwatch_config.selenium.port;
}
module.exports = nightwatch_config;
Test local
module.exports = {
'BrowserStack Local Testing' : function (browser) {
browser
.url('http://bs-local.com:45691/check')
.waitForElementVisible('body', 1000)
.assert.containsText('body', 'Up and running')
.collectCoverage()
//.end();
}
};
Using nightwatch '1.5.1' or '1.7.13', I was getting timeouts errors due to crash in afterEach (browser.globals.coverageReporter.coverageMap.merge
undefined)
It seemed that coverageMap was a POJO when calling browser.collectCoverage
(either during tests or during global afterEach).
to work around that, I set persist_globals
to true
, which did nothing, and ended up using a global beforeEach
to restore the instance
beforeEach(browser, done) {
// fixes coverageMap not being the expected class instance
browser.globals.coverageReporter.coverageMap = coverageReporter.coverageMap;
done();
},
I'm not too sure if that was expected to work out of the box, or is broken by some context, or if some version of nightwatch broke it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.