Hello. I’ve started to write tests for IONIC project. I use protractor. I can not catch the transitions the proper way. Condition Expectorations are implicit(isPreset, IsVisible). Class anchors do not help. Share with your experience.
first keep in mind that unit tests are more important than e2e-test.
i would run protractor tests only for basic functionalities and maybe check if all navigation-conzepts are working (linking in a sidemenu and so on).
your code looks a little complex.
If you want to wait for an animation to finish… i would set a timeout or browser sleep maybe for 3 seconds… and then simple run my test if i can click the button.
I agree that it should be simple. browser.sleep() does not help. I know that it is unsynchronized. So I used promises also.
I also checked by console. I could not invoke the command - click twice.
element(by.css('.ion-navicon')).click();
waited for 5 seconds
element(by.css('.ion-navicon')).click();
I received:
UnknownError: unknown error: Element is not clickable at point (297, 21). Other element would receive the click: <ion-nav-view name="main" class="view-container" nav-view-transition="ios" nav-view-direction="none" nav-swipe="">...</ion-nav-view>
I see the button, it is visible but not click-able. I also tried.
Maybe.
I tried to get different object with same locator, and the common object for two calls. But same errors are displayed. I used by.css. I hope it looks in the DOM. I heard that IONIC had own cache system of views.
I guess that the driver does not call the click event. It moves an arrow and click. It sends coordinates of the button. But the button has been moved to another place.
I tried also: