I've been trying to automate my Protractor tests for a couple weeks, and I've had many problems. First I tried running them through Jenkins, which is installed on an Amazon Linux AMI instance. That didn't work, because I couldn't properly install Firefox or Chrome, and I couldn't get PhantomJS to run my tests correctly.
Next I tried using SSH commands to get Jenkins to run the Protractor tests on a separate Ubuntu Server instance. Whenever I try to run Firefox or Chrome in there with Xvfb, it gets stuck on the step Initializing built-in extension GLX. I also get the error (process:7476): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed when trying to run Firefox.
Any ideas that could point me in the right direction? I basically need to get Firefox or Chrome to run properly on either Amazon Linux AMI or Ubuntu Server 14.04.
I use a headless selenium server in the cloud, it provides Chrome & Firefox even though there is no real DISPLAY. I've just moved the config files here: https://github.com/elgalu/headless
Works ok with Ubuntu Server 14.04.
Related
I have a stand alone node js script.
I am doing some local task with that script. I want to debug that script in chrome dev tools. I know I can debug it locally via putting debugger in code but do not want to do that.
On nodejs docs I saw that it has some options like -
V8 Inspector Integration for Node.js# NOTE: This is an experimental
feature.
V8 Inspector integration allows attaching Chrome DevTools to Node.js
instances for debugging and profiling.
V8 Inspector can be enabled by passing the --inspect flag when
starting a Node.js application. It is also possible to supply a custom
port with that flag, e.g. --inspect=9222 will accept DevTools
connections on port 9222.
To break on the first line of the application code, provide the
--debug-brk flag in addition to --inspect.
$ node --inspect index.js
But when I do that it gives me error like -
$ node --inspect index.js
node: bad option: --inspect
My node version is:
$ node --version
v4.4.7
You need node 6.3 or above --inspect is not supported in 4.4.7
#Andrey
Thanks a lot for pointing out that I was scratching my head for a long time on this.
#dan
Thanks for node-inspector suggestion.
I am just posting an answer in case someone else might stuck on this.
I have installed node-inspector and,
This is what I'm doing to start the debugger..
Opened one terminal and
$ node-inspector --no-preload
Node Inspector v0.12.5
Visit http://127.0.0.1:8080/?ws=127.0.0.1:8080&port=5858 to start debugging.
In another terminal,
$ node --debug-brk app.js
debugger listening on port 5858
Intially I was using just --debug. But it was not hitting the breakpoints and was going through all code. Then I used --debug-brk. Using --debug-brk caused node to break on the first line of app and waited for a debugger to hit breakpoints.
Then started Google Chrome and went to
http://127.0.0.1:8080/debug?port=5858
Here chrome dev tools was opened and I was able to put break point and debug the code.
Node Inspector works pretty well. Also keep in mind Node 7 has native node debugging, even supports live-edit! Here's a gif of it in action: Chrome DevTools: Live edit running Node.js code with hotswapping
I have tried to install meteor js 1.1 on windows 8.1 with the official installer:
https://github.com/meteor/meteor/wiki/Preview-of-Meteor-on-Windows
But even after restarting my computer, when I type the command meteor in the command prompt I get the error command not found.
Even after a search on my computer to find the installation folder of meteor, I am unable to find the answer. However, in the add/remove program utility, I can see meteor.exe.
As a note, I already successfully installed meteor before, and it used to run smoothly. In the meantime, I have removed and re-installed node, and it seems that since this moment the command meteor does not work anymore. Hence my attempt to re-install it.
Does anyone have any idea about how to troubleshoot my issue ?
I just solved my issue by using the windows command prompt instead of the git bash
It appears that only windows command prompt is supported so far.
You can try to manually add Meteor to your Path.
Go to "Environment variables" (you can find it by doing a simple search in your welcome screen) and add the following entry:
C:\\Users\\**your_user_name**\\AppData\\Local\\.meteor
Do not forget to separate this entry from other entries by a semicolon ;.
My general problem is how to run unit tests with karma in IE or other browser installed on a Windows machine, while karma is run on a Linux machine, though in the question below I might ask more specific question based on what I've already tried.
Also it may be worth to mention, that I have Windows installed on a Virtual box machine.
I started karma from a terminal, then opened in IE this url: http://10.0.2.2:9876 and saw the karma page in the browser window (though I spotted some quick blink with a red background, I suppose it is related to an error I'll mention further).
After that I tried to run tests with the command: node_modules/karma/bin/karma run config.js in another terminal tab. When I did this I got this error (I get it even when I use Chrome on my Linux host-machine instead IE on the Virtual box guest, so I suppose the error has nothing to do with networking):
You need to include some adapter that implements __karma__.start method!
I googled for this error and found another question: Error: You need to include some adapter that implements __karma__.start method
Supposing that I need to run tests from the same place I started karma-server I tried to redirect the output to another tab:
$node_modules/karma/bin/karma start &> /dev/pts/17 &
$node_modules/karma/bin/karma run config.js
But this did not help. If I try to start server and run tests in a single command, then I do not have time to register IE.
So could anyone please answer any of the next questions:
how to run unit tests with karma in a browser on other machine?
how to get rid of this error You need to include some adapter that implements __karma__.start method!, if the karma server was started in one terminal tab and the run command was issued in another?
how to start the karma server and run tests in separate steps, i.e. issue the karma start and karma run config.js commands instead of karma start config.js?
My regards and sincerest appreciation in advance for any help.
Currently I've found a workaround for this. I start karma with the config file:
karma start config.js
in the config I have singleRun: false.
Then I manually connect my IE instance, and after this I run the tests from another terminal tab. Why this happens I have no idea. The only inconvenience is that I always have browsers' windows open.
I have moved an existing node.js + express project to VS because I prefer the IDE over JetBrains for now (used VS for years, only peeked into Webstorm).
I used NTVS new project->from existing sources and all files were imported successfully.
Afterwards, I opened the project settings of my project and set the node.exe arguments to bin\www, startup file for express.
When I press F5 (debug) I get the console.log messages I have put into the www and app.js files in the opening command prompt, and it looks like the server is running (cannot confirm, I want to debug if everything is working), but the VS debugger directly exits again, it also does not open any page in the browser I selected for debugging.
My node app actually is a REST webservice, so I want to test different URLs with different parameters.
Also, I cannot access the app on the port I specified, though when I directly start it from node.exe I can, even though the command prompt is still open.
(I have NTVS and WebEssentials installed - some operations take a long long time, but I attribute this to NTVS being still an early version.)
Question: how does the Visual Studio debugger stay connected to the node.js application so I can use breakpoints and use any browser then to connect and test different URLs? (Even a breakpoint put on the console.log that gets printed during startup is not being triggered.)
For everyone who asks receives, and the one who searches finds....
(and yes, I did spend a long time searching and trying before posting here..)
Kind of nice to debug node.js server with VS..
hope this helps someone
Edit: The arguments to node.exe can be hard to read in the image. It must be
--debug=<portno>
that is with two dashes (and not just one) to specify the debug port.
Not so much knowledge on expressjs but with a recent release of NTVS 1.0 Alpha, I did find it supports remote debugging which can be also used to debug nodejs app running locally - anyway haven't tried if it works with nodejs app + expressjs but it should.
I followed the step in this video https://youtu.be/-ir9ZB8lUg4 which is
Run your nodejs with node.exe RemoteDebug.js <your_javascript_file>.
RemoteDebug.js has come when you install NTVS.
In Visual Studio, select Debug > Attach to Process
Select Node.js remote debugging for Transport
Enter localhost:5859 for Qualifier
Click Attach
This will put Visual Studio in debugging mode which you can set a breakpoint, do step-in/step-out, very same experience when you use VS to debug .NET app.
Its pretty straight forward with NTVS, you can download required version for your windows from github here
Once you install NTVS, NodeJS project templates will be added
Now, Goto File->New project -> Basic NodeJS Express 3 application (it will be available in javascript project templates)
Now just goto debug and select Start Debugging, add breakpoints where ever required and you can start debugging
I was wondering if it is possible to run a browser (specifically a browser engine) on the server side. I do not just mean to render a page but to keep a browser open for some time, run some JS, do some clicks or press some keys and meanwhile grab the graphical output.
Does anyone know how to accomplish this? So far my only idea was to run the browser in a VNC, RDP etc. session but this seems like an overkill to me.
PhantomJS does what you are describing. It is basically a headless browser - http://phantomjs.org/
you can run it server side via any server side language. See some integration modules below for NodeJS and PHP
NodeJS
https://npmjs.org/package/node-phantom
https://github.com/sgentle/phantomjs-node
PHP
https://github.com/diggin/php-PhantomjsRunner
Yes, it it very possible to run a web browser on a server. Ubuntu Server, for example can run firefox by simply installing firefox and xserver.
$ sudo apt-get install firefox
$ sudo apt-get install xserver-xorg
Then to get firefox running type:
$ X
This will leave you with a blank screen because there are no applications running on the display yet. You need to shift back to a new terminal with
Ctrl-Alt-F2. Ctrl-Alt-F1 holds the X process now.
Login to the new terminal and set the environment’s display variable to :0 and launch firefox.
$ export DISPLAY=:0
$ firefox &
Firefox should now be running, but you'll notice it's got some quirks to it. If you decide that you want to go forward with this you should install a window manager. I'd go with a lightweight tiling window manager and run firefox and whatever other applications need graphical output within that window manager.