Karma v 0.10.2 using jquery and json file.

529 views
Skip to first unread message

Amol Panchal

unread,
Aug 27, 2013, 6:53:26 AM8/27/13
to karma...@googlegroups.com
I am using jquery and to parse json file but chrome console showing following and my e2e test are not executing.
When I fire the command "grunt test".

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:8080/__e2e/test/e2e/arithmatic.json
Object
 scenarios.js:50
GET http://localhost:8080/base/calculator/lib/jQuery/jquery-1.10.1.min.map 404 (Not Found) :8080/base/calculator/lib/jQuery/jquery-1.10.1.min.map:1

kama-e2e.conf.js

 module.exports = function(config) {
   config.set({

// Karma E2E configuration

// base path, that will be used to resolve files and exclude
basePath : '../',

// list of files / patterns to load in the browser
files : [

  'calculator/app/bower_components/jQuery/jquery-1.10.1.min.js',
  'calculator/test/e2e/scenarios.js'

],


frameworks :["ng-scenario"],
// list of files to exclude
exclude :[],

// test results reporter to use
// possible values: dots || progress || growl
reporters: ['progress'],

// web server port
port: 8080,

// cli runner port
runnerPort: 9100,

// enable / disable colors in the output (reporters and logs)
colors :true,

// level of logging
// possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
//logLevel : karma.LOG_INFO,

// enable / disable watching file and executing tests whenever any file changes
autoWatch : false,

// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
browsers :['Chrome'],

// If browser does not capture in given timeout [ms], kill it
captureTimeout : 5000,

// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun : false,

// Uncomment the following lines if you are using grunt's server to run the tests
 proxies : {
 },
// URL root prevent conflicts with the site root
 //urlRoot : '_karma_'
 //urlRoot : '/_karma_/'
 urlRoot : '/__e2e/'
  });
 };

Thomas Kunnumpurath

unread,
Aug 27, 2013, 9:42:45 AM8/27/13
to karma...@googlegroups.com
Your paths are likely wrong, can you post your directory structure.

Amol Panchal

unread,
Aug 28, 2013, 3:30:15 AM8/28/13
to karma...@googlegroups.com
Inline image 1


--
You received this message because you are subscribed to a topic in the Google Groups "karma-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/karma-users/XWUno-7KGyM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to karma-users...@googlegroups.com.
To post to this group, send email to karma...@googlegroups.com.
Visit this group at http://groups.google.com/group/karma-users.
For more options, visit https://groups.google.com/groups/opt_out.

folder_structure.png

Amol Panchal

unread,
Aug 29, 2013, 5:55:03 AM8/29/13
to karma...@googlegroups.com
Above is my folder structure for that used following commands:
1.yo angular
2.bower install angular-ui

and created e2e folder inside test folder for e2e testing

thanks
folder_structure.png

Vojta Jína

unread,
Aug 30, 2013, 1:57:27 AM8/30/13
to karma...@googlegroups.com


You received this message because you are subscribed to the Google Groups "karma-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to karma-users...@googlegroups.com.
folder_structure.png

Amol Panchal

unread,
Aug 30, 2013, 5:08:55 AM8/30/13
to karma...@googlegroups.com
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:8080/
FAILED my app cal testing debug.html:28
  1. element 'inputLine' set val to '22+22' debug.html:31
    1. window.__karma__.resultdebug.html:31
  1. http://localhost:8080/base/calculator/test/e2e/scenarios.js:15:2: Selector inputLine did not match any elements. debug.html:31
    1. window.__karma__.resultdebug.html:31

I am getting above in chrome console my karma.e2e.conf.js is as follows:

// Karma configuration // http://karma-runner.github.io/0.10/config/configuration-file.html module.exports = function(config) { config.set({ // base path, that will be used to resolve files and exclude basePath: '../', // testing framework to use (jasmine/mocha/qunit/...) frameworks: ['ng-scenario'], // list of files / patterns to load in the browser files: [ 'calculator/lib/jQuery/jquery-1.10.1.min.js', 'calculator/test/e2e/scenarios.js' ], // list of files / patterns to exclude exclude: [], // web server port port: 8080, // level of logging // possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG logLevel: config.LOG_INFO, // enable / disable watching file and executing tests whenever any file changes autoWatch: false, // Start these browsers, currently available: // - Chrome // - ChromeCanary // - Firefox // - Opera // - Safari (only Mac) // - PhantomJS // - IE (only Windows) browsers: ['Chrome'], // Continuous Integration mode // if true, it capture browsers, run tests and exit singleRun: false, // Uncomment the following lines if you are using grunt's server to run the tests proxies: { '/': 'http://localhost:9000/' }, // URL root prevent conflicts with the site root //urlRoot: '_karma_' urlRoot : '/__e2e/' }); };
I have placed the arithmatic.json and lib folder of jquery inside calculator folder.

Thanks

folder_structure.png

Vojta Jína

unread,
Sep 2, 2013, 4:04:38 PM9/2/13
to karma...@googlegroups.com
The 404 you getting is from sourcemaps file (which you are not serving and the minified jquery probably contains the source maps comment).

The rest is just failing e2e test, because it's not finding some element you are looking for. Pause the angular scenario runner by pause() and check out the browser - is it loading your app ?
folder_structure.png

amolp1709

unread,
Sep 4, 2013, 8:34:41 AM9/4/13
to karma...@googlegroups.com
Its working after removing the comment from minified jquery and replacing the test task with following :
grunt.registerTask('test', [
    'clean:server',
    'coffee',
    //'compass',
    //'livereload-start',
    'connect:livereload',
    'karma'
  ]);
Reply all
Reply to author
Forward
0 new messages