I know that it's recommended to use karma/jasmine for component/unit testing but I want to do the same using protractor because of two reasons:
- it's not possible to emulate 'Tab' behaviour in javascript to move to the next focusable element (Is there a way to programmatically trigger the TAB key to move the focus to the next focusable element?). I need to be able to test 'Tab', 'Esc', key combinations and with protractor it's as simple as calling
sendKey
. - karma/jasmine don't render css. You need to use
setStyleFixtures
which is a pain. The absence of css causes issues: for instance, jasmine/karma renders elements with 'display: none' and messes up the market (I'm not sure about this part but this is what happens when I create dx-data-grid).
I know that protractor is meant to be used to do e2e testing but because of those two key benefits, I wonder if there is an easy way to use a protractor to do unit testing/integration testing.
An ideal solution for me would be to write a regular jasmine test with TestBed(to mock dependencies using angular's DI) and test it using protractor API without creating angular routes and special pages.
Heads-up, I've used jasmine for a couple of months, I'm not very familiar with protractor.