From: Stas Vilchik Date: Fri, 17 Apr 2015 13:18:26 +0000 (+0200) Subject: SONAR-5851 add profiles test X-Git-Tag: 5.2-RC1~2223 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=76c0f10693e69f1f943f368252019c7bb0777649;p=sonarqube.git SONAR-5851 add profiles test --- diff --git a/server/sonar-web/src/test/js/quality-profiles.js b/server/sonar-web/src/test/js/quality-profiles.js index 796a395997a..19aec79ae04 100644 --- a/server/sonar-web/src/test/js/quality-profiles.js +++ b/server/sonar-web/src/test/js/quality-profiles.js @@ -343,6 +343,59 @@ casper.test.begin(testName('Should Show Selected Projects'), 2, function (test) }); +casper.test.begin(testName('Should Move Between Profiles'), 1, function (test) { + casper + .start(lib.buildUrl('profiles'), function () { + lib.setDefaultViewport(); + + lib.mockRequestFromFile('/api/users/current', 'user.json'); + lib.mockRequestFromFile('/api/qualityprofiles/search', 'search-inheritance.json'); + lib.mockRequestFromFile('/api/languages/list', 'languages.json'); + this.rulesMock = lib.mockRequestFromFile('/api/rules/search', 'rules.json', + { data: { qprofile: 'java-inherited-profile-85155', activation: 'true' }}); + this.inheritanceMock = lib.mockRequestFromFile('/api/qualityprofiles/inheritance', 'inheritance-plus.json'); + }) + + .then(function () { + casper.evaluate(function () { + require(['/js/quality-profiles/app.js']); + }); + }) + + .then(function () { + casper.waitForSelector('.js-list .list-group-item'); + }) + + .then(function () { + casper.click('.js-list .list-group-item[data-key="java-inherited-profile-85155"]'); + casper.waitForSelector('#quality-profile-ancestors'); + }) + + .then(function () { + lib.clearRequestMock(this.rulesMock); + lib.clearRequestMock(this.inheritanceMock); + lib.mockRequestFromFile('/api/rules/search', 'rules.json', + { data: { qprofile: 'java-sonar-way-67887', activation: 'true' }}); + lib.mockRequestFromFile('/api/qualityprofiles/inheritance', 'inheritance.json'); + + casper.click('#quality-profile-ancestors .js-profile[data-key="java-sonar-way-67887"]'); + casper.waitForSelectorTextChange('.search-navigator-header-component'); + }) + + .then(function () { + test.assertSelectorContains('.search-navigator-header-component', 'Sonar way'); + }) + + .then(function () { + lib.sendCoverage(); + }) + + .run(function () { + test.done(); + }); +}); + + casper.test.begin(testName('Copy Profile'), 5, function (test) { casper .start(lib.buildUrl('profiles'), function () {