In my react project, I would like to use nightwatch as testing tool. I'm actually using Nightwatch v1.0.4 and selenium-server-standalone-3.9.1.jar on windows.
And this is my config (nightwatch.json) :
{
"src_folders": [
"tests"
],
"output_folder": "reports",
"custom_commands_path": "",
"custom_assertions_path": "",
"page_objects_path": "",
"globals_path": "",
"disable_colors": false,
"test_workers": false,
"selenium": {
"start_process": true,
"host": "localhost",
"port": 4444,
"server_path": "./bin/selenium-server-standalone-3.9.1.jar",
"log_path": "./logs",
"cli_args": {
"webdriver.chrome.driver": "./bin/chromedriver"
}
},
"desiredCapabilities": {
"browserName": "chrome",
"acceptSslCerts": true
},
"test_settings": {
"default": {
"webdriver": {
"server_path": "./bin/chromedriver",
"cli_args": [
"--log",
"debug"
]
},
"disable_colors": false,
"screenshots": {
"enabled": false,
"path": ""
},
"request_timeout_options": {
"timeout": 60000,
"retry_attempts": 5
},
"default_path_prefix" : "",
"desiredCapabilities": {
"browserName": "chrome",
"acceptInsecureCerts": true
}
},
"chrome": {
"webdriver": {
"port": 9515,
"default_path_prefix": "",
"server_path": "./bin/chromedriver",
"cli_args": [
"--verbose"
]
},
"desiredCapabilities": {
"browserName": "chrome",
"loggingPrefs": {
"driver": "INFO",
"server": "OFF",
"browser": "INFO"
}
}
}
}
}
And my test file (tests/index.js):
const host = 'http://localhost:3000'
module.exports = {
'Demo test' : function (browser) {
browser
.url('http://google.com')
.waitForElementVisible('body', 1000)
.pause(5000)
.end();
}
}
When I run nightwatch, it gives me the following error:
Can anyone tell me what I'm doing wrong please ?
Your ChromeDriver version -which you've mentioned as v2.9 is pretty old.
As of the ChromeDriver download page, as per your Chrome version, you should use ChromeDriver version above 2.36 - I would recommend the latest 2.38
Related
I didn't find any information on how to properly setup the nightwatch config using Safari technology preview.
I've tried something like this:
module.exports = {
"src_folders": [
"suites"
],
"output_folder": "reports",
"custom_commands_path": "commands",
"page_objects_path": "pageObjects",
"globals_path": "globals.js",
"selenium": {
"start_process": true,
"server_path": seleniumServer.path,
"host": "127.0.0.1",
"port": 4444,
"log_path": "logs",
"cli_args": {
"webdriver.chrome.driver": chromedriver.path,
"webdriver.firefox.driver": '/usr/bin/geckodriver',
"webdriver.safari.driver": '/usr/bin/safaridriver'
}
},
"test_settings": {
"default": {
"launch_url": "http://google.com",
"screenshots": {
"enabled": true,
"on_failure" : true,
"on_error" : true
},
"globals": {
"waitForConditionTimeout": 5000,
"retryAssertionTimeout": 5000
},
"desiredCapabilities": {
"browserName": "safari",
"browserVersion": "12",
"technologyPreview": true
},
"skip_testcases_on_fail": false,
"end_session_on_fail": false
}
}
};
But after execution I get this error:
{ value:
{ message: 'Could not create a session: A browser with name \'safari\' version \'12\' could not be found on the system.\nBuild info: version: \'3.13.0\', revision: \'2f0d292\', time: \'2018-06-25T15:32:19.891Z\'\nSystem info: host: \'Boostas-MacBook-Pro-5.local\', ip: \'fe80:0:0:0:100a:70f9:d6d7:cbfc%en0\', os.name: \'Mac OS X\', os.arch: \'x86_64\', os.version: \'10.13.6\', java.version: \'10.0.1\'\nDriver info: driver.version: unknown\nremote stacktrace: ',
error: 'session not created' },
status: 33 }
Note: If I set technologyPreview to false the test will be run in Safari browser.
Hope you guys can help me!
Those two options worked in my case in nightwatch.json to launch Safari Technology Preview :
"desiredCapabilities": {
"browserName": "safari",
"safari.options": {"technologyPreview": true},
}
Useful reference : https://macops.ca/using-safari-technology-preview-with-selenium-webdriver/
Hope this helps !
Here is my problem: I want be abble to set firefox in specific language to run our e2e tests, and be abble to distribute them.
all verions:
Mozilla Firefox 53.0.3
Selenium 3.4.0 (from npm)
geckodriver 0.17.0 (from npm)
nightwatch.conf.js:
const seleniumServer = require('selenium-server');
module.exports = {
"src_folders": [
"test/functional/features"
],
"custom_commands_path": [
"test/functional/commands/commun",
"test/functional/commands/project"
],
"output_folder": false,
"selenium": {
"start_process": true,
"server_path": seleniumServer.path,
"port": 4444,
"cli_args": {
"webdriver.gecko.driver": "./node_modules/.bin/geckodriver"
}
},
"test_settings": {
"default": {
"selenium_port": 4444,
"selenium_host": "localhost",
"silent": true,
"screenshots": {
"enabled": false
},
"detailed_output": false,
"desiredCapabilities": {
"javascriptEnabled": true,
"acceptSslCerts": true,
"marionette": true,
"browserName": "firefox"
}
}
}
};
In general I tryed two way:
dynamically create a firefox profile, and use it.
In theorie, I can use a before(Each) and use firefox-profile. In practice it create my profile but doesn't use it.
const FirefoxProfile = require('firefox-profile');
function setProfile(browser, profile, callback) {
profile.encoded(function (encodedProfile) {
browser.options.desiredCapabilities['firefox_profile'] = encodedProfile;
callback();
});
}
function setPrefToFrench(browser, done) {
var FFprofile = new FirefoxProfile();
FFprofile.setPreference('general.useragent.locale', 'fr');
FFprofile.setPreference('intl.accept_languages', 'fr');
setProfile(browser, FFprofile, done);
}
module.exports = {
'default' : {
isLocal : true
},
beforeEach: function(browser, done) {
setPrefToFrench(browser, done);
done();
}
};
Save a profile (why not ziped) and include it in project
The same, in theorie, i just have to add it on the nightwatch.conf.js
"selenium": {
"start_process": true,
"server_path": seleniumServer.path,
"port": 4444,
"cli_args": {
"webdriver.gecko.driver": "./node_modules/.bin/geckodriver",
"webdriver.firefox.profile": "path/to/my/profile(or base64 zip)"
}
},
But all time the same, my firefox is still in english.
Does anyone whould have a solution, or maybe I made something wrong?
I've used Rich file manager with Laravel5.3.20 as the default configuration as below
Javascript
<script>
CKEDITOR.replace( 'textarea', {
filebrowserBrowseUrl: '{!! url('gallery/index.html') !!}',
///ImageBrowser : true,
autoUpdateElement:true,
language:'en'
});
</script>
Images in textarea url is wrong.
<p><img alt="" src="http://website.dev/gallery/connectors/php/filemanager.php?mode=readfile&path=%2Fae.jpg&config=filemanager.config.json&time=1477642950519" style="height:960px; width:720px" /></p>
All files, folder and sub folder have already update to userfiles
But it image url which i have to insert into Database with textarea go wrong as above url.
FileManager.configure.json
{
"_comment": "IMPORTANT : go to the wiki page to know about options configuration https://github.com/simogeo/Filemanager/wiki/Filemanager-configuration-file",
"options": {
"culture": "en",
"lang": "php",
"theme": "flat-dark",
"defaultViewMode": "grid",
"localizeGUI": true,
"showFullPath": false,
"showTitleAttr": false,
"browseOnly": false,
"showConfirmation": true,
"showThumbs": true,
"searchBox": true,
"listFiles": true,
"fileSorting": "NAME_ASC",
"folderPosition": "bottom",
"quickSelect": false,
"charsLatinOnly": false,
"splitterWidth": 200,
"splitterMinWidth": 200,
"dateFormat": "d M Y H:i",
"serverRoot": true,
"fileRoot": false,
"fileConnector": false,
"fileRootSizeLimit": false,
"baseUrl": false,
"capabilities": ["select", "upload", "download", "rename", "move", "replace", "delete"],
"logger": false,
"plugins": []
},
"security": {
"allowFolderDownload": false,
"allowChangeExtensions": false,
"allowNoExtension": false,
"normalizeFilename": true,
"uploadPolicy": "DISALLOW_ALL",
"uploadRestrictions": [
"jpg",
"jpe",
"jpeg",
"gif",
"png",
"svg",
"txt",
"pdf",
"odp",
"ods",
"odt",
"rtf",
"doc",
"docx",
"xls",
"xlsx",
"ppt",
"pptx",
"csv",
"ogv",
"avi",
"mkv",
"mp4",
"webm",
"m4v",
"ogg",
"mp3",
"wav",
"zip",
"rar"
]
},
"exclude": {
"unallowed_files": [
".htaccess",
"web.config"
],
"unallowed_dirs": [
"_thumbs",
".CDN_ACCESS_LOGS",
"cloudservers"
],
"unallowed_files_REGEXP": "/^\\./",
"unallowed_dirs_REGEXP": "/^\\./"
},
"upload": {
"multiple": true,
"paramName": "files",
"chunkSize": false,
"numberOfFiles": 5,
"fileSizeLimit": 16000000,
"overwrite": false,
"imagesOnly": false
},
"images": {
"imagesExt": [
"jpg",
"jpe",
"jpeg",
"gif",
"png",
"svg"
],
"main": {
"autoOrient": true,
"maxWidth": 1280,
"maxHeight": 1024
},
"thumbnail": {
"enabled": true,
"cache": true,
"dir": "_thumbs/",
"crop": true,
"maxWidth": 64,
"maxHeight": 64
}
},
"videos": {
"showVideoPlayer": true,
"videosExt": [
"ogv",
"mp4",
"webm",
"m4v"
],
"videosPlayerWidth": 400,
"videosPlayerHeight": 222
},
"audios": {
"showAudioPlayer": true,
"audiosExt": [
"ogg",
"mp3",
"wav"
]
},
"pdfs": {
"showPdfReader": true,
"pdfsExt": [
"pdf",
"odt",
"odp",
"ods"
],
"pdfsReaderWidth": "640",
"pdfsReaderHeight": "480"
},
"docs": {
"showGoogleViewer": true,
"docsExt": [
"doc",
"docx",
"xls",
"xlsx",
"ppt",
"pptx"
],
"docsReaderWidth": "640",
"docsReaderHeight": "480"
},
"edit": {
"enabled": true,
"lineNumbers": true,
"lineWrapping": true,
"codeHighlight": false,
"theme": "elegant",
"editExt": [
"txt",
"csv"
]
},
"customScrollbar": {
"enabled": true,
"theme": "inset-2-dark",
"button": true
},
"extras": {
"extra_js": [],
"extra_js_async": true
},
"icons": {
"path": "images/fileicons/",
"folder": "_Open.png",
"parent": "_Parent.png",
"default": "default.png"
},
"url": "https://github.com/servocoder/RichFilemanager",
"version": "1.0.6"
}
The version that you use doesn't support absolute paths in preview links, it builds preview urls via connector request path only.It was done because some users keep connector file separate from the client-side scripts (different servers and so on). After some discussions it was decided to support both options: absolute path (by default) and connector path (configurable). The feature that you need will be included in the next major release 2.0. Some discussion on your problem is here.
Can I execute multiple test cases in parallel through Nightwatch ?Is it Possible?
I am searching for ability of threading capability in java for parallel test case execution.
Also what do you guys think about moving from Selenium to Nightwatch?
You can see the thread for parallelism: nightwatchjs also take a look into parallel run
Nightwatch is using the same selenium webdriver protocol but with some extra additions.
Yes you can leverage the parallel mode of nightwatch js using following configuration:
test_workers: {
enabled: true,
workers: 'auto'
}
To execute tests in multiple browsers, you need to add the desired capabilities of the browsers and Test_worker configurations in nightwatch.json file.
For eg. if you want to use Opera you have to add this config:
"cli_args": {
//path to Opera Webdriver File
"webdriver.opera.driver": "bin/operadriver"
}
"opera": {
"desiredCapabilities": {
"browserName": "opera"
}
}
For Test_Worker Configuration you should add:
"test_workers": {
"enabled": true,
"workers": "auto"
}
For example if you want to execute tests in three browsers parallely - Chrome, Firefox and Opera, your nightwatch.json should something like this.
{
"src_folders": [
"tests"
],
"output_folder": "reports",
"selenium": {
"start_process": true,
"server_path": "bin/selenium-server-standalone-3.12.0.jar",
"log_path": "",
"port": 4444,
"cli_args": {
"webdriver.chrome.driver": "bin/chromedriver",
"webdriver.gecko.driver": "bin/geckodriver",
"webdriver.opera.driver": "bin/operadriver"
}
},
"test_workers": {
"enabled": true,
"workers": "auto"
},
"test_settings": {
"default": {
"launch_url": "http://localhost",
"selenium_port": 4444,
"selenium_host": "localhost",
"silent": true,
"screenshots": {
"enabled": false,
"path": ""
},
"desiredCapabilities": {
"browserName": "chrome"
}
},
"firefox": {
"desiredCapabilities": {
"browserName": "firefox",
"marionette": true
}
},
"opera": {
"desiredCapabilities": {
"browserName": "opera"
}
}
}
}
For more info, you can look into this article: How To Execute Tests In Multiple Browsers Parallely With NIGHTWATCH JS.
I have Simogeo FileManager version 2.0.0.
I extracted it in root/tools, changed the config file, set up the permissions, hooked it to tinymce and everything seemed to work. The tinymce opens the popup window with FileManager. I can create a folder, change folder and upload files.
Problem is when I upload file(s) I cannot see them in the FileManager but they are uploaded in the directories I created. The only thing I can see are directories.
I am testing it on Windows 8.1 with uwAmp, PHP 5.3.24 or PHP 5.4.31.
Config file:
{
"_comment": "IMPORTANT : go to the wiki page to know about options configuration https://github.com/simogeo/Filemanager/wiki/Filemanager-configuration-file",
"options": {
"culture": "en",
"lang": "php",
"theme": "flat-dark",
"defaultViewMode": "grid",
"autoload": true,
"showFullPath": false,
"showTitleAttr": false,
"browseOnly": false,
"showConfirmation": true,
"showThumbs": true,
"generateThumbnails": true,
"searchBox": true,
"listFiles": true,
"fileSorting": "default",
"chars_only_latin": true,
"dateFormat": "d M Y H:i",
"serverRoot": true,
"fileRoot": false,
"relPath": false,
"logger": false,
"capabilities": ["select", "download", "rename", "delete", "replace"],
"plugins": []
},
"security": {
"allowFolderDownload": false,
"allowChangeExtensions": false,
"allowNoExtension": false,
"uploadPolicy": "DISALLOW_ALL",
"uploadRestrictions": [
"jpg",
"jpeg",
"gif",
"png",
"svg",
"txt",
"pdf",
"odp",
"ods",
"odt",
"rtf",
"doc",
"docx",
"xls",
"xlsx",
"ppt",
"pptx",
"csv",
"ogv",
"mp4",
"webm",
"m4v",
"ogg",
"mp3",
"wav",
"zip",
"rar"
]
},
"upload": {
"multiple": true,
"number": 5,
"overwrite": false,
"imagesOnly": false,
"fileSizeLimit": 16
},
"exclude": {
"unallowed_files": [
".htaccess",
"web.config"
],
"unallowed_dirs": [
"_thumbs",
".CDN_ACCESS_LOGS",
"cloudservers"
],
"unallowed_files_REGEXP": "/^\\./",
"unallowed_dirs_REGEXP": "/^\\./"
},
"images": {
"imagesExt": [
"jpg",
"jpeg",
"gif",
"png",
"svg"
],
"resize": {
"enabled":true,
"maxWidth": 1280,
"maxHeight": 1024
}
},
"videos": {
"showVideoPlayer": true,
"videosExt": [
"ogv",
"mp4",
"webm",
"m4v"
],
"videosPlayerWidth": 400,
"videosPlayerHeight": 222
},
"audios": {
"showAudioPlayer": true,
"audiosExt": [
"ogg",
"mp3",
"wav"
]
},
"edit": {
"enabled": true,
"lineNumbers": true,
"lineWrapping": true,
"codeHighlight": false,
"theme": "elegant",
"editExt": [
"txt",
"csv"
]
},
"customScrollbar": {
"enabled": true,
"theme": "inset-2-dark",
"button": true
},
"extras": {
"extra_js": [],
"extra_js_async": true
},
"icons": {
"path": "images/fileicons/",
"directory": "_Open.png",
"default": "default.png"
},
"url": "https://github.com/simogeo/Filemanager",
"version": "2.0.0-dev"
}
The problem was with the type in referer.
tinymce was passing ?type=image and filemanager expected ?type=images
Are you sure listFiles option is set to true inc config file ?
See the related doc : https://github.com/simogeo/Filemanager/wiki/Filemanager-configuration-file
listFiles Default value true. Display files in right column (filetree). If set to false, will display only folders. Can take value true or false.
For further help, could you copy-paste an URL or at least your config file!?