-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: browser is not defined #10
Comments
I solved adding
|
Hello bitliner.I used angular seed project adding extra simple login page. I added frameworks login.html {{message}}
Controller code $scope.login = function () { e2e describe('login', function () {
unit test controllersSpec.js it('should login', function () {
my karma.config.js module.exports = function(config) {
}); |
Guys, do not use "jasmine" and "ng-scenario" together. That won't work. These are two different frameworks with very similar syntax. If you wanna write unit tests (low level, JS tests, asserting that some objects or functions work as expected), use Karma with Jasmine. If you wanna write end-to-end test for an AngularJS app (such as, open my app, click on "OK" button, etc), use Protractor. You can also use Karma with "ng-scenario" runner, but it's deprecated. |
Hi vojtajina, I am beginner for karma unit testing. Please help me. You download angular seed project https://github.com/angular/angular-seed. Added Extra login page and controller.The page was username and password textfield. How to write karma unit test. Please send modified angular seed your project. Urgent please. |
@vojtajina |
@WayneYe I think your have to use two different karma.conf.js files. One for unit tests and one for 2e2. |
@sylvain-hamel Thanks for the reply! Buy even if I use two conf file, I still need Jasmine (or mocha, qunit, etc) to do assertions, I googled for hours but didn't find a example with the following things running together: |
@WayneYe I don't know then. I'm still new to the project. |
Did you read my comment above? (#10 (comment)) If you wanna test your app from a user point of view, do things like "open google.com", "type foo", "click a button", etc... that's what we call end2end test. Check out Protractor https://github.com/angular/protractor Karma is for unit testing, where you test individual objects, whether they do what they are suppose to do. These tests run in a browser too. There is DOM and all the stuff. These tests are faster, but are not suitable for the entire app tests (stuff like navigating to a page), because Karma just loads a bunch of JavaScript files and runs that code. |
@vojtajina Thanks for the reply, I missed your last sentence:) I realised it now and already working with protractor. Appreciate your splendid work on Karma, make it better!! |
The test case throws the following error:
My karma config file is:
My test case is:
Even if i move browser().navigateTo('/index.html') outside of beforeEach, nothing changes
The text was updated successfully, but these errors were encountered: