Advertisement
Varun_Krishna

Karma-Selector [ng\:model="userName"] did not match any elem

Nov 29th, 2013
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // contents of index.html
  2. !DOCTYPE html>
  3. <html ng-app="E2ETesting">
  4. <head>
  5.     <title>Angularjs Karma Testing</title>
  6.     <script type="text/javascript" src="js/angular.js-1.1.1/angular.min.js"></script>
  7.     <!-- <script type="text/javascript" src="test/e2eindexspec.js"></script> -->
  8.     <script type="text/javascript" src="http://code.angularjs.org/1.0.6/angular-scenario.js" ng-autotest></script>
  9.    
  10. </head>
  11. <body>
  12. <label>User Name:</label>
  13. <input type="text" ng-model="userName" placeholder="Enter Your User Name" />
  14. </body>
  15. </html>
  16.  
  17.  
  18. // contents of Karma.conf.js
  19. module.exports = function(config) {
  20. config.set({
  21. frameworks: ['ng-scenario'],
  22.  
  23. files: [
  24. 'e2eSpec.js'
  25. ],
  26.  
  27. urlRoot: '/__karma/',
  28.  
  29. autoWatch: true,
  30.  
  31. proxies: {
  32. '/': 'http://localhost:8000/'
  33. },
  34.  
  35. browsers: [process.env.TRAVIS ? 'Firefox' : 'Chrome'],
  36.  
  37. reporters: ['dots'],
  38.  
  39. plugins: [
  40. 'karma-ng-scenario',
  41. 'karma-chrome-launcher',
  42. 'karma-firefox-launcher'
  43. ]
  44. });
  45. };
  46. //e2espec.js
  47. describe ("E2ETesting" , function() {
  48.  
  49.     it("should check username ", function() {
  50.  
  51.     browser().navigateTo('index.html');
  52.  
  53.     input('userName').enter('ss');
  54.     expect(element('.ng-binding').text()).toEqual('ss');
  55.     //expect(element('.ng-binding').text()).toEqual('Sanp');
  56. });
  57.  
  58.  
  59.  
  60. });
  61. // The error message
  62.  
  63. describe: E2ETesting
  64. 205ms should check username
  65. 123ms   browser navigate to 'index.html'
  66. 17ms    input 'userName' enter 'ss'
  67. http://localhost:9876/base/e2eSpec.js:7:2
  68.  
  69. Selector [ng\:model="userName"] did not match any elements.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement