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 :).
Related
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).
I started adding e2e tests into our project and it seems a few things changed since the last time I used Protractor. For example elementExplorer still useful, but Elementor is way more cooler.
In its the readme is says to launch it by running e.g.: webmanager start and then elementor http://localhost:3000.
But this way it ignores protractor.conf. And since I have a binary path for Chrome browser in that file, along with a logic for clearing cookies and logging into the app in onPrepare function, protractor has to know where the file is. But I can't find a way.
Starting protractor as usual via protractor protractor.conf.coffee and then elementor localhost:3000 not working either. It says "Unable to start a WebDriver session"
Yes, you should launch it by running webdriver-manager start, I use this to run the scripts: protractor script_file_conf.js since I save my scripts as javascript code in my repository. Remember that the conf file should have a reference to the script file.
I'm trying to get e2e testing going with on my angular project using Gulp.
I'm able to get it working, but only if I manually launch a standalone selenium server using webdriver-manager start in a seperate terminal window.
Ideally I would like my gulp task to manage starting and stopping the server so as to not add more overhead for my team to run these tests.
I got set up following the instructions here:
https://github.com/mllrsohn/gulp-protractor
They describe 2 options for starting the selenium server. One is to set up a gulp task which appears to do the same thing as webdriver-manager start:
gulp.task('webdriver_standalone', require("gulp-protractor").webdriver_standalone);
This works, but not when I have my e2eTest task invoke it as a dependency. I have to run gulp webdriver_standalone in a seperate terminal window.
I cannot understand the other suggested option.
point to the selenium jar in the protractor config file
These instructions require a path to the selenium-server-standalone jar, in protractors node_modules (./node_modules/protractor/selenium/selenium-server-standalone-2.45.0.jar), but my node_modules/protractor/ directory does not have such a jar (or a selenium sub-directory at all)
The instructions for Running Protractor without a plugin seem to have the same problem of having to run the selenium server in another terminal window.
Is there a way to get this set up so that a single gulp task starts the standalone server, runs the tests, and shuts it down with no other intervention?
When you run Protractor you have several options regarding Selenium WebDriver (remember that WebDriver is web-service written in Java):
Run with Protractor with remote (standalone) service. It can be either local or on different machine. If Selenium is on different machine then your web app should be publicly available, not just localhost. If you choose to use standalone Selenium service then you configure your config file/Gulp task with seleniumAddress option.
"Ask" Protractor to run Selenium for you. In this case Protractor will run Selenium WebDriver with the Jar file you provide in seleniumServerJar configuration.
Do not use Selenium WD. Use direct connect instead, which is compatible with Chrome and (probably) Firefox only.
In your case simply run:
./node_modules/protractor/bin/webdriver-manager update
It will download Selenium. Then point config to the right jar.
The easiest way to get this working locally is using a local Selenium Standalone jar, as Igor suggested in option #2. (It is pretty difficult to get gulp to run webdriver-manager start as a spawned child_process or async task.)
You can get that jar in your node_modules folder easily by using:
npm install selenium-server-standalone-jar --save-dev
Then, in your protractor.conf.js comment out or remove the seleniumAddress line and add a line for seleniumServerJar.
exports.config = {
seleniumServerJar: '../node_modules/selenium-server-standalone-jar/jar/selenium-server-standalone-2.47.1.jar',
//seleniumAddress: 'http://localhost:4444/wd/hub',
/* Lines below for completeness only, leave yours as is. */
framework: 'jasmine2',
specs: ['login-spec.js'],
multiCapabilities: [{
browserName: 'chrome',
browserName: 'firefox'
}]
};
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.
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