diff --git a/core/js/tests/specHelper.js b/core/js/tests/specHelper.js index 23eec8711f67..05904f63f565 100644 --- a/core/js/tests/specHelper.js +++ b/core/js/tests/specHelper.js @@ -127,7 +127,7 @@ window.isPhantom = /phantom/i.test(navigator.userAgent); /** * Returns the image URL set on the given element * @param $el element - * @return {String} image URL + * @return {String} absolute image URL */ getImageUrl: function($el) { // might be slightly different cross-browser @@ -136,7 +136,13 @@ window.isPhantom = /phantom/i.test(navigator.userAgent); if (!r) { return url; } - return r[1]; + url = r[1]; + + // some browsers return this as relative URL, others as absolute + if (!url.startsWith(OC.getProtocol() + '://')) { + return this.buildAbsoluteUrl(url); + } + return url; }, buildAbsoluteUrl: function(relativeUrl) { return window.location.protocol + '//' + window.location.host + relativeUrl; diff --git a/core/js/tests/specs/shareSpec.js b/core/js/tests/specs/shareSpec.js index af437274e9f1..82c7ed75058b 100644 --- a/core/js/tests/specs/shareSpec.js +++ b/core/js/tests/specs/shareSpec.js @@ -100,7 +100,7 @@ describe('OC.Share tests', function() { describe('displaying the folder icon', function() { function checkIcon(expectedImage) { var imageUrl = OC.TestUtil.getImageUrl($file.find('.filename .thumbnail')); - expectedIcon = OC.TestUtil.buildAbsoluteUrl(OC.imagePath('core', expectedImage)); + var expectedIcon = OC.TestUtil.buildAbsoluteUrl(OC.imagePath('core', expectedImage)); expect(imageUrl).toEqual(expectedIcon); }