@@ -89,6 +89,41 @@ | |||
"falsepositive", | |||
"wontfix" | |||
] | |||
}, | |||
{ | |||
"key": "10c6eeca-cc71-40fc-9ea8-fa90fef8db73", | |||
"component": "org.codehaus.sonar:sonar-plugin-api:src/main/java/org/sonar/api/CoreProperties.java", | |||
"componentId": 3509, | |||
"project": "org.codehaus.sonar:sonar", | |||
"subProject": "org.codehaus.sonar:sonar-plugin-api", | |||
"rule": "squid:S1214", | |||
"status": "CONFIRMED", | |||
"severity": "MINOR", | |||
"message": "Move constants to a class or enum.", | |||
"line": 30, | |||
"debt": "20min", | |||
"author": "simon.brandhof@gmail.com", | |||
"creationDate": "2013-08-28T12:19:16+0200", | |||
"updateDate": "2015-03-19T14:15:56+0100", | |||
"fUpdateAge": "about a minute", | |||
"tags": [ | |||
"bad-practice", | |||
"brain-overload" | |||
], | |||
"actions": [ | |||
"comment", | |||
"assign", | |||
"set_tags", | |||
"assign_to_me", | |||
"plan", | |||
"set_severity" | |||
], | |||
"transitions": [ | |||
"unconfirm", | |||
"resolve", | |||
"falsepositive", | |||
"wontfix" | |||
] | |||
} | |||
], | |||
"rules": [ |
@@ -113,64 +113,56 @@ | |||
"property": "rules", | |||
"values": [ | |||
{ | |||
"val": "javascript:OneStatementPerLine", | |||
"val": "squid:S1698", | |||
"count": 801 | |||
}, | |||
{ | |||
"val": "javascript:S100", | |||
"val": "squid:S1142", | |||
"count": 394 | |||
}, | |||
{ | |||
"val": "javascript:VariableDeclarationAfterUsage", | |||
"val": "squid:S1694", | |||
"count": 114 | |||
}, | |||
{ | |||
"val": "javascript:BitwiseOperators", | |||
"val": "squid:S1151", | |||
"count": 78 | |||
}, | |||
{ | |||
"val": "javascript:NestedIfDepth", | |||
"val": "squid:S1643", | |||
"count": 57 | |||
}, | |||
{ | |||
"val": "javascript:EqEqEq", | |||
"val": "squid:S134", | |||
"count": 53 | |||
}, | |||
{ | |||
"val": "javascript:FunctionComplexity", | |||
"val": "common-java:DuplicatedBlocks", | |||
"count": 53 | |||
}, | |||
{ | |||
"val": "javascript:ConstructorFunctionsForSideEffects", | |||
"val": "squid:RightCurlyBraceSameLineAsNextBlockCheck", | |||
"count": 40 | |||
}, | |||
{ | |||
"val": "javascript:ForIn", | |||
"val": "squid:MethodCyclomaticComplexity", | |||
"count": 28 | |||
}, | |||
{ | |||
"val": "javascript:S1067", | |||
"val": "squid:S138", | |||
"count": 24 | |||
}, | |||
{ | |||
"val": "javascript:S2814", | |||
"val": "squid:S1067", | |||
"count": 21 | |||
}, | |||
{ | |||
"val": "javascript:ArrayAndObjectConstructors", | |||
"val": "common-java:InsufficientBranchCoverage", | |||
"count": 16 | |||
}, | |||
{ | |||
"val": "javascript:S138", | |||
"val": "squid:S1228", | |||
"count": 14 | |||
}, | |||
{ | |||
"val": "javascript:ExcessiveParameterList", | |||
"count": 13 | |||
}, | |||
{ | |||
"val": "javascript:TrailingWhitespace", | |||
"count": 13 | |||
} | |||
] | |||
} |
@@ -5,13 +5,15 @@ define(function (require) { | |||
var Command = require('intern/dojo/node!leadfoot/Command'); | |||
var pollUntil = require('intern/dojo/node!leadfoot/helpers/pollUntil'); | |||
var DEFAULT_TIMEOUT = 4000; | |||
Command.prototype.checkElementCount = function (selector, count) { | |||
return new this.constructor(this, function () { | |||
return this.parent | |||
.then(pollUntil(function (selector, count) { | |||
var elements = document.querySelectorAll(selector); | |||
return elements.length === count ? true : null; | |||
}, [selector, count])) | |||
}, [selector, count], DEFAULT_TIMEOUT)) | |||
.then(function () { | |||
}, function () { | |||
@@ -26,7 +28,7 @@ define(function (require) { | |||
.then(pollUntil(function (selector) { | |||
var elements = document.querySelectorAll(selector); | |||
return elements.length > 0 ? true : null; | |||
}, [selector])) | |||
}, [selector], DEFAULT_TIMEOUT)) | |||
.then(function () { | |||
}, function () { | |||
@@ -41,7 +43,7 @@ define(function (require) { | |||
.then(pollUntil(function (selector) { | |||
var elements = document.querySelectorAll(selector); | |||
return elements.length === 0 ? true : null; | |||
}, [selector])) | |||
}, [selector], DEFAULT_TIMEOUT)) | |||
.then(function () { | |||
}, function () { | |||
@@ -59,7 +61,7 @@ define(function (require) { | |||
return element.textContent.indexOf(text) !== -1; | |||
}); | |||
return result ? true : null; | |||
}, [selector, text])) | |||
}, [selector, text], DEFAULT_TIMEOUT)) | |||
.then(function () { | |||
}, function () { | |||
@@ -78,7 +80,7 @@ define(function (require) { | |||
return element.textContent.indexOf(text) === -1; | |||
}); | |||
return result ? true : null; | |||
}, [selector, text])) | |||
}, [selector, text], DEFAULT_TIMEOUT)) | |||
.then(function () { | |||
}, function () { | |||
@@ -147,4 +149,16 @@ define(function (require) { | |||
}); | |||
}; | |||
Command.prototype.open = function (hash) { | |||
var url = 'test/medium/base.html?' + Date.now(); | |||
if (hash) { | |||
url += hash; | |||
} | |||
return new this.constructor(this, function () { | |||
return this.parent | |||
.get(require.toUrl(url)) | |||
.checkElementExist('#content'); | |||
}); | |||
}; | |||
}); |
@@ -6,7 +6,7 @@ define(function (require) { | |||
bdd.describe('Saved Searches', function () { | |||
bdd.it('should show list of saved searches', function () { | |||
return this.remote | |||
.get(require.toUrl('test/medium/base.html')) | |||
.open() | |||
.mockFromString('/api/l10n/index', '{}') | |||
.mockFromFile('/api/issue_filters/app', 'issues-spec/app.json') | |||
.mockFromFile('/api/issues/search', 'issues-spec/search.json') | |||
@@ -18,7 +18,7 @@ define(function (require) { | |||
bdd.it('should load a saved search', function () { | |||
return this.remote | |||
.get(require.toUrl('test/medium/base.html')) | |||
.open() | |||
.mockFromString('/api/l10n/index', '{}') | |||
.mockFromFile('/api/issue_filters/app', 'issues-spec/app.json') | |||
.mockFromFile('/api/issues/search', 'issues-spec/search.json') | |||
@@ -36,7 +36,7 @@ define(function (require) { | |||
bdd.it('should load a saved search and then resets it by new search', function () { | |||
return this.remote | |||
.get(require.toUrl('test/medium/base.html')) | |||
.open() | |||
.mockFromString('/api/l10n/index', '{}') | |||
.mockFromFile('/api/issue_filters/app', 'issues-spec/app.json') | |||
.mockFromFile('/api/issues/search', 'issues-spec/search.json') | |||
@@ -60,7 +60,7 @@ define(function (require) { | |||
bdd.it('should load', function () { | |||
return this.remote | |||
.get(require.toUrl('test/medium/base.html')) | |||
.open() | |||
.mockFromString('/api/l10n/index', '{}') | |||
.mockFromFile('/api/issue_filters/app', 'issues-spec/app.json') | |||
.mockFromFile('/api/issues/search', 'issues-spec/search.json') | |||
@@ -85,7 +85,7 @@ define(function (require) { | |||
.checkElementCount('.issue', 50) | |||
.checkElementCount('.issue.selected', 1) | |||
//.checkElementInclude('.issue', '1 more branches need to be covered by unit tests to reach') | |||
.checkElementInclude('.issue', '1 more branches need to be covered by unit tests to reach') | |||
.checkElementExist('.js-new-search') | |||
.checkElementExist('.js-filter-save-as') | |||
@@ -99,7 +99,7 @@ define(function (require) { | |||
bdd.it('should show severity facet', function () { | |||
return this.remote | |||
.get(require.toUrl('test/medium/base.html')) | |||
.open() | |||
.mockFromString('/api/l10n/index', '{}') | |||
.mockFromFile('/api/issue_filters/app', 'issues-spec/app.json') | |||
.mockFromFile('/api/issues/search', 'issues-spec/search.json') | |||
@@ -117,7 +117,7 @@ define(function (require) { | |||
issueSelector = '.issue[data-key="' + issueKey + '"]'; | |||
return this.remote | |||
.get(require.toUrl('test/medium/base.html')) | |||
.open() | |||
.mockFromString('/api/l10n/index', '{}') | |||
.mockFromFile('/api/issue_filters/app', 'issues-spec/app.json') | |||
.mockFromFile('/api/issues/search', 'issues-spec/search.json') | |||
@@ -141,7 +141,7 @@ define(function (require) { | |||
bdd.it('should bulk change issues', function () { | |||
return this.remote | |||
.get(require.toUrl('test/medium/base.html')) | |||
.open() | |||
.mockFromString('/api/l10n/index', '{}') | |||
.mockFromFile('/api/issue_filters/app', 'issues-spec/app.json') | |||
.mockFromFile('/api/issues/search', 'issues-spec/search.json') | |||
@@ -160,7 +160,7 @@ define(function (require) { | |||
issueSelector = '.issue[data-key="' + issueKey + '"]'; | |||
return this.remote | |||
.get(require.toUrl('test/medium/base.html')) | |||
.open() | |||
.mockFromString('/api/l10n/index', '{}') | |||
.mockFromFile('/api/issue_filters/app', 'issues-spec/app.json') | |||
.mockFromFile('/api/issues/search', 'issues-spec/search.json') | |||
@@ -190,14 +190,13 @@ define(function (require) { | |||
bdd.it('should filter similar issues', function () { | |||
return this.remote | |||
.get(require.toUrl('test/medium/base.html')) | |||
.open() | |||
.mockFromString('/api/l10n/index', '{}') | |||
.mockFromFile('/api/issue_filters/app', 'issues-spec/app.json') | |||
.mockFromFile('/api/issues/search', | |||
'issues-spec/search-filter-similar-issues-severities.json', { data: { severities: 'MAJOR' } }) | |||
.mockFromFile('/api/issues/search', 'issues-spec/search-filter-similar-issues.json') | |||
.startApp('issues') | |||
.clickElement('.js-new-search') | |||
.checkElementCount('.issue', 2) | |||
.clickElement('.issue.selected .js-issue-filter') | |||
.checkElementExist('.bubble-popup') | |||
.checkElementExist('.bubble-popup [data-property="severities"][data-value="MAJOR"]') | |||
@@ -211,39 +210,42 @@ define(function (require) { | |||
.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', 17); | |||
.checkElementCount('.issue', 1); | |||
}); | |||
bdd.it('should open issue permalink', function () { | |||
var issueKey = 'some-issue-key'; | |||
return this.remote | |||
.get(require.toUrl('test/medium/base.html#issues=' + issueKey)) | |||
.open('#issues=' + issueKey) | |||
.mockFromString('/api/l10n/index', '{}') | |||
.mockFromFile('/api/issue_filters/app', 'issues-page-should-open-issue-permalink/app.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 } }) | |||
//.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') | |||
.startApp('issues') | |||
.checkElementExist('.source-line') | |||
.checkElementInclude('.source-viewer', 'public void executeOn(Project project, SensorContext context') | |||
.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 | |||
.get(require.toUrl('test/medium/base.html')) | |||
.open() | |||
.mockFromString('/api/l10n/index', '{}') | |||
.mockFromFile('/api/issue_filters/app', 'issues-spec/app.json') | |||
.mockFromFile('/api/issues/search', 'issues-spec/search-rules-facet.json', { data: { facets: 'rules' } }) | |||
.mockFromFile('/api/issues/search', 'issues-spec/search.json') | |||
.startApp('issues') | |||
.clickElement('[data-property="rules"] .js-facet-toggle') | |||
.checkElementCount('[data-property="rules"] .js-facet', 15) | |||
.checkElementInclude('[data-property="rules"] .js-facet:nth-child(1)', 'Statements should be on separate'); | |||
.checkElementCount('[data-property="rules"] .js-facet', 13) | |||
.checkElementInclude('[data-property="rules"] .js-facet:nth-child(1)', 'Objects should be compared with'); | |||
}); | |||
}); | |||
@@ -5,7 +5,7 @@ define(function (require) { | |||
bdd.describe('Update Center Page', function () { | |||
bdd.it('should show plugin card', function () { | |||
return this.remote | |||
.get(require.toUrl('test/medium/base.html?1')) | |||
.open() | |||
.mockFromString('/api/l10n/index', '{}') | |||
.mockFromFile('/api/plugins/installed', 'update-center-spec/installed.json') | |||
.mockFromFile('/api/plugins/updates', 'update-center-spec/updates.json') | |||
@@ -32,7 +32,7 @@ define(function (require) { | |||
bdd.it('should show system update', function () { | |||
return this.remote | |||
.get(require.toUrl('test/medium/base.html?2#updates')) | |||
.open('#updates') | |||
.mockFromString('/api/l10n/index', '{}') | |||
.mockFromFile('/api/plugins/installed', 'update-center-spec/installed.json') | |||
.mockFromFile('/api/plugins/updates', 'update-center-spec/updates.json') | |||
@@ -52,7 +52,7 @@ define(function (require) { | |||
bdd.it('should show installed', function () { | |||
return this.remote | |||
.get(require.toUrl('test/medium/base.html?3#installed')) | |||
.open('#installed') | |||
.mockFromString('/api/l10n/index', '{}') | |||
.mockFromFile('/api/plugins/installed', 'update-center-spec/installed.json') | |||
.mockFromFile('/api/plugins/updates', 'update-center-spec/updates.json') | |||
@@ -66,7 +66,7 @@ define(function (require) { | |||
bdd.it('should show updates', function () { | |||
return this.remote | |||
.get(require.toUrl('test/medium/base.html?4#updates')) | |||
.open('#updates') | |||
.mockFromString('/api/l10n/index', '{}') | |||
.mockFromFile('/api/plugins/installed', 'update-center-spec/installed.json') | |||
.mockFromFile('/api/plugins/updates', 'update-center-spec/updates.json') | |||
@@ -81,7 +81,7 @@ define(function (require) { | |||
bdd.it('should show available', function () { | |||
return this.remote | |||
.get(require.toUrl('test/medium/base.html?5#available')) | |||
.open('#available') | |||
.mockFromString('/api/l10n/index', '{}') | |||
.mockFromFile('/api/plugins/available', 'update-center-spec/available.json') | |||
.mockFromFile('/api/plugins/pending', 'update-center-spec/pending.json') | |||
@@ -94,7 +94,7 @@ define(function (require) { | |||
bdd.it('should switch between views', function () { | |||
return this.remote | |||
.get(require.toUrl('test/medium/base.html?6#installed')) | |||
.open('#installed') | |||
.mockFromString('/api/l10n/index', '{}') | |||
.mockFromFile('/api/plugins/installed', 'update-center-spec/installed.json') | |||
.mockFromFile('/api/plugins/updates', 'update-center-spec/updates.json') | |||
@@ -135,7 +135,7 @@ define(function (require) { | |||
bdd.it('should search', function () { | |||
return this.remote | |||
.get(require.toUrl('test/medium/base.html?7#installed')) | |||
.open('#installed') | |||
.mockFromString('/api/l10n/index', '{}') | |||
.mockFromFile('/api/plugins/installed', 'update-center-spec/installed.json') | |||
.mockFromFile('/api/plugins/updates', 'update-center-spec/updates.json') | |||
@@ -154,7 +154,7 @@ define(function (require) { | |||
bdd.it('should show plugin changelog', function () { | |||
return this.remote | |||
.get(require.toUrl('test/medium/base.html?8#installed')) | |||
.open('#installed') | |||
.mockFromString('/api/l10n/index', '{}') | |||
.mockFromFile('/api/plugins/installed', 'update-center-spec/installed.json') | |||
.mockFromFile('/api/plugins/updates', 'update-center-spec/updates.json') | |||
@@ -171,7 +171,7 @@ define(function (require) { | |||
bdd.it('should update plugin', function () { | |||
return this.remote | |||
.get(require.toUrl('test/medium/base.html?9#installed')) | |||
.open('#installed') | |||
.mockFromString('/api/l10n/index', '{}') | |||
.mockFromFile('/api/plugins/installed', 'update-center-spec/installed.json') | |||
.mockFromFile('/api/plugins/updates', 'update-center-spec/updates.json') | |||
@@ -186,7 +186,7 @@ define(function (require) { | |||
bdd.it('should uninstall plugin', function () { | |||
return this.remote | |||
.get(require.toUrl('test/medium/base.html?10#installed')) | |||
.open('#installed') | |||
.mockFromString('/api/l10n/index', '{}') | |||
.mockFromFile('/api/plugins/installed', 'update-center-spec/installed.json') | |||
.mockFromFile('/api/plugins/updates', 'update-center-spec/updates.json') | |||
@@ -201,7 +201,7 @@ define(function (require) { | |||
bdd.it('should install plugin', function () { | |||
return this.remote | |||
.get(require.toUrl('test/medium/base.html?11#available')) | |||
.open('#available') | |||
.mockFromString('/api/l10n/index', '{}') | |||
.mockFromFile('/api/plugins/available', 'update-center-spec/available.json') | |||
.mockFromFile('/api/plugins/pending', 'update-center-spec/pending.json') | |||
@@ -215,7 +215,7 @@ define(function (require) { | |||
bdd.it('should cancel all pending', function () { | |||
return this.remote | |||
.get(require.toUrl('test/medium/base.html?12#available')) | |||
.open('#available') | |||
.mockFromString('/api/l10n/index', '{}') | |||
.mockFromFile('/api/plugins/available', 'update-center-spec/available.json') | |||
.mockFromFile('/api/plugins/pending', 'update-center-spec/pending.json') |
@@ -5,12 +5,10 @@ define(function (require) { | |||
bdd.describe('Users Page', function () { | |||
bdd.it('should show list of users', function () { | |||
return this.remote | |||
.get(require.toUrl('test/medium/base.html')) | |||
.setFindTimeout(5000) | |||
.open() | |||
.mockFromString('/api/l10n/index', '{}') | |||
.mockFromFile('/api/users/search', 'users-spec/search.json') | |||
.startApp('users') | |||
.checkElementCount('#users-list ul', 1) | |||
.checkElementCount('#users-list li[data-login]', 3) | |||
.checkElementInclude('#users-list .js-user-login', 'smith') | |||
.checkElementInclude('#users-list .js-user-name', 'Bob') | |||
@@ -18,7 +16,7 @@ define(function (require) { | |||
.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') | |||
.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') | |||
@@ -29,18 +27,16 @@ define(function (require) { | |||
bdd.it('should search users', function () { | |||
return this.remote | |||
.get(require.toUrl('test/medium/base.html')) | |||
.setFindTimeout(5000) | |||
.open() | |||
.mockFromString('/api/l10n/index', '{}') | |||
.mockFromFile('/api/users/search', 'users-spec/search.json') | |||
.startApp('users') | |||
.checkElementCount('#users-list ul', 1) | |||
.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') | |||
.waitForDeletedByCssSelector('[data-login="admin"]') | |||
.checkElementNotExist('[data-login="admin"]') | |||
.checkElementCount('#users-list li[data-login]', 1) | |||
.clearMocks() | |||
.mockFromFile('/api/users/search', 'users-spec/search.json') | |||
@@ -52,12 +48,10 @@ define(function (require) { | |||
bdd.it('should show more', function () { | |||
return this.remote | |||
.get(require.toUrl('test/medium/base.html')) | |||
.setFindTimeout(5000) | |||
.open() | |||
.mockFromString('/api/l10n/index', '{}') | |||
.mockFromFile('/api/users/search', 'users-spec/search-big-1.json') | |||
.startApp('users') | |||
.checkElementCount('#users-list ul', 1) | |||
.checkElementCount('#users-list li[data-login]', 2) | |||
.clearMocks() | |||
.mockFromFile('/api/users/search', 'users-spec/search-big-2.json') | |||
@@ -68,12 +62,10 @@ define(function (require) { | |||
bdd.it('should create a new user', function () { | |||
return this.remote | |||
.get(require.toUrl('test/medium/base.html')) | |||
.setFindTimeout(5000) | |||
.open() | |||
.mockFromString('/api/l10n/index', '{}') | |||
.mockFromFile('/api/users/search', 'users-spec/search.json') | |||
.startApp('users') | |||
.checkElementCount('#users-list ul', 1) | |||
.checkElementCount('#users-list li[data-login]', 3) | |||
.clickElement('#users-create') | |||
.checkElementCount('#create-user-form', 1) | |||
@@ -82,14 +74,12 @@ define(function (require) { | |||
.mockFromString('/api/users/create', '{}') | |||
.clickElement('#create-user-add-scm-account') | |||
.clickElement('#create-user-add-scm-account') | |||
.execute(function () { | |||
jQuery('#create-user-login').val('login'); | |||
jQuery('#create-user-name').val('name'); | |||
jQuery('#create-user-email').val('email@example.com'); | |||
jQuery('#create-user-password').val('secret'); | |||
jQuery('[name="scmAccounts"]').first().val('scm1'); | |||
jQuery('[name="scmAccounts"]').last().val('scm2'); | |||
}) | |||
.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) | |||
@@ -100,24 +90,20 @@ define(function (require) { | |||
bdd.it('should update a user', function () { | |||
return this.remote | |||
.get(require.toUrl('test/medium/base.html')) | |||
.setFindTimeout(5000) | |||
.open() | |||
.mockFromString('/api/l10n/index', '{}') | |||
.mockFromFile('/api/users/search', 'users-spec/search.json') | |||
.startApp('users') | |||
.checkElementCount('#users-list ul', 1) | |||
.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') | |||
.execute(function () { | |||
jQuery('#create-user-name').val('Mike'); | |||
jQuery('#create-user-email').val('mike@example.com'); | |||
jQuery('[name="scmAccounts"]').first().val('scm5'); | |||
jQuery('[name="scmAccounts"]').last().val('scm6'); | |||
}) | |||
.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') | |||
@@ -127,38 +113,30 @@ define(function (require) { | |||
bdd.it('should change user\'s password', function () { | |||
return this.remote | |||
.get(require.toUrl('test/medium/base.html')) | |||
.setFindTimeout(5000) | |||
.open() | |||
.mockFromString('/api/l10n/index', '{}') | |||
.mockFromFile('/api/users/search', 'users-spec/search.json') | |||
.startApp('users') | |||
.checkElementCount('#users-list ul', 1) | |||
.clickElement('[data-login="smith"] .js-user-change-password') | |||
.checkElementCount('#change-user-password-form', 1) | |||
.clearMocks() | |||
.mockFromString('/api/users/change_password', '{}') | |||
.execute(function () { | |||
jQuery('#change-user-password-password').val('secret'); | |||
jQuery('#change-user-password-password-confirmation').val('another'); | |||
}) | |||
.fillElement('#change-user-password-password', 'secret') | |||
.fillElement('#change-user-password-password-confirmation', 'another') | |||
.clickElement('#change-user-password-submit') | |||
.checkElementCount('.alert.alert-danger', 1) | |||
.execute(function () { | |||
jQuery('#change-user-password-password').val('secret'); | |||
jQuery('#change-user-password-password-confirmation').val('secret'); | |||
}) | |||
.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 | |||
.get(require.toUrl('test/medium/base.html')) | |||
.setFindTimeout(5000) | |||
.open() | |||
.mockFromString('/api/l10n/index', '{}') | |||
.mockFromFile('/api/users/search', 'users-spec/search.json') | |||
.startApp('users') | |||
.checkElementCount('#users-list ul', 1) | |||
.clickElement('[data-login="smith"] .js-user-deactivate') | |||
.checkElementCount('#deactivate-user-form', 1) | |||
.clearMocks() |