intern chromeOptions.args window-size seemingly not working - intern

i'm requiring a capabilities.js file with an object to my intern suites so i can specify which environments to use for various tests. here is my default chrome:
chrome: {
browserName: 'chrome',
chromeOptions: {
args: [
// 'start-maximized',
'window-size=1024x768'
]
}
}
from this i'd expect something like environments: [caps.chrome] to open a browser window that is 1024x768. I need to specify window size in a per-environment way. (also, start-maximized isn't working- though i do have several mobile emulators set up and doing well).

I did find this which seems to hint that it won't work on a mac. can anyone confirm?
However, the issue linked in the question has been closed for some time.
Arguments not being applied to Google chromedriver in Selenium with python

I use these configs to control windows size on windows, should work on Mac too.
"chromeOptions": {
"args": [
"--window-size=800,600"
]
"chromeOptions": {
"args": [
"--start-maximized"
]

Related

Node.js live debugging in VSCode doesn't work

I have a small project (but issue also appears on the one created by npx create-react-app my-app). I use VsCode and developing inside container (https://code.visualstudio.com/docs/remote/containers) . Dockerfile is very minimal:
ARG VARIANT="16-bullseye"
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT}
devcontainer.json has, almost, just defaults:
{
"name": "Node.js",
"build": {
"dockerfile": "Dockerfile",
"args": { "VARIANT": "16-bullseye" }
},
"settings": {},
"extensions": [
"dbaeumer.vscode-eslint"
],
"remoteUser": "node"
}
To debug, I run npm start , then I (for the 1st time) i click on Debug URl.
On macOS everything works, including file monitoring, so when I change js file, npm is recompiling instantly.
On Windows 11 however, the last part doesn't work - I need to stop and start npm manually, to have changes implement.
I've even tried to remove .vscode directory from my profile - no change here...
Any idea what is going on? Why it does work on macOS and doesn't work on Windows ?
I have the same extensions on both systems...I just can't find what is going on with Windows machine...
EDIT: the issue seems to be related to "Remote Development" extension for vscode . Issue is present only when using this extension on Windows. So I've opened a bug there: https://github.com/microsoft/vscode-remote-release/issues/6633

Jasming config flag (--config) does not use the right config file

I have my node server on path F:\proj\dev-react-node-java\src\server. I used 'jasmine init' to create spec folder here and running 'jasmine' in terminal runs the specs (tests) correctly.
I wish to run the tests from F:\proj\dev-react-node-java so I used the command
jasmine --config=src/server/spec/support/jasmine.json
at this path but I get the message 'No specs found'. Why is it not using the correct configuration file (jasmine.json)?
I am sure --config reaches for this file because:
Giving wrong path gives 'Cannot find module' error.
Writing errorful json also generates and error.
Here is the jasmine.json code for reference:
{
"spec_dir": "spec",
"spec_files": [
"**/*[sS]pec.js"
],
"helpers": [
"helpers/**/*.js"
],
"stopSpecOnExpectationFailure": false,
"random": true
}
spec/support/jasmine.json is the default path as far as I understand since running 'jasmine' command at path say F:\proj\dev-react-node-java\src\server\spec also results in No specs found.
jasmine version is 3.6.1
P.S. This is my first question asked here. Please inform if I made any mistakes in asking. Thank you.
I did find the reason. It is indeed not an issue with the config flag but rather with my jasmine.json file.
What I thought the use of config flag was to specify the path to the file instead of the default spec/support/jasmine.json. It would then have the same behaviour as if the relative path to config was spec/support/jasmine.json.
But
F:\proj\dev-react-node-java>jasmine --config=src/server/spec/support/jasmine.json
is not the same as
F:\proj\dev-react-node-java\src\server>jasmine --config=spec/support/jasmine.json
What it does instead is like copying it to the path from where the command was called and then using it to run the tests.
Hence, what worked was changing the spec_dir field.
{
"spec_dir": "src/server/spec",
"spec_files": [
"**/*[sS]pec.js"
],
"helpers": [
"helpers/**/*.js"
],
"stopSpecOnExpectationFailure": false,
"random": true
}
A little more clarification/examples in the docs would have been nicer but perhaps I misunderstood the functionality.

Disable image in Selenium ChromeDriver

Is there a way to disable images in Chromedriver with Javascript ( Node.js )? I couldn't find a proper answer to this question anywhere!
I do realise this question is quite old, but still - it is the first Google search result for the node chromedriver disable images query. So I decided to give it a go anyway.
I don't know the exact setup the OP was trying to use, so I'll refer to my own. I'm using nightwatch.js with pre-built Selenium running chromedriver. In my nightwatch.conf.js file I have the following setup for the chromedriver:
module.exports = {
"test_settings": {
"default": {
...
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true,
"chromeOptions": {
"args": ["disable-web-security"],
"prefs": {
"profile.managed_default_content_settings.images": 2
}
}
}
}
}
};
The setup above works with
"chromedriver": "^2.21.2",
"selenium-server": "^2.53.0"
and is running Chrome 51.0.2704.84 stable.
I hope that helps someone, as I lost about 3 hours trying to come up with this solution.

Why might Intern timeout with BrowserStack, but not Sauce Labs?

Edit: This has since been solved as an interesting network issue, see my comments and answer below.
Original Post:
My goal: Setup proof-of-concept tests on BrowserStack with Intern.
I went through the intern-tutorial, which all worked beutifully for me on Sauce Labs, and now I just want to learn what it takes to modify that configuration to test on BrowserStack, which keeps failing for me.
The terminal command, as per the tutorial:
./node_modules/.bin/intern-runner config=tests/intern
When running that, I get:
Listening on 0.0.0.0:9000
Starting tunnel...
BrowserStackLocal v2.2
Connecting to BrowserStack using WebSocket protocol...
Connected.
Ready
Error: connect ETIMEDOUT
at errnoException <net.js:904:11>
at Object.afterConnect [as oncomplete] <net.js:895:19>
TOTAL: tested 0 platforms, 0/0 tests failed; fatal error occurred
Environment:
OS: Mac OS X 10.9.4
Node: 0.10.29
NPM: 1.4.21
Intern: 2.0.1
Variables set in ~/.bash_profile as:
export BROWSERSTACK_USERNAME="<my_actual_username>"
export BROWSERSTACK_ACCESS_KEY="<my_actual_access_key>"
Intern configuration set in tests/intern as:
define({
proxyPort: 9000,
proxyUrl: 'http://localhost:9000/',
capabilities: {
'selenium-version': '2.41.0'
},
environments: [
{ os: "Windows", os_version: "8.1", browser: "chrome", browser_version: "34.0" }
],
maxConcurrency: 3,
tunnel: 'BrowserStackTunnel',
tunnelOptions: {
verbose: true
},
loader: {
packages: [ { name: 'app', location: 'app' } ]
},
suites: [ 'tests/hello' ],
functionalSuites: [ 'tests/functional/index' ],
excludeInstrumentation: /^(?:tests|node_modules)\//
});
As in, this is all that has been changed since the completed tutorial:
Removed all but one environment object (for simplicity), modified it to a format supported by BrowserStack.
Set the 'tunnel' property to the appropriate tunnel class.
Set tunnelOptions: { verbose: true } for debugging.
Things I've tried:
Setting BROWSERSTACK_USERNAME and BROWSERSTACK_ACCESS_KEY inline on the command line when executing the runner, just in case.
Used the configuration here (which I recognize is out of date): https://stackoverflow.com/questions/23304388/intern-js-and-browserstack
Stupidity checks, computer reboots, etc.
My environment object should be valid, as its based on one coming back from:
https://www.browserstack.com/automate/browsers.json
I feel like there's some basic thing here I'm missing about the configuration.
Can you have a look into the intern config file, which I use to run tests on browserstack. Hope it will help you solve your problem.
I have confirmed via A/B testing on different networks and with the same configuration, that this is due to the fact that Verizon Wireless blocks WebSocket connections, which has been reported elsewhere (see my comments on the original question).
This can be very tricky to diagnose. I hope it helps someone in the future!

jshint and sublimelinter settings config on mac

I'm trying to configure sublimelinter, specifically jshint on my Mac. On my windows version of SublimeText there is the following section in SublimeLinter.sublime-settings
"jshint_options":
{
// To fix column positions for JSHint errors you may want to add `"indent": 1` to your
// **User** "jshint_options". This issue affects users with tabs for indentation.
// This fix was reverted due to a conflict with using the `"white": true` option.
// "indent": 1,
"evil": true,
"regexdash": true,
"browser": true,
"wsh": true,
"trailing": true,
"sub": true
},
When I view the file on my Mac this section doesn't exist, is there a place to edit these option on the Mac version without a separate settings file? Or a global settings file for jshint?
I've been digging through similar questions but haven't found a clear solution.
Update:
Actually it doesn't seem to catch any errors at all when using it on the console. My javascript file doesn't end in .js how can I configure it to look at different extensions? I can't find it in the docs.
There's another way to set options globally, without using ".jshintrc" files.
1) create a file with any name (e.g. "jshint.conf"). my file is:
{
"globals": { "$": false },
"globalstrict": true,
"devel": true
}
2) put it anywhere. in my case it is: "c:\Users\Smith\AppData\Roaming\Sublime Text 3\Packages\User\"
3) make the next reference in section "jshint"->"args" of sublime-linter user setting (user/SublimeLinter.sublime-settings):
{
"user": {
"linters": {
"jshint": {
"args": [
"--config", "c:\\Users\\Smith\\AppData\\Roaming\\Sublime Text 3\\Packages\\User\\jshint.conf"
]
}
}
}
}
4) Enjoy!
In general I would recommend against configuring JSHint system-wide. It's usually safer to create a .jshintrc file for each project your work on because it's likely they will have different JSHint requirements.
The jshint_options SublimeLinter setting you mention in your question is from the old version of SublimeLinter, which has recently been reworked to have a simple plugin architecture. The JSHint plugin (which I assume you are using, since the settings you tried didn't work) makes the same recommendation:
You can configure jshint options in the way you would from the command line, with .jshintrc files.
The added benefit of this approach is that you can commit the .jshintrc file to your repository and ensure that anyone who works on the project is working with the same JSHint rules, rather than their own system-wide settings.

Resources