We run tests from grunt, like so: grunt browsertest
Gruntfile.js would have in it:
grunt.registerTask('browsertest', ['nightwatch:browsertest_osx']);
nightwatch.js would have in it:
module.exports = {
options: {
'browsertest_osx': {
globals: {
targetmachine: 'http://localhost:3000',
username: 'someuser',
password: ''
},
'launch_url': 'http://localhost:3000',
'selenium_port': 4444,
'selenium_host': 'localhost',
'src_folders': ['Tests/browsertests'],
'silent': true,
'screenshots': {
'enabled': false,
'path': ''
},
'selenium': {
'cli_args': {
'webdriver.chrome.driver': 'bin/chromedriver_osx'
}
},
'desiredCapabilities': {
'browserName': 'chrome',
'javascriptEnabled': true,
'acceptSslCerts': true
}
},
}
}
};
Now, this means I will run all test scripts in folder 'Tests/browsertests' (see attribute src_folders in nightwatch.js)...
I've found a remedy to it on SE: NightWatch Tags
However, now I am stuck with how to install this functionality into my existing test system.
Let's say I would like to run different areas of the browser tests, which are in their own scripts:
1-browsingZoneA.js, 2-browsingZoneB.js...
And I would like to control which of the above scripts actually gets run by plugging a '@tags': ['browsingZoneA'] into file '1-browsingZoneA.js'...
So, my question is: how should I now invoke these specific tags?
I don't know which is the best command format, but let's say I choose:
grunt browsertest --areaA
- How do I connect areaA to something like: nightwatch --tag smokeTests? Do I add something in nightwatch.js? Or perhaps a conditional grunt.registerTask() in Gruntfile.js?
Aucun commentaire:
Enregistrer un commentaire