1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
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');
});
});
});
|