How to check e2e google chrome extension with karma?

I found fantastic unit / e2e karma testing tools. And I wrote a simple chrome extension with angular . I want to write automated tests for her, but not only unit tests, end-to-end tests too. I wrote something like this (will open my angular extension-options page):

it('Go to options page', function() { browser().navigateTo('chrome-extension://aopgehikihpnclbfeohobanjecpiefho/html/application.html#/options'); }); 

I removed '--user-data-dir' and '--disable-default-apps' for karma-chrome-launcher (because I want my extension to remain in chrome during “karma tests”)

but I got the following error message "Sandbox error: application document not available." :

  browser navigate to 'chrome-extension://aopgehikihpnclbfeohobanjecpiefho/html/application.html#/options' http://localhost:9876/base/tests/e2e/scenario.js?1372429335000:9:5: Sandbox Error: Application document not accessible. Chrome 27.0 (Windows): Executed 2 of 2 (2 FAILED) (0.254 secs / 0.139 secs) 

Chrome option - no-sandbox is outdated a long time ago.

I am sure that I am not mistaken, the parameters page opens normally, but from the omnibox chrome.

 chrome-extension://aopgehikihpnclbfeohobanjecpiefho/html/application.html#/options 

An error in the sandbox means without end-to-end tests for google chrome extensions via karma? Can I set chrome to a special "unsafe" mode for tests only?

Thanks,

+7
source share
2 answers

I do not think that a karma script scenario can do this. You can try Protractor , it uses WebDriver, and the karma script will be replaced by it.

+2
source

What if you tried to install a proxy? how

 proxies = { '/': 'chrome-extension://aopgehikihpnclbfeohobanjecpiefho/' }; 

in your karma-e2e.conf.js file and then

 browser().navigateTo('/html/application.html#/options'); 

in the test?

0
source

All Articles