Note that there are some explanatory texts on larger screens.

plurals
  1. POTesting a non-trivial AngularJS app with Karma
    primarykey
    data
    text
    <p>I've been writing attempting to setup a testing suite for an application that I've been developing. The app is hosted locally, and on most accounts works fine. I've tried to setup karma via the instructions on AngularJS's site, and on Karma's site, and pretty much every other site I could find, but I keep getting the same error.</p> <p>Here's my conf: </p> <pre><code>urlRoot = '/karma/'; frameworks = ['ng-scenario']; files = [ ANGULAR_SCENARIO, ANGULAR_SCENARIO_ADAPTER, 'spec/e2e/*.spec.js' ]; browsers = [ 'Firefox', ]; proxies = { '/': 'http://localhost/web/', }; port = 9876; singleRun = false; junitReporter = { outputFile: 'logs/e2e.xml', }; logLevel = LOG_DEBUG; </code></pre> <p>And an example spec:</p> <pre><code>describe('login test', function() { it('should login', function(){ browser().navigateTo('/'); if(browser().window().path() != '/'){ expect(element('[ng-model="username"]').count()).toBeGreaterThan(0); input('username').enter('username'); input('password').enter('password'); element('#submit').click(); sleep(3); } expect(browser().window().path()).toEqual('/'); }); it('should logout', function(){ element('#quit').click(); element('quit_dialog').click(); sleep(1); }); }); </code></pre> <p>When I run the test in an html file via angular-scenario it works fine, all green. When I run it via karma I get the following errors:</p> <pre><code>Error: Permission denied to access property 'angular' </code></pre> <p>I suspect that it's a Cross-Domain issue, but why? And if so, how can I fix it?</p> <p>NOTE: My application redirects someone to the login page from the base url. I assumed karma could handle a redirection.</p> <p>EDIT: I cloned <a href="https://github.com/angular/angular-seed" rel="nofollow">angular-seed</a> and ran it untouched (apart from changing the proxy url), and that went fine.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload