My config file is just launching 1 instance of chrome. I'm expecting it to open 2.
This is my config multi capabilities.
multiCapabilities: [
{
browserName: 'chrome',
logName: 'Chrome - Suite 1',
shardTestFiles: false,
maxInstances: 1,
maxSessions: 1,
specs: ['test/protractor/test.js']
},
{
browserName: 'Chrome',
logName: 'Chrome - Suite 2',
shardTestFiles: false,
maxInstances: 1,
maxSessions: 1,
specs: ['test/protractor/test2.js']
}
],
Now I am facing the error as below:
/usr/local/lib/node_modules/protractor/node_modules/selenium-
webdriver/lib/error.js:546
throw new ctor(message);
^
SessionNotCreatedError: Unable to create session from {
"desiredCapabilities": {
"specs": [
"test\u002fprotractor\u002ftest2.js"
],
"maxSessions": 1,
"logName": "Chrome - Suite 2",
"count": 1,
"browserName": "Chrome",
"maxInstances": 1,
"shardTestFiles": false
},
"capabilities": {
"firstMatch": [
{
"browserName": "Chrome"
}
]
}
}
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-
11
14T08:25:53'
System info: host: 'Siva.local', ip:
'fe80:0:0:0:4b7:1bb3:a4c7:925f%en0', os.name: 'Mac OS X', os.arch:
'x86_64', os.version: '10.14', java.version: '1.8.0_131'
Driver info: driver.version: unknown
Any help to make it launch 2 instances is highly welcome.
Make your config like below.
exports.config = {
// Capabilities to be passed to the webdriver instance.
capabilities: {
browserName: 'chrome',
// allows different specs to run in parallel.
// If this is set to be true, specs will be sharded by file
// (i.e. all files to be run by this set of capabilities will run in parallel).
// Default is false.
shardTestFiles: true,
// Maximum number of browser instances that can run in parallel for this
// set of capabilities. This is only needed if shardTestFiles is true.
// Default is 1.
maxInstances: 2,
},
// Spec patterns are relative to the current working directly when
// protractor is called.
specs: ['spec.js', 'spec2.js'],
}
Hope it help you..
Related
I've implemented nightwatchjs in my project and the start is there. However, something I don't like is that the chrome and gecko driver are placing a log file in my root directory. I'ld much prefer this to move to a logging location.
disable_error_log: true,
desiredCapabilities: {
silent: true,
browserName: 'firefox',
alwaysMatch: {
acceptInsecureCerts: true,
'moz:firefoxOptions': {
args: []
}
}
},
webdriver: {
start_process: true,
server_path: GeckoDriver.path,
cli_args: []
}
},
chrome: {
disable_error_log: true,
desiredCapabilities: {
silent: true,
browserName: 'chrome',
chromeOptions: {
args: []
}
},
webdriver: {
log_path: false,
start_process: true,
server_path: ChromeDriver.path,
cli_args: [
]
}
}
Right now the configuration is as above. Two questions here for the logging are:
wat setting do you use to turn it on or off
what setting do you use to change the location and or file name for the log
I'm running Nightwatch on a Mac machine and in my nightwatch.conf.js file I have a Selenium object that has a log_path property. The path currently is logs/ but I just tried to remove the path and put false as the path and that worked for me. If you want to turn it off, put false as the path for log_path, otherwise put the name of the directory (mine is logs/). As far as changing the name of the selenium-server.log file, I do not think you can change this, unless someone has create an npm module that gives the ability to extend Nightwatch.
selenium: {
"start_process": true,
"server_path": "bin/selenium-server-standalone-3.9.1.jar",
"log_path": false,
"port": 4444,
"cli_args": {
"webdriver.chrome.driver": this.chromePath
}
}
link for nightwatch docs
I also have the same issue. I solve this by setting value of log_path in webdriver object of each driver.
you can make changes as like:
chrome: {
disable_error_log: true,
desiredCapabilities: {
silent: true,
browserName: 'chrome',
chromeOptions: {
args: []
}
},
webdriver: {
start_process: true,
server_path: ChromeDriver.path,
log_path:'log_folder', // add this line to your every webdriver object.
cli_args: [
]
}
}
You can off your driverLog generation by setting log_path to false. If you want to specify some specific folder to store the driverLog file then you have to set the log_path to desired location.
How to set Appium tests (WDIO-Mocha tests) pass % tolerance on BitRise Test Jobs
Hi,
We are running UI Test Suite on BitRise CI/CD.
The test suite itself is built on ReactNative/Jest codebase.
And WDIO-Mocha runner is used for running the tests.
Exports.conf
exports.config = {
specs: [
'./<my directory>/**/*.<testName>.js'
],
exclude: [],
maxInstances: 1,
capabilities: [],
sync: true,
logLevel: 'verbose',
coloredLogs: true,
deprecationWarnings: true,
bail: 0,
screenshotPath: './errorShots/',
waitforTimeout: 5000,
connectionRetryTimeout: 90000,
connectionRetryCount: 3,
baseUrl: '',
framework: 'mocha',
mochaOpts: {
ui: 'bdd',
timeout: 90000,
logLevel: 'info',
logOutput: './wdio.log'
},
reporters: ['dot', 'allure'],
before() {
require('#babel/register');
global.expect = jestMatchers;
}
};
How to set pass % tolerance viz- 98% or 90% etc
[For Example- On CI/CDs like - Jenkins we can achieve this using Hidden parameter mechanism or on TeamCity CI/CD it comes as out of box facility]
Thanks
I am unable to run "protractor test script" in "Internet explorer" browser.
I run below command.
webdriver-manager update --ie --versions.standalone 3.4.0 --versions.ie 3.4.0
my configuration file code is as below.
exports.config = {
allScriptsTimeout: 15000,
seleniumAddress:'http://localhost:4444/wd/hub',
capabilities:
{
'browserName': 'internet explorer',
'platform' : 'ANY',
'version' : '11'
},
suites: {
heropage: ['e2e/hero/hero.e2e-spec.ts'],
dashboardpage : ['e2e/dashboard/dashboard.e2e-spec.ts']
},
baseUrl: 'http://localhost:4200/',
// directConnect : true,
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 50000,
includeStackTrace: true
},
onPrepare() {
require('ts-node').register({
project: 'e2e/tsconfig.e2e.json'
});
},
}
I change all the required setting for internet explorer browser in "internet options" by following http://elgalu.github.io/2014/run-protractor-against-internet-explorer-vm/
I am getting below error
Failed: JavaScript error in async script. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 26 milliseconds
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'BHUVISDESK-16', ip: '192.168.0.109', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0',
java.version: '1.8.0_144'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{se:ieOptions={browserAttachTimeout=0.0, ie.enableFullPageScreenshot=true, enablePersistentHover=true, i
e.forceCreateProcessApi=false, ie.forceShellWindowsApi=false, ignoreZoomSetting=false, ie.fileUploadDialogTimeout=3000.0,
ie.useLegacyFileUploadDialogHandling=false, nativeEvents=true, ie.ensureCleanSession=false, elementScrollBehavior=0.0, ie.
browserCommandLineSwitches=, requireWindowFocus=false, initialBrowserUrl=http://localhost:39545/, ignoreProtectedModeSetti
ngs=false, enableElementCacheCleanup=true}, browserName=internet explorer, pageLoadStrategy=normal, javascriptEnabled=true
, version=11, platform=WINDOWS, unexpectedAlertBehaviour=dismiss}]
Session ID: 01bf3915-d549-421b-a6f1-771e17c78cc7
Can any one help me what's my mistake in this process
I am having issues testing my NW.js app using Karma. Tests that used to work now don't after updating ??? (I'm not sure which update killed me)
START:
13 07 2016 08:33:30.517:INFO [karma]: Karma v1.1.1 server started at http://localhost:9876/
13 07 2016 08:33:30.519:INFO [launcher]: Launching browser NodeWebkitTest with unlimited concurrency
13 07 2016 08:33:30.531:INFO [launcher]: Starting browser node-webkit
13 07 2016 08:33:36.221:INFO [Chrome 41.0.2272 (Windows 7 0.0.0)]: Connected on socket /#6fJGXLlwDNlOGXukAAAA with id 21855637
Chrome 41.0.2272 (Windows 7 0.0.0) ERROR
Uncaught TypeError: Cannot read property 'setup' of undefined
at C:/Users/ethomps2/IdeaProjects/evidentia3/node_modules/karma-mocha/lib/adapter.js:209
Finished in 0.331 secs / 0 secs
At the point in the adapter where it is failing, the adapter is looking for window.mocha.
Here is my karma config:
module.exports = function (config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha', 'chai', 'sinon'],
'plugins': [
'karma-nodewebkit-launcher',
'karma-mocha',
'karma-chai',
'karma-sinon',
'karma-coverage',
'karma-mocha-reporter'
],
// list of files / patterns to load in the browser
files: [
<my code including test files>
],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'../build/js/controllers/*.js': ['coverage'],
'../build/js/services/*.js': ['coverage'],
'../build/js/filters/*.js': ['coverage'],
'../build/js/directives/*.js': ['coverage']
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['mocha', 'coverage'],
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['NodeWebkitTest'],
customLaunchers: {
'NodeWebkitTest': {
base: 'NodeWebkit',
paths: ['node_modules'],
options: {
"name": "Evidentia",
"main": "index.html",
"description": "Evidence management software for your genealogy research",
"version": "3.0.0",
"ver": "300",
"webkit": {
"page-cache": false
},
"window": {
"title": "Evidentia",
"icon": "img/Evidentia128x128.png",
"toolbar": true,
"frame": true,
"width": 1100,
"height": 700,
"show": false
}
}
}
},
// optionally, configure the reporter
coverageReporter: {
type: 'html',
dir: '../coverage/',
instrumenterOptions: {
istanbul: {noCompact: true}
}
},
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true
})
};
As you can see I am using karma-nodewebkit-launcher as my browser. My understanding was that nwjs global got linked to the window.
Use karma-nodewebkit-mocha in your project.
See https://github.com/karma-runner/karma-mocha/issues/184 for more details.
We were evaluating Sauce labs for our application. We were trying to get protractor tests run on multiple browsers at same time in Sauce labs. Will there be a new instance of VM created to run tests on each browser? We have configured protractor for multicapablities.
When would the new instance of VM be created? and if possible how would we configure to run tests on single VM or multiple VM?
Thanks.
It is possible to have protractor start multiple capabilities at the same time as well as run multiple tests in parallel. ( i do it in a work project )
By default i believe that each capability will run in parallel, to have the tests run in parallel also you need to set the shardTestFiles: true option.
https://github.com/angular/protractor/blob/master/docs/referenceConf.js#L114-L117
note this will be limited to the max instances limit of your saucelabs account (normally 10)
you can see in the following code snippet that we have set our protractor to give precedence to IE8 as its is the slowest, then the other browsers will start a maximum of 3 test scripts in parallel with the rest queuing up
maxSessions: 10,
multiCapabilities: [
{
browserName: 'internet explorer',
version: '10',
shardTestFiles: true,
maxInstances: 3,
'screen-resolution': '1024x768',
build: process.env.CI_BUILD_NUMBER
},
{
browserName: 'internet explorer',
version: '8',
platform: 'Windows XP',
shardTestFiles: true,
maxInstances: 10,
'screen-resolution': '1024x768',
build: process.env.CI_BUILD_NUMBER
},
{
browserName: 'firefox',
platform: 'Windows 8',
shardTestFiles: true,
maxInstances: 3,
'screen-resolution': '1024x768',
build: process.env.CI_BUILD_NUMBER
},
{
browserName: 'safari',
version: '7',
platform: 'OS X 10.9',
shardTestFiles: true,
maxInstances: 3,
'screen-resolution': '1024x768',
build: process.env.CI_BUILD_NUMBER
},
{
browserName: 'chrome',
platform: 'Windows 8.1',
shardTestFiles: true,
maxInstances: 3,
'screen-resolution': '1024x768'
}
]