0

I am using Jasmine with Karma for unit testing Angular2 application. In the Karma config file I am using PhantomJS as the browser to run the tests.

browsers: ['PhantomJS']

I am using ng2-translate module for running translations on my texts with below piece of code:

userLang = navigator.language.split('-')[0];

Is it possible to configure PhantomJS to test different browser languages in the test suite?

If yes, then what is the procedure?

Mustafa
  • 202
  • 3
  • 14

1 Answers1

-1

This question has already been asked in this topic:

How to set the browser language of PhantomJS

You can check how to do this in this link:

https://groups.google.com/forum/#!topic/dalekjs/HHt6eoZRQc4

But, basically the only thing that you need to do is to set the customHeaders:

 // Set a custom Accept-Language
 var page = require('webpage').create();
 page.customHeaders = {'Accept-Language': 'it-IT'};
Thomas Gassmann
  • 737
  • 1
  • 13
  • 27