11/// <reference types="Cypress" />
22context ( 'Permission Manager' , ( ) => {
3- describe ( 'working with tree view' , ( ) => {
4- before ( ( ) => {
5- cy . connect ( )
6- cy . visit ( '/' )
7- cy . get ( `[node-id=${ CSS . escape ( 'admin@' + Cypress . env ( 'API_HOST' ) ) } ]` )
8- . click ( )
9- } )
10-
11- // TODO(DP): note how the tree expansion for groups and users is memorized we need to clean that up
12-
13- describe ( 'the security item' , ( ) => {
14- it ( 'should have user entries' , ( ) => {
15- cy . get ( '[node-id$=security]' )
16- . click ( )
17- cy . get ( '.ReactVirtualized__Grid' )
18- . contains ( 'Users' )
19- . click ( )
20- cy . get ( '[node-id$=guest]' )
21- . should ( 'be.visible' )
22- } )
23-
24- it ( 'should let us create a new user' , ( ) => {
25- cy . get ( '[node-id$=security]' )
26- . rightclick ( )
27- cy . get ( '[data-command="fusion.add-user"]' )
28- . contains ( 'Add' )
29- . should ( 'be.visible' )
30- // TODO(DP): finish creating a test user
31- } )
32-
33- it ( 'should display user properties card' , ( ) => {
34- cy . get ( '[node-id$=user\\/guest]' )
35- . rightclick ( )
36- cy . get ( '.p-Menu > ul > .p-Menu-item' )
37- . should ( 'be.visible' )
38- . should ( 'have.length' , 2 )
39- cy . get ( '[data-command="fusion.edit-user"]' )
40- . click ( )
41- cy . get ( '.dialogTitle' )
42- . contains ( 'guest' )
43- cy . get ( '.pb-headers > a' )
44- . should ( 'have.length' , 3 )
45- cy . get ( '.dialogContent' )
46- . contains ( 'Username' )
47- cy . get ( '.pb-headers > a:nth-child(2)' )
48- . click ( )
49- cy . get ( '.dialogContent' )
50- . contains ( 'Primary group' )
51- cy . get ( '.pb-headers > a:nth-child(3)' )
52- . click ( )
53- cy . get ( '.active > .pb-tab > .keys > tr' )
54- . should ( 'have.length' , 9 )
55- cy . get ( '.secondary' )
56- . click ( )
57- } )
58-
59- it . skip ( 'should let us delete a user' , ( ) => {
60- cy . get ( '.ReactVirtualized__Grid' )
61- . contains ( 'Users' )
62- . click ( )
63- cy . get ( '[node-id$=use\\/guest]' )
64- . should ( 'be.visible' )
65- } )
66-
3+ describe ( 'working with security item' , ( ) => {
4+ before ( ( ) => {
5+ cy . connect ( )
6+ cy . visit ( '/' )
7+ cy . get ( `[node-id=${ CSS . escape ( 'admin@' + Cypress . env ( 'API_HOST' ) ) } ]` )
8+ . click ( )
9+ } )
10+
11+ it ( 'should have user entries' , ( ) => {
12+ cy . get ( '[node-id$=security]' )
13+ . click ( )
14+ cy . get ( '.ReactVirtualized__Grid' )
15+ . contains ( 'Users' )
16+ . click ( )
17+ cy . get ( '[node-id$=user\\/guest]' )
18+ . should ( 'be.visible' )
19+ } )
20+
21+ it ( 'should have group entries' , ( ) => {
22+ cy . get ( '.ReactVirtualized__Grid' )
23+ . contains ( 'Groups' )
24+ . click ( )
25+ cy . get ( '[node-id$=group\\/guest]' )
26+ . should ( 'be.visible' )
27+ } )
28+
29+ // TODO(DP): note how the tree expansion for groups and users is memorized we need to clean that up
30+ describe ( 'the user item' , ( ) => {
31+ it ( 'should let us create a new user' , ( ) => {
32+ cy . get ( '[node-id$=security]' )
33+ . rightclick ( )
34+ cy . get ( '[data-command="fusion.add-user"]' )
35+ . contains ( 'Add' )
36+ . should ( 'be.visible' )
37+ . click ( )
38+ cy . get ( ':nth-child(1) > .theia-input' )
39+ . type ( 'cy-usr' , { force : true } )
40+ // TODO(DP): better selector see #411
41+ cy . get ( ':nth-child(2) > :nth-child(1) > .checkbox > .checkbox-box' )
42+ . click ( )
43+ cy . get ( '.pb-headers > :nth-child(2)' )
44+ . click ( )
45+ // s.a. #411
46+ cy . get ( '.awesomplete > .theia-input' )
47+ . type ( 'guest{enter}' )
48+ cy . get ( '.main' )
49+ . click ( )
50+ cy . get ( '[node-id$=user\\/cy-usr]' )
51+ . should ( 'be.visible' )
52+ } )
53+
54+ it ( 'should display user properties card' , ( ) => {
55+ cy . get ( '[node-id$=user\\/guest]' )
56+ . rightclick ( )
57+ cy . get ( '.p-Menu > ul > .p-Menu-item' )
58+ . should ( 'be.visible' )
59+ . should ( 'have.length' , 2 )
60+ cy . get ( '[data-command="fusion.edit-user"]' )
61+ . click ( )
62+ cy . get ( '.dialogTitle' )
63+ . contains ( 'guest' )
64+ cy . get ( '.pb-headers > a' )
65+ . should ( 'have.length' , 3 )
66+ cy . get ( '.dialogContent' )
67+ . contains ( 'Username' )
68+ cy . get ( '.pb-headers > a:nth-child(2)' )
69+ . click ( )
70+ cy . get ( '.dialogContent' )
71+ . contains ( 'Primary group' )
72+ cy . get ( '.pb-headers > a:nth-child(3)' )
73+ . click ( )
74+ cy . get ( '.active > .pb-tab > .keys > tr' )
75+ . should ( 'have.length' , 9 )
76+ cy . get ( '.secondary' )
77+ . click ( )
6778 } )
68-
69- describe ( 'the groups item' , ( ) => {
70- it ( 'should have group entries' , ( ) => {
71- cy . get ( '.ReactVirtualized__Grid' )
72- . contains ( 'Groups' )
73- . click ( )
74- cy . get ( '[node-id$=group\\/guest]' )
75- . should ( 'be.visible' )
76- } )
77-
78- it ( 'should let us create a new group' , ( ) => {
79- cy . get ( '[node-id$=security]' )
80- . rightclick ( )
81- cy . get ( '[data-command="fusion.add-group"]' )
82- . contains ( 'Add' )
83- . should ( 'be.visible' )
84- // TODO(DP): finish creating a test group
85- } )
86-
87- it ( 'should display group properties card' , ( ) => {
88- cy . get ( '[node-id$=group\\/guest]' )
89- . rightclick ( )
90- cy . get ( '.p-Menu > ul > .p-Menu-item' )
91- . should ( 'be.visible' )
92- . should ( 'have.length' , 2 )
93- cy . get ( '[data-command="fusion.edit-group"]' )
94- . click ( )
95- cy . get ( '.dialogTitle' )
96- . contains ( 'guest' )
97- cy . get ( '.pb-headers > a' )
98- . should ( 'have.length' , 2 )
99- cy . get ( '.dialogContent' )
100- . contains ( 'Group name' )
101- cy . get ( '.pb-headers > a:nth-child(2)' )
102- . click ( )
103- cy . get ( '.active > .pb-tab > .keys > tr' )
104- . should ( 'have.length' , 3 )
105- cy . get ( '.secondary' )
106- . click ( )
107- } )
108-
109- it . skip ( 'should let us delete a group' , ( ) => {
110- cy . get ( '.ReactVirtualized__Grid' )
111- . contains ( 'Users' )
112- . click ( )
113- cy . get ( '[node-id$=use\\/guest]' )
114- . should ( 'be.visible' )
115- } )
79+
80+ it ( 'should let us delete a user' , ( ) => {
81+ cy . get ( '[node-id$=user\\/cy-usr]' )
82+ . rightclick ( )
83+ cy . get ( '[data-command="fusion.delete-user"]' )
84+ . click ( )
85+ cy . get ( '.dialogContent' )
86+ . contains ( 'Are you sure' )
87+ cy . get ( '.main' )
88+ . click ( )
89+ cy . get ( '[node-id$=user\\/cy-usr]' )
90+ . should ( 'not.exist' )
91+ } )
92+ } )
93+
94+ describe ( 'the groups item' , ( ) => {
95+ it ( 'should let us create a new group' , ( ) => {
96+ cy . get ( '[node-id$=security]' )
97+ . rightclick ( )
98+ cy . get ( '[data-command="fusion.add-group"]' )
99+ . contains ( 'Add' )
100+ . should ( 'be.visible' )
101+ . click ( )
102+ . focused ( )
103+ . type ( 'cy-group{enter}' , { force : true } )
104+ cy . get ( '[node-id$=group\\/cy-group]' )
105+ . should ( 'be.visible' )
106+ } )
107+
108+ it ( 'should display group properties card' , ( ) => {
109+ cy . get ( '[node-id$=group\\/guest]' )
110+ . rightclick ( )
111+ cy . get ( '.p-Menu > ul > .p-Menu-item' )
112+ . should ( 'be.visible' )
113+ . should ( 'have.length' , 2 )
114+ cy . get ( '[data-command="fusion.edit-group"]' )
115+ . click ( )
116+ cy . get ( '.dialogTitle' )
117+ . contains ( 'guest' )
118+ cy . get ( '.pb-headers > a' )
119+ . should ( 'have.length' , 2 )
120+ cy . get ( '.dialogContent' )
121+ . contains ( 'Group name' )
122+ cy . get ( '.pb-headers > a:nth-child(2)' )
123+ . click ( )
124+ cy . get ( '.active > .pb-tab > .keys > tr' )
125+ . should ( 'have.length' , 3 )
126+ cy . get ( '.secondary' )
127+ . click ( )
128+ } )
129+
130+ it ( 'should let us delete a group' , ( ) => {
131+ cy . get ( '[node-id$=group\\/cy-group]' )
132+ . rightclick ( )
133+ cy . get ( '[data-command="fusion.delete-group"]' )
134+ . click ( )
135+ cy . get ( '.dialogContent' )
136+ . contains ( 'Are you sure' )
137+ cy . get ( '.main' )
138+ . click ( )
139+ cy . get ( '[node-id$=user\\/cy-group]' )
140+ . should ( 'not.exist' )
116141 } )
117-
118142 } )
119- } )
143+ } )
144+ } )
0 commit comments