Angular 5 Headless Browser unittesting - unit-testing

I am running unit test using karma, jasmine with Angular 5. As I am deploying on a server we are running them using HealdessChrome.
Everything is working fine on my local computer. However, It's getting stuck on the ubuntu server.
05 03 2018 07:43:02.132:INFO [HeadlessChrome 64.0.3282 (Ubuntu 0.0.0)]: Connected on socket 9NdPfrccf8iYNlPrAAAA with id 56814881
05 03 2018 07:45:21.364:WARN [HeadlessChrome 64.0.3282 (Ubuntu 0.0.0)]: Disconnected (1 times)
HeadlessChrome 64.0.3282 (Ubuntu 0.0.0) ERROR
Disconnectedundefined
For information, it's working using Firefox Headless.
Thank you for your help!

Related

Chrome is giving up and able to start

13:31:12 12 05 2022 09:01:11.977:ERROR [launcher]: Chrome failed 2 times (cannot start). Giving up.
13:31:20 ✔ Browser application bundle generation complete.
13:31:20 12 05 2022 09:01:19.494:WARN [karma]: No captured browser, open http://localhost:9876/
13:31:21 ✔ Browser application bundle generation complete.
13:31:21 12 05 2022 09:01:21.033:WARN [karma]: No captured browser, open http://localhost:9876/

Problem installing RStudio onto a GCP cluster

I'm trying to follow this tutorial but keep getting an error when I try to install RStudio on the main cluster. (see section Installing RStudio Server..., item 3).
When I run the line
$ sudo gdebi rstudio-server-1.2.1335-amd64.deb
The installation starts but then fails with
Jun 03 03:10:16 cluster-c141-m systemd[1]: Starting RStudio Server...
Jun 03 03:10:16 cluster-c141-m rserver[20313]: /usr/lib/rstudio-server/bin/rserver: error while loading shar…ectory
Jun 03 03:10:16 cluster-c141-m systemd[1]: rstudio-server.service: Control process exited, code=exited status=127
Jun 03 03:10:16 cluster-c141-m systemd[1]: Failed to start RStudio Server.
Jun 03 03:10:16 cluster-c141-m systemd[1]: rstudio-server.service: Unit entered failed state.
Jun 03 03:10:16 cluster-c141-m systemd[1]: rstudio-server.service: Failed with result 'exit-code'.
Thanks for any suggestions.
You are installing the rstudio-server for Debian 8. Install the Debian 9 version.
The tutorial could use an update.
There is an initialization action to take care of installation of rstudio (in case you want to create another cluster later): https://github.com/GoogleCloudPlatform/dataproc-initialization-actions/tree/master/rstudio

Angular: ng test runs but doesnt execute test cases

I get the below messages after executing command ng test. It runs with out any errors but doesn't execute test cases. Any idea why it's not executing the tests?
My project is upgraded from Angular 2 to 4, 5 & now 6. Is it because the karma library has not upgraded properly?
I have created new Angular 6 project and tried ng test it works there but doesn't work on my project. I have deleted the node_modules folder and installed it by npm install, but it is still not working. Any other sugessions?
10% building modules 1/1 modules 0 active(node:9836) DeprecationWarning: Tapable.plugin is deprecated. Use new API on .hooks instead
28 06 2018 11:23:24.302:WARN [karma]: No captured browser, open http://localhost:9876/
28 06 2018 11:23:24.399:INFO [karma]: Karma v1.7.1 server started at http://0.0.0.0:9876/
28 06 2018 11:23:24.402:INFO [launcher]: Launching browser Chrome with unlimited concurrency
28 06 2018 11:23:24.426:INFO [launcher]: Starting browser Chrome 95% emitting CopyPlugi
28 06 2018 11:24:31.561:WARN [launcher]: Chrome have not captured in 60000 ms, killing.
28 06 2018 11:24:42.702:WARN [karma]: No captured browser, open http://localhost:9876/
28 06 2018 11:24:43.272:INFO [launcher]: Trying to start Chrome again (1/2).
28 06 2018 11:24:48.951:INFO [Chrome 67.0.3396 (Windows 7 0.0.0)]: Connected on socket VC2A92U8dwahjxB5AAAA with id 78549298
Chrome 67.0.3396 (Windows 7 0.0.0): Executed 0 of 41 SUCCESS (0 secs / 0 secs)
28 06 2018 11:25:16.507:WARN [Chrome 67.0.3396 (Windows 7 0.0.0)]: Disconnected (1 times), because no message in 10000 ms.
Chrome 67.0.3396 (Windows 7 0.0.0) ERROR
Chrome 67.0.3396 (Windows 7 0.0.0) ERROR Disconnected, because no message in 10000 ms.
Chrome 67.0.3396 (Windows 7 0.0.0): Executed 0 of 41 DISCONNECTED (10.004 secs / 0 secs)
Chrome 67.0.3396 (Windows 7 0.0.0) ERROR
Chrome 67.0.3396 (Windows 7 0.0.0): Executed 0 of 41 DISCONNECTED (10.004 secs / 0 secs)
I got this working by removing ngx-translation import. But its not fix as with out importing translation I wont be able to proceed further.
Anyone implemented the ngx-translation in Unit test cases.
This happens when jasmine goes in to a loop. Actually because of my translate service, It was going in the loop and which was causing karma not to run any test cases and exit, giving error 0 of 43 test executed.
Just for the information:
To find the exact issue about this, run the test case with -sm=false.
C:\Angular>ng test -sm=false
I was stuck in this for a while. Above command gave me the exact issue needs to be resolved. Hope it will be helpful to others getting this issue.

Jasmine Karma Unit testing doesn't detect my test cases in Angular2 Unit testing

I faced to a wired problem while unit testing my angular2/ionic2 application.
I wrote some unit tests to the application and they were tested normally when I hit npm test. But today when I hit npm test it doesn't detect any unit test of my project. It gives the following output in the terminal.
dilanka#Dilanka-NoteBook:/media/dilanka/Stuff/CODE BASE/Inspection/UnitTesting/Inspection-Rewrite$ npm test
> ionic-hello-world# test /media/dilanka/Stuff/CODE BASE/Inspection/UnitTesting/Inspection-Rewrite
> ng test --code-coverage
05 12 2016 13:10:45.485:WARN [karma]: No captured browser, open http://localhost:9876/
05 12 2016 13:10:45.492:WARN [karma]: Port 9876 in use
05 12 2016 13:10:45.493:INFO [karma]: Karma v1.3.0 server started at http://localhost:9877/
05 12 2016 13:10:45.493:INFO [launcher]: Launching browser Chrome with unlimited concurrency
05 12 2016 13:10:45.497:INFO [launcher]: Starting browser Chrome
05 12 2016 13:10:47.739:INFO [Chrome 55.0.2883 (Linux 0.0.0)]: Connected on socket /#9FP78x92YrV-nPNoAAAA with id 77141340
START:
Finished in 0.003 secs / 0 secs
SUMMARY:
✔ 0 tests completed
But in other computers, the same branch runs npm install without any doubts. And it detects all test cases.
Then I reinstalled node and npm on my computer. but Still, I get the same situation.
Then I checked by running npm test on this project(https://github.com/lathonez/clicker) and it also gives the same result and doesn't detect any test cases. previously this project also run perfectly on my computer.
I can't understand what is going wrong. The problem is it my node or npm or karma configurations?
Please help me. Thanks...
It looks like a problem with chrome version 55. We had same problem this morning and we updated karma config file to use firefox instead of chrome.
For running tests in firefox, you need to add karma-firefox-launcher plugin and change browsers to firefox.
plugins: [
require('karma-jasmine'),
require('karma-firefox-launcher'),
require('karma-remap-istanbul'),
require('angular-cli/plugins/karma')
],
browsers: ['Firefox'],
Edit
Was able to get this working for chrome by adding below line karma.conf.js file.
mime: { 'text/x-typescript': ['ts','tsx'] }
Source: https://github.com/angular/angular-cli/issues/2125

How to debug launching of Karma runner vs PhantomJS browser?

I have problem with running unit tests with Karma runner + PhantomJS browser.
Karma server starts, then PhantomJS browsers starts and then nothing happens. After 1 minute I am getting message about nothing was capured in 60s, killing process.
[11:08:35][Step 3/5] Running "karma:allTests" (karma) task
[11:08:36][Step 3/5] 26 03 2016 11:08:36.520:WARN [watcher]: Pattern "/export/home/bc_prod1/buildAgent1/work/dac7c6b3e0abf1a1/test/fixtures/*.json" does not match any file.
[11:08:41][Step 3/5] 26 03 2016 11:08:41.077:INFO [karma]: Karma v0.13.21 server started at http://localhost:9876/
[11:08:41][Step 3/5] 26 03 2016 11:08:41.084:INFO [launcher]: Starting browser PhantomJS
[11:09:41][Step 3/5] 26 03 2016 11:09:41.085:WARN [launcher]: PhantomJS have not captured in 60000 ms, killing.
[11:09:43][Step 3/5] 26 03 2016 11:09:43.087:WARN [launcher]: PhantomJS was not killed in 2000 ms, sending SIGKILL.
[11:09:45][Step 3/5] 26 03 2016 11:09:45.087:WARN [launcher]: PhantomJS was not killed by SIGKILL in 2000 ms, continuing.
[11:09:45][Step 3/5] Warning: Task "karma:allTests" failed. Use --force to continue.
I don't know why it is not starting. How I can debug this problem? I have no idea.
OS is redhat6.
There are some incompatibility issues with different versions of karma-phantomjs-launcher and phantomjs-prebuilt.
Try downgrading your version of phantomjs-prebuilt.