Output plugins used by protractor - angularjs

Protractor 2.0.0. introduces this neat idea of extending protractor with plugins offering several built-in plugins, like ngHint, console or timeline.
Currently, I'm trying to make the timeline plugin work and I'd like to see a more verbose output on the console in order to debug the problem.
Is it possible to see on the console what plugins are loaded by protractor?
FYI, created an issue: Protractor to report loaded plugins.

No, I did not find something in the code of the plugins.js. If I run Protractor tests with enabled plugins, on the console I only see the result output of a plugins hook method. This assumes that the plugin has been loaded correctly.
I think this is a missing feature. I look forward on your (or someones) contribution for Issue 1961.

I've sent a pull request (currently merged to the development protractor - master branch) closing the Protractor to report loaded plugins issue.
Now, if you run protractor with --troubleshoot flag, you'll get the list of loaded plugins:
DEBUG - Running with --troubleshoot
DEBUG - Protractor version: 2.1.0
DEBUG - Your base url for tests is http://127.0.0.1:9001
...
DEBUG - Plugin "/path/to/node_modules/protractor/plugins/console/index.js" loaded.
DEBUG - Plugin "/path/to/node_modules/protractor/plugins/timeline/index.js" loaded.

Related

Jasmine2 is not a valid framework error

I recently followed a tutorial on running protractor tests inside vs. To my surprise it works however i had to remove jasmine2 as the framework in the conf file or I would get this error
config.framework jasmine2 is not a valid framework.
This is also my first time running the chromedriver through vs and it cannot sendKeys as i was before.
Ex: this.passwordTextField.clear().sendKeys(browser.params.password);
I'm not sure how to get protractor to recognize jasmine2. I have installed jasmine manually also with the --save-dev tag. Protractor is at version 2.5.1
and jasmine is at 2.1.4
Any idea what is going on? Or if there is a better way of running protractor in vs?
I'm using this tutorial which didn't exactly work so I borrowed her sample code and edited that, that worked. Here is the site:
https://misaxionsoftware.wordpress.com/2014/01/30/angularjs-protractor-visual-studio-super-dry/
This error can only happen if protractor <= 1.5.0 is used. Check if tests are executed by the correct protractor executable. FYI, this is where it fails.
For instance, you may have an old globally installed protractor which is used instead of the one installed locally inside project's node_modules.
Or, what I've also seen in practice, the protractor executable located at .bin/protractor was updated by one of the packages that has protractor as a dependency (like grunt-protractor-runner, for instance).

Debug webstorm with AngularJS and Browserify

I'm building an AngularJs web application in WebStorm. I use browserify as a bundling package, and gulp as a task runner.
I tried setting breakpoint on the individual Javascript file in Webstorm and run Debug. But, I'm not unable to hit the breakpoint.
Also, I tried debug a angularjs application without browserify and gulp. I was able to debug in Webstorm.
Is it possible to run debug in a bundled javascript file? How would we make that work?
If not, what could be the reasons?
Found a solution to this problem. We will need to upgrade to Webstorm 10. Webstorm 9 doesn't support source map in debugging mode.

Debugging AngularJS Code in JHipster (Intellij)

I am running Application.java from within IntelliJ and Grunt Serve from the Command Window. Thus, I can debug Java code and Live Reload changes to Html. But I cannot set breakpoints or trace Javascript files.
I know I could debug in Chrome, but I rather debug in IntelliJ if at all possible.
I would appreciate any suggestions.
Thanks
You should be able to do this with the NodeJS plugin for IntelliJ. I have it installed on my machine and I'm able to right-click on my project's Gruntfile.js and select Run or Debug.

angular karma runner hangs indefinitely

Windows 8 64bit
Node.js 0.10.5 64bit
Karma 0.8.5
I am able to start karma server, Chrome browser opens (I have it defined as default browser in karma config). The issue comes when I am doing 'karma run'. Chrome changes the tab status to Chrome 26.0 (Windows) is executing. But that is all, no output on the console, no nothing. it can stay like that for hours.
Any ideas?
EDIT
I have the follwoing gists: karma.conf.js and main.js (used for loading the test scripts).
I am starting the server with LOG_DEBUG and I can see that all script files are loaded.
Gist url: https://gist.github.com/mihaihuluta/5490991
I personally found that if you have require.js...
frameworks: ['jasmine', 'requirejs'],
...when you don't need it, things will just lock up at "executing..." in all browsers.
Also make sure you've specifed your adapters, eg.
files: [
//adapter
JASMINE,
JASMINE_ADAPTER,
//...other files...
'test/client/*.js'
]
Finally, I use
logLevel: config.LOG_DEBUG
and
browsers: ['Chrome'] //only one
...to ensure I have the simplest test case and am getting all debug information for any failures.
What have described in the previous post (about not being able to run
karma) was just a hack. Today I decided to pay more attention to
details (as I should have done in the first place) and ques what...I
managed to have it up and running using a much more elegant and
official way. First I have uninstalled node.js 0.10.5 64bit and
installed node.js 0.10.5 x86. When I have installed karma first time I
used the following command npm install karma where the correct
command would be npm install -g karma in order to have it
installed globally. Once installed I added the appropriate environment
variables (CHROME_BIN and PHANOMJS_BIN) with the correct paths and
voila! All is running just fine.
That's from the blog that went down :).

How can I run Jasmine tests with Karma (was Testacular) from Bamboo?

While building a single page app with AngularJS, I'm trying to integrate Jasmine tests in my build.
I did something similar before with the Maven Jasmine plugin, but I don't like to wrap my project in maven just to run the Jasmine tests. It seems cleaner to use Karma (was Testacular) for this somehow.
I'm comfortable that I'll get things running from a shell command, and my guess is that I can then run the command from Bamboo.
My questions:
Am I on the right track?
How can I best fail the build from a script, or does Bamboo recognize the Karma output automatically?
Great question. Make sure testacular.conf.js is configured to output junit xml for consumption by bamboo
junitReporter = {
// will be resolved to basePath (in the same way as files/exclude patterns)
outputFile: 'test-results.xml'
};
You can configure Testacular to run against many browsers and is pre-configured to use Chrome, we've chosen to start going headless with PhantomJS to do unit testing. Testacular already has jasmine inside.
For CI we are following the recommendation in
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun = true;
If you use Ant a lot (and we do) sometimes you just want to stick with what you know... so you may want to checkout ANT, Windows and NodeJS Modules. to run node modules (ie testacular).
One note, if you are running testacular on windows, the npm install of testacular fails on hiredis module, which seems to be just *nix friendly. So, far it works fine without it.
It took us a couple of hours to prove all of this works. Hope this helps
--dan

Resources