I had this exact same issue. For me it turned out that I had switched
booting my app from
<html ng-app="myApp">
to:
angular.bootstrap(angular.element('html'),'myApp');
Apparently Karma doesn't support this and I was getting the cross domain
issue you have noted. Karma uses the attribute as a way of defining the
root element for the tests so because the attribute doesn't exist anymore
Karma half way runs and fails. The solution is hacky:
*First apply the attribute to the html this will be applied after angular
has loaded so it won't cause the app to boot. Then you do the manual
bootstrap of the app. You get no double boot and Karma is then happy.*
$('html').attr("ng-app", "myApp");
angular.bootstrap(angular.element('html'),'myApp');
On Wednesday, February 19, 2014 at 5:00:49 PM UTC-8, Adam St. John wrote:
>
> Hi all,
>
> I'm hoping someone can help me out as I'm exhausted. I am trying to set up
> a karma runner for e2e tests using a Rails backend. My karma config is
> something like the following:
>
> basePath : '../../',
> files : [
> 'test/karma/scenarios/*.js'
> ],
> autoWatch : false,
> browsers : ['Chrome'],
> frameworks: ['ng-scenario'],
> singleRun : true,
> proxies : {
> '/': 'http://localhost:3000/'
> },
> plugins : [
> 'karma-junit-reporter',
> 'karma-chrome-launcher',
> 'karma-firefox-launcher',
> 'karma-jasmine',
> 'karma-ng-scenario'
> ],
> junitReporter : {
> outputFile: 'test_out/e2e.xml',
> suite: 'e2e'
> }
>
>
> Karma launches fine and everything works for a test navigating to the root
> of the project. The problem occurs when we navigate to any other path such
> as "browser().navigateTo('partner/');"
>
> At this point, the page loads for a split second and then karma and the
> browser choke with the following error:
>
> Uncaught SecurityError: Blocked a frame with origin "http://localhost:9876"
> from accessing a cross-origin frame.
>
>
> Any help or insight is greatly appreciated!
>
> Thanks,
> Adam
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.