How can I configure wdio.conf to allow Chrome multiple file download? - selenium-chromedriver

What I did so far:
browserName: 'chrome',
'goog:chromeOptions': {
args: ['--use-fake-ui-for-media-stream', 'use-fake-device-for-media-stream', '--ignore-certificate-errors'],
prefs: {
'intl.accept_languages': 'hu,HU',
'profile.default_content_setting_values.automatic_downloads': 1,
'profile.default_content_setting_multiple-automatic-downloads': 1,
},
},
But it doesn't work. Manually, I have to configure at chrome://settings/content/automaticDownloads
and have to add a site from where the multiple file download is allowed.

Related

How to run behat-html-formatter in behat 3.5

I have behat 3.5 up and running fine on windows 10. Now I wish to publish test results in html format. I installed this plugin https://github.com/dutchiexl/BehatHtmlFormatterPlugin
But how do I run behat tests utilizing this plugin? If I type "behat" I only see test steps in text format on the console. If I type "behat --format html --out test.feature.html --config behat.yml" I get an html output that looks "ugly".
My composer.json:
{
"require": {
"behat/behat": "~3.0",
"behat/mink": "~1.7#dev",
"behat/mink-goutte-driver": "1.2.1",
"behat/mink-selenium2-driver": "~1.3.1" ,
"behat/mink-extension": "*"
},
"config": {
"bin-dir": "bin/"
},
"require-dev": {
"emuse/behat-html-formatter": "^0.2.0"
}
}
My behat.yml:
default:
extensions:
Behat\MinkExtension:
default_session: goutte
goutte: ~
selenium2:
wd_host: "http://127.0.0.1:4444/wd/hub"
capabilities: { "browserName": "firefox", "browser": "firefox", "version": "", "platform": "WINDOWS" }
browser_name: firefox
emuse\BehatHTMLFormatter\BehatHTMLFormatterExtension:
name: html
renderer: Twig,Behat2
file_name: index
print_args: true
print_outp: true
loop_break: true
suites:
default:
contexts:
- emuse\BehatHTMLFormatter\Context\ScreenshotContext:
screenshotDir: build/html/behat/assets/screenshots
- FeatureContext
formatters:
html:
output_path: %paths.base%/build/html/behat
I found the details to make this work at https://packagist.org/packages/emuse/behat-html-formatter - I am using behat 3.6.1
After installing the html formatter with composer: composer require --dev emuse/behat-html-formatter I made my behat.html file look like this:
default:
suites:
default:
contexts:
- FeatureContext
- Drupal\DrupalExtension\Context\DrupalContext
- Drupal\DrupalExtension\Context\MinkContext
- Drupal\DrupalExtension\Context\MessageContext
- Drupal\DrupalExtension\Context\DrushContext
- emuse\BehatHTMLFormatter\Context\ScreenshotContext:
screenshotDir: report/html/behat/assets/screenshots
formatters:
html:
output_path: report/html/behat
extensions:
Drupal\MinkExtension:
goutte: ~
selenium2: ~
base_url: http://tea.ddev.site
Drupal\DrupalExtension:
blackbox: ~
emuse\BehatHTMLFormatter\BehatHTMLFormatterExtension:
name: html
renderer: Twig,Behat2
file_name: index
print_args: true
print_outp: true
loop_break: true
Now when I run the behat tests, the output goes to behat/report/html/behat/index.html
I don't need to specify the output as html, it automatically does that.

#nuxtjs/pwa does not generate sw.js with local system hosts information

I would like to apply PWA in nuxt(#2.3.4) web application.
The operating system is OSX latest.
So I have installed #nuxtjs/pwa and add some config to nuxt.config.js.
These are what I have added
module.exports = {
...
modules: [
['#nuxtjs/pwa', {icon : false}]
],
workbox : {
dev: true,
debug: true
},
manifest : {
viewport: 'width=device-width, initial-scale=1',
theme_color: '#3B8070'
},
...
}
And build with NODE_ENV=production and start.
I am able to find sw.js in localhost:9000, but it is not available with
local.jy.net:9000.
I was expecting the same result since I register that hostname on my hosts file.
Here is what I have in /private/etc/hosts.
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
127.0.0.1 Juneui-MacBook-Pro.local
127.0.0.1 local.jy.net aad901eb546340cc9a69b0b030b124fc.jy.net
How could I make #nuxtjs/pwa refers system hosts variables?
If you need more information, add reply then I will provide as possible as I can. Thanks.
The #nuxtjs/pwa package is looking for the build.publicPath option: https://github.com/nuxt-community/pwa-module/blob/9f27d5cdae0e0341d6d4b4f6814f91db6eab1432/packages/manifest/index.js#L24
Adding this option to your nuxt.config.js should do the trick:
module.exports = {
...
modules: [
['#nuxtjs/pwa', {icon : false}]
],
workbox : {
dev: true,
debug: true
},
manifest : {
viewport: 'width=device-width, initial-scale=1',
theme_color: '#3B8070'
},
build: {
publicPath: '//local.jy.net:9000/pwa/',
}
...
}
You can find more information about the publicPath property here: https://nuxtjs.org/api/configuration-build#publicpath

How to change default file watch options in LiteServer

So I'm trying to use LiteServer in my project, but I can't get it to change the default watch of index.html, my current file is index1.html. I specified app2.js as the entry point during npm init, so I was able to change the JS default, but not for HTML.
> lite-server
Did not detect a `bs-config.json` or `bs-config.js` override file. Using lite-server defaults...
** browser-sync config **
{ injectChanges: false,
files: [ './**/*.{html,htm,css,js}' ],
watchOptions: { ignored: 'node_modules' },
server: { baseDir: './', middleware: [ [Function], [Function] ] } }
[BS] Access URLs:
--------------------------------------
Local: http://localhost:3000
External: http://10.40.244.189:3000
--------------------------------------
UI: http://localhost:3001
UI External: http://10.40.244.189:3001
--------------------------------------
[BS] Serving files from: ./
[BS] Watching files...
16.12.21 18:43:32 200 GET /index.html
16.12.21 18:43:32 200 GET /style.css
16.12.21 18:43:33 200 GET /app2.js
16.12.21 18:43:34 404 GET /favicon.ico
I know the doc mentions the use of a bs-config.json file, but I couldn't get any reference which has the syntax for this.
Would appreciate the help!
UPDATE - I currently have this in the bs-config.json file, but no use -
{
"files": ["style.css", "app2.js", "index1.html"]
}
lite-server is based on BrowserSync. bs-config.js is browsersync's config file. The config options are documented here:
https://browsersync.io/docs/options
For example, to set your default indx to be index1.html, instead of setting it in your routes, the bs-config.json could contain:
{
"server": {
"baseDir": "src",
"index": "/index1.html",
"routes": {
"/node_modules": "node_modules"
}
}
}

Protractor-cucumber report: result.json is empty

After i follow this question Cucumber HTML report with Protractor to add this line to config file resultJsonOutputFile: 'report.json', i can generate report.json file but this file is empty after i run my test.
---------------conf.js--------------
exports.config = {
allScriptTimeout: 60000, //To set up a timeout for each test executed on Protractor
baseUrl: 'http://localhost/wp/index.php',
seleniumAddress: 'http://127.0.0.1:4444/wd/hub',
//seleniumServerJar: 'selenium-server-standalone-2.48.2.jar',
framework: 'cucumber',
specs: [
'Feature/login.feature'
],
capabilities: {
browserName: 'firefox',
},
onPrepare : function () {
//driver.manage().window().setSize( width, height );
global.driver = browser.driver;
browser.ignoreSynchronization = true;
},
resultJsonOutputFile: 'report.json',
cucumberOpts: {
require: 'Feature/Steps/*_steps.js',
format: 'pretty',
defaultTimeoutInterval: 30000
}
};
Am i doing wrong or missing with my config? Could you help me give a guide to generate report for protractor-cucumber? Thank so much.
Changing the following code should solve the issue. (Refresh the folder in IDE to view the report.json)
// resultJsonOutputFile: 'report.json',
cucumberOpts: {
require: 'Feature/Steps/*_steps.js',
format: 'pretty',
format:'json:../report.json'
}

Sublime2 Parse Error

I'm getting an error in Sublime2 SFTP.
Error parsing sftp-config.json file:
No JSON object could be decoded
I'm not sure what is going. Help is appreciated. I've tried uninstalling and reinstalling the SFTP plugin but that didn't fix it.
Here is my code:
{
// The tab key will cycle through the settings when first created
// Visit http://wbond.net/sublime_packages/sftp/settings for help
// sftp, ftp or ftps
"type": "sftp",
"save_before_upload": true,
"upload_on_save": false,
"sync_down_on_open": false,
"sync_skip_deletes": false,
"sync_same_age": true,
"confirm_downloads": false,
"confirm_sync": true,
"confirm_overwrite_newer": false,
"host": "54.173.65.194",
"user": "brent",
//"password": "password",
//"port": "22",
"remote_path": "/example",
"ignore_regexes": [
"\\.sublime-(project|workspace)", "sftp-config(-alt\\d?)?\\.json",
"sftp-settings\\.json", "/venv/", "\\.svn/", "\\.hg/", "\\.git/",
"\\.bzr", "_darcs", "CVS", "\\.DS_Store", "Thumbs\\.db", "desktop\\.ini"
],
//"file_permissions": "664",
//"dir_permissions": "775",
//"extra_list_connections": 0,
"connect_timeout": 30,
//"keepalive": 120,
//"ftp_passive_mode": true,
//"ftp_obey_passive_host": false,
//"ssh_key_file": "~/.ssh/id_rsa",
//"sftp_flags": ["-F", "/path/to/ssh_config"],
//"preserve_modification_times": false,
//"remote_time_offset_in_hours": 0,
//"remote_encoding": "utf-8",
//"remote_locale": "C",
//"allow_config_upload": false,
}
Go to
~/.config/sublime-text-3/Packages/User/sftp_servers
and delete the file that is causing the error
this sftp_server folder contains all your existing server connection config so you can decide which one is causing the problem by reading the error properly.
I think it might be the','(comma) after the connect_timeout. Javscript/json doesn't allow trailing commas on the last item in a list, unlike Python.
I resolved it by uninstalling Sublime 2, removing all preferences, and reinstalling. It works now.
On my MacOS it was non-json file app.py inside (could be another file)
/Users/<your_username>/Library/Application Support/Sublime Text 3/Packages/User/sftp_servers
When I deleted it error disappeared