Yes, you can use karma and protractor together. Karma is used for unit testing the component you created using angular command you can test those components using karma. Protractor is used for end to end test.
Earlier this year, the Angular team announced that they would cease development for open source end-to-end automated testing tool Protractor at the end of 2022. As a popular and long-established tool for automated web application testing, Protractor was an early pioneer in enabling behavior-driven end-to-end testing.
End-to-end testing (E2E) of Angular applications is performed using the Protractor testing framework, which is created by the Angular team themselves. Protractor can perform end to end tests on Angular applications that are running in a real browser by interacting with it, similar to that of an end-user.
End to end testing (E2E testing) refers to a software testing method that involves testing an application's workflow from beginning to end. This method basically aims to replicate real user scenarios so that the system can be validated for integration and data integrity.
The AngularJS team recommends using Protractor as it's going to replace angular scenario runner:
Angular Scenario Runner is in maintenance mode - If you're starting a new Angular project, consider using Protractor.
quoted from AngularJs documentation.
The tutorial angular-phonecat was developed a long time ago (in 2011 mainly) and has not yet been updated to use some Angular new features like Protractor.
EDIT
In the Protractor Docs - FAQ:
Why both Karma and Protractor? When do I use which?
Karma is a great tool for unit testing, and Protractor is intended for end to end or integration testing. This means that small tests for the logic of your individual controllers, directives, and services should be run using Karma. Big tests in which you have a running instance of your entire application should be run using Protractor. Protractor is intended to run tests from a user's point of view - if your test could be written down as instructions for a human interacting with your application, it should be an end to end test written with Protractor.
Here's a great blog post with more info.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With