angular.js icon indicating copy to clipboard operation
angular.js copied to clipboard

Angular 1.0.7 can't navigate to '/' for e2e test with Karma 0.8.5

Open danielabar opened this issue 13 years ago • 3 comments

Using Angular 1.0.7, Karma 0.8.5, Node 0.10.7, Express 3.3.3 (Windows 7 64 bit, karma installed as global module)

the following e2e test fails

it('Non logged in user sees login or register page', function() {
    browser().navigateTo('/');
    expect(browser().location().url()).toBe('/');
  });

with stacktrace

TypeError: Object [object Object] has no method 'injector'
    at Object.<anonymous> (http://localhost:9876/adapter/lib/angular-scenario.js?1368839758000:27278:30)
    at null.<anonymous> (http://localhost:9876/adapter/lib/angular-scenario.js?1368839758000:27163:18)
    at angular.scenario.Application.executeAction (http://localhost:9876/adapter/lib/angular-scenario.js?1368839758000:26319:19)
    at Object.<anonymous> (http://localhost:9876/adapter/lib/angular-scenario.js?1368839758000:27136:22)

However a test going to /login does pass:

it('Non logged in user can navigate to login page', function() {
    browser().navigateTo('/login');    
    pause();
    expect(browser().location().url()).toBe('/login');
  });

At the breakpoint, I can see the login page loaded in the Chrome test browser.

So it seems there's a bug in handling "/"

One thing I tried was getting the newest angular-scenario.js from 1.0.7 site and replacing it in the karma adapters lib: %GLOBAL_NODE_DIR%\node_modules\karma\adapter\lib

But I got the same stacktrace, only the line numbers were slightly different.

Project here: https://github.com/arpetti/LEDITA Karma e2e conf: https://github.com/arpetti/LEDITA/blob/master/test/client/config/karma-e2e.conf.js Test Scenario: https://github.com/arpetti/LEDITA/blob/master/test/client/e2e/login-scenarios.js

danielabar avatar Jul 06 '13 02:07 danielabar

I encountered the same bugs as well.

yangchenyun avatar Aug 08 '13 08:08 yangchenyun

I have a similar issue. It seems to be a race condition, as it works well when there's a pause() in the middle, and it doesn't when there's no pause().

artursoler avatar Feb 26 '14 15:02 artursoler

The ngScenario module is deprecated and we are not accepting further code changes for it. Please look at using Protractor for your e2e testing.

petebacondarwin avatar Jun 06 '16 10:06 petebacondarwin