Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // contents of index.html
- !DOCTYPE html>
- <html ng-app="E2ETesting">
- <head>
- <title>Angularjs Karma Testing</title>
- <script type="text/javascript" src="js/angular.js-1.1.1/angular.min.js"></script>
- <!-- <script type="text/javascript" src="test/e2eindexspec.js"></script> -->
- <script type="text/javascript" src="http://code.angularjs.org/1.0.6/angular-scenario.js" ng-autotest></script>
- </head>
- <body>
- <label>User Name:</label>
- <input type="text" ng-model="userName" placeholder="Enter Your User Name" />
- </body>
- </html>
- // contents of Karma.conf.js
- module.exports = function(config) {
- config.set({
- frameworks: ['ng-scenario'],
- files: [
- 'e2eSpec.js'
- ],
- urlRoot: '/__karma/',
- autoWatch: true,
- proxies: {
- '/': 'http://localhost:8000/'
- },
- browsers: [process.env.TRAVIS ? 'Firefox' : 'Chrome'],
- reporters: ['dots'],
- plugins: [
- 'karma-ng-scenario',
- 'karma-chrome-launcher',
- 'karma-firefox-launcher'
- ]
- });
- };
- //e2espec.js
- describe ("E2ETesting" , function() {
- it("should check username ", function() {
- browser().navigateTo('index.html');
- input('userName').enter('ss');
- expect(element('.ng-binding').text()).toEqual('ss');
- //expect(element('.ng-binding').text()).toEqual('Sanp');
- });
- });
- // The error message
- describe: E2ETesting
- 205ms should check username
- 123ms browser navigate to 'index.html'
- 17ms input 'userName' enter 'ss'
- http://localhost:9876/base/e2eSpec.js:7:2
- Selector [ng\:model="userName"] did not match any elements.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement