From f14a07796a04815dabde6f357de3ac87e5344d4a Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Wed, 12 Aug 2015 16:11:07 +0200 Subject: SONAR-6764 add web tests --- server/sonar-web/test/intern.js | 3 +- server/sonar-web/test/medium/source-viewer.spec.js | 33 ++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 server/sonar-web/test/medium/source-viewer.spec.js (limited to 'server/sonar-web/test') diff --git a/server/sonar-web/test/intern.js b/server/sonar-web/test/intern.js index 16b5ff93c82..42049ab87db 100644 --- a/server/sonar-web/test/intern.js +++ b/server/sonar-web/test/intern.js @@ -27,7 +27,8 @@ define(['intern'], function (intern) { 'test/medium/computation.spec', 'test/medium/coding-rules.spec', 'test/medium/custom-measures.spec', - 'test/medium/quality-profiles.spec' + 'test/medium/quality-profiles.spec', + 'test/medium/source-viewer.spec' ], tunnel: tunnel, diff --git a/server/sonar-web/test/medium/source-viewer.spec.js b/server/sonar-web/test/medium/source-viewer.spec.js new file mode 100644 index 00000000000..27a5b96057f --- /dev/null +++ b/server/sonar-web/test/medium/source-viewer.spec.js @@ -0,0 +1,33 @@ +define(function (require) { + var bdd = require('intern!bdd'); + require('../helpers/test-page'); + + bdd.describe('Source Viewer', function () { + var file = { uuid: 'uuid', key: 'key' }; + + bdd.describe('Issues', function () { + bdd.it('should show precise issue location', function () { + return this.remote + .open() + .mockFromFile('/api/components/app', 'source-viewer-spec/app.json', { data: { uuid: 'uuid' } }) + .mockFromFile('/api/sources/lines', 'source-viewer-spec/lines.json', { data: { uuid: 'uuid' } }) + .mockFromFile('/api/issues/search', + 'source-viewer-spec/issues-with-precise-location.json', + { data: { componentUuids: 'uuid' } }) + .startApp('source-viewer', { file: file }) + + .checkElementExist('.source-line-code[data-line-number="3"] .source-line-code-issue') + .checkElementInclude('.source-line-code[data-line-number="3"] .source-line-code-issue', '14 So') + + .checkElementExist('.source-line-code[data-line-number="11"] .source-line-code-issue') + .checkElementInclude('.source-line-code[data-line-number="11"] .source-line-code-issue', 'arQub') + + .checkElementExist('.source-line-code[data-line-number="18"] .source-line-code-issue') + .checkElementInclude('.source-line-code[data-line-number="18"] .source-line-code-issue', + 'ranklin Street, Fifth Floor, Boston, MA 02110-1301, USA.') + .checkElementExist('.source-line-code[data-line-number="19"] .source-line-code-issue') + .checkElementInclude('.source-line-code[data-line-number="19"] .source-line-code-issue', ' */'); + }); + }); + }); +}); -- cgit v1.2.3