-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Cucumber + Karma #1095
Comments
What’s your motivation for using it with Karma? What problem are you trying to solve? |
I would like to use Cucumber to test Angular components. I already wrote e2e tests for those components using cucumber+protactor, however i think it's not the right approach. I think i should have most of those as angular unit tests so basic component functionality is fast to test (these tests should run in seconds, not minutes), and then have some truly e2e tests, potentially going with SerenityJS to describe user-centric use cases. I love Gherkin expressiveness. I love datatables as a way to parameterize tests. I love step definition code reuse. I've been maintaining Jasmine tests for a while now and i believe having Gherkin expressiveness would be a big productivity boost! |
@lwouis have you considered using cucumber-electron instead? The setup is a lot simpler. You can find a small example here: /~https://github.com/cucumber-ltd/cucumber-angular-poc/tree/cucumber-electron |
@aslakhellesoy Thanks for the suggestion! I tried the demo which works. Then I tried to use it in my Angular project, but it broke:
on this line, on Before(() => {
TestBed.configureTestingModule({
declarations: [DropdownMultiselectFieldComponent],
imports: [FormsModule],
})
.compileComponents();
}); I think there is some glue code between Karma and Angular that makes the Angular TestBed work. For instance, this line in
In the end using cucumber-electron or cucumber doesn't seem to solve the problem of testing angular components because I would have to find out what kind of glue makes testing work under karma, then write something similar for cucumber, which is kind of my original question, asking about a karma adapter. |
I also tried replacing karma with In any cases, just wanted to report for other people trying to unit test their angular app using cucumber that the jest route seems also to be a deadend, unfortunately. |
I just released a karma adapter that uses the latest version of cucumber-js. https://www.npmjs.com/package/karma-cucumber-js-latest/. It is setup so you can use any assertion library (so far I have only tested it with chai/sinon). It doesn't support any of the cli options yet for cucmber-js. But it does support tag expressions. And currently only uses the summary report cucumber formater. |
Closing: No activity for more than a year. Happy to re-open if this is still relevant. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This is a follow-up to a closed issue. I'm looking for a way to use Cucumber together with Karma runner.
A few projects exist for that purpose, but they are all outdated. The most recent one only supports cucumber 1.3.0.
It was pretty easy to integrate Cucumber with protractor thanks to the actively maintained adapter, but there seems to be nothing similar for Karma.
The text was updated successfully, but these errors were encountered: