From 62310cb02fb8a255701b868f95d85e384424e860 Mon Sep 17 00:00:00 2001 From: scardinius Date: Tue, 2 Jun 2015 15:16:52 +0200 Subject: [PATCH] Create externalDomainSpec.js --- tests/karma/unit/externalDomainSpec.js | 29 ++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tests/karma/unit/externalDomainSpec.js diff --git a/tests/karma/unit/externalDomainSpec.js b/tests/karma/unit/externalDomainSpec.js new file mode 100644 index 0000000000..e8f23283ff --- /dev/null +++ b/tests/karma/unit/externalDomainSpec.js @@ -0,0 +1,29 @@ +'use strict'; + +describe('Web page', function(){ + + var request = new XMLHttpRequest(); + var url = 'http://localhost:8000'; // Change to your port! + + beforeAll(function(){ + /** + * Warning! Default installation of jasmine (karma+phantomjs) + * doesn't support JS request to other domains than own. + * The solutions is at page https://github.com/karma-runner/karma-phantomjs-launcher + * + add additional configuration to karma.conf.js + * with parameter for PhantomJS webSecurityEnabled: false + * + change run parameter in npm/test.sh + */ + request.open("GET", url, false); + request.send(); + }); + + it('has response code 200', function(){ + expect(request.status).toBe(200); + }); + + it('contain tag body', function(){ + expect(request.responseText).toContain('