diff options
Diffstat (limited to 'server/sonar-web/test/medium')
-rw-r--r-- | server/sonar-web/test/medium/api-documentation.spec.js | 81 | ||||
-rw-r--r-- | server/sonar-web/test/medium/base.html | 43 | ||||
-rw-r--r-- | server/sonar-web/test/medium/coding-rules.spec.js | 999 | ||||
-rw-r--r-- | server/sonar-web/test/medium/custom-measures.spec.js | 141 | ||||
-rw-r--r-- | server/sonar-web/test/medium/global-permissions.spec.js | 22 | ||||
-rw-r--r-- | server/sonar-web/test/medium/groups.spec.js | 140 | ||||
-rw-r--r-- | server/sonar-web/test/medium/issues.spec.js | 263 | ||||
-rw-r--r-- | server/sonar-web/test/medium/maintenance.spec.js | 28 | ||||
-rw-r--r-- | server/sonar-web/test/medium/metrics.spec.js | 125 | ||||
-rw-r--r-- | server/sonar-web/test/medium/project-permissions.spec.js | 67 | ||||
-rw-r--r-- | server/sonar-web/test/medium/quality-gates.spec.js | 277 | ||||
-rw-r--r-- | server/sonar-web/test/medium/quality-profiles.spec.js | 556 | ||||
-rw-r--r-- | server/sonar-web/test/medium/source-viewer.spec.js | 87 | ||||
-rw-r--r-- | server/sonar-web/test/medium/update-center.spec.js | 301 | ||||
-rw-r--r-- | server/sonar-web/test/medium/users.spec.js | 149 |
15 files changed, 0 insertions, 3279 deletions
diff --git a/server/sonar-web/test/medium/api-documentation.spec.js b/server/sonar-web/test/medium/api-documentation.spec.js deleted file mode 100644 index b0ed5b8331c..00000000000 --- a/server/sonar-web/test/medium/api-documentation.spec.js +++ /dev/null @@ -1,81 +0,0 @@ -define(function (require) { - var bdd = require('intern!bdd'); - require('../helpers/test-page'); - - bdd.describe('API Documentation Page', function () { - bdd.it('should show list', function () { - return this.remote - .open() - .mockFromFile('/api/webservices/list', 'api-documentation/list.json') - .startAppBrowserify('api-documentation') - .checkElementExist('.api-documentation-results .list-group-item') - .checkElementCount('.api-documentation-results .list-group-item', 2) - .checkElementInclude('.list-group-item[data-path="api/public"] .list-group-item-heading', 'api/public') - .checkElementInclude('.list-group-item[data-path="api/public"] .list-group-item-text', - 'api/public description') - .checkElementInclude('.list-group-item[data-path="api/internal"] .list-group-item-heading', 'api/internal') - .checkElementInclude('.list-group-item[data-path="api/internal"] .list-group-item-text', - 'api/internal description') - .checkElementInclude('.list-group-item[data-path="api/internal"]', 'internal') - .checkElementExist('.list-group-item[data-path="api/public"]:not(.hidden)') - .checkElementExist('.list-group-item.hidden[data-path="api/internal"]') - .checkElementNotExist('#api-documentation-show-internal:checked') - .clickElement('#api-documentation-show-internal') - .checkElementExist('.list-group-item[data-path="api/public"]:not(.hidden)') - .checkElementExist('.list-group-item[data-path="api/internal"]:not(.hidden)') - .checkElementExist('#api-documentation-show-internal:checked'); - }); - - bdd.it('should show actions', function () { - return this.remote - .open() - .mockFromFile('/api/webservices/list', 'api-documentation/list.json') - .startAppBrowserify('api-documentation') - .checkElementExist('.api-documentation-results .list-group-item') - .clickElement('.list-group-item[data-path="api/public"]') - .checkElementCount('.search-navigator-workspace-details .panel', 2) - .checkElementInclude('.panel[data-action="do"]', 'POST api/public/do') - .checkElementInclude('.panel[data-action="do"]', 'api/public/do description') - .checkElementInclude('.panel[data-action="do"]', 'Since 3.6') - .checkElementCount('.panel[data-action="do"] table tr', 1) - .checkElementInclude('.panel[data-action="do"] table tr', 'format') - .checkElementInclude('.panel[data-action="do"] table tr', 'optional') - .checkElementInclude('.panel[data-action="do"] table tr', 'api/public/do format description') - .checkElementInclude('.panel[data-action="do"] table tr', 'json') - .checkElementInclude('.panel[data-action="do"] table tr', 'xml'); - }); - - bdd.it('should show example response', function () { - return this.remote - .open() - .mockFromFile('/api/webservices/list', 'api-documentation/list.json') - .mockFromFile('/api/webservices/response_example', 'api-documentation/response-example.json') - .startAppBrowserify('api-documentation') - .checkElementExist('.api-documentation-results .list-group-item') - .clickElement('.list-group-item[data-path="api/public"]') - .clickElement('.panel[data-action="undo"] .js-show-response-example') - .checkElementExist('.panel[data-action="undo"] pre') - .checkElementInclude('.panel[data-action="undo"] pre', 'leia.organa'); - }); - - //bdd.it('should open WS permalink', function () { - // return this.remote - // .open('#api/public') - // .mockFromFile('/api/webservices/list', 'api-documentation/list.json') - // .startAppBrowserify('api-documentation') - // .checkElementExist('.api-documentation-results .list-group-item') - // .checkElementExist('.panel[data-web-service="api/public"]') - // .checkElementCount('.panel[data-web-service="api/public"]', 2); - //}); - // - //bdd.it('should open action permalink', function () { - // return this.remote - // .open('#api/internal/move') - // .mockFromFile('/api/webservices/list', 'api-documentation/list.json') - // .startAppBrowserify('api-documentation') - // .checkElementExist('.api-documentation-results .list-group-item') - // .checkElementExist('.panel[data-web-service="api/internal"]') - // .checkElementExist('.panel[data-web-service="api/internal"][data-action="move"]'); - //}); - }); -}); diff --git a/server/sonar-web/test/medium/base.html b/server/sonar-web/test/medium/base.html deleted file mode 100644 index aca0d14ad6a..00000000000 --- a/server/sonar-web/test/medium/base.html +++ /dev/null @@ -1,43 +0,0 @@ -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> - <link href="../../src/main/webapp/css/sonar.css" rel="stylesheet" media="all"> - <script src="../../src/main/webapp/js/sonar.js"></script> - <script src="../../src/main/js/libs/third-party/jquery.mockjax.js"></script> - <script> - var baseUrl = ''; - var $j = jQuery.noConflict(); - window.suppressTranslationWarnings = true; - jQuery.mockjaxSettings.contentType = 'text/json'; - jQuery.mockjaxSettings.responseTime = 50; - jQuery(document).ready(function () { - $j('.open-modal').modal(); - }); - window.SS = { - hoursInDay: 8, - user: '', - userName: '', - userEmail: '', - lf: { - enableGravatar: false, - gravatarServerUrl: '' - }, - updateCenterActive: true - }; - </script> - <script> - window.sonarqube = {}; - window.sonarqube.el = '#content'; - window.sonarqube.urlRoot = '/test/medium/base.html'; - window.sonarqube.projectId = 'eb294572-a6a4-43cf-acc2-33c2fe37c02e' - window.sonarqube.file = { uuid: 'uuid', key: 'key' }; - </script> - <script> - jQuery.mockjax({ url: '/api/l10n/index', responseText:'{}' }); - </script> -</head> -<body> -<div id="content"></div> -<script src="../../src/main/webapp/js/bundles/main.js"></script> -</body> -</html> diff --git a/server/sonar-web/test/medium/coding-rules.spec.js b/server/sonar-web/test/medium/coding-rules.spec.js deleted file mode 100644 index ac363c87c2b..00000000000 --- a/server/sonar-web/test/medium/coding-rules.spec.js +++ /dev/null @@ -1,999 +0,0 @@ -define(function (require) { - var bdd = require('intern!bdd'); - require('../helpers/test-page'); - - bdd.describe('Coding Rules Page', function () { - - bdd.it('should show alert when there is no available profiles for activation', function () { - return this.remote - .open() - .mockFromFile('/api/rules/app', 'coding-rules-spec/app-no-available-profiles.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-no-available-profiles.json') - .mockFromFile('/api/rules/show', 'coding-rules-spec/show-no-available-profiles.json') - .mockFromString('/api/issues/search', '{}') - .startAppBrowserify('coding-rules') - .checkElementExist('.coding-rule.selected') - .clickElement('.coding-rule.selected .js-rule') - .checkElementExist('.coding-rules-detail-header') - .checkElementExist('#coding-rules-quality-profile-activate') - .clickElement('#coding-rules-quality-profile-activate') - .checkElementExist('.modal') - .checkElementExist('.modal .alert'); - }); - - bdd.it('should show profile facet', function () { - return this.remote - .open() - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-profile-facet.json') - .startAppBrowserify('coding-rules') - .checkElementExist('.coding-rule') - .checkElementInclude('#coding-rules-total', '609') - .clickElement('[data-property="qprofile"] .js-facet-toggle') - .checkElementExist('.js-facet[data-value="java-default-with-mojo-conventions-49307"]') - .clearMocks() - .mockFromFile('/api/rules/search', - 'coding-rules-spec/search-profile-facet-qprofile-active.json', - { data: { activation: true } }) - .clickElement('.js-facet[data-value="java-default-with-mojo-conventions-49307"]') - .checkElementInclude('#coding-rules-total', '407') - .checkElementExist('.js-facet[data-value="java-default-with-mojo-conventions-49307"] .js-active.facet-toggle-active') - .clearMocks() - .mockFromFile('/api/rules/search', - 'coding-rules-spec/search-profile-facet-qprofile-inactive.json', - { data: { activation: 'false' } }) - .clickElement('.js-facet[data-value="java-default-with-mojo-conventions-49307"] .js-inactive') - .checkElementInclude('#coding-rules-total', '408') - .checkElementExist('.js-facet[data-value="java-default-with-mojo-conventions-49307"] .js-inactive.facet-toggle-active') - .clearMocks() - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-profile-facet.json') - .clickElement('[data-property="qprofile"] .js-facet-toggle') - .checkElementInclude('#coding-rules-total', '609'); - }); - - bdd.it('should show query facet', function () { - return this.remote - .open() - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json') - .startAppBrowserify('coding-rules') - .checkElementExist('.coding-rule') - .checkElementInclude('#coding-rules-total', '609') - .clearMocks() - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-query.json', { data: { q: 'query' } }) - .fillElement('[data-property="q"] input', 'query') - .submitForm('[data-property="q"] form') - .checkElementInclude('#coding-rules-total', '4') - .clearMocks() - .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json') - .fillElement('[data-property="q"] input', '') - .submitForm('[data-property="q"] form') - .checkElementInclude('#coding-rules-total', '609'); - }); - - bdd.it('should show rule permalink', function () { - return this.remote - .open() - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json') - .mockFromFile('/api/rules/show', 'coding-rules-spec/show.json') - .mockFromString('/api/issues/search', '{}') - .startAppBrowserify('coding-rules') - .checkElementExist('.coding-rule.selected') - .clickElement('.coding-rule.selected .js-rule') - .checkElementExist('.coding-rules-detail-header') - .checkElementExist('a[href="/coding_rules#rule_key=squid%3AS2204"]'); - }); - - bdd.it('should activate profile', function () { - return this.remote - .open() - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json') - .mockFromFile('/api/rules/show', 'coding-rules-spec/show-activate-profile.json') - .mockFromString('/api/qualityprofiles/activate_rule', '{}') - .mockFromString('/api/issues/search', '{}') - .startAppBrowserify('coding-rules') - .checkElementExist('.coding-rule.selected') - .clickElement('.coding-rule.selected .js-rule') - .checkElementExist('.coding-rules-detail-header') - .checkElementNotExist('.coding-rules-detail-quality-profile-name') - .checkElementExist('#coding-rules-quality-profile-activate') - .clickElement('#coding-rules-quality-profile-activate') - .checkElementExist('.modal') - .clearMocks() - .mockFromFile('/api/rules/show', 'coding-rules-spec/show-activate-profile-with-profile.json') - .mockFromString('/api/qualityprofiles/activate_rule', '{}') - .mockFromString('/api/issues/search', '{}') - .clickElement('#coding-rules-quality-profile-activation-activate') - .checkElementExist('.coding-rules-detail-quality-profile-name') - .checkElementExist('.coding-rules-detail-quality-profile-name') - .checkElementExist('.coding-rules-detail-quality-profile-severity') - .checkElementExist('.coding-rules-detail-quality-profile-deactivate'); - }); - - bdd.it('should create custom rule', function () { - return this.remote - .open() - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-create-custom-rules.json') - .startAppBrowserify('coding-rules') - .checkElementExist('.coding-rule.selected') - .clearMocks() - .mockFromFile('/api/rules/show', 'coding-rules-spec/show-create-custom-rules.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-custom-rules.json', - { data: { template_key: 'squid:ArchitecturalConstraint' } }) - .mockFromString('/api/rules/create', '{}') - .mockFromString('/api/issues/search', '{}') - .clickElement('.coding-rule.selected .js-rule') - .checkElementExist('#coding-rules-detail-custom-rules .coding-rules-detail-list-name') - .clearMocks() - .mockFromString('/api/rules/create', '{}') - .mockFromFile('/api/rules/show', 'coding-rules-spec/show-create-custom-rules.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-custom-rules2.json') - .checkElementCount('#coding-rules-detail-custom-rules .coding-rules-detail-list-name', 1) - .clickElement('.js-create-custom-rule') - .fillElement('.modal form [name="name"]', 'test') - .fillElement('.modal form [name="markdown_description"]', 'test') - .clickElement('#coding-rules-custom-rule-creation-create') - .checkElementCount('#coding-rules-detail-custom-rules .coding-rules-detail-list-name', 2); - }); - - bdd.it('should reactivate custom rule', function () { - return this.remote - .open() - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-create-custom-rules.json') - .startAppBrowserify('coding-rules') - .forceJSON() - .checkElementExist('.coding-rule.selected') - .clearMocks() - .mockFromFile('/api/rules/show', 'coding-rules-spec/show-create-custom-rules.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-custom-rules.json', - { data: { template_key: 'squid:ArchitecturalConstraint' } }) - .mockFromFile('/api/rules/create', 'coding-rules-spec/create-create-custom-rules.json', { status: 409 }) - .mockFromString('/api/issues/search', '{}') - .clickElement('.coding-rule.selected .js-rule') - .checkElementExist('.js-create-custom-rule') - .clickElement('.js-create-custom-rule') - .checkElementExist('.modal') - .fillElement('.modal form [name="name"]', 'My Custom Rule') - .fillElement('.modal form [name="markdown_description"]', 'My Description') - .clickElement('#coding-rules-custom-rule-creation-create') - .checkElementExist('.modal .alert-warning') - .clearMocks() - .mockFromFile('/api/rules/create', 'coding-rules-spec/create-create-custom-rules.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-custom-rules2.json', - { data: { template_key: 'squid:ArchitecturalConstraint' } }) - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-create-custom-rules.json') - .mockFromFile('/api/rules/show', 'coding-rules-spec/show-create-custom-rules.json') - .clickElement('.modal #coding-rules-custom-rule-creation-reactivate') - .checkElementCount('#coding-rules-detail-custom-rules .coding-rules-detail-list-name', 2); - }); - - bdd.it('should create manual rule', function () { - return this.remote - .open() - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-create-manual-rule.json') - .mockFromFile('/api/rules/create', 'coding-rules-spec/show-create-manual-rule.json') - .mockFromFile('/api/rules/show', 'coding-rules-spec/show-create-manual-rule.json') - .mockFromString('/api/issues/search', '{}') - .startAppBrowserify('coding-rules') - .forceJSON() - .checkElementExist('.js-create-manual-rule') - .clickElement('.js-create-manual-rule') - .checkElementExist('.modal') - .fillElement('.modal [name="name"]', 'Manual Rule') - .fillElement('.modal [name="markdown_description"]', 'Manual Rule Description') - .clickElement('.modal #coding-rules-manual-rule-creation-create') - .checkElementExist('.coding-rules-detail-header') - .checkElementInclude('.coding-rules-detail-header', 'Manual Rule') - .checkElementInclude('.coding-rule-details', 'manual:Manual_Rule') - .checkElementInclude('.coding-rules-detail-description', 'Manual Rule Description'); - }); - - bdd.it('should reactivate manual rule', function () { - return this.remote - .open() - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-create-manual-rule.json') - .mockFromFile('/api/rules/create', 'coding-rules-spec/show-create-manual-rule.json', { status: 409 }) - .mockFromFile('/api/rules/show', 'coding-rules-spec/show-create-manual-rule.json') - .mockFromString('/api/issues/search', '{}') - .startAppBrowserify('coding-rules') - .forceJSON() - .checkElementExist('.js-create-manual-rule') - .clickElement('.js-create-manual-rule') - .checkElementExist('.modal') - .checkElementExist('.modal #coding-rules-manual-rule-creation-create') - .fillElement('.modal [name="name"]', 'Manual Rule') - .fillElement('.modal [name="markdown_description"]', 'Manual Rule Description') - .clickElement('.modal #coding-rules-manual-rule-creation-create') - .checkElementExist('.modal .alert-warning') - .clearMocks() - .mockFromFile('/api/rules/create', 'coding-rules-spec/show.json') - .mockFromFile('/api/rules/show', 'coding-rules-spec/show-create-manual-rule.json') - .clickElement('.modal #coding-rules-manual-rule-creation-reactivate') - .checkElementExist('.coding-rules-detail-header') - .checkElementInclude('.coding-rules-detail-header', 'Manual Rule') - .checkElementInclude('.coding-rule-details', 'manual:Manual_Rule') - .checkElementInclude('.coding-rules-detail-description', 'Manual Rule Description'); - }); - - bdd.it('should delete custom rules', function () { - return this.remote - .open() - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-delete-custom-rule-custom-rules.json', - { data: { template_key: 'squid:ArchitecturalConstraint' } }) - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-delete-custom-rule.json') - .mockFromFile('/api/rules/show', 'coding-rules-spec/show-delete-custom-rule.json') - .mockFromString('/api/rules/delete', '{}') - .mockFromString('/api/issues/search', '{}') - .startAppBrowserify('coding-rules') - .checkElementExist('.coding-rule.selected') - .clickElement('.coding-rule.selected .js-rule') - .checkElementExist('#coding-rules-detail-custom-rules .coding-rules-detail-list-name') - .checkElementCount('#coding-rules-detail-custom-rules .coding-rules-detail-list-name', 2) - .clickElement('.js-delete-custom-rule') - .clickElement('[data-confirm="yes"]') - .checkElementCount('#coding-rules-detail-custom-rules .coding-rules-detail-list-name', 1); - }); - - bdd.it('should delete manual rules', function () { - return this.remote - .open() - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-delete-manual-rule-before.json') - .mockFromFile('/api/rules/show', 'coding-rules-spec/show-delete-manual-rule.json') - .mockFromString('/api/issues/search', '{}') - .startAppBrowserify('coding-rules') - .forceJSON() - .checkElementExist('.coding-rule.selected') - .clickElement('.coding-rule.selected .js-rule') - .checkElementExist('.js-delete') - .clickElement('.js-delete') - .checkElementExist('[data-confirm="yes"]') - .clearMocks() - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-delete-manual-rule-after.json') - .mockFromString('/api/rules/delete', '{}') - .clickElement('[data-confirm="yes"]') - .checkElementInclude('#coding-rules-total', 0); - }); - - bdd.it('should show custom rules', function () { - return this.remote - .open() - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-show-cutsom-rule-custom-rules.json', - { data: { template_key: 'squid:ArchitecturalConstraint' } }) - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-show-cutsom-rule.json') - .mockFromFile('/api/rules/show', 'coding-rules-spec/show-show-cutsom-rule.json') - .mockFromString('/api/issues/search', '{}') - .startAppBrowserify('coding-rules') - .checkElementExist('.coding-rule.selected') - .clickElement('.coding-rule.selected .js-rule') - .checkElementExist('#coding-rules-detail-custom-rules .coding-rules-detail-list-name') - .checkElementExist('#coding-rules-detail-custom-rules') - .checkElementCount('#coding-rules-detail-custom-rules .coding-rules-detail-list-name', 2) - .checkElementInclude('#coding-rules-detail-custom-rules .coding-rules-detail-list-name', - 'Do not use org.h2.util.StringUtils'); - }); - - bdd.it('should show deprecated label', function () { - return this.remote - .open() - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-deprecated.json') - .startAppBrowserify('coding-rules') - .checkElementExist('.coding-rule.selected') - .checkElementInclude('.coding-rule.selected', 'DEPRECATED'); - }); - - bdd.it('should show rule details', function () { - return this.remote - .open() - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-show-details.json') - .mockFromFile('/api/rules/show', 'coding-rules-spec/show-show-details.json') - .mockFromString('/api/issues/search', '{}') - .startAppBrowserify('coding-rules') - .checkElementExist('.coding-rule.selected') - .clickElement('.coding-rule.selected .js-rule') - .checkElementExist('.coding-rules-detail-header') - .checkElementInclude('.search-navigator-workspace-details', - 'Throwable and Error classes should not be caught') - .checkElementInclude('.search-navigator-workspace-details', 'squid:S1181') - .checkElementExist('.coding-rules-detail-properties .icon-severity-blocker') - .checkElementInclude('.coding-rules-detail-properties', 'error-handling') - .checkElementInclude('.coding-rules-detail-properties', '2013') - .checkElementInclude('.coding-rules-detail-properties', 'SonarQube (Java)') - .checkElementInclude('.coding-rules-detail-properties', 'Reliability > Exception handling') - .checkElementInclude('.coding-rules-detail-properties', 'LINEAR') - .checkElementInclude('.coding-rules-detail-properties', '20min') - - .checkElementInclude('.coding-rules-detail-description', 'is the superclass of all errors and') - .checkElementInclude('.coding-rules-detail-description', 'its subclasses should be caught.') - .checkElementInclude('.coding-rules-detail-description', 'Noncompliant Code Example') - .checkElementInclude('.coding-rules-detail-description', 'Compliant Solution') - - .checkElementInclude('.coding-rules-detail-parameters', 'max') - .checkElementInclude('.coding-rules-detail-parameters', 'Maximum authorized number of parameters') - .checkElementInclude('.coding-rules-detail-parameters', '7') - - .checkElementCount('.coding-rules-detail-quality-profile-name', 6) - .checkElementInclude('.coding-rules-detail-quality-profile-name', 'Default - Top') - .checkElementCount('.coding-rules-detail-quality-profile-inheritance', 4) - .checkElementInclude('.coding-rules-detail-quality-profile-inheritance', 'Default - Top'); - }); - - bdd.it('should show empty list', function () { - return this.remote - .open() - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-empty.json') - .startAppBrowserify('coding-rules') - .checkElementExist('.search-navigator-facet-box') - .checkElementNotExist('.coding-rule') - .checkElementInclude('#coding-rules-total', 0) - .checkElementExist('.search-navigator-no-results'); - }); - - bdd.it('should show facets', function () { - return this.remote - .open() - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json') - .startAppBrowserify('coding-rules') - .checkElementExist('.search-navigator-facet-box') - .checkElementCount('.search-navigator-facet-box', 13); - }); - - bdd.it('should show rule', function () { - return this.remote - .open() - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json') - .startAppBrowserify('coding-rules') - .checkElementExist('.coding-rule.selected') - .checkElementInclude('.coding-rule.selected', 'Values passed to SQL commands should be sanitized') - .checkElementInclude('.coding-rule.selected', 'Java') - .checkElementInclude('.coding-rule.selected', 'cwe') - .checkElementInclude('.coding-rule.selected', 'owasp-top10') - .checkElementInclude('.coding-rule.selected', 'security') - .checkElementInclude('.coding-rule.selected', 'sql') - .checkElementInclude('.coding-rule.selected', 'custom-tag'); - }); - - bdd.it('should show rule issues', function () { - return this.remote - .open() - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json') - .mockFromFile('/api/rules/show', 'coding-rules-spec/show.json') - .mockFromFile('/api/issues/search', 'coding-rules-spec/issues-search.json') - .startAppBrowserify('coding-rules') - .checkElementExist('.coding-rule.selected') - .clickElement('.coding-rule.selected .js-rule') - .checkElementExist('.coding-rules-most-violated-projects') - .checkElementInclude('.js-rule-issues', '7') - .checkElementInclude('.coding-rules-most-violated-projects', 'SonarQube') - .checkElementInclude('.coding-rules-most-violated-projects', '2') - .checkElementInclude('.coding-rules-most-violated-projects', 'SonarQube Runner') - .checkElementInclude('.coding-rules-most-violated-projects', '1'); - }); - - bdd.it('should show rules', function () { - return this.remote - .open() - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json') - .startAppBrowserify('coding-rules') - .checkElementExist('.coding-rule') - .checkElementCount('.coding-rule', 25) - .checkElementInclude('.coding-rule', 'Values passed to SQL commands should be sanitized') - .checkElementInclude('.coding-rule', 'An open curly brace should be located at the beginning of a line') - .checkElementInclude('#coding-rules-total', '609'); - }); - - bdd.it('should move between rules from detailed view', function () { - return this.remote - .open() - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json') - .mockFromFile('/api/rules/show', 'coding-rules-spec/show.json') - .startAppBrowserify('coding-rules') - .checkElementExist('.coding-rule.selected') - .clickElement('.coding-rule.selected .js-rule') - .checkElementExist('.coding-rules-detail-header') - .checkElementInclude('.coding-rules-detail-header', - '".equals()" should not be used to test the values') - .clearMocks() - .mockFromFile('/api/rules/show', 'coding-rules-spec/show2.json') - .clickElement('.js-next') - .checkElementInclude('.coding-rules-detail-header', '"@Override" annotation should be used on any') - .clearMocks() - .mockFromFile('/api/rules/show', 'coding-rules-spec/show.json') - .clickElement('.js-prev') - .checkElementInclude('.coding-rules-detail-header', '".equals()" should not be used to test the values'); - }); - - bdd.it('should filter similar rules', function () { - return this.remote - .open() - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json') - .startAppBrowserify('coding-rules') - .checkElementExist('.coding-rule.selected .js-rule-filter') - .checkElementInclude('#coding-rules-total', '609') - .clickElement('.js-rule-filter') - .checkElementExist('.bubble-popup') - .checkElementExist('.bubble-popup [data-property="languages"][data-value="java"]') - .clearMocks() - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-sql-tag.json', { data: { tags: 'sql' } }) - .clickElement('.bubble-popup [data-property="tags"][data-value="sql"]') - .checkElementInclude('#coding-rules-total', '2'); - }); - - bdd.it('should show active severity facet', function () { - return this.remote - .open() - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json') - .startAppBrowserify('coding-rules') - .checkElementExist('.coding-rule') - .checkElementInclude('#coding-rules-total', '609') - .checkElementExist('.search-navigator-facet-box-forbidden[data-property="active_severities"]') - .clickElement('[data-property="qprofile"] .js-facet-toggle') - .checkElementExist('.js-facet[data-value="java-default-with-mojo-conventions-49307"]') - .clearMocks() - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-qprofile.json', - { data: { qprofile: 'java-default-with-mojo-conventions-49307' } }) - .clickElement('.js-facet[data-value="java-default-with-mojo-conventions-49307"]') - .checkElementInclude('#coding-rules-total', '407') - .checkElementNotExist('.search-navigator-facet-box-forbidden[data-property="active_severities"]') - .clearMocks() - .mockFromFile('/api/rules/search', 'coding-rules-spec/active-severities-facet.json', - { data: { facets: 'active_severities', ps: 1 } }) - .clickElement('[data-property="active_severities"] .js-facet-toggle') - .checkElementExist('[data-property="active_severities"] [data-value="BLOCKER"]') - .clearMocks() - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-BLOCKER.json', - { data: { active_severities: 'BLOCKER' } }) - .clickElement('[data-property="active_severities"] [data-value="BLOCKER"]') - .checkElementInclude('#coding-rules-total', '4') - .clearMocks() - .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json') - .clickElement('[data-property="qprofile"] .js-facet-toggle') - .checkElementInclude('#coding-rules-total', '609') - .checkElementExist('.search-navigator-facet-box-forbidden[data-property="active_severities"]'); - }); - - bdd.it('should show available since facet', function () { - return this.remote - .open() - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json') - .startAppBrowserify('coding-rules') - .checkElementExist('.coding-rule') - .checkElementInclude('#coding-rules-total', '609') - .clearMocks() - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-limited.json', - { data: { available_since: '2014-12-01' } }) - .clickElement('[data-property="available_since"] .js-facet-toggle') - .fillElement('[data-property="available_since"] input', '2014-12-01') - .execute(function () { - // TODO do not use jQuery - jQuery('[data-property="available_since"] input').change(); - }) - .checkElementInclude('#coding-rules-total', '101'); - }); - - bdd.it('should bulk activate', function () { - return this.remote - .open() - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json') - .mockFromString('/api/qualityprofiles/activate_rules', '{ "succeeded": 225 }') - .startAppBrowserify('coding-rules') - .forceJSON() - .checkElementExist('.coding-rule') - .checkElementExist('.js-bulk-change') - .clickElement('.js-bulk-change') - .checkElementExist('.bubble-popup') - .checkElementExist('.bubble-popup .js-bulk-change[data-action="activate"]') - .clickElement('.js-bulk-change[data-action="activate"]') - .checkElementExist('.modal') - .checkElementExist('.modal #coding-rules-bulk-change-profile') - .checkElementExist('.modal #coding-rules-submit-bulk-change') - .fillElement('#coding-rules-bulk-change-profile', 'java-default-with-mojo-conventions-49307') - .clickElement('.modal #coding-rules-submit-bulk-change') - .checkElementExist('.modal .alert-success') - .checkElementInclude('.modal', 'Default - Maven Conventions') - .checkElementInclude('.modal', 'Java') - .checkElementInclude('.modal', '225'); - }); - - bdd.it('should fail to bulk activate', function () { - return this.remote - .open() - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json') - .mockFromString('/api/qualityprofiles/activate_rules', '{ "succeeded": 225, "failed": 395 }') - .startAppBrowserify('coding-rules') - .forceJSON() - .checkElementExist('.coding-rule') - .checkElementExist('.js-bulk-change') - .clickElement('.js-bulk-change') - .checkElementExist('.bubble-popup') - .checkElementExist('.bubble-popup .js-bulk-change[data-action="activate"]') - .clickElement('.js-bulk-change[data-action="activate"]') - .checkElementExist('.modal') - .checkElementExist('.modal #coding-rules-bulk-change-profile') - .checkElementExist('.modal #coding-rules-submit-bulk-change') - .fillElement('#coding-rules-bulk-change-profile', 'java-default-with-mojo-conventions-49307') - .clickElement('.modal #coding-rules-submit-bulk-change') - .checkElementExist('.modal .alert-warning') - .checkElementInclude('.modal', '225') - .checkElementInclude('.modal', '395'); - }); - - bdd.it('should filter profiles by language during bulk change', function () { - return this.remote - .open() - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json') - .startAppBrowserify('coding-rules') - .checkElementExist('.coding-rule') - .clickElement('.js-facet[data-value="java"]') - .checkElementExist('.js-bulk-change') - .clickElement('.js-bulk-change') - .checkElementExist('.bubble-popup') - .checkElementExist('.bubble-popup .js-bulk-change[data-action="activate"]') - .clickElement('.js-bulk-change[data-action="activate"]') - .checkElementExist('.modal') - .checkElementExist('.modal #coding-rules-bulk-change-profile') - .checkElementCount('.modal #coding-rules-bulk-change-profile option', 8); - }); - - bdd.it('should change selected profile during bulk change', function () { - return this.remote - .open() - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-qprofile-active.json', - { data: { activation: true } }) - .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json') - .mockFromString('/api/qualityprofiles/deactivate_rules', '{ "succeeded": 7 }') - .startAppBrowserify('coding-rules') - .checkElementExist('.coding-rule') - .clickElement('[data-property="qprofile"] .js-facet-toggle') - .checkElementExist('.js-facet[data-value="java-default-with-mojo-conventions-49307"]') - .clickElement('.js-facet[data-value="java-default-with-mojo-conventions-49307"]') - .checkElementExist('.js-bulk-change') - .clickElement('.js-bulk-change') - .checkElementExist('.bubble-popup') - .checkElementExist('.bubble-popup .js-bulk-change[data-param="java-default-with-mojo-conventions-49307"]') - .clickElement('.js-bulk-change[data-param="java-default-with-mojo-conventions-49307"]') - .checkElementExist('.modal') - .checkElementNotExist('.modal #coding-rules-bulk-change-profile') - .clickElement('.modal #coding-rules-submit-bulk-change') - .checkElementExist('.modal .alert-success') - .checkElementInclude('.modal', '7'); - }); - - bdd.it('should show characteristic facet', function () { - return this.remote - .open() - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json') - .startAppBrowserify('coding-rules') - .checkElementExist('.coding-rule') - .checkElementExist('.search-navigator-facet-box-collapsed[data-property="debt_characteristics"]') - .clearMocks() - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-characteristic.json', - { data: { facets: 'debt_characteristics' } }) - .clickElement('[data-property="debt_characteristics"] .js-facet-toggle') - .checkElementExist('.js-facet[data-value="PORTABILITY"]') - .checkElementCount('[data-property="debt_characteristics"] .js-facet', 32) - .checkElementCount('[data-property="debt_characteristics"] .js-facet.search-navigator-facet-indent', 24) - .clearMocks() - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-with-portability-characteristic.json', - { data: { debt_characteristics: 'PORTABILITY' } }) - .clickElement('.js-facet[data-value="PORTABILITY"]') - .checkElementInclude('#coding-rules-total', 21) - .clearMocks() - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-without-characteristic.json', - { data: { has_debt_characteristic: 'false' } }) - .clickElement('.js-facet[data-empty-characteristic]') - .checkElementInclude('#coding-rules-total', 208) - .clearMocks() - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-with-memory-efficiency-characteristic.json', - { data: { debt_characteristics: 'MEMORY_EFFICIENCY' } }) - .clickElement('.js-facet[data-value="MEMORY_EFFICIENCY"]') - .checkElementInclude('#coding-rules-total', 3); - }); - - bdd.it('should disable characteristic facet', function () { - return this.remote - .open() - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json') - .startAppBrowserify('coding-rules') - .checkElementExist('.coding-rule') - - .clearMocks() - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-characteristic.json', - { data: { facets: 'debt_characteristics' } }) - .clickElement('[data-property="debt_characteristics"] .js-facet-toggle') - .checkElementExist('.js-facet[data-value="PORTABILITY"]') - - .clearMocks() - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-with-portability-characteristic.json', - { data: { debt_characteristics: 'PORTABILITY' } }) - .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json') - .clickElement('.js-facet[data-value="PORTABILITY"]') - .checkElementInclude('#coding-rules-total', 21) - - .clearMocks() - .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json') - .clickElement('[data-property="debt_characteristics"] .js-facet-toggle') - .checkElementInclude('#coding-rules-total', 609) - - .clearMocks() - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-characteristic.json', - { data: { facets: 'debt_characteristics' } }) - .clickElement('[data-property="debt_characteristics"] .js-facet-toggle') - .checkElementExist('.js-facet[data-value="MEMORY_EFFICIENCY"]') - - .clearMocks() - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-with-memory-efficiency-characteristic.json', - { data: { debt_characteristics: 'MEMORY_EFFICIENCY' } }) - .clickElement('.js-facet[data-value="MEMORY_EFFICIENCY"]') - .checkElementInclude('#coding-rules-total', 3) - - .clearMocks() - .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json') - .clickElement('[data-property="debt_characteristics"] .js-facet-toggle') - .checkElementInclude('#coding-rules-total', 609) - - .clearMocks() - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-characteristic.json', - { data: { facets: 'debt_characteristics' } }) - .clickElement('[data-property="debt_characteristics"] .js-facet-toggle') - .checkElementExist('.js-facet[data-empty-characteristic]') - - .clearMocks() - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-without-characteristic.json', - { data: { has_debt_characteristic: 'false' } }) - .clickElement('.js-facet[data-empty-characteristic]') - .checkElementInclude('#coding-rules-total', 208) - - .clearMocks() - .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json') - .clickElement('[data-property="debt_characteristics"] .js-facet-toggle') - .checkElementInclude('#coding-rules-total', 609); - }); - - bdd.it('should show template facet', function () { - return this.remote - .open() - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json') - .startAppBrowserify('coding-rules') - .checkElementExist('.coding-rule') - .checkElementExist('.search-navigator-facet-box-collapsed[data-property="is_template"]') - - .clickElement('[data-property="is_template"] .js-facet-toggle') - .checkElementExist('[data-property="is_template"] .js-facet[data-value="true"]') - - .clearMocks() - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-only-templates.json', - { data: { 'is_template': 'true' } }) - .clickElement('[data-property="is_template"] .js-facet[data-value="true"]') - .checkElementInclude('#coding-rules-total', 8) - - .clearMocks() - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-hide-templates.json', - { data: { 'is_template': 'false' } }) - .clickElement('[data-property="is_template"] .js-facet[data-value="false"]') - .checkElementInclude('#coding-rules-total', 7) - - .clearMocks() - .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json') - .clickElement('[data-property="is_template"] .js-facet-toggle') - .checkElementInclude('#coding-rules-total', 609); - }); - - bdd.it('should show language facet', function () { - return this.remote - .open() - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json') - .mockFromString('/api/languages/list', '{"languages":[{"key":"custom","name":"Custom"}]}', - { data: { q: 'custom' } }) - .startAppBrowserify('coding-rules') - .checkElementExist('.coding-rule') - .clickElement('[data-property="languages"] .select2-choice') - .checkElementExist('.select2-search') - .fillElement('.select2-input', 'custom') - .execute(function () { - // TODO remove jQuery usage - jQuery('.select2-input').trigger('keyup-change'); - }) - .checkElementExist('.select2-result') - .checkElementInclude('.select2-result', 'Custom') - .clearMocks() - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-with-custom-language.json', - { data: { languages: 'custom' } }) - .execute(function () { - // TODO remove jQuery usage - jQuery('.select2-result').mouseup(); - }) - .checkElementInclude('#coding-rules-total', 13) - .checkElementExist('[data-property="languages"] .js-facet.active') - .checkElementInclude('[data-property="languages"] .js-facet.active', 'custom') - .checkElementInclude('[data-property="languages"] .js-facet.active', '13'); - }); - - bdd.it('should reload results', function () { - return this.remote - .open() - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json') - .startAppBrowserify('coding-rules') - .checkElementExist('.coding-rule') - .checkElementInclude('#coding-rules-total', 609) - .clearMocks() - .mockFromFile('/api/rules/search', 'coding-rules-spec/search2.json') - .clickElement('.js-reload') - .checkElementInclude('#coding-rules-total', 413); - }); - - bdd.it('should do a new search', function () { - return this.remote - .open() - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json') - .startAppBrowserify('coding-rules') - .checkElementExist('.coding-rule') - .checkElementInclude('#coding-rules-total', 609) - .clearMocks() - .mockFromFile('/api/rules/search', 'coding-rules-spec/search2.json', { data: { languages: 'java' } }) - .clickElement('.js-facet[data-value="java"]') - .checkElementInclude('#coding-rules-total', 413) - .clearMocks() - .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json') - .clickElement('.js-new-search') - .checkElementInclude('#coding-rules-total', 609); - }); - - bdd.it('should go back', function () { - return this.remote - .open() - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json') - .mockFromFile('/api/rules/show', 'coding-rules-spec/show.json') - .startAppBrowserify('coding-rules') - .checkElementExist('.coding-rule.selected') - .clickElement('.coding-rule.selected .js-rule') - .checkElementExist('.coding-rules-detail-header') - .clickElement('.js-back') - .checkElementNotExist('.js-back') - .checkElementNotExist('.coding-rules-detail-header'); - }); - - bdd.it('should show inheritance facet', function () { - return this.remote - .open() - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json') - .startAppBrowserify('coding-rules') - .checkElementExist('.coding-rule') - .checkElementInclude('#coding-rules-total', '609') - .checkElementExist('.search-navigator-facet-box-forbidden[data-property="inheritance"]') - - .clickElement('[data-property="qprofile"] .js-facet-toggle') - .checkElementExist('.js-facet[data-value="java-default-with-mojo-conventions-49307"]') - - .clearMocks() - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-qprofile.json', - { data: { qprofile: 'java-default-with-mojo-conventions-49307' } }) - .clickElement('.js-facet[data-value="java-default-with-mojo-conventions-49307"]') - .checkElementInclude('#coding-rules-total', '407') - .checkElementNotExist('.search-navigator-facet-box-forbidden[data-property="inheritance"]') - - .clickElement('[data-property="inheritance"] .js-facet-toggle') - .checkElementExist('[data-property="inheritance"] [data-value="NONE"]') - - .clearMocks() - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-not-inherited.json', - { data: { inheritance: 'NONE' } }) - .clickElement('[data-property="inheritance"] [data-value="NONE"]') - .checkElementInclude('#coding-rules-total', '103') - - .clearMocks() - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-inherited.json', - { data: { inheritance: 'INHERITED' } }) - .clickElement('[data-property="inheritance"] [data-value="INHERITED"]') - .checkElementInclude('#coding-rules-total', '101') - - .clearMocks() - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-overriden.json', - { data: { inheritance: 'OVERRIDES' } }) - .clickElement('[data-property="inheritance"] [data-value="OVERRIDES"]') - .checkElementInclude('#coding-rules-total', '102') - - .clearMocks() - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-qprofile2.json', - { data: { qprofile: 'java-top-profile-without-formatting-conventions-50037' } }) - .clickElement('.js-facet[data-value="java-top-profile-without-formatting-conventions-50037"]') - .checkElementInclude('#coding-rules-total', '408') - .checkElementExist('.search-navigator-facet-box-forbidden[data-property="inheritance"]') - - .clearMocks() - .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json') - .clickElement('[data-property="qprofile"] .js-facet-toggle') - .checkElementInclude('#coding-rules-total', '609') - .checkElementExist('.search-navigator-facet-box-forbidden[data-property="inheritance"]'); - }); - - bdd.it('should show activation details', function () { - return this.remote - .open() - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json') - .startAppBrowserify('coding-rules') - .checkElementExist('.coding-rule') - .checkElementNotExist('.coding-rule-activation') - .clickElement('[data-property="qprofile"] .js-facet-toggle') - .checkElementExist('.js-facet[data-value="java-default-with-mojo-conventions-49307"]') - .clearMocks() - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-actives.json', { data: { activation: true } }) - .clickElement('.js-facet[data-value="java-default-with-mojo-conventions-49307"]') - .checkElementCount('.coding-rule-activation', 2) - .checkElementCount('.coding-rule-activation .icon-severity-major', 2) - .checkElementCount('.coding-rule-activation .icon-inheritance', 1) - .checkElementNotExist('.coding-rules-detail-quality-profile-activate'); - }); - - bdd.it('should activate rule', function () { - return this.remote - .open() - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-inactive.json', - { data: { activation: 'false' } }) - .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json') - .mockFromString('/api/qualityprofiles/activate_rule', '{}') - .startAppBrowserify('coding-rules') - .checkElementExist('.coding-rule') - .checkElementNotExist('.coding-rule-activation') - .clickElement('[data-property="qprofile"] .js-facet-toggle') - .checkElementExist('.js-facet[data-value="java-default-with-mojo-conventions-49307"]') - .clickElement('.js-facet[data-value="java-default-with-mojo-conventions-49307"]') - .clickElement('.js-facet[data-value="java-default-with-mojo-conventions-49307"] .js-inactive') - .checkElementNotExist('.coding-rule-activation .icon-severity-major') - .checkElementExist('.coding-rules-detail-quality-profile-activate') - .clickElement('.coding-rules-detail-quality-profile-activate') - .checkElementExist('.modal') - .checkElementExist('#coding-rules-quality-profile-activation-select') - .checkElementCount('#coding-rules-quality-profile-activation-select option', 1) - .checkElementExist('#coding-rules-quality-profile-activation-severity') - .clickElement('#coding-rules-quality-profile-activation-activate') - .checkElementExist('.coding-rule-activation .icon-severity-major') - .checkElementExist('.coding-rule-activation .icon-severity-major') - .checkElementNotExist('.coding-rules-detail-quality-profile-activate') - .checkElementExist('.coding-rules-detail-quality-profile-deactivate'); - }); - - bdd.it('should deactivate rule', function () { - return this.remote - .open() - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json') - .startAppBrowserify('coding-rules') - .checkElementExist('.coding-rule') - .checkElementNotExist('.coding-rule-activation') - .clickElement('[data-property="qprofile"] .js-facet-toggle') - .checkElementExist('.js-facet[data-value="java-default-with-mojo-conventions-49307"]') - .clearMocks() - .mockFromString('/api/qualityprofiles/deactivate_rule', '{}') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-active.json', { data: { activation: true } }) - .clickElement('.js-facet[data-value="java-default-with-mojo-conventions-49307"]') - .checkElementExist('.coding-rule-activation .icon-severity-major') - .checkElementNotExist('.coding-rules-detail-quality-profile-activate') - .clickElement('.coding-rules-detail-quality-profile-deactivate') - .checkElementExist('button[data-confirm="yes"]') - .clickElement('button[data-confirm="yes"]') - .checkElementNotExist('.coding-rule-activation .icon-severity-major') - .checkElementNotExist('.coding-rule-activation .icon-severity-major') - .checkElementExist('.coding-rules-detail-quality-profile-activate') - .checkElementNotExist('.coding-rules-detail-quality-profile-deactivate'); - }); - - bdd.it('should deactivate just activated rule', function () { - return this.remote - .open() - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-inactive.json', - { data: { activation: 'false' } }) - .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json') - .mockFromString('/api/qualityprofiles/activate_rule', '{}', - { - data: { - profile_key: 'java-default-with-mojo-conventions-49307', - rule_key: 'common-java:FailedUnitTests' - } - }) - .mockFromString('/api/qualityprofiles/deactivate_rule', '{}', - { - data: { - profile_key: 'java-default-with-mojo-conventions-49307', - rule_key: 'common-java:FailedUnitTests' - } - }) - .startAppBrowserify('coding-rules') - .checkElementExist('.coding-rule') - .clickElement('[data-property="qprofile"] .js-facet-toggle') - .checkElementExist('.js-facet[data-value="java-default-with-mojo-conventions-49307"]') - .clickElement('.js-facet[data-value="java-default-with-mojo-conventions-49307"]') - - .clickElement('.js-facet[data-value="java-default-with-mojo-conventions-49307"] .js-inactive') - .checkElementNotExist('.coding-rule-activation .icon-severity-major') - .checkElementExist('.coding-rules-detail-quality-profile-activate') - - .clickElement('.coding-rules-detail-quality-profile-activate') - .checkElementExist('.modal') - .checkElementExist('#coding-rules-quality-profile-activation-select') - .checkElementCount('#coding-rules-quality-profile-activation-select option', 1) - .checkElementExist('#coding-rules-quality-profile-activation-severity') - .clickElement('#coding-rules-quality-profile-activation-activate') - .checkElementExist('.coding-rule-activation .icon-severity-major') - .checkElementExist('.coding-rule-activation .icon-severity-major') - .checkElementNotExist('.coding-rules-detail-quality-profile-activate') - .checkElementExist('.coding-rules-detail-quality-profile-deactivate') - - .clickElement('.coding-rules-detail-quality-profile-deactivate') - .clickElement('[data-confirm="yes"]') - .checkElementNotExist('.coding-rule-activation .icon-severity-major') - .checkElementNotExist('.coding-rule-activation .icon-severity-major') - .checkElementExist('.coding-rules-detail-quality-profile-activate') - .checkElementNotExist('.coding-rules-detail-quality-profile-deactivate'); - }); - - bdd.it('should pre-select context profile in the activation modal', function () { - return this.remote - .open() - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json') - .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json') - .startAppBrowserify('coding-rules') - .clickElement('[data-property="qprofile"] .js-facet-toggle') - .checkElementExist('.js-facet[data-value="java-default-with-mojo-conventions-49307"]') - .clearMocks() - .mockFromFile('/api/rules/search', 'coding-rules-spec/search-inactive.json') - .mockFromFile('/api/rules/show', 'coding-rules-spec/show-activate-profile.json') - .clickElement('.js-facet[data-value="java-findbugs-14954"]') - .clickElement('.js-facet[data-value="java-findbugs-14954"] .js-inactive') - .checkElementExist('.coding-rule.selected') - .clickElement('.coding-rule.selected .js-rule') - .checkElementExist('.coding-rules-detail-header') - .checkElementNotExist('.coding-rules-detail-quality-profile-name') - .checkElementExist('#coding-rules-quality-profile-activate') - .clickElement('#coding-rules-quality-profile-activate') - .checkElementExist('.modal') - .checkElementInclude('#coding-rules-quality-profile-activation-select option[selected]', 'FindBugs'); - }); - }); -}); diff --git a/server/sonar-web/test/medium/custom-measures.spec.js b/server/sonar-web/test/medium/custom-measures.spec.js deleted file mode 100644 index 775e47a8c12..00000000000 --- a/server/sonar-web/test/medium/custom-measures.spec.js +++ /dev/null @@ -1,141 +0,0 @@ -define(function (require) { - var bdd = require('intern!bdd'); - require('../helpers/test-page'); - - bdd.describe('Custom Measures Page', function () { - var projectId = 'eb294572-a6a4-43cf-acc2-33c2fe37c02e'; - - bdd.it('should show list', function () { - return this.remote - .open() - .mockFromFile('/api/custom_measures/search', 'custom-measures-spec/search.json', - { data: { projectId: projectId } }) - .startAppBrowserify('custom-measures') - .checkElementCount('#custom-measures-list tr[data-id]', 4) - .checkElementInclude('#custom-measures-list .js-custom-measure-value', '35') - .checkElementInclude('#custom-measures-list .js-custom-measure-metric-name', 'Distribution') - .checkElementInclude('#custom-measures-list .js-custom-measure-domain', 'Management') - .checkElementInclude('#custom-measures-list .js-custom-measure-description', 'Description...') - .checkElementInclude('#custom-measures-list .js-custom-measure-created-at', '2015') - .checkElementInclude('#custom-measures-list .js-custom-measure-user', 'Administrator') - .checkElementCount('#custom-measures-list .js-custom-measure-pending', 4) - .checkElementCount('#custom-measures-list .js-custom-measure-update', 4) - .checkElementCount('#custom-measures-list .js-custom-measure-delete', 4) - .checkElementInclude('#custom-measures-list-footer', '4/4'); - }); - - bdd.it('should show more', function () { - return this.remote - .open() - .mockFromFile('/api/custom_measures/search', 'custom-measures-spec/search-big-1.json', - { data: { projectId: projectId } }) - .startAppBrowserify('custom-measures') - .checkElementCount('#custom-measures-list tr[data-id]', 2) - .checkElementNotExist('[data-id="3"]') - .clearMocks() - .mockFromFile('/api/custom_measures/search', 'custom-measures-spec/search-big-2.json', - { data: { projectId: projectId, p: 2 } }) - .clickElement('#custom-measures-fetch-more') - .checkElementExist('[data-id="3"]') - .checkElementCount('#custom-measures-list tr[data-id]', 4); - }); - - bdd.it('should create a new custom measure', function () { - return this.remote - .open() - .mockFromFile('/api/custom_measures/search', 'custom-measures-spec/search.json', - { data: { projectId: projectId } }) - .mockFromFile('/api/metrics/search', 'custom-measures-spec/metrics.json', { data: { isCustom: true } }) - .startAppBrowserify('custom-measures') - .checkElementCount('#custom-measures-list tr[data-id]', 4) - .clickElement('#custom-measures-create') - .checkElementExist('#create-custom-measure-form') - .clearMocks() - .mockFromFile('/api/custom_measures/search', 'custom-measures-spec/search-created.json', - { data: { projectId: projectId } }) - .mockFromString('/api/custom_measures/create', '{}', { data: { - metricId: '156', - value: '17', - description: 'example', - projectId: projectId - } }) - .fillElement('#create-custom-measure-metric', '156') - .fillElement('#create-custom-measure-value', '17') - .fillElement('#create-custom-measure-description', 'example') - .clickElement('#create-custom-measure-submit') - .checkElementExist('[data-id="6"]') - .checkElementCount('#custom-measures-list tr[data-id]', 5) - .checkElementInclude('[data-id="6"] .js-custom-measure-value', '17'); - }); - - bdd.it('should filter available metrics', function () { - return this.remote - .open() - .mockFromFile('/api/custom_measures/search', 'custom-measures-spec/search.json', - { data: { projectId: projectId } }) - .mockFromFile('/api/metrics/search', 'custom-measures-spec/metrics.json', { data: { isCustom: true } }) - .startAppBrowserify('custom-measures') - .clickElement('#custom-measures-create') - .checkElementExist('#create-custom-measure-form') - .checkElementCount('#create-custom-measure-metric option', 1) - .checkElementExist('#create-custom-measure-metric option[value="156"]'); - }); - - bdd.it('should show warning when there are no available metrics', function () { - return this.remote - .open() - .mockFromFile('/api/custom_measures/search', 'custom-measures-spec/search.json', - { data: { projectId: projectId } }) - .mockFromFile('/api/metrics/search', 'custom-measures-spec/metrics-limited.json', - { data: { isCustom: true } }) - .startAppBrowserify('custom-measures') - .clickElement('#custom-measures-create') - .checkElementExist('#create-custom-measure-form') - .checkElementNotExist('#create-custom-measure-metric') - .checkElementExist('#create-custom-measure-form .alert-warning') - .checkElementExist('#create-custom-measure-submit[disabled]'); - }); - - bdd.it('should update a custom measure', function () { - return this.remote - .open() - .mockFromFile('/api/custom_measures/search', 'custom-measures-spec/search.json', - { data: { projectId: projectId } }) - .mockFromFile('/api/metrics/search', 'custom-measures-spec/metrics.json', { data: { isCustom: true } }) - .startAppBrowserify('custom-measures') - .clickElement('[data-id="5"] .js-custom-measure-update') - .checkElementExist('#create-custom-measure-form') - .clearMocks() - .mockFromFile('/api/custom_measures/search', 'custom-measures-spec/search-updated.json', - { data: { projectId: projectId } }) - .mockFromString('/api/custom_measures/update', '{}', { data: { - id: '5', - value: '2', - description: 'new!' - } }) - .fillElement('#create-custom-measure-value', '2') - .fillElement('#create-custom-measure-description', 'new!') - .clickElement('#create-custom-measure-submit') - .checkElementExist('[data-id="5"]') - .checkElementInclude('[data-id="5"] .js-custom-measure-value', 'B') - .checkElementInclude('[data-id="5"] .js-custom-measure-description', 'new!'); - }); - - bdd.it('should delete a custom measure', function () { - return this.remote - .open() - .mockFromFile('/api/custom_measures/search', 'custom-measures-spec/search.json', - { data: { projectId: projectId } }) - .startAppBrowserify('custom-measures') - .clickElement('[data-id="5"] .js-custom-measure-delete') - .checkElementExist('#delete-custom-measure-form', 1) - .clearMocks() - .mockFromFile('/api/custom_measures/search', 'custom-measures-spec/search-deleted.json', - { data: { projectId: projectId } }) - .mockFromString('/api/custom_measures/delete', '{}', { data: { id: '5' } }) - .clickElement('#delete-custom-measure-submit') - .checkElementNotExist('[data-id="5"]'); - }); - }); - -}); diff --git a/server/sonar-web/test/medium/global-permissions.spec.js b/server/sonar-web/test/medium/global-permissions.spec.js deleted file mode 100644 index 8e65281fac2..00000000000 --- a/server/sonar-web/test/medium/global-permissions.spec.js +++ /dev/null @@ -1,22 +0,0 @@ -define(function (require) { - var bdd = require('intern!bdd'); - require('../helpers/test-page'); - - bdd.describe('Global Permissions', function () { - bdd.it('should show permissions', function () { - return this.remote - .open() - .mockFromFile('/api/permissions/search_global_permissions', 'permissions/global-permissions.json') - .mockFromFile('/api/permissions/users', 'permissions/users.json') - .mockFromFile('/api/permissions/groups', 'permissions/groups.json') - .startAppBrowserify('global-permissions') - .checkElementExist('#global-permissions-header') - .checkElementExist('#global-permissions-list') - .checkElementCount('#global-permissions-list > li', 6) - .checkElementInclude('#global-permissions-list > li h3', 'Administer System') - .checkElementInclude('#global-permissions-list > li p', 'Ability to perform all administration') - .checkElementInclude('#global-permissions-list > li ul > li:first-child', 'Administrator') - .checkElementInclude('#global-permissions-list > li ul > li:last-child', '1'); - }); - }); -}); diff --git a/server/sonar-web/test/medium/groups.spec.js b/server/sonar-web/test/medium/groups.spec.js deleted file mode 100644 index dbaa59bdc55..00000000000 --- a/server/sonar-web/test/medium/groups.spec.js +++ /dev/null @@ -1,140 +0,0 @@ -define(function (require) { - var bdd = require('intern!bdd'); - require('../helpers/test-page'); - - bdd.describe('Groups Page', function () { - bdd.it('should show list', function () { - return this.remote - .open() - .mockFromFile('/api/user_groups/search', 'groups-spec/search.json') - .startAppBrowserify('groups') - .checkElementInclude('#content', 'sonar-users') - .checkElementExist('#groups-list ul') - .checkElementCount('#groups-list li[data-id]', 2) - .checkElementInclude('#groups-list .js-group-name', 'sonar-users') - .checkElementInclude('#groups-list .js-group-description', - 'Any new users created will automatically join this group') - .checkElementCount('#groups-list .js-group-update', 2) - .checkElementCount('#groups-list .js-group-delete', 2) - .checkElementInclude('#groups-list-footer', '2/2'); - }); - - bdd.it('should search', function () { - return this.remote - .open() - .mockFromFile('/api/user_groups/search', 'groups-spec/search.json') - .startAppBrowserify('groups') - .checkElementInclude('#content', 'sonar-users') - .checkElementCount('#groups-list li[data-id]', 2) - .clearMocks() - .mockFromFile('/api/user_groups/search', 'groups-spec/search-filtered.json', { data: { q: 'adm' } }) - .fillElement('#groups-search-query', 'adm') - .clickElement('#groups-search-submit') - .checkElementInclude('#groups-list-footer', '1/1') - .checkElementCount('#groups-list li[data-id]', 1) - .clearMocks() - .mockFromFile('/api/user_groups/search', 'groups-spec/search.json') - .fillElement('#groups-search-query', '') - .clickElement('#groups-search-submit') - .checkElementInclude('#groups-list-footer', '2/2') - .checkElementCount('#groups-list li[data-id]', 2); - }); - - bdd.it('should show more', function () { - return this.remote - .open() - .mockFromFile('/api/user_groups/search', 'groups-spec/search-big-1.json') - .startAppBrowserify('groups') - .checkElementInclude('#content', 'sonar-users') - .checkElementCount('#groups-list li[data-id]', 1) - .checkElementInclude('#groups-list-footer', '1/2') - .clearMocks() - .mockFromFile('/api/user_groups/search', 'groups-spec/search-big-2.json', { data: { p: 2 } }) - .clickElement('#groups-fetch-more') - .checkElementInclude('#groups-list-footer', '2/2') - .checkElementCount('#groups-list li[data-id]', 2); - }); - - bdd.it('should show users', function () { - return this.remote - .open() - .mockFromFile('/api/user_groups/search', 'groups-spec/search.json') - .mockFromFile('/api/user_groups/users*', 'groups-spec/users.json') - .startAppBrowserify('groups') - .checkElementInclude('#content', 'sonar-users') - .checkElementNotInclude('#content', 'Bob') - .clickElement('[data-id="1"] .js-group-users') - .checkElementInclude('#groups-users', 'Bob') - .checkElementInclude('#groups-users', 'John'); - }); - - bdd.it('should create new group', function () { - return this.remote - .open() - .mockFromFile('/api/user_groups/search', 'groups-spec/search.json') - .mockFromFile('/api/user_groups/create', 'groups-spec/error.json', { status: 400 }) - .startAppBrowserify('groups') - .checkElementInclude('#content', 'sonar-users') - .checkElementCount('#groups-list li[data-id]', 2) - .clickElement('#groups-create') - .checkElementExist('#create-group-form') - .fillElement('#create-group-name', 'name') - .fillElement('#create-group-description', 'description') - .clickElement('#create-group-submit') - .checkElementExist('.alert.alert-danger') - .clearMocks() - .mockFromFile('/api/user_groups/search', 'groups-spec/search-created.json') - .mockFromString('/api/user_groups/create', '{}', { data: { name: 'name', description: 'description' } }) - .fillElement('#create-group-name', 'name') - .fillElement('#create-group-description', 'description') - .clickElement('#create-group-submit') - .checkElementCount('#groups-list li[data-id]', 3) - .checkElementInclude('#groups-list .js-group-name', 'name') - .checkElementInclude('#groups-list .js-group-description', 'description'); - }); - - bdd.it('should update group', function () { - return this.remote - .open() - .mockFromFile('/api/user_groups/search', 'groups-spec/search.json') - .mockFromFile('/api/user_groups/update', 'groups-spec/error.json', { status: 400 }) - .startAppBrowserify('groups') - .checkElementInclude('#content', 'sonar-users') - .clickElement('[data-id="2"] .js-group-update') - .checkElementExist('#create-group-form') - .fillElement('#create-group-name', 'guys') - .fillElement('#create-group-description', 'cool guys') - .clickElement('#create-group-submit') - .checkElementExist('.alert.alert-danger') - .clearMocks() - .mockFromFile('/api/user_groups/search', 'groups-spec/search-updated.json') - .mockFromString('/api/user_groups/update', '{}', { data: { id: '2' } }) - .fillElement('#create-group-name', 'guys') - .fillElement('#create-group-description', 'cool guys') - .clickElement('#create-group-submit') - .checkElementInclude('[data-id="2"] .js-group-name', 'guys') - .checkElementInclude('[data-id="2"] .js-group-description', 'cool guys'); - }); - - bdd.it('should delete group', function () { - return this.remote - .open() - .mockFromFile('/api/user_groups/search', 'groups-spec/search.json') - .mockFromFile('/api/user_groups/delete', 'groups-spec/error.json', { status: 400 }) - .startAppBrowserify('groups') - .checkElementInclude('#content', 'sonar-users') - .clickElement('[data-id="1"] .js-group-delete') - .checkElementExist('#delete-group-form') - .clickElement('#delete-group-submit') - .checkElementExist('.alert.alert-danger') - .clickElement('.js-modal-close') - .checkElementNotExist('#delete-group-form') - .clickElement('[data-id="1"] .js-group-delete') - .checkElementExist('#delete-group-form') - .clearMocks() - .mockFromString('/api/user_groups/delete', '{}', { data: { id: '1' } }) - .clickElement('#delete-group-submit') - .checkElementNotExist('[data-id="1"]'); - }); - }); -}); diff --git a/server/sonar-web/test/medium/issues.spec.js b/server/sonar-web/test/medium/issues.spec.js deleted file mode 100644 index 4683fc73308..00000000000 --- a/server/sonar-web/test/medium/issues.spec.js +++ /dev/null @@ -1,263 +0,0 @@ -define(function (require) { - var bdd = require('intern!bdd'); - require('../helpers/test-page'); - - bdd.describe('Issues Page', function () { - bdd.describe('Saved Searches', function () { - bdd.it('should show list of saved searches', function () { - return this.remote - .open() - .mockFromFile('/api/issue_filters/app', 'issues-spec/app.json') - .mockFromFile('/api/issue_filters/search', 'issues-spec/issue-filters.json') - .mockFromFile('/api/issues/search', 'issues-spec/search.json') - .startAppBrowserify('issues') - .checkElementCount('.js-filter', 2) - .checkElementCount('.js-filter[data-id="1"]', 1) - .checkElementCount('.js-filter[data-id="2"]', 1); - }); - - bdd.it('should load a saved search', function () { - return this.remote - .open() - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/issue_filters/app', 'issues-spec/app.json') - .mockFromFile('/api/issue_filters/search', 'issues-spec/issue-filters.json') - .mockFromFile('/api/issues/search', 'issues-spec/search.json') - .startAppBrowserify('issues') - .clickElement('.search-navigator-filters-show-list') - .clickElement('.js-filter[data-id="2"]') - .checkElementCount('.js-filter-copy', 1) - .checkElementCount('.js-filter-edit', 1) - .checkElementInclude('.issues-filters-name', 'False Positive and Won\'t Fix Issues') - .checkElementCount('.js-facet.active[data-value="FALSE-POSITIVE"]', 1); - }); - - bdd.it('should load a saved search and then resets it by new search', function () { - return this.remote - .open() - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/issue_filters/app', 'issues-spec/app.json') - .mockFromFile('/api/issue_filters/search', 'issues-spec/issue-filters.json') - .mockFromFile('/api/issues/search', 'issues-spec/search.json') - .startAppBrowserify('issues') - .clickElement('.search-navigator-filters-show-list') - .clickElement('.js-filter[data-id="2"]') - .checkElementCount('.js-filter-copy', 1) - .checkElementCount('.js-filter-edit', 1) - .checkElementInclude('.issues-filters-name', 'False Positive and Won\'t Fix Issues') - .checkElementCount('.js-facet.active[data-value="FALSE-POSITIVE"]', 1) - .clickElement('.js-new-search') - .checkElementCount('.js-facet[data-value="FALSE-POSITIVE"]:not(.active)', 1) - .checkElementNotInclude('.issues-filters-name', 'False Positive and Won\'t Fix Issues'); - }); - }); - - bdd.it('should load', function () { - return this.remote - .open('#resolved=false') - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/issue_filters/app', 'issues-spec/app.json') - .mockFromFile('/api/issue_filters/search', 'issues-spec/issue-filters.json') - .mockFromFile('/api/issues/search', 'issues-spec/search.json') - .startAppBrowserify('issues') - .checkElementExist('.facet[data-value=BLOCKER]') - .checkElementExist('.facet[data-value=CRITICAL]') - .checkElementExist('.facet[data-value=MAJOR]') - .checkElementExist('.facet[data-value=MINOR]') - .checkElementExist('.facet[data-value=INFO]') - - .checkElementExist('.facet[data-value=OPEN]') - .checkElementExist('.facet[data-value=REOPENED]') - .checkElementExist('.facet[data-value=CONFIRMED]') - .checkElementExist('.facet[data-value=RESOLVED]') - .checkElementExist('.facet[data-value=CLOSED]') - - .checkElementExist('.facet[data-unresolved]') - .checkElementExist('.facet[data-value=REMOVED]') - .checkElementExist('.facet[data-value=FIXED]') - .checkElementExist('.facet[data-value=FALSE-POSITIVE]') - - .checkElementCount('.issue', 50) - .checkElementCount('.issue.selected', 1) - .checkElementInclude('.issue', '1 more branches need to be covered by unit tests to reach') - - .checkElementExist('.js-new-search') - .checkElementExist('.js-filter-save-as') - - .checkElementInclude('#issues-total', '4,623') - .checkElementExist('.js-prev') - .checkElementExist('.js-next') - .checkElementExist('.js-reload') - .checkElementExist('.js-bulk-change'); - }); - - bdd.it('should show severity facet', function () { - return this.remote - .open('#resolved=false') - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/issue_filters/app', 'issues-spec/app.json') - .mockFromFile('/api/issue_filters/search', 'issues-spec/issue-filters.json') - .mockFromFile('/api/issues/search', 'issues-spec/search.json') - .startAppBrowserify('issues') - .checkElementCount('.issue', 50) - .clearMocks() - .mockFromFile('/api/issues/search', 'issues-spec/search-reopened.json', { data: { severities: 'BLOCKER' } }) - .clickElement('.facet[data-value=BLOCKER]') - .checkElementCount('.issue', 4); - }); - - bdd.it('should select issues', function () { - var issueKey = '94357807-fcb4-40cc-9598-9a715f1eee6e', - issueSelector = '.issue[data-key="' + issueKey + '"]'; - - return this.remote - .open('#resolved=false') - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/issue_filters/app', 'issues-spec/app.json') - .mockFromFile('/api/issue_filters/search', 'issues-spec/issue-filters.json') - .mockFromFile('/api/issues/search', 'issues-spec/search.json') - .startAppBrowserify('issues') - .checkElementExist('.js-selection') - .checkElementNotExist('.js-selection.icon-checkbox-checked') - .checkElementExist('.issue .js-toggle') - .checkElementCount('.js-toggle', 50) - .checkElementNotExist(issueSelector + ' .js-toggle .icon-checkbox-checked') - .clickElement(issueSelector + ' .js-toggle') - .checkElementExist(issueSelector + ' .js-toggle .icon-checkbox-checked') - .checkElementExist('.js-selection.icon-checkbox-single.icon-checkbox-checked') - .clickElement('.js-selection') - .checkElementNotExist('.js-selection.icon-checkbox-checked') - .checkElementNotExist('.js-toggle .icon-checkbox-checked') - .clickElement('.js-selection') - .checkElementExist('.js-selection.icon-checkbox-checked') - .checkElementCount('.js-toggle .icon-checkbox-checked', 50); - }); - - bdd.it('should bulk change issues', function () { - return this.remote - .open('#resolved=false') - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/issue_filters/app', 'issues-spec/app.json') - .mockFromFile('/api/issue_filters/search', 'issues-spec/issue-filters.json') - .mockFromFile('/api/issues/search', 'issues-spec/search.json') - .mockFromString('/issues/bulk_change_form*', - '<div id="bulk-change-form">bulk change form</div>', { contentType: 'text/plain' }) - .startAppBrowserify('issues') - .clickElement('#issues-bulk-change') - .clickElement('.js-bulk-change') - .checkElementExist('#bulk-change-form') - .checkElementInclude('#bulk-change-form', 'bulk change form'); - }); - - bdd.it('should bulk change selected issues', function () { - var issueKey = '94357807-fcb4-40cc-9598-9a715f1eee6e', - issueSelector = '.issue[data-key="' + issueKey + '"]'; - - return this.remote - .open('#resolved=false') - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/issue_filters/app', 'issues-spec/app.json') - .mockFromFile('/api/issue_filters/search', 'issues-spec/issue-filters.json') - .mockFromFile('/api/issues/search', 'issues-spec/search.json') - .mockFromString('/issues/bulk_change_form*', - '<div id="bulk-change-form">bulk change form</div>', { contentType: 'text/plain' }) - .startAppBrowserify('issues') - .checkElementExist('.js-selection') - .checkElementNotExist('.js-selection.icon-checkbox-checked') - .checkElementExist('.issue .js-toggle') - .checkElementNotExist(issueSelector + ' .js-toggle .icon-checkbox-checked') - .clickElement(issueSelector + ' .js-toggle') - .checkElementExist(issueSelector + ' .js-toggle .icon-checkbox-checked') - .checkElementExist('.js-selection.icon-checkbox-single.icon-checkbox-checked') - .clickElement('#issues-bulk-change') - .clickElement('.js-bulk-change-selected') - .checkElementExist('#bulk-change-form') - .checkElementInclude('#bulk-change-form', 'bulk change form') - .clearMocks() - .mockFromFile('/api/issues/search', 'issues-spec/search-changed.json') - .execute(function () { - window.onBulkIssues(); - }) - .checkElementExist(issueSelector + ' .js-issue-set-severity .icon-severity-blocker') - .checkElementExist(issueSelector + ' .js-toggle .icon-checkbox-checked'); - }); - - bdd.it('should filter similar issues', function () { - return this.remote - .open('#resolved=false') - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/issue_filters/app', 'issues-spec/app.json') - .mockFromFile('/api/issue_filters/search', 'issues-spec/issue-filters.json') - .mockFromFile('/api/issues/search', 'issues-spec/search-filter-similar-issues.json') - .startAppBrowserify('issues') - .checkElementCount('.issue', 2) - .clickElement('.issue.selected .js-issue-filter') - .checkElementExist('.bubble-popup') - .checkElementExist('.bubble-popup [data-property="severities"][data-value="MAJOR"]') - .checkElementExist('.bubble-popup [data-property="statuses"][data-value="CONFIRMED"]') - .checkElementExist('.bubble-popup [data-property="resolved"][data-value="false"]') - .checkElementExist('.bubble-popup [data-property="rules"][data-value="squid:S1214"]') - .checkElementExist('.bubble-popup [data-property="assigned"][data-value="false"]') - .checkElementExist('.bubble-popup [data-property="planned"][data-value="false"]') - .checkElementExist('.bubble-popup [data-property="tags"][data-value="bad-practice"]') - .checkElementExist('.bubble-popup [data-property="tags"][data-value="brain-overload"]') - .checkElementExist('.bubble-popup [data-property="projectUuids"][data-value="69e57151-be0d-4157-adff-c06741d88879"]') - .checkElementExist('.bubble-popup [data-property="moduleUuids"][data-value="7feef7c3-11b9-4175-b5a7-527ca3c75cb7"]') - .checkElementExist('.bubble-popup [data-property="fileUuids"][data-value="b0517331-0aaf-4091-b5cf-8e305dd0337a"]') - .clearMocks() - .mockFromFile('/api/issues/search', - 'issues-spec/search-filter-similar-issues-severities.json', { data: { severities: 'MAJOR' } }) - .clickElement('.bubble-popup [data-property="severities"]') - .checkElementCount('.issue', 1); - }); - - bdd.it('should open issue permalink', function () { - var issueKey = 'some-issue-key'; - - return this.remote - .open('#issues=' + issueKey) - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/issue_filters/app', 'issues-page-should-open-issue-permalink/app.json') - .mockFromFile('/api/issue_filters/search', 'issues-spec/issue-filters.json') - //.mockFromString('/api/issues/search', '{}', { data: { issues: issueKey, p: 2 } }) - .mockFromFile('/api/issues/search', 'issues-page-should-open-issue-permalink/search.json', { data: { issues: issueKey } }) - .mockFromFile('/api/components/app', 'issues-page-should-open-issue-permalink/components-app.json') - .mockFromFile('/api/sources/lines', 'issues-page-should-open-issue-permalink/lines.json') - .startAppBrowserify('issues') - .checkElementExist('.source-line') - .checkElementInclude('.source-line', 'public void executeOn(Project project, SensorContext context') - .checkElementCount('.issue', 1) - .checkElementCount('.issue[data-key="' + issueKey + '"]', 1); - }); - - bdd.it('should open closed facet', function () { - return this.remote - .open() - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/issue_filters/app', 'issues-spec/app.json') - .mockFromFile('/api/issue_filters/search', 'issues-spec/issue-filters.json') - .mockFromFile('/api/issues/search', 'issues-spec/search-rules-facet.json', { data: { facets: 'rules' } }) - .mockFromFile('/api/issues/search', 'issues-spec/search.json') - .startAppBrowserify('issues') - .clickElement('[data-property="rules"] .js-facet-toggle') - .checkElementCount('[data-property="rules"] .js-facet', 13) - .checkElementInclude('[data-property="rules"] .js-facet:nth-child(1)', 'Objects should be compared with'); - }); - - bdd.it('should open comment form after FP or WF transition', function () { - return this.remote - .open('#resolved=false') - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/issue_filters/app', 'issues-spec/app.json') - .mockFromFile('/api/issue_filters/search', 'issues-spec/issue-filters.json') - .mockFromFile('/api/issues/search', 'issues-spec/search.json') - .mockFromFile('/api/issues/do_transition', 'issues-spec/show-fp-new.json') - .startAppBrowserify('issues') - .checkElementExist('.issue.selected') - .clickElement('.issue.selected .js-issue-transition') - .clickElement('.js-issue-transition[data-value="falsepositive"]') - .checkElementExist('.js-issue-comment-submit'); - }); - }); - -}); diff --git a/server/sonar-web/test/medium/maintenance.spec.js b/server/sonar-web/test/medium/maintenance.spec.js deleted file mode 100644 index afc7c539cea..00000000000 --- a/server/sonar-web/test/medium/maintenance.spec.js +++ /dev/null @@ -1,28 +0,0 @@ -define(function (require) { - var bdd = require('intern!bdd'); - require('../helpers/test-page'); - - bdd.describe('Maintenance Page', function () { - bdd.it('should work', function () { - return this.remote - .open() - .mockFromFile('/api/system/status', 'maintenance-spec/status-up.json') - .startAppBrowserify('maintenance', { setup: false }) - .checkElementExist('.maintenance-title') - .checkElementExist('.maintenance-title') - .checkElementExist('.maintenance-text'); - }); - - bdd.it('should change status', function () { - return this.remote - .open() - .mockFromFile('/api/system/status', 'maintenance-spec/status-up.json') - .startAppBrowserify('maintenance', { setup: false }) - .checkElementExist('.maintenance-title') - .checkElementNotExist('.maintenance-title.text-danger') - .clearMocks() - .mockFromFile('/api/system/status', 'maintenance-spec/status-down.json') - .checkElementExist('.maintenance-title.text-danger'); - }); - }); -}); diff --git a/server/sonar-web/test/medium/metrics.spec.js b/server/sonar-web/test/medium/metrics.spec.js deleted file mode 100644 index e86d5d93ed8..00000000000 --- a/server/sonar-web/test/medium/metrics.spec.js +++ /dev/null @@ -1,125 +0,0 @@ -define(function (require) { - var bdd = require('intern!bdd'); - require('../helpers/test-page'); - - bdd.describe('Custom Metrics Page', function () { - bdd.it('should show list', function () { - return this.remote - .open() - .mockFromFile('/api/metrics/domains', 'metrics-spec/domains.json') - .mockFromFile('/api/metrics/types', 'metrics-spec/types.json') - .mockFromFile('/api/metrics/search', 'metrics-spec/search.json') - .startAppBrowserify('metrics') - .checkElementExist('#metrics-list li') - .checkElementCount('#metrics-list li[data-id]', 3) - .checkElementInclude('#metrics-list .js-metric-name', 'Business value') - .checkElementInclude('#metrics-list .js-metric-key', 'business_value') - .checkElementInclude('#metrics-list .js-metric-domain', 'Complexity') - .checkElementInclude('#metrics-list .js-metric-type', 'PERCENT') - .checkElementInclude('#metrics-list .js-metric-description', 'Description of Business value') - .checkElementCount('#metrics-list .js-metric-update', 3) - .checkElementCount('#metrics-list .js-metric-delete', 3) - .checkElementInclude('#metrics-list-footer', '3/3'); - }); - - bdd.it('should show more', function () { - return this.remote - .open() - .mockFromFile('/api/metrics/domains', 'metrics-spec/domains.json') - .mockFromFile('/api/metrics/types', 'metrics-spec/types.json') - .mockFromFile('/api/metrics/search', 'metrics-spec/search-big-1.json') - .startAppBrowserify('metrics') - .checkElementExist('#metrics-list li') - .checkElementCount('#metrics-list li[data-id]', 2) - .checkElementInclude('#metrics-list-footer', '2/3') - .clearMocks() - .mockFromFile('/api/metrics/search', 'metrics-spec/search-big-2.json', { data: { p: 2 } }) - .clickElement('#metrics-fetch-more') - .checkElementInclude('#metrics-list-footer', '3/3') - .checkElementCount('#metrics-list li[data-id]', 3); - }); - - bdd.it('should create custom metric', function () { - return this.remote - .open() - .mockFromFile('/api/metrics/domains', 'metrics-spec/domains.json') - .mockFromFile('/api/metrics/types', 'metrics-spec/types.json') - .mockFromFile('/api/metrics/search', 'metrics-spec/search.json') - .mockFromFile('/api/metrics/create', 'metrics-spec/error.json', { status: 400 }) - .startAppBrowserify('metrics') - .checkElementExist('#metrics-list li') - .checkElementCount('#metrics-list li[data-id]', 3) - .clickElement('#metrics-create') - .checkElementExist('#create-metric-form') - .fillElement('#create-metric-key', 'new_metric') - .fillElement('#create-metric-name', 'New Metric') - .fillElement('#create-metric-domain', 'Domain for New Metric') - .fillElement('#create-metric-type', 'RATING') - .clickElement('#create-metric-submit') - .checkElementExist('.alert.alert-danger') - .clearMocks() - .mockFromFile('/api/metrics/search', 'metrics-spec/search-created.json') - .mockFromString('/api/metrics/create', '{}', - { data: { key: 'new_metric', name: 'New Metric', domain: 'Domain for New Metric', type: 'RATING' } }) - .fillElement('#create-metric-key', 'new_metric') - .fillElement('#create-metric-name', 'New Metric') - .fillElement('#create-metric-domain', 'Domain for New Metric') - .fillElement('#create-metric-type', 'RATING') - .clickElement('#create-metric-submit') - .checkElementCount('#metrics-list li[data-id]', 4) - .checkElementInclude('#metrics-list .js-metric-key', 'new_metric') - .checkElementInclude('#metrics-list .js-metric-name', 'New Metric'); - }); - - bdd.it('should update custom metric', function () { - return this.remote - .open() - .mockFromFile('/api/metrics/domains', 'metrics-spec/domains.json') - .mockFromFile('/api/metrics/types', 'metrics-spec/types.json') - .mockFromFile('/api/metrics/search', 'metrics-spec/search.json') - .mockFromFile('/api/metrics/update', 'metrics-spec/error.json', { status: 400 }) - .startAppBrowserify('metrics') - .checkElementExist('#metrics-list li') - .clickElement('[data-id="3"] .js-metric-update') - .checkElementExist('#create-metric-form') - .fillElement('#create-metric-key', 'updated_key') - .fillElement('#create-metric-name', 'Updated Name') - .fillElement('#create-metric-domain', 'Random Domain') - .fillElement('#create-metric-type', 'WORK_DUR') - .clickElement('#create-metric-submit') - .checkElementExist('.alert.alert-danger') - .clearMocks() - .mockFromFile('/api/metrics/search', 'metrics-spec/search-updated.json') - .mockFromString('/api/metrics/update', '{}', - { data: { id: '3', key: 'updated_key', name: 'Updated Name', domain: 'Random Domain', type: 'WORK_DUR' } }) - .fillElement('#create-metric-key', 'updated_key') - .fillElement('#create-metric-name', 'Updated Name') - .fillElement('#create-metric-domain', 'Random Domain') - .fillElement('#create-metric-type', 'WORK_DUR') - .clickElement('#create-metric-submit') - .checkElementInclude('#metrics-list [data-id="3"] .js-metric-key', 'updated_key') - .checkElementInclude('#metrics-list [data-id="3"] .js-metric-name', 'Updated Name') - .checkElementInclude('#metrics-list [data-id="3"] .js-metric-domain', 'Random Domain') - .checkElementInclude('#metrics-list [data-id="3"] .js-metric-type', 'WORK_DUR'); - }); - - bdd.it('should delete custom metric', function () { - return this.remote - .open() - .mockFromFile('/api/metrics/domains', 'metrics-spec/domains.json') - .mockFromFile('/api/metrics/types', 'metrics-spec/types.json') - .mockFromFile('/api/metrics/search', 'metrics-spec/search.json') - .mockFromFile('/api/metrics/delete', 'metrics-spec/error.json', { status: 400 }) - .startAppBrowserify('metrics') - .checkElementExist('#metrics-list li') - .clickElement('[data-id="3"] .js-metric-delete') - .checkElementExist('#delete-metric-form') - .clickElement('#delete-metric-submit') - .checkElementExist('.alert.alert-danger') - .clearMocks() - .mockFromString('/api/metrics/delete', '{}', { data: { ids: '3' } }) - .clickElement('#delete-metric-submit') - .checkElementNotExist('[data-id="3"]'); - }); - }); -}); diff --git a/server/sonar-web/test/medium/project-permissions.spec.js b/server/sonar-web/test/medium/project-permissions.spec.js deleted file mode 100644 index 6ed89b073f8..00000000000 --- a/server/sonar-web/test/medium/project-permissions.spec.js +++ /dev/null @@ -1,67 +0,0 @@ -define(function (require) { - var bdd = require('intern!bdd'); - require('../helpers/test-page'); - - bdd.describe('Project Permissions', function () { - bdd.it('should show permissions', function () { - return this.remote - .open() - .mockFromFile('/api/permissions/search_project_permissions', 'permissions/project-permissions.json') - .mockFromFile('/api/permissions/search_templates', 'permissions/permission-templates.json') - .startAppBrowserify('project-permissions') - .checkElementExist('#project-permissions-header') - .checkElementExist('#projects') - .checkElementCount('#projects > thead > tr > th', 4) - .checkElementCount('#projects > tbody > tr', 2) - .checkElementInclude('#projects > tbody > tr:first-child td:nth-child(1)', 'My Project') - .checkElementInclude('#projects > tbody > tr:first-child td:nth-child(2)', '3') - .checkElementInclude('#projects > tbody > tr:first-child td:nth-child(2)', '4') - .checkElementInclude('#projects > tbody > tr:first-child td:nth-child(3)', '1') - .checkElementInclude('#projects > tbody > tr:first-child td:nth-child(3)', '2'); - }); - - bdd.it('should apply a permission template', function () { - return this.remote - .open() - .mockFromFile('/api/permissions/search_project_permissions', 'permissions/project-permissions.json') - .mockFromFile('/api/permissions/search_templates', 'permissions/permission-templates.json') - .startAppBrowserify('project-permissions') - .checkElementInclude('#projects > tbody > tr:first-child td:nth-child(1)', 'My Project') - .checkElementInclude('#projects > tbody > tr:first-child td:nth-child(2)', '3') - .checkElementInclude('#projects > tbody > tr:first-child td:nth-child(2)', '4') - .checkElementInclude('#projects > tbody > tr:first-child td:nth-child(3)', '1') - .checkElementInclude('#projects > tbody > tr:first-child td:nth-child(3)', '2') - .clearMocks() - .mockFromFile('/api/permissions/search_project_permissions', 'permissions/project-permissions-changed.json') - .mockFromString('/api/permissions/apply_template', '{}') - .clickElement('#projects > tbody > tr:first-child .js-apply-template') - .clickElement('#project-permissions-apply-template') - .checkElementInclude('#projects > tbody > tr:first-child td:nth-child(2)', '13') - .checkElementInclude('#projects > tbody > tr:first-child td:nth-child(2)', '14') - .checkElementInclude('#projects > tbody > tr:first-child td:nth-child(3)', '11') - .checkElementInclude('#projects > tbody > tr:first-child td:nth-child(3)', '12'); - }); - - bdd.it('should bulk apply a permission template', function () { - return this.remote - .open() - .mockFromFile('/api/permissions/search_project_permissions', 'permissions/project-permissions.json') - .mockFromFile('/api/permissions/search_templates', 'permissions/permission-templates.json') - .startAppBrowserify('project-permissions') - .checkElementInclude('#projects > tbody > tr:first-child td:nth-child(1)', 'My Project') - .checkElementInclude('#projects > tbody > tr:first-child td:nth-child(2)', '3') - .checkElementInclude('#projects > tbody > tr:first-child td:nth-child(2)', '4') - .checkElementInclude('#projects > tbody > tr:first-child td:nth-child(3)', '1') - .checkElementInclude('#projects > tbody > tr:first-child td:nth-child(3)', '2') - .clearMocks() - .mockFromFile('/api/permissions/search_project_permissions', 'permissions/project-permissions-changed.json') - .mockFromString('/api/permissions/apply_template', '{}') - .clickElement('.js-bulk-apply-template') - .clickElement('#project-permissions-apply-template') - .checkElementInclude('#projects > tbody > tr:first-child td:nth-child(2)', '13') - .checkElementInclude('#projects > tbody > tr:first-child td:nth-child(2)', '14') - .checkElementInclude('#projects > tbody > tr:first-child td:nth-child(3)', '11') - .checkElementInclude('#projects > tbody > tr:first-child td:nth-child(3)', '12'); - }); - }); -}); diff --git a/server/sonar-web/test/medium/quality-gates.spec.js b/server/sonar-web/test/medium/quality-gates.spec.js deleted file mode 100644 index 79f79ef4b27..00000000000 --- a/server/sonar-web/test/medium/quality-gates.spec.js +++ /dev/null @@ -1,277 +0,0 @@ -define(function (require) { - var bdd = require('intern!bdd'); - require('../helpers/test-page'); - - bdd.describe('Quality Gates Page', function () { - bdd.it('should show list', function () { - return this.remote - .open() - .mockFromFile('/api/qualitygates/app', 'quality-gates-spec/app.json') - .mockFromFile('/api/qualitygates/list', 'quality-gates-spec/list.json') - .startAppBrowserify('quality-gates', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-list .list-group-item') - .checkElementCount('.js-list .list-group-item', 3) - .checkElementInclude('.js-list .list-group-item', 'SonarQube way') - .checkElementInclude('.js-list .list-group-item', 'Simple Gate') - .checkElementInclude('.js-list .list-group-item', 'Another Gate') - .checkElementCount('.js-list .badge', 1); - }); - - bdd.it('should show details for anonymous', function () { - return this.remote - .open() - .mockFromFile('/api/qualitygates/app', 'quality-gates-spec/app-anonymous.json') - .mockFromFile('/api/qualitygates/list', 'quality-gates-spec/list.json') - .mockFromFile('/api/qualitygates/show', 'quality-gates-spec/show.json', { data: { id: 1 } }) - .startAppBrowserify('quality-gates', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-list .list-group-item') - .clickElement('.js-list .list-group-item[data-id="1"]') - .checkElementExist('.search-navigator-header-component') - .checkElementCount('.js-list .list-group-item.active', 1) - .checkElementInclude('.js-list .list-group-item.active', 'SonarQube way') - .checkElementInclude('.search-navigator-workspace-header', 'SonarQube way') - .checkElementNotExist('#quality-gate-rename') - .checkElementNotExist('#quality-gate-copy') - .checkElementNotExist('#quality-gate-unset-as-default') - .checkElementNotExist('#quality-gate-delete') - .checkElementExist('.js-conditions') - .checkElementCount('.js-conditions tbody tr', 8) - .checkElementNotExist('.js-conditions .update-condition') - .checkElementNotExist('.js-conditions .delete-condition') - .checkElementExist('.quality-gate-default-message') - .checkElementExist('.js-more.hidden') - .clickElement('.js-show-more') - .checkElementExist('.js-more:not(.hidden)'); - }); - - bdd.it('should show details for admin', function () { - return this.remote - .open() - .mockFromFile('/api/qualitygates/app', 'quality-gates-spec/app.json') - .mockFromFile('/api/qualitygates/list', 'quality-gates-spec/list.json') - .mockFromFile('/api/qualitygates/show', 'quality-gates-spec/show.json', { data: { id: 1 } }) - .startAppBrowserify('quality-gates', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-list .list-group-item') - .clickElement('.js-list .list-group-item[data-id="1"]') - .checkElementExist('.search-navigator-header-component') - .checkElementCount('.js-list .list-group-item.active', 1) - .checkElementInclude('.js-list .list-group-item.active', 'SonarQube way') - .checkElementInclude('.search-navigator-workspace-header', 'SonarQube way') - .checkElementExist('#quality-gate-rename') - .checkElementExist('#quality-gate-copy') - .checkElementExist('#quality-gate-toggle-default') - .checkElementExist('#quality-gate-delete') - .checkElementExist('.js-conditions') - .checkElementCount('.js-conditions tbody tr', 8) - .checkElementCount('.js-conditions .update-condition', 8) - .checkElementCount('.js-conditions .delete-condition', 8) - .checkElementExist('.quality-gate-default-message'); - }); - - bdd.it('should show projects', function () { - return this.remote - .open('#show/5') - .mockFromFile('/api/qualitygates/app', 'quality-gates-spec/app-anonymous.json') - .mockFromFile('/api/qualitygates/list', 'quality-gates-spec/list.json') - .mockFromFile('/api/qualitygates/show', 'quality-gates-spec/show-another.json', { data: { id: 5 } }) - .mockFromFile('/api/qualitygates/search?gateId=5', 'quality-gates-spec/projects.json') - .startAppBrowserify('quality-gates', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-list .list-group-item') - .checkElementExist('.select-list-list li') - .checkElementCount('.select-list-list li', 1) - .checkElementInclude('.select-list-list li', 'SonarQube'); - }); - - bdd.it('should rename', function () { - return this.remote - .open('#show/1') - .mockFromFile('/api/qualitygates/app', 'quality-gates-spec/app.json') - .mockFromFile('/api/qualitygates/list', 'quality-gates-spec/list.json') - .mockFromFile('/api/qualitygates/show', 'quality-gates-spec/show.json', { data: { id: 1 } }) - .mockFromFile('/api/qualitygates/rename', 'quality-gates-spec/rename.json', { data: { id: 1, name: 'New Name' } }) - .startAppBrowserify('quality-gates', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-list .list-group-item') - .checkElementExist('.search-navigator-header-component') - .clickElement('#quality-gate-rename') - .checkElementExist('#quality-gate-form-name') - .fillElement('#quality-gate-form-name', 'New Name') - .clickElement('.modal-foot button') - .checkElementInclude('.search-navigator-header-component', 'New Name') - .checkElementInclude('.js-list .list-group-item.active', 'New Name'); - }); - - bdd.it('should copy', function () { - return this.remote - .open('#show/1') - .mockFromFile('/api/qualitygates/app', 'quality-gates-spec/app.json') - .mockFromFile('/api/qualitygates/list', 'quality-gates-spec/list.json') - .mockFromFile('/api/qualitygates/show', 'quality-gates-spec/show.json', { data: { id: 1 } }) - .mockFromFile('/api/qualitygates/show', 'quality-gates-spec/show-created.json', { data: { id: 6 } }) - .mockFromFile('/api/qualitygates/copy', 'quality-gates-spec/copy.json', { data: { id: 1, name: 'New Name' } }) - .startAppBrowserify('quality-gates', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-list .list-group-item') - .checkElementExist('.search-navigator-header-component') - .clickElement('#quality-gate-copy') - .checkElementExist('#quality-gate-form-name') - .fillElement('#quality-gate-form-name', 'New Name') - .clickElement('.modal-foot button') - .checkElementInclude('.search-navigator-header-component', 'New Name') - .checkElementInclude('.js-list .list-group-item.active', 'New Name') - .checkElementInclude('.js-list .list-group-item', 'SonarQube way'); - }); - - bdd.it('should set as default', function () { - return this.remote - .open('#show/5') - .mockFromFile('/api/qualitygates/app', 'quality-gates-spec/app.json') - .mockFromFile('/api/qualitygates/list', 'quality-gates-spec/list.json') - .mockFromFile('/api/qualitygates/show', 'quality-gates-spec/show-another.json', { data: { id: 5 } }) - .mockFromString('/api/qualitygates/set_as_default', '{}', { data: { id: 5 } }) - .startAppBrowserify('quality-gates', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-list .list-group-item') - .checkElementExist('.search-navigator-header-component') - .checkElementNotExist('.js-list .list-group-item.active .badge') - .checkElementNotExist('.quality-gate-default-message') - .clickElement('#quality-gate-toggle-default') - .checkElementExist('.js-list .list-group-item.active .badge') - .checkElementExist('.quality-gate-default-message') - .checkElementCount('.js-list .badge', 1); - }); - - bdd.it('should unset as default', function () { - return this.remote - .open('#show/1') - .mockFromFile('/api/qualitygates/app', 'quality-gates-spec/app.json') - .mockFromFile('/api/qualitygates/list', 'quality-gates-spec/list.json') - .mockFromFile('/api/qualitygates/show', 'quality-gates-spec/show.json', { data: { id: 1 } }) - .mockFromString('/api/qualitygates/unset_default', '{}', { data: { id: 1 } }) - .startAppBrowserify('quality-gates', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-list .list-group-item') - .checkElementExist('.search-navigator-header-component') - .checkElementExist('.js-list .list-group-item.active .badge') - .checkElementExist('.quality-gate-default-message') - .clickElement('#quality-gate-toggle-default') - .checkElementNotExist('.js-list .list-group-item.active .badge') - .checkElementNotExist('.quality-gate-default-message') - .checkElementNotExist('.js-list .badge'); - }); - - bdd.it('should create', function () { - return this.remote - .open() - .mockFromFile('/api/qualitygates/app', 'quality-gates-spec/app.json') - .mockFromFile('/api/qualitygates/list', 'quality-gates-spec/list.json') - .mockFromString('/api/qualitygates/create', '{"errors":[{"msg": "error"}]}', - { status: 400, data: { name: 'Bad' } }) - .mockFromFile('/api/qualitygates/create', 'quality-gates-spec/create.json', { data: { name: 'New Name' } }) - .mockFromFile('/api/qualitygates/show', 'quality-gates-spec/show-created.json', { data: { id: 6 } }) - .startAppBrowserify('quality-gates', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-list .list-group-item') - .clickElement('#quality-gate-add') - .checkElementExist('#quality-gate-form-name') - .fillElement('#quality-gate-form-name', 'Bad') - .clickElement('.modal-foot button') - .checkElementExist('.alert-danger') - .fillElement('#quality-gate-form-name', 'New Name') - .clickElement('.modal-foot button') - .checkElementExist('.search-navigator-header-component') - .checkElementInclude('.search-navigator-header-component', 'New Name') - .checkElementInclude('.js-list .list-group-item.active', 'New Name'); - }); - - bdd.it('should delete', function () { - return this.remote - .open('#show/5') - .mockFromFile('/api/qualitygates/app', 'quality-gates-spec/app.json') - .mockFromFile('/api/qualitygates/list', 'quality-gates-spec/list.json') - .mockFromFile('/api/qualitygates/show', 'quality-gates-spec/show-another.json', { data: { id: 5 } }) - .mockFromString('/api/qualitygates/destroy', '{"errors":[{"msg": "error"}]}', - { status: 400 }) - .startAppBrowserify('quality-gates', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-list .list-group-item') - .checkElementExist('.search-navigator-header-component') - .checkElementCount('.js-list .list-group-item', 3) - .clickElement('#quality-gate-delete') - .checkElementExist('#delete-gate-submit') - .clickElement('#delete-gate-submit') - .checkElementExist('.alert-danger') - .clearMocks() - .mockFromString('/api/qualitygates/destroy', '{}', { data: { id: 5 } }) - .clickElement('#delete-gate-submit') - .checkElementNotExist('.search-navigator-header-component') - .checkElementCount('.js-list .list-group-item', 2); - }); - - bdd.it('should add condition', function () { - return this.remote - .open('#show/5') - .mockFromFile('/api/qualitygates/app', 'quality-gates-spec/app.json') - .mockFromFile('/api/qualitygates/list', 'quality-gates-spec/list.json') - .mockFromFile('/api/qualitygates/show', 'quality-gates-spec/show-another.json', { data: { id: 5 } }) - .mockFromFile('/api/qualitygates/create_condition', 'quality-gates-spec/create-condition.json', - { data: { gateId: 5, metric: 'complexity', op: 'GT', period: '1', warning: '3', error: '4' } }) - .startAppBrowserify('quality-gates', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-list .list-group-item') - .checkElementExist('.search-navigator-header-component') - .checkElementCount('.js-conditions [name="error"]', 0) - .fillElement('#quality-gate-new-condition-metric', 'complexity') - .changeElement('#quality-gate-new-condition-metric') - .checkElementCount('.js-conditions [name="error"]', 1) - .clickElement('.cancel-add-condition') - .checkElementNotExist('.cancel-add-condition') - .checkElementCount('.js-conditions [name="error"]', 0) - .fillElement('#quality-gate-new-condition-metric', 'complexity') - .changeElement('#quality-gate-new-condition-metric') - .checkElementCount('.js-conditions [name="error"]', 1) - .fillElement('[name="period"]', '1') - .fillElement('[name="operator"]', 'GT') - .fillElement('[name="warning"]', '3') - .fillElement('[name="error"]', '4') - .clickElement('.add-condition') - .checkElementExist('.update-condition') - .checkElementExist('.update-condition[disabled]') - .checkElementExist('.delete-condition'); - }); - - bdd.it('should update condition', function () { - return this.remote - .open('#show/1') - .mockFromFile('/api/qualitygates/app', 'quality-gates-spec/app.json') - .mockFromFile('/api/qualitygates/list', 'quality-gates-spec/list.json') - .mockFromFile('/api/qualitygates/show', 'quality-gates-spec/show.json', { data: { id: 1 } }) - .mockFromFile('/api/qualitygates/update_condition', 'quality-gates-spec/update-condition.json', - { data: { id: 1, warning: '173' } }) - .startAppBrowserify('quality-gates', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-list .list-group-item') - .checkElementExist('.update-condition') - .checkElementExist('.js-conditions tr:first-child .update-condition[disabled]') - .fillElement('.js-conditions tr:first-child [name="warning"]', '173') - .changeElement('.js-conditions tr:first-child [name="warning"]') - .checkElementNotExist('.js-conditions tr:first-child .update-condition[disabled]') - .clickElement('.js-conditions tr:first-child .update-condition') - .checkElementNotExist('.js-conditions tr:first-child .update-condition:not([disabled])') - .checkElementExist('.js-conditions tr:first-child .update-condition[disabled]'); - }); - - bdd.it('should delete condition', function () { - return this.remote - .open('#show/1') - .mockFromFile('/api/qualitygates/app', 'quality-gates-spec/app.json') - .mockFromFile('/api/qualitygates/list', 'quality-gates-spec/list.json') - .mockFromFile('/api/qualitygates/show', 'quality-gates-spec/show.json', { data: { id: 1 } }) - .mockFromString('/api/qualitygates/delete_condition', '{"errors":[{"msg": "error"}]}', { status: 400 }) - .startAppBrowserify('quality-gates', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-list .list-group-item') - .checkElementExist('.delete-condition') - .checkElementCount('.delete-condition', 8) - .clickElement('.js-conditions tr:first-child .delete-condition') - .checkElementExist('#delete-condition-submit') - .clickElement('#delete-condition-submit') - .checkElementExist('.alert-danger') - .clearMocks() - .mockFromString('/api/qualitygates/delete_condition', '{}', { data: { id: 1 } }) - .clickElement('#delete-condition-submit') - .checkElementCount('.delete-condition', 7); - }); - }); -}); diff --git a/server/sonar-web/test/medium/quality-profiles.spec.js b/server/sonar-web/test/medium/quality-profiles.spec.js deleted file mode 100644 index ecafd4b0c01..00000000000 --- a/server/sonar-web/test/medium/quality-profiles.spec.js +++ /dev/null @@ -1,556 +0,0 @@ -define(function (require) { - var bdd = require('intern!bdd'); - require('../helpers/test-page'); - - bdd.describe('Quality Profiles Page', function () { - bdd.it('should show list', function () { - return this.remote - .open() - .mockFromFile('/api/users/current', 'quality-profiles/user.json') - .mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search.json') - .mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json') - .mockFromFile('/api/languages/list', 'quality-profiles/languages.json') - .startAppBrowserify('quality-profiles', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-list .list-group-item') - .checkElementCount('.js-list .list-group-item', 5) - .checkElementInclude('.js-list .list-group-item', 'Sonar way') - .checkElementInclude('.js-list .list-group-item', 'PSR-2') - .checkElementCount('.js-list-language', 4) - .checkElementInclude('.js-list-language', 'Java') - .checkElementInclude('.js-list-language', 'JavaScript') - .checkElementInclude('.js-list-language', 'PHP') - .checkElementInclude('.js-list-language', 'Python') - .checkElementCount('.js-list .badge', 4); - }); - - bdd.it('should filter list by language', function () { - return this.remote - .open() - .mockFromFile('/api/users/current', 'quality-profiles/user.json') - .mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search.json') - .mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json') - .mockFromFile('/api/languages/list', 'quality-profiles/languages.json') - .startAppBrowserify('quality-profiles', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-list .list-group-item') - .checkElementCount('.js-list .list-group-item', 5) - .checkElementExist('.js-list .list-group-item[data-key="java-sonar-way-67887"]:not(.hidden)') - .checkElementExist('.js-list .list-group-item[data-key="js-sonar-way-71566"]:not(.hidden)') - .checkElementCount('.js-list-language', 4) - .checkElementExist('.js-list-language[data-language="java"]:not(.hidden)') - .checkElementExist('.js-list-language[data-language="js"]:not(.hidden)') - .checkElementExist('#quality-profiles-filter-by-language') - .clickElement('#quality-profiles-filter-by-language .dropdown-toggle') - .clickElement('.js-filter-by-language[data-language="js"]') - .checkElementNotExist('.js-list .list-group-item[data-key="java-sonar-way-67887"]:not(.hidden)') - .checkElementExist('.js-list .list-group-item[data-key="js-sonar-way-71566"]:not(.hidden)') - .checkElementNotExist('.js-list-language[data-language="java"]:not(.hidden)') - .checkElementExist('.js-list-language[data-language="js"]:not(.hidden)') - .clickElement('#quality-profiles-filter-by-language .dropdown-toggle') - .clickElement('.js-filter-by-language:nth-child(1)') - .checkElementExist('.js-list .list-group-item[data-key="java-sonar-way-67887"]:not(.hidden)') - .checkElementExist('.js-list .list-group-item[data-key="js-sonar-way-71566"]:not(.hidden)') - .checkElementExist('.js-list-language[data-language="java"]:not(.hidden)') - .checkElementExist('.js-list-language[data-language="js"]:not(.hidden)'); - }); - - bdd.it('should show details', function () { - return this.remote - .open() - .mockFromFile('/api/users/current', 'quality-profiles/user.json') - .mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search.json') - .mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json') - .mockFromFile('/api/languages/list', 'quality-profiles/languages.json') - .mockFromFile('/api/rules/search', 'quality-profiles/rules.json', - { data: { qprofile: 'java-sonar-way-67887', activation: 'true' } }) - .mockFromFile('/api/qualityprofiles/inheritance', 'quality-profiles/inheritance.json', - { data: { profileKey: 'java-sonar-way-67887' } }) - .startAppBrowserify('quality-profiles', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-list .list-group-item') - .clickElement('.js-list .list-group-item[data-key="java-sonar-way-67887"]') - .checkElementExist('.search-navigator-header-component') - .checkElementCount('.js-list .list-group-item.active', 1) - .checkElementInclude('.js-list .list-group-item.active', 'Sonar way') - .checkElementInclude('.search-navigator-workspace-header', 'Sonar way') - .checkElementInclude('.search-navigator-workspace-header', 'Java') - .checkElementExist('#quality-profile-backup') - .checkElementNotExist('#quality-profile-rename') - .checkElementNotExist('#quality-profile-copy') - .checkElementNotExist('#quality-profile-delete') - .checkElementNotExist('#quality-profile-set-as-default') - .checkElementNotExist('#quality-profile-change-parent'); - }); - - bdd.it('should show details for admin', function () { - return this.remote - .open() - .mockFromFile('/api/users/current', 'quality-profiles/user-admin.json') - .mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search.json') - .mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json') - .mockFromFile('/api/languages/list', 'quality-profiles/languages.json') - .mockFromFile('/api/rules/search', 'quality-profiles/rules.json', - { data: { qprofile: 'java-sonar-way-67887', activation: 'true' } }) - .mockFromFile('/api/qualityprofiles/inheritance', 'quality-profiles/inheritance.json', - { data: { profileKey: 'java-sonar-way-67887' } }) - .startAppBrowserify('quality-profiles', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-list .list-group-item') - .clickElement('.js-list .list-group-item[data-key="java-sonar-way-67887"]') - .checkElementExist('.search-navigator-header-component') - .checkElementCount('.js-list .list-group-item.active', 1) - .checkElementInclude('.js-list .list-group-item.active', 'Sonar way') - .checkElementInclude('.search-navigator-workspace-header', 'Sonar way') - .checkElementInclude('.search-navigator-workspace-header', 'Java') - .checkElementExist('#quality-profile-backup') - .checkElementExist('#quality-profile-rename') - .checkElementExist('#quality-profile-copy') - .checkElementNotExist('#quality-profile-delete') - .checkElementNotExist('#quality-profile-set-as-default') - .checkElementExist('#quality-profile-change-parent'); - }); - - bdd.it('should show inheritance details', function () { - return this.remote - .open() - .mockFromFile('/api/users/current', 'quality-profiles/user-admin.json') - .mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search-inheritance.json') - .mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json') - .mockFromFile('/api/languages/list', 'quality-profiles/languages.json') - .mockFromFile('/api/rules/search', 'quality-profiles/rules.json') - .mockFromFile('/api/qualityprofiles/inheritance', 'quality-profiles/inheritance-plus.json', { - data: { profileKey: 'java-inherited-profile-85155' } - }) - .startAppBrowserify('quality-profiles', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-list .list-group-item') - .clickElement('.js-list .list-group-item[data-key="java-inherited-profile-85155"]') - .checkElementExist('.search-navigator-header-component') - .checkElementCount('#quality-profile-ancestors li', 1) - .checkElementInclude('#quality-profile-ancestors', 'Sonar way') - .checkElementInclude('#quality-profile-ancestors', '161') - .checkElementCount('#quality-profile-inheritance-current', 1) - .checkElementInclude('#quality-profile-inheritance-current', 'Inherited Profile') - .checkElementInclude('#quality-profile-inheritance-current', '163') - .checkElementInclude('#quality-profile-inheritance-current', '7') - .checkElementCount('#quality-profile-children li', 1) - .checkElementInclude('#quality-profile-children', 'Second Level Inherited Profile') - .checkElementInclude('#quality-profile-children', '165'); - }); - - bdd.it('should show selected projects', function () { - return this.remote - .open() - .mockFromFile('/api/users/current', 'quality-profiles/user-admin.json') - .mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search.json') - .mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json') - .mockFromFile('/api/languages/list', 'quality-profiles/languages.json') - .mockFromFile('/api/rules/search', 'quality-profiles/rules.json') - .mockFromFile('/api/qualityprofiles/projects?key=php-psr-2-46772', 'quality-profiles/projects.json') - .mockFromFile('/api/qualityprofiles/inheritance', 'quality-profiles/inheritance.json') - .startAppBrowserify('quality-profiles', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-list .list-group-item') - .clickElement('.js-list .list-group-item[data-key="php-psr-2-46772"]') - .checkElementExist('#quality-profile-projects') - .checkElementCount('#quality-profile-projects .select-list-list li', 2) - .checkElementInclude('#quality-profile-projects .select-list-list li', 'CSS') - .checkElementInclude('#quality-profile-projects .select-list-list li', 'http-request-parent'); - }); - - bdd.it('should move between profiles', function () { - return this.remote - .open() - .mockFromFile('/api/users/current', 'quality-profiles/user.json') - .mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search-inheritance.json') - .mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json') - .mockFromFile('/api/languages/list', 'quality-profiles/languages.json') - .mockFromFile('/api/rules/search', 'quality-profiles/rules.json', - { data: { qprofile: 'java-inherited-profile-85155', activation: 'true' } }) - .mockFromFile('/api/qualityprofiles/inheritance', 'quality-profiles/inheritance-plus.json') - .startAppBrowserify('quality-profiles', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-list .list-group-item') - .clickElement('.js-list .list-group-item[data-key="java-inherited-profile-85155"]') - .checkElementExist('#quality-profile-ancestors') - .clearMocks() - .clearMocks() - .mockFromFile('/api/rules/search', 'quality-profiles/rules.json', - { data: { qprofile: 'java-sonar-way-67887', activation: 'true' } }) - .mockFromFile('/api/qualityprofiles/inheritance', 'quality-profiles/inheritance.json') - .clickElement('#quality-profile-ancestors .js-profile[data-key="java-sonar-way-67887"]') - .checkElementInclude('.search-navigator-header-component', 'Sonar way'); - }); - - bdd.it('should copy profile', function () { - return this.remote - .open() - .mockFromFile('/api/users/current', 'quality-profiles/user-admin.json') - .mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search.json') - .mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json') - .mockFromFile('/api/languages/list', 'quality-profiles/languages.json') - .mockFromFile('/api/rules/search', 'quality-profiles/rules.json') - .mockFromFile('/api/qualityprofiles/inheritance', 'quality-profiles/inheritance.json') - .mockFromFile('/api/qualityprofiles/copy', 'quality-profiles/copy.json', { - data: { fromKey: 'java-sonar-way-67887', toName: 'Copied Profile' } - }) - .startAppBrowserify('quality-profiles', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-list .list-group-item') - .checkElementCount('.js-list .list-group-item', 5) - .clickElement('.js-list .list-group-item[data-key="java-sonar-way-67887"]') - .checkElementExist('#quality-profile-copy') - .clickElement('#quality-profile-copy') - .checkElementExist('.modal') - .fillElement('#copy-profile-name', 'Copied Profile') - .clickElement('#copy-profile-submit') - .checkElementInclude('.search-navigator-header-component', 'Copied Profile') - .checkElementInclude('.js-list .list-group-item.active', 'Copied Profile') - .checkElementInclude('.search-navigator-header-component', 'Java') - .checkElementCount('.js-list .list-group-item', 6); - }); - - bdd.it('should rename profile', function () { - return this.remote - .open() - .mockFromFile('/api/users/current', 'quality-profiles/user-admin.json') - .mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search.json') - .mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json') - .mockFromFile('/api/languages/list', 'quality-profiles/languages.json') - .mockFromFile('/api/rules/search', 'quality-profiles/rules.json') - .mockFromFile('/api/qualityprofiles/inheritance', 'quality-profiles/inheritance.json') - .startAppBrowserify('quality-profiles', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-list .list-group-item') - .clickElement('.js-list .list-group-item[data-key="java-sonar-way-67887"]') - .checkElementExist('#quality-profile-rename') - .clickElement('#quality-profile-rename') - .checkElementExist('.modal') - .clearMocks() - .mockFromString('/api/qualityprofiles/rename', '{}', { - data: { key: 'java-sonar-way-67887', name: 'Renamed Profile' } - }) - .mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search-renamed.json') - .fillElement('#rename-profile-name', 'Renamed Profile') - .clickElement('#rename-profile-submit') - .checkElementInclude('.js-list .list-group-item.active', 'Renamed Profile') - .checkElementInclude('.search-navigator-header-component', 'Renamed Profile'); - }); - - bdd.it('should make profile default', function () { - return this.remote - .open() - .mockFromFile('/api/users/current', 'quality-profiles/user-admin.json') - .mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search.json') - .mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json') - .mockFromFile('/api/languages/list', 'quality-profiles/languages.json') - .mockFromFile('/api/rules/search', 'quality-profiles/rules.json') - .mockFromFile('/api/qualityprofiles/inheritance', 'quality-profiles/inheritance.json') - .startAppBrowserify('quality-profiles', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-list .list-group-item') - .checkElementNotExist('.js-list .list-group-item[data-key="php-psr-2-46772"] .badge') - .checkElementExist('.js-list .list-group-item[data-key="php-sonar-way-10778"] .badge') - .clickElement('.js-list .list-group-item[data-key="php-psr-2-46772"]') - .checkElementExist('#quality-profile-set-as-default') - .clearMocks(this.searchMock) - .mockFromString('/api/qualityprofiles/set_default', '{}', { - data: { profileKey: 'php-psr-2-46772' } - }) - .mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search-another-default.json') - .clickElement('#quality-profile-set-as-default') - .checkElementNotExist('.js-list .list-group-item[data-key="php-sonar-way-10778"] .badge') - .checkElementNotExist('#quality-profile-set-as-default') - .checkElementExist('.js-list .list-group-item[data-key="php-psr-2-46772"] .badge'); - }); - - bdd.it('should delete profile', function () { - return this.remote - .open() - .mockFromFile('/api/users/current', 'quality-profiles/user-admin.json') - .mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search-with-copy.json') - .mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json') - .mockFromFile('/api/languages/list', 'quality-profiles/languages.json') - .mockFromFile('/api/rules/search', 'quality-profiles/rules.json') - .mockFromFile('/api/qualityprofiles/inheritance', 'quality-profiles/inheritance.json') - .startAppBrowserify('quality-profiles', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-list .list-group-item') - .checkElementCount('.js-list .list-group-item', 6) - .clickElement('.js-list .list-group-item[data-key="java-copied-profile-11711"]') - .checkElementExist('#quality-profile-delete') - .clickElement('#quality-profile-delete') - .checkElementExist('.modal') - .clearMocks() - .mockFromString('/api/qualityprofiles/delete', '{}', { - data: { profileKey: 'java-copied-profile-11711' } - }) - .mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search.json') - .clickElement('#delete-profile-submit') - .checkElementCount('.js-list .list-group-item', 5) - .checkElementNotInclude('.js-list .list-group-item', 'Copied Profile'); - }); - - bdd.it('should create profile', function () { - return this.remote - .open() - .mockFromFile('/api/users/current', 'quality-profiles/user-admin.json') - .mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search.json') - .mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json') - .mockFromFile('/api/rules/search', 'quality-profiles/rules.json') - .mockFromFile('/api/qualityprofiles/inheritance', 'quality-profiles/inheritance.json') - .mockFromFile('/api/languages/list', 'quality-profiles/languages.json') - .mockFromFile('/api/qualityprofiles/importers', 'quality-profiles/importers-empty.json') - .startAppBrowserify('quality-profiles', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-list .list-group-item') - .checkElementCount('.js-list .list-group-item', 5) - .clickElement('#quality-profiles-create') - .checkElementExist('.modal') - .checkElementExist('#create-profile-name') - .checkElementExist('#create-profile-language'); - }); - - bdd.it('should restore profile', function () { - return this.remote - .open() - .mockFromFile('/api/users/current', 'quality-profiles/user-admin.json') - .mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search.json') - .mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json') - .mockFromFile('/api/languages/list', 'quality-profiles/languages.json') - .mockFromFile('/api/rules/search', 'quality-profiles/rules.json') - .mockFromFile('/api/qualityprofiles/inheritance', 'quality-profiles/inheritance.json') - .startAppBrowserify('quality-profiles', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-list .list-group-item') - .checkElementCount('.js-list .list-group-item', 5) - .clickElement('#quality-profiles-actions') - .clickElement('#quality-profiles-restore') - .checkElementExist('.modal') - .checkElementExist('.modal input[type="file"]'); - }); - - bdd.it('should show importers', function () { - return this.remote - .open() - .mockFromFile('/api/users/current', 'quality-profiles/user-admin.json') - .mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search.json') - .mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json') - .mockFromFile('/api/rules/search', 'quality-profiles/rules.json') - .mockFromFile('/api/qualityprofiles/inheritance', 'quality-profiles/inheritance.json') - .mockFromFile('/api/languages/list', 'quality-profiles/languages.json') - .mockFromFile('/api/qualityprofiles/importers', 'quality-profiles/importers.json') - .startAppBrowserify('quality-profiles', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-list .list-group-item') - .clickElement('#quality-profiles-create') - .checkElementExist('.modal') - .checkElementExist('.js-importer[data-key="pmd"]:not(.hidden)') - .checkElementExist('.js-importer[data-key="random"]:not(.hidden)') - .fillElement('#create-profile-language', 'js') - .changeElement('#create-profile-language') - .checkElementNotExist('.js-importer[data-key="pmd"]:not(.hidden)') - .checkElementExist('.js-importer[data-key="random"]:not(.hidden)') - .fillElement('#create-profile-language', 'py') - .changeElement('#create-profile-language') - .checkElementNotExist('.js-importer[data-key="pmd"]:not(.hidden)') - .checkElementNotExist('.js-importer[data-key="random"]:not(.hidden)'); - }); - - bdd.it('should restore built-in profiles', function () { - return this.remote - .open() - .mockFromFile('/api/users/current', 'quality-profiles/user-admin.json') - .mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search-modified.json') - .mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json') - .mockFromFile('/api/rules/search', 'quality-profiles/rules.json') - .mockFromFile('/api/qualityprofiles/inheritance', 'quality-profiles/inheritance.json') - .mockFromFile('/api/languages/list', 'quality-profiles/languages.json') - .startAppBrowserify('quality-profiles', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-list .list-group-item') - .checkElementCount('.js-list .js-list-language', 1) - .checkElementCount('.js-list .list-group-item', 1) - .clickElement('#quality-profiles-actions') - .clickElement('#quality-profiles-restore-built-in') - .checkElementExist('.modal') - .clearMocks() - .mockFromString('/api/qualityprofiles/restore_built_in', '{}', { data: { language: 'java' } }) - .mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search.json') - .fillElement('#restore-built-in-profiles-language', 'java') - .clickElement('#restore-built-in-profiles-submit') - .checkElementCount('.js-list .js-list-language', 4) - .checkElementCount('.js-list .list-group-item', 5) - .checkElementInclude('.js-list .list-group-item', 'Sonar way') - .checkElementNotExist('.search-navigator-header-component'); - }); - - bdd.it('should change profile\'s parent', function () { - return this.remote - .open() - .mockFromFile('/api/users/current', 'quality-profiles/user-admin.json') - .mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search-change-parent.json') - .mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json') - .mockFromFile('/api/languages/list', 'quality-profiles/languages.json') - .mockFromFile('/api/rules/search', 'quality-profiles/rules.json') - .mockFromFile('/api/qualityprofiles/inheritance', 'quality-profiles/inheritance-change-parent.json') - .startAppBrowserify('quality-profiles', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-list .list-group-item') - .clickElement('.js-list .list-group-item[data-key="java-inherited-profile-85155"]') - .checkElementExist('#quality-profile-change-parent') - .clickElement('#quality-profile-change-parent') - .checkElementExist('.modal') - .clearMocks() - .mockFromString('/api/qualityprofiles/change_parent', '{}', { - data: { profileKey: 'java-inherited-profile-85155', parentKey: 'java-another-profile-00609' } - }) - .mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search-changed-parent.json') - .mockFromFile('/api/qualityprofiles/inheritance', 'quality-profiles/inheritance-changed-parent.json') - .mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json') - .mockFromFile('/api/languages/list', 'quality-profiles/languages.json') - .mockFromFile('/api/rules/search', 'quality-profiles/rules.json') - .fillElement('#change-profile-parent', 'java-another-profile-00609') - .clickElement('#change-profile-parent-submit') - .checkElementInclude('#quality-profile-ancestors', 'Another Profile'); - }); - - bdd.it('should open permalink', function () { - return this.remote - .open('#show?key=java-sonar-way-67887') - .mockFromFile('/api/users/current', 'quality-profiles/user-admin.json') - .mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search.json') - .mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json') - .mockFromFile('/api/languages/list', 'quality-profiles/languages.json') - .mockFromFile('/api/rules/search', 'quality-profiles/rules.json') - .mockFromFile('/api/qualityprofiles/inheritance', 'quality-profiles/inheritance.json') - .startAppBrowserify('quality-profiles', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('#quality-profile-rename') - .checkElementCount('.js-list .list-group-item.active', 1) - .checkElementInclude('.js-list .list-group-item.active', 'Sonar way') - .checkElementInclude('.search-navigator-workspace-header', 'Sonar way') - .checkElementInclude('.search-navigator-workspace-header', 'Java') - .checkElementExist('#quality-profile-backup') - .checkElementExist('#quality-profile-rename') - .checkElementExist('#quality-profile-copy') - .checkElementNotExist('#quality-profile-delete') - .checkElementNotExist('#quality-profile-set-as-default'); - }); - - bdd.it('should show changelog', function () { - return this.remote - .open('#show?key=java-sonar-way-67887') - .mockFromFile('/api/users/current', 'quality-profiles/user.json') - .mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search.json') - .mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json') - .mockFromFile('/api/languages/list', 'quality-profiles/languages.json') - .mockFromFile('/api/rules/search', 'quality-profiles/rules.json') - .mockFromFile('/api/qualityprofiles/inheritance', 'quality-profiles/inheritance.json') - .mockFromFile('/api/qualityprofiles/changelog', 'quality-profiles/changelog.json', { - data: { profileKey: 'java-sonar-way-67887' } - }) - .startAppBrowserify('quality-profiles', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('#quality-profile-changelog-form-submit') - .checkElementNotExist('.js-show-more-changelog') - .clickElement('#quality-profile-changelog-form-submit') - .checkElementExist('#quality-profile-changelog table') - .checkElementExist('.js-show-more-changelog') - .checkElementCount('#quality-profile-changelog tbody tr', 2) - .checkElementInclude('#quality-profile-changelog tbody tr:nth-child(1)', 'April 13 2015') - .checkElementInclude('#quality-profile-changelog tbody tr:nth-child(1)', 'System') - .checkElementInclude('#quality-profile-changelog tbody tr:nth-child(1)', 'ACTIVATED') - .checkElementInclude('#quality-profile-changelog tbody tr:nth-child(1)', 'Synchronisation should not') - .checkElementInclude('#quality-profile-changelog tbody tr:nth-child(1)', 'BLOCKER') - .checkElementInclude('#quality-profile-changelog tbody tr:nth-child(2)', 'April 13 2015') - .checkElementInclude('#quality-profile-changelog tbody tr:nth-child(2)', 'Anakin Skywalker') - .checkElementInclude('#quality-profile-changelog tbody tr:nth-child(2)', 'ACTIVATED') - .checkElementInclude('#quality-profile-changelog tbody tr:nth-child(2)', 'Double.longBitsToDouble') - .checkElementInclude('#quality-profile-changelog tbody tr:nth-child(2)', 'threshold') - .checkElementInclude('#quality-profile-changelog tbody tr:nth-child(2)', '3') - .checkElementInclude('#quality-profile-changelog tbody tr:nth-child(2)', 'emptyParameter') - .clearMocks() - .mockFromFile('/api/qualityprofiles/changelog', 'quality-profiles/changelog2.json', { - data: { profileKey: 'java-sonar-way-67887' } - }) - .clickElement('.js-show-more-changelog') - .checkElementCount('#quality-profile-changelog tbody tr', 3) - .checkElementNotExist('.js-show-changelog') - .checkElementNotExist('.js-show-more-changelog') - .checkElementInclude('#quality-profile-changelog tbody tr:nth-child(3)', 'April 13 2015') - .checkElementInclude('#quality-profile-changelog tbody tr:nth-child(3)', 'System') - .checkElementInclude('#quality-profile-changelog tbody tr:nth-child(3)', 'DEACTIVATED') - .checkElementInclude('#quality-profile-changelog tbody tr:nth-child(3)', 'runFinalizersOnExit') - .clickElement('.js-hide-changelog') - .checkElementNotExist('#quality-profile-changelog tbody tr'); - }); - - bdd.it('should open changelog permalink', function () { - return this.remote - .open('#changelog?since=2015-03-25&key=java-sonar-way-67887&to=2015-03-26') - .mockFromFile('/api/users/current', 'quality-profiles/user.json') - .mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search.json') - .mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json') - .mockFromFile('/api/languages/list', 'quality-profiles/languages.json') - .mockFromFile('/api/rules/search', 'quality-profiles/rules.json') - .mockFromFile('/api/qualityprofiles/inheritance', 'quality-profiles/inheritance.json') - .mockFromFile('/api/qualityprofiles/changelog', 'quality-profiles/changelog.json', { - data: { - since: '2015-03-25', - to: '2015-03-26', - profileKey: 'java-sonar-way-67887' - } - }) - .startAppBrowserify('quality-profiles', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-show-more-changelog') - .checkElementCount('#quality-profile-changelog tbody tr', 2) - .clearMocks() - .mockFromFile('/api/qualityprofiles/changelog', 'quality-profiles/changelog2.json', { - data: { - since: '2015-03-25', - to: '2015-03-26', - profileKey: 'java-sonar-way-67887' - } - }) - .clickElement('.js-show-more-changelog') - .checkElementCount('#quality-profile-changelog tbody tr', 3) - .checkElementNotExist('.js-show-more-changelog'); - }); - - bdd.it('should show comparison', function () { - return this.remote - .open('#show?key=java-sonar-way-67887') - .mockFromFile('/api/users/current', 'quality-profiles/user.json') - .mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search-with-copy.json') - .mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json') - .mockFromFile('/api/languages/list', 'quality-profiles/languages.json') - .mockFromFile('/api/rules/search', 'quality-profiles/rules.json') - .mockFromFile('/api/qualityprofiles/inheritance', 'quality-profiles/inheritance.json') - .mockFromFile('/api/qualityprofiles/compare', 'quality-profiles/compare.json', { - data: { leftKey: 'java-sonar-way-67887', rightKey: 'java-copied-profile-11711' } - }) - .startAppBrowserify('quality-profiles', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('#quality-profile-comparison-form-submit') - .checkElementCount('#quality-profile-comparison-with-key option', 1) - .clickElement('#quality-profile-comparison-form-submit') - .checkElementExist('#quality-profile-comparison table') - .checkElementCount('.js-comparison-in-left', 2) - .checkElementCount('.js-comparison-in-right', 2) - .checkElementCount('.js-comparison-modified', 2) - .checkElementInclude('.js-comparison-in-left', '".equals()" should not be used to test') - .checkElementInclude('.js-comparison-in-left', '"@Override" annotation should be used on') - .checkElementInclude('.js-comparison-in-right', '"ConcurrentLinkedQueue.size()" should not be used') - .checkElementInclude('.js-comparison-in-right', '"compareTo" results should not be checked') - .checkElementInclude('.js-comparison-modified', 'Control flow statements') - .checkElementInclude('.js-comparison-modified', '"Cloneables" should implement "clone"') - .checkElementInclude('.js-comparison-modified', 'max: 5') - .checkElementInclude('.js-comparison-modified', 'max: 3'); - }); - - bdd.it('should open comparison permalink', function () { - return this.remote - .open('#compare?key=java-sonar-way-67887&withKey=java-copied-profile-11711') - .mockFromFile('/api/users/current', 'quality-profiles/user.json') - .mockFromFile('/api/qualityprofiles/search', 'quality-profiles/search-with-copy.json') - .mockFromFile('/api/qualityprofiles/exporters', 'quality-profiles/exporters.json') - .mockFromFile('/api/languages/list', 'quality-profiles/languages.json') - .mockFromFile('/api/rules/search', 'quality-profiles/rules.json') - .mockFromFile('/api/qualityprofiles/inheritance', 'quality-profiles/inheritance.json') - .mockFromFile('/api/qualityprofiles/compare', 'quality-profiles/compare.json', { - data: { leftKey: 'java-sonar-way-67887', rightKey: 'java-copied-profile-11711' } - }) - .startAppBrowserify('quality-profiles', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('#quality-profile-comparison table') - .checkElementCount('#quality-profile-comparison-with-key option', 1) - .checkElementCount('.js-comparison-in-left', 2) - .checkElementCount('.js-comparison-in-right', 2) - .checkElementCount('.js-comparison-modified', 2); - - }); - }); - -}); diff --git a/server/sonar-web/test/medium/source-viewer.spec.js b/server/sonar-web/test/medium/source-viewer.spec.js deleted file mode 100644 index 3583853ee7e..00000000000 --- a/server/sonar-web/test/medium/source-viewer.spec.js +++ /dev/null @@ -1,87 +0,0 @@ -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' } }) - .startAppBrowserify('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="9"] .source-line-code-issue') - .checkElementInclude('.source-line-code[data-line-number="9"] .source-line-code-issue', 'sion') - - .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', ' */'); - }); - - bdd.it('should show secondary issue locations on the same line', 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' } }) - .startAppBrowserify('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') - .clickElement('.source-line-with-issues[data-line-number="3"]') - .clickElement('.js-issue-locations') - .checkElementCount('.source-line-code[data-line-number="3"] .source-viewer-issue-location', 1) - .checkElementCount('.source-line-code[data-line-number="3"] .source-line-code-secondary-issue', 2) - .checkElementInclude('.source-line-code[data-line-number="3"] .source-line-code-secondary-issue', ') 200') - .checkElementInclude('.source-line-code[data-line-number="3"] .source-line-code-secondary-issue', '14 So'); - }); - - bdd.it('should show secondary issue locations on the different lines', 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' } }) - .startAppBrowserify('source-viewer', { file: file }) - .checkElementExist('.source-line-code[data-line-number="9"] .source-line-code-issue') - .checkElementInclude('.source-line-code[data-line-number="9"] .source-line-code-issue', 'sion') - .clickElement('.source-line-with-issues[data-line-number="9"]') - .clickElement('.js-issue-locations') - .checkElementCount('.source-line-code[data-line-number="8"] .source-viewer-issue-location', 1) - .checkElementNotExist('.source-line-code[data-line-number="9"] .source-viewer-issue-location') - .checkElementCount('.source-line-code[data-line-number="8"] .source-line-code-secondary-issue', 1) - .checkElementCount('.source-line-code[data-line-number="9"] .source-line-code-secondary-issue', 1) - .checkElementInclude('.source-line-code[data-line-number="8"] .source-line-code-secondary-issue', 'ense ') - .checkElementInclude('.source-line-code[data-line-number="9"] .source-line-code-secondary-issue', 'sion'); - }); - - bdd.it('should show the number of issues on a line', 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/several-issues-on-a-line.json') - .startAppBrowserify('source-viewer', { file: file }) - .checkElementExist('.source-line-issues[data-line-number="3"] .icon-severity-critical') - .checkElementExist('.source-line-issues[data-line-number="3"] .source-line-issues-counter') - .checkElementInclude('.source-line-issues[data-line-number="3"] .source-line-issues-counter', 2) - .checkElementExist('.source-line-issues[data-line-number="5"] .icon-severity-critical') - .checkElementNotExist('.source-line-issues[data-line-number="5"] .source-line-issues-counter'); - }); - }); - }); -}); diff --git a/server/sonar-web/test/medium/update-center.spec.js b/server/sonar-web/test/medium/update-center.spec.js deleted file mode 100644 index 3acc5961cd5..00000000000 --- a/server/sonar-web/test/medium/update-center.spec.js +++ /dev/null @@ -1,301 +0,0 @@ -define(function (require) { - var bdd = require('intern!bdd'); - require('../helpers/test-page'); - - bdd.describe('Update Center Page', function () { - bdd.it('should show plugin card', function () { - return this.remote - .open() - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/plugins/installed', 'update-center-spec/installed.json') - .mockFromFile('/api/plugins/updates', 'update-center-spec/updates.json') - .mockFromFile('/api/plugins/pending', 'update-center-spec/pending.json') - .startAppBrowserify('update-center', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-plugin-name') - .checkElementCount('li[data-id]', 5) - .checkElementInclude('li[data-id="scmgit"] .js-plugin-name', 'Git') - .checkElementInclude('li[data-id="scmgit"] .js-plugin-category', 'Integration') - .checkElementInclude('li[data-id="scmgit"] .js-plugin-description', 'Git SCM Provider.') - .checkElementInclude('li[data-id="scmgit"] .js-plugin-installed-version', '1.0') - .checkElementCount('li[data-id="scmgit"] .js-update-version', 1) - .checkElementInclude('li[data-id="scmgit"] .js-update-version', '1.1') - .checkElementCount('li[data-id="scmgit"] .js-changelog', 1) - .checkElementCount('li[data-id="scmgit"] .js-plugin-homepage', 1) - .checkElementCount('li[data-id="scmgit"] .js-plugin-issues', 1) - .checkElementNotExist('li[data-id="scmgit"] .js-plugin-terms') - .checkElementInclude('li[data-id="scmgit"] .js-plugin-license', 'GNU LGPL 3') - .checkElementInclude('li[data-id="scmgit"] .js-plugin-organization', 'SonarSource') - .checkElementCount('li[data-id="scmgit"] .js-update', 1) - .checkElementCount('li[data-id="scmgit"] .js-uninstall', 1) - .checkElementNotExist('li[data-id="scmgit"] .js-install'); - }); - - bdd.it('should show system upgrade', function () { - return this.remote - .open('#system') - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/plugins/pending', 'update-center-spec/pending.json') - .mockFromFile('/api/system/upgrades', 'update-center-spec/system-updates.json') - .startAppBrowserify('update-center', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-plugin-name') - .checkElementCount('li[data-system]', 1) - .checkElementInclude('li[data-system] .js-plugin-name', 'SonarQube 5.3') - .checkElementInclude('li[data-system] .js-plugin-category', 'System Upgrade') - .checkElementInclude('li[data-system] .js-plugin-description', 'New!') - .checkElementCount('li[data-system] .js-plugin-release-notes', 1) - .checkElementCount('li[data-system] .js-plugin-date', 1) - .checkElementCount('li[data-system] .js-plugin-update-steps', 1) - .checkElementCount('li[data-system] .js-plugin-update-steps > li', 4); - }); - - bdd.it('should show installed', function () { - return this.remote - .open('#installed') - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/plugins/installed', 'update-center-spec/installed.json') - .mockFromFile('/api/plugins/updates', 'update-center-spec/updates.json') - .mockFromFile('/api/plugins/pending', 'update-center-spec/pending.json') - .startAppBrowserify('update-center', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-plugin-name') - .checkElementCount('li[data-id]', 5) - .checkElementExist('li[data-id="scmgit"]') - .checkElementExist('li[data-id="javascript"]'); - }); - - bdd.it('should show updates', function () { - return this.remote - .open('#updates') - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/plugins/installed', 'update-center-spec/installed.json') - .mockFromFile('/api/plugins/updates', 'update-center-spec/updates.json') - .mockFromFile('/api/plugins/pending', 'update-center-spec/pending.json') - .startAppBrowserify('update-center', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-plugin-name') - .checkElementCount('li[data-id]', 4) - .checkElementExist('li[data-id="scmgit"]') - .checkElementNotExist('li[data-id="javascript"]'); - }); - - bdd.it('should show available', function () { - return this.remote - .open('#available') - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/plugins/available', 'update-center-spec/available.json') - .mockFromFile('/api/plugins/pending', 'update-center-spec/pending.json') - .startAppBrowserify('update-center', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-plugin-name') - .checkElementCount('li[data-id]', 3) - .checkElementNotExist('li[data-id="scmgit"]') - .checkElementExist('li[data-id="abap"]'); - }); - - bdd.it('should work offline', function () { - return this.remote - .open('') - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/plugins/installed', 'update-center-spec/installed.json') - .mockFromFile('/api/plugins/updates', 'update-center-spec/updates.json') - .mockFromFile('/api/plugins/pending', 'update-center-spec/pending.json') - .execute(function () { - window.SS.updateCenterActive = false; - }) - .startAppBrowserify('update-center', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-plugin-name') - .checkElementCount('li[data-id]', 5) - .checkElementExist('li[data-id="scmgit"]') - .checkElementExist('li[data-id="javascript"]') - .checkElementNotExist('#update-center-filter-installed[disabled]') - .checkElementExist('#update-center-filter-updates[disabled]') - .checkElementExist('#update-center-filter-available[disabled]') - .checkElementExist('#update-center-filter-system[disabled]'); - }); - - bdd.it('should switch between views', function () { - return this.remote - .open('#installed') - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/plugins/installed', 'update-center-spec/installed.json') - .mockFromFile('/api/plugins/updates', 'update-center-spec/updates.json') - .mockFromFile('/api/plugins/pending', 'update-center-spec/pending.json') - .mockFromFile('/api/plugins/available', 'update-center-spec/available.json') - .mockFromFile('/api/system/upgrades', 'update-center-spec/system-updates.json') - .startAppBrowserify('update-center', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-plugin-name') - .checkElementCount('li[data-id]', 5) - .checkElementExist('li[data-id="javascript"]') - .checkElementExist('#update-center-filter-installed:checked') - .clickElement('[for="update-center-filter-available"]') - .checkElementExist('li[data-id="abap"]') - .checkElementCount('li[data-id]', 3) - .checkElementExist('li[data-id="abap"]') - .checkElementExist('#update-center-filter-available:checked') - .clickElement('[for="update-center-filter-updates"]') - .checkElementExist('li[data-id="scmgit"]') - .checkElementCount('li[data-id]', 4) - .checkElementExist('li[data-id="scmgit"]') - .checkElementExist('#update-center-filter-updates:checked') - .clickElement('[for="update-center-filter-system"]') - .checkElementExist('li[data-system]') - .checkElementExist('#update-center-filter-system:checked') - .clickElement('[for="update-center-filter-installed"]') - .checkElementExist('li[data-id="javascript"]') - .checkElementCount('li[data-id]', 5) - .checkElementExist('li[data-id="javascript"]') - .checkElementExist('#update-center-filter-installed:checked') - .clickElement('[for="update-center-filter-available"]') - .checkElementExist('li[data-id="abap"]') - .checkElementCount('li[data-id]', 3) - .checkElementExist('li[data-id="abap"]') - .checkElementExist('#update-center-filter-available:checked') - .clickElement('[for="update-center-filter-updates"]') - .checkElementExist('li[data-id="scmgit"]') - .checkElementCount('li[data-id]', 4) - .checkElementExist('li[data-id="scmgit"]') - .checkElementExist('#update-center-filter-updates:checked') - .clickElement('[for="update-center-filter-system"]') - .checkElementExist('li[data-system]') - .checkElementExist('#update-center-filter-system:checked'); - }); - - bdd.it('should search', function () { - return this.remote - .open('#installed') - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/plugins/installed', 'update-center-spec/installed.json') - .mockFromFile('/api/plugins/updates', 'update-center-spec/updates.json') - .mockFromFile('/api/plugins/pending', 'update-center-spec/pending.json') - .startAppBrowserify('update-center', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-plugin-name') - .checkElementCount('li[data-id]', 5) - .checkElementNotExist('li.hidden[data-id]') - .fillElement('#update-center-search-query', 'jA') - .clickElement('#update-center-search-submit') - .checkElementExist('li.hidden[data-id]') - .checkElementCount('li[data-id]', 5) - .checkElementCount('li.hidden[data-id]', 3) - .checkElementInclude('li:not(.hidden)[data-id] .js-plugin-name', 'JavaScript'); - }); - - bdd.it('should search by category on click', function () { - return this.remote - .open('#available') - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/plugins/available', 'update-center-spec/available.json') - .mockFromFile('/api/plugins/pending', 'update-center-spec/pending.json') - .startAppBrowserify('update-center', { urlRoot: '/test/medium/base.html' }) - .checkElementCount('li[data-id]:not(.hidden)', 3) - .clickElement('li[data-id="abap"] .js-plugin-category') - .checkElementCount('li[data-id]:not(.hidden)', 2); - }); - - bdd.it('should show changelog of plugin update', function () { - return this.remote - .open('#installed') - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/plugins/installed', 'update-center-spec/installed.json') - .mockFromFile('/api/plugins/updates', 'update-center-spec/updates.json') - .mockFromFile('/api/plugins/pending', 'update-center-spec/pending.json') - .startAppBrowserify('update-center', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-plugin-name') - .clickElement('li[data-id="python"] .js-changelog') - .checkElementExist('.bubble-popup') - .checkElementCount('.bubble-popup .js-plugin-changelog-version', 2) - .checkElementCount('.bubble-popup .js-plugin-changelog-date', 2) - .checkElementCount('.bubble-popup .js-plugin-changelog-link', 2) - .checkElementCount('.bubble-popup .js-plugin-changelog-description', 2); - }); - - bdd.it('should show changelog of plugin release', function () { - return this.remote - .open('#available') - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/plugins/available', 'update-center-spec/available.json') - .mockFromFile('/api/plugins/pending', 'update-center-spec/pending.json') - .startAppBrowserify('update-center', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-plugin-name') - .clickElement('li[data-id="abap"] .js-changelog') - .checkElementExist('.bubble-popup') - .checkElementCount('.bubble-popup .js-plugin-changelog-version', 1) - .checkElementCount('.bubble-popup .js-plugin-changelog-date', 1) - .checkElementCount('.bubble-popup .js-plugin-changelog-link', 1) - .checkElementCount('.bubble-popup .js-plugin-changelog-description', 1); - }); - - bdd.it('should update plugin', function () { - return this.remote - .open('#installed') - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/plugins/installed', 'update-center-spec/installed.json') - .mockFromFile('/api/plugins/updates', 'update-center-spec/updates.json') - .mockFromFile('/api/plugins/pending', 'update-center-spec/pending.json') - .mockFromString('/api/plugins/update', '{}', { data: { key: 'scmgit' } }) - .startAppBrowserify('update-center', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-plugin-name') - .clickElement('li[data-id="scmgit"] .js-update') - .checkElementNotExist('li[data-id="scmgit"] .js-spinner') - .checkElementInclude('li[data-id="scmgit"]', 'Update Pending'); - }); - - bdd.it('should uninstall plugin', function () { - return this.remote - .open('#installed') - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/plugins/installed', 'update-center-spec/installed.json') - .mockFromFile('/api/plugins/updates', 'update-center-spec/updates.json') - .mockFromFile('/api/plugins/pending', 'update-center-spec/pending.json') - .mockFromString('/api/plugins/uninstall', '{}', { data: { key: 'scmgit' } }) - .startAppBrowserify('update-center', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-plugin-name') - .clickElement('li[data-id="scmgit"] .js-uninstall') - .checkElementNotExist('li[data-id="scmgit"] .js-spinner') - .checkElementInclude('li[data-id="scmgit"]', 'Uninstall Pending'); - }); - - bdd.it('should install plugin', function () { - return this.remote - .open('#available') - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/plugins/available', 'update-center-spec/available.json') - .mockFromFile('/api/plugins/pending', 'update-center-spec/pending.json') - .mockFromString('/api/plugins/install', '{}', { data: { key: 'android' } }) - .startAppBrowserify('update-center', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-plugin-name') - .clickElement('li[data-id="android"] .js-install') - .checkElementNotExist('li[data-id="android"] .js-spinner') - .checkElementInclude('li[data-id="android"]', 'Install Pending'); - }); - - bdd.it('should cancel all pending', function () { - return this.remote - .open('#available') - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/plugins/available', 'update-center-spec/available.json') - .mockFromFile('/api/plugins/pending', 'update-center-spec/pending.json') - .mockFromString('/api/plugins/cancel_all', '{}') - .startAppBrowserify('update-center', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-plugin-name') - .checkElementExist('.js-pending') - .clickElement('.js-cancel-all') - .checkElementNotExist('.js-pending'); - }); - - bdd.it('should should check terms and conditions', function () { - return this.remote - .open('#available') - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/plugins/available', 'update-center-spec/available.json') - .mockFromFile('/api/plugins/pending', 'update-center-spec/pending.json') - .mockFromString('/api/plugins/install', '{}', { data: { key: 'abap' } }) - .startAppBrowserify('update-center', { urlRoot: '/test/medium/base.html' }) - .checkElementExist('.js-plugin-name') - .checkElementExist('li[data-id="abap"] .js-terms') - .checkElementExist('li[data-id="abap"] .js-install[disabled]') - .clickElement('li[data-id="abap"] .js-terms') - .checkElementNotExist('li[data-id="abap"] .js-install[disabled]') - .clickElement('li[data-id="abap"] .js-install') - .checkElementNotExist('li[data-id="abap"] .js-spinner') - .checkElementInclude('li[data-id="abap"]', 'Install Pending'); - }); - }); -}); - diff --git a/server/sonar-web/test/medium/users.spec.js b/server/sonar-web/test/medium/users.spec.js deleted file mode 100644 index 50b906c353d..00000000000 --- a/server/sonar-web/test/medium/users.spec.js +++ /dev/null @@ -1,149 +0,0 @@ -define(function (require) { - var bdd = require('intern!bdd'); - require('../helpers/test-page'); - - bdd.describe('Users Page', function () { - bdd.it('should show list of users', function () { - return this.remote - .open() - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/users/search', 'users-spec/search.json') - .startAppBrowserify('users') - .checkElementCount('#users-list li[data-login]', 3) - .checkElementInclude('#users-list .js-user-login', 'smith') - .checkElementInclude('#users-list .js-user-name', 'Bob') - .checkElementInclude('#users-list .js-user-email', 'bob@example.com') - .checkElementCount('#users-list .js-user-update', 3) - .checkElementCount('#users-list .js-user-change-password', 3) - .checkElementCount('#users-list .js-user-deactivate', 3) - .checkElementInclude('#users-list-footer', '3/3') - .checkElementNotInclude('[data-login="ryan"]', 'another@example.com') - .clickElement('[data-login="ryan"] .js-user-more-scm') - .checkElementInclude('[data-login="ryan"]', 'another@example.com') - .checkElementNotInclude('[data-login="ryan"]', 'four') - .clickElement('[data-login="ryan"] .js-user-more-groups') - .checkElementInclude('[data-login="ryan"]', 'four'); - }); - - bdd.it('should search users', function () { - return this.remote - .open() - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/users/search', 'users-spec/search.json') - .startAppBrowserify('users') - .checkElementCount('#users-list li[data-login]', 3) - .clearMocks() - .mockFromFile('/api/users/search', 'users-spec/search-filtered.json') - .fillElement('#users-search-query', 'ryan') - .clickElement('#users-search-submit') - .checkElementNotExist('[data-login="admin"]') - .checkElementCount('#users-list li[data-login]', 1) - .clearMocks() - .mockFromFile('/api/users/search', 'users-spec/search.json') - .fillElement('#users-search-query', '') - .clickElement('#users-search-submit') - .checkElementCount('[data-login="admin"]', 1) - .checkElementCount('#users-list li[data-login]', 3); - }); - - bdd.it('should show more', function () { - return this.remote - .open() - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/users/search', 'users-spec/search-big-1.json') - .startAppBrowserify('users') - .checkElementCount('#users-list li[data-login]', 2) - .clearMocks() - .mockFromFile('/api/users/search', 'users-spec/search-big-2.json') - .clickElement('#users-fetch-more') - .checkElementCount('[data-login="ryan"]', 1) - .checkElementCount('#users-list li[data-login]', 3); - }); - - bdd.it('should create a new user', function () { - return this.remote - .open() - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/users/search', 'users-spec/search.json') - .startAppBrowserify('users') - .checkElementCount('#users-list li[data-login]', 3) - .clickElement('#users-create') - .checkElementCount('#create-user-form', 1) - .clearMocks() - .mockFromFile('/api/users/search', 'users-spec/search-created.json') - .mockFromString('/api/users/create', '{}') - .clickElement('#create-user-add-scm-account') - .clickElement('#create-user-add-scm-account') - .fillElement('#create-user-login', 'login') - .fillElement('#create-user-name', 'name') - .fillElement('#create-user-email', 'email@example.com') - .fillElement('#create-user-password', 'secret') - .fillElement('[name="scmAccounts"]:first-child', 'scm1') - .fillElement('[name="scmAccounts"]:last-child', 'scm2') - .clickElement('#create-user-submit') - .checkElementCount('[data-login="login"]', 1) - .checkElementCount('#users-list li[data-login]', 4) - .checkElementInclude('#users-list .js-user-login', 'login') - .checkElementInclude('#users-list .js-user-name', 'name') - .checkElementInclude('#users-list .js-user-email', 'email@example.com'); - }); - - bdd.it('should update a user', function () { - return this.remote - .open() - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/users/search', 'users-spec/search.json') - .startAppBrowserify('users') - .clickElement('[data-login="smith"] .js-user-update') - .checkElementCount('#create-user-form', 1) - .clearMocks() - .mockFromFile('/api/users/search', 'users-spec/search-updated.json') - .mockFromString('/api/users/update', '{}') - .clickElement('#create-user-add-scm-account') - .fillElement('#create-user-name', 'Mike') - .fillElement('#create-user-email', 'mike@example.com') - .fillElement('[name="scmAccounts"]:first-child', 'scm5') - .fillElement('[name="scmAccounts"]:last-child', 'scm6') - .clickElement('#create-user-submit') - .waitForDeletedByCssSelector('#create-user-form') - .checkElementInclude('[data-login="smith"] .js-user-login', 'smith') - .checkElementInclude('[data-login="smith"] .js-user-name', 'Mike') - .checkElementInclude('[data-login="smith"] .js-user-email', 'mike@example.com'); - }); - - bdd.it('should change user\'s password', function () { - return this.remote - .open() - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/users/search', 'users-spec/search.json') - .startAppBrowserify('users') - .clickElement('[data-login="smith"] .js-user-change-password') - .checkElementCount('#change-user-password-form', 1) - .clearMocks() - .mockFromString('/api/users/change_password', '{}') - .fillElement('#change-user-password-password', 'secret') - .fillElement('#change-user-password-password-confirmation', 'another') - .clickElement('#change-user-password-submit') - .checkElementCount('.alert.alert-danger', 1) - .fillElement('#change-user-password-password', 'secret') - .fillElement('#change-user-password-password-confirmation', 'secret') - .clickElement('#change-user-password-submit') - .waitForDeletedByCssSelector('#change-user-password-form'); - }); - - bdd.it('should deactivate a user', function () { - return this.remote - .open() - .mockFromString('/api/l10n/index', '{}') - .mockFromFile('/api/users/search', 'users-spec/search.json') - .startAppBrowserify('users') - .clickElement('[data-login="smith"] .js-user-deactivate') - .checkElementCount('#deactivate-user-form', 1) - .clearMocks() - .mockFromString('/api/users/deactivate', '{}') - .clickElement('#deactivate-user-submit') - .waitForDeletedByCssSelector('[data-login="smith"]'); - }); - }); - -}); |