@@ -62,7 +62,8 @@ describe('Json Editor', () => {
62
62
cy . get ( '.add-button' )
63
63
. last ( )
64
64
. within ( ( ) => {
65
- cy . get ( 'ngx-dropdown' ) . as ( 'addPropDropdown' ) . scrollIntoView ( ) . should ( 'be.visible' ) ;
65
+ cy . get ( 'ngx-dropdown' ) . as ( 'addPropDropdown' ) . scrollIntoView ( ) ;
66
+ cy . get ( '@addPropDropdown' ) . should ( 'be.visible' ) ;
66
67
cy . get ( '@addPropDropdown' ) . find ( 'ngx-dropdown-toggle' ) . should ( 'contain.text' , 'Add a property' ) . click ( ) ;
67
68
cy . get ( '@addPropDropdown' ) . find ( 'ngx-dropdown-menu' ) . should ( 'exist' ) ;
68
69
} ) ;
@@ -77,20 +78,22 @@ describe('Json Editor', () => {
77
78
it ( 'Should allow to add a property of type array' , ( ) => {
78
79
cy . get ( '@jsonEditorFlat' ) . within ( ( ) => {
79
80
cy . get ( 'ngx-dropdown-menu' )
81
+ . last ( )
80
82
. should ( 'exist' )
81
83
. within ( ( ) => {
82
84
cy . contains ( 'li' , 'Array' ) . click ( ) ;
83
85
} ) ;
84
86
} ) ;
85
87
cy . get ( '@jsonEditorFlat' ) . within ( ( ) => {
86
- cy . get ( 'ngx-dropdown-menu' ) . should ( 'not.be.visible' ) ;
88
+ cy . get ( 'ngx-dropdown-menu' ) . last ( ) . should ( 'not.be.visible' ) ;
87
89
} ) ;
88
90
cy . get ( 'ngx-json-array-node-flat' ) . should ( 'exist' ) ;
89
91
} ) ;
90
92
91
93
it ( 'should allow adding primitive items to newly created array property' , ( ) => {
94
+ cy . get ( 'ngx-json-array-node-flat' ) . scrollIntoView ( ) ;
95
+
92
96
cy . get ( 'ngx-json-array-node-flat' )
93
- . scrollIntoView ( )
94
97
. should ( 'contain.text' , 'Array' )
95
98
. within ( ( ) => {
96
99
cy . get ( '.add-button' )
@@ -99,13 +102,15 @@ describe('Json Editor', () => {
99
102
cy . get ( 'ngx-dropdown-toggle' ) . should ( 'contain.text' , 'Add an item' ) . click ( ) ;
100
103
} ) ;
101
104
cy . get ( 'ngx-dropdown-menu' )
105
+ . last ( )
102
106
. should ( 'be.visible' )
103
107
. within ( ( ) => {
104
108
cy . contains ( 'li' , 'String' ) . click ( ) ;
105
109
} ) ;
106
110
} ) ;
107
111
cy . get ( 'ngx-json-array-node-flat' )
108
112
. should ( 'exist' )
113
+ . last ( )
109
114
. within ( ( ) => {
110
115
cy . get ( '.node-input ngx-input' ) . should ( 'exist' ) . should ( 'have.attr' , 'type' , 'textarea' ) . ngxFill ( 'test' ) ;
111
116
} ) ;
@@ -115,13 +120,15 @@ describe('Json Editor', () => {
115
120
cy . get ( 'ngx-json-array-node-flat' ) . within ( ( ) => {
116
121
cy . get ( '.node-options' )
117
122
. should ( 'be.visible' )
123
+ . first ( )
118
124
. within ( ( ) => {
119
125
cy . get ( 'ngx-dropdown-toggle' ) . should ( 'be.visible' ) . click ( ) ;
120
126
} ) ;
121
127
cy . get ( 'ngx-dropdown-menu' )
122
128
. should ( 'be.visible' )
129
+ . first ( )
123
130
. within ( ( ) => {
124
- cy . contains ( 'li ' , 'Delete' ) . click ( ) ;
131
+ cy . contains ( 'button ' , 'Delete' ) . click ( { force : true } ) ;
125
132
} ) ;
126
133
} ) ;
127
134
@@ -139,29 +146,31 @@ describe('Json Editor', () => {
139
146
} ) ;
140
147
cy . get ( 'ngx-dropdown-menu' )
141
148
. should ( 'be.visible' )
149
+ . last ( )
142
150
. within ( ( ) => {
143
151
cy . contains ( 'li' , 'Object' ) . click ( ) ;
144
152
} ) ;
153
+ cy . get ( 'ngx-json-object-node-flat' ) . scrollIntoView ( ) ;
154
+
145
155
cy . get ( 'ngx-json-object-node-flat' )
146
- . scrollIntoView ( )
147
156
. should ( 'exist' )
148
157
. within ( ( ) => {
149
158
cy . get ( '.add-button' )
150
159
. should ( 'be.visible' )
160
+ . last ( )
151
161
. within ( ( ) => {
152
162
cy . get ( 'ngx-dropdown-toggle' ) . should ( 'contain.text' , 'Add a property' ) . click ( ) ;
153
163
} ) ;
164
+
154
165
cy . get ( 'ngx-dropdown-menu' )
155
166
. should ( 'be.visible' )
156
167
. within ( ( ) => {
157
168
cy . contains ( 'li' , 'String' ) . click ( ) ;
158
169
} ) ;
159
170
160
- cy . get ( 'ngx-json-editor-node-info' )
161
- . scrollIntoView ( )
162
- . find ( 'ngx-input' )
163
- . should ( 'be.visible' )
164
- . ngxFill ( 'name' ) ;
171
+ cy . get ( 'ngx-json-editor-node-info' ) . scrollIntoView ( ) ;
172
+
173
+ cy . get ( 'ngx-json-editor-node-info' ) . find ( 'ngx-input' ) . should ( 'be.visible' ) . ngxFill ( 'name' ) ;
165
174
166
175
cy . get ( '.node-input ngx-input' )
167
176
. should ( 'exist' )
@@ -173,23 +182,25 @@ describe('Json Editor', () => {
173
182
174
183
it ( 'should allow adding another object with same props as array item' , ( ) => {
175
184
cy . get ( 'ngx-json-array-node-flat' ) . within ( ( ) => {
185
+ cy . get ( '.add-button' ) . last ( ) . scrollIntoView ( ) ;
176
186
cy . get ( '.add-button' )
187
+ . last ( )
177
188
. should ( 'be.visible' )
178
189
. within ( ( ) => {
179
- cy . get ( 'ngx-dropdown-toggle' ) . eq ( 1 ) . should ( 'contain.text' , 'Add an item' ) . click ( ) ;
180
- cy . get ( 'ngx-dropdown-menu' )
181
- . eq ( 1 )
182
- . scrollIntoView ( )
190
+ cy . get ( 'ngx-dropdown-toggle' ) . should ( 'contain.text' , 'Add an item' ) . click ( ) ;
191
+ cy . get ( 'ngx-dropdown-menu' ) . scrollIntoView ( ) ;
183
192
193
+ cy . get ( 'ngx-dropdown-menu' )
184
194
. should ( 'be.visible' )
195
+ . last ( )
185
196
. within ( ( ) => {
186
197
cy . contains ( 'li' , 'Object' ) . click ( ) ;
187
198
} ) ;
188
199
} ) ;
189
200
201
+ cy . get ( 'ngx-json-object-node-flat' ) . eq ( 1 ) . scrollIntoView ( ) ;
190
202
cy . get ( 'ngx-json-object-node-flat' )
191
203
. eq ( 1 )
192
- . scrollIntoView ( )
193
204
. should ( 'exist' )
194
205
. within ( ( ) => {
195
206
cy . get ( '.add-button' )
@@ -203,11 +214,9 @@ describe('Json Editor', () => {
203
214
} ) ;
204
215
} ) ;
205
216
206
- cy . get ( 'ngx-json-editor-node-info' )
207
- . scrollIntoView ( )
208
- . find ( 'ngx-input' )
209
- . should ( 'be.visible' )
210
- . ngxFill ( 'name' ) ;
217
+ cy . get ( 'ngx-json-editor-node-info' ) . scrollIntoView ( ) ;
218
+
219
+ cy . get ( 'ngx-json-editor-node-info' ) . find ( 'ngx-input' ) . should ( 'be.visible' ) . ngxFill ( 'name' ) ;
211
220
212
221
cy . get ( '.node-input ngx-input' )
213
222
. should ( 'exist' )
@@ -261,7 +270,8 @@ describe('Json Editor', () => {
261
270
beforeEach ( ( ) => {
262
271
cy . get ( '@section3' ) . find ( 'ngx-json-editor-flat' ) . as ( 'jsonEditorFlat' ) ;
263
272
cy . get ( '@jsonEditorFlat' ) . find ( '.add-button' ) . last ( ) . find ( 'ngx-dropdown' ) . as ( 'addPropDropdown' ) ;
264
- cy . get ( '@addPropDropdown' ) . scrollIntoView ( ) . should ( 'be.visible' ) ;
273
+ cy . get ( '@addPropDropdown' ) . scrollIntoView ( ) ;
274
+ cy . get ( '@addPropDropdown' ) . should ( 'be.visible' ) ;
265
275
} ) ;
266
276
describe ( 'String prop' , ( ) => {
267
277
it ( 'Adding' , ( ) => {
@@ -318,7 +328,8 @@ describe('Json Editor', () => {
318
328
} ) ;
319
329
320
330
it ( 'Checking after modification' , ( ) => {
321
- cy . get ( '@stringTabs' ) . scrollIntoView ( ) . ngxSelectTab ( 1 ) ;
331
+ cy . get ( '@stringTabs' ) . scrollIntoView ( ) ;
332
+ cy . get ( '@stringTabs' ) . ngxSelectTab ( 1 ) ;
322
333
cy . get ( '@stringTabs' ) . find ( '.ngx-tab-content ngx-tab' ) . eq ( 1 ) . as ( 'tabModel' ) ;
323
334
cy . get ( '@tabModel' ) . should ( 'contain' , '"abc"' ) ;
324
335
@@ -343,7 +354,8 @@ describe('Json Editor', () => {
343
354
} ) ;
344
355
describe ( 'Checking' , ( ) => {
345
356
beforeEach ( ( ) => {
346
- cy . get ( '@section3' ) . scrollIntoView ( ) . find ( 'ngx-json-editor-flat div.node' ) . eq ( 2 ) . as ( 'arrayNode' ) ;
357
+ cy . get ( '@section3' ) . scrollIntoView ( ) ;
358
+ cy . get ( '@section3' ) . find ( 'ngx-json-editor-flat div.node' ) . eq ( 2 ) . as ( 'arrayNode' ) ;
347
359
cy . get ( '@arrayNode' ) . find ( 'ngx-tabs' ) . as ( 'arrayTabs' ) ;
348
360
} ) ;
349
361
@@ -389,7 +401,8 @@ describe('Json Editor', () => {
389
401
cy . get ( '@section3' ) . find ( 'ngx-json-editor-flat div.node' ) . eq ( 3 ) . as ( 'arraySub1Node' ) ;
390
402
cy . get ( '@arraySub1Node' ) . find ( 'ngx-tabs' ) . as ( 'stringTabs' ) ;
391
403
392
- cy . get ( '@arraySub1Node' ) . scrollIntoView ( ) . ngxSelectTab ( 1 ) ;
404
+ cy . get ( '@arraySub1Node' ) . scrollIntoView ( ) ;
405
+ cy . get ( '@arraySub1Node' ) . ngxSelectTab ( 1 ) ;
393
406
cy . get ( '@arraySub1Node' ) . find ( '.ngx-tab-content ngx-tab' ) . eq ( 1 ) . as ( 'tabModel' ) ;
394
407
cy . get ( '@tabModel' ) . should ( 'contain' , '0' ) ;
395
408
@@ -418,14 +431,15 @@ describe('Json Editor', () => {
418
431
} ) ;
419
432
describe ( 'Remove props' , ( ) => {
420
433
it ( 'Removing array' , ( ) => {
421
- cy . get ( '@section3' ) . scrollIntoView ( ) . find ( 'ngx-json-editor-flat div.node' ) . eq ( 2 ) . as ( 'arrayNode' ) ;
434
+ cy . get ( '@section3' ) . scrollIntoView ( ) ;
435
+ cy . get ( '@section3' ) . find ( 'ngx-json-editor-flat div.node' ) . eq ( 2 ) . as ( 'arrayNode' ) ;
422
436
cy . get ( '@arrayNode' ) . find ( '.node-options ngx-dropdown' ) . as ( 'nodeOptions' ) ;
423
437
cy . get ( '@nodeOptions' ) . find ( 'ngx-dropdown-toggle' ) . click ( ) ;
424
438
cy . get ( '@nodeOptions' )
425
439
. find ( 'ngx-dropdown-menu' )
426
440
. should ( 'exist' )
427
441
. within ( ( ) => {
428
- cy . contains ( 'li ' , 'Remove' ) . click ( ) ;
442
+ cy . contains ( 'button ' , 'Remove' ) . click ( ) ;
429
443
} ) ;
430
444
} ) ;
431
445
describe ( 'Check root schema and model sync' , ( ) => {
@@ -478,7 +492,8 @@ describe('Json Editor', () => {
478
492
cy . get ( '.add-button' )
479
493
. last ( )
480
494
. within ( ( ) => {
481
- cy . get ( 'ngx-dropdown' ) . as ( 'addPropDropdown' ) . scrollIntoView ( ) . should ( 'be.visible' ) ;
495
+ cy . get ( 'ngx-dropdown' ) . as ( 'addPropDropdown' ) . scrollIntoView ( ) ;
496
+ cy . get ( '@addPropDropdown' ) . should ( 'be.visible' ) ;
482
497
cy . get ( '@addPropDropdown' ) . find ( 'ngx-dropdown-toggle' ) . should ( 'contain.text' , 'Add a property' ) . click ( ) ;
483
498
cy . get ( '@addPropDropdown' ) . find ( 'ngx-dropdown-menu' ) . should ( 'exist' ) ;
484
499
cy . contains ( 'li' , 'Object' ) . click ( ) ;
@@ -509,7 +524,8 @@ describe('Json Editor', () => {
509
524
cy . get ( '.add-button' )
510
525
. first ( )
511
526
. within ( ( ) => {
512
- cy . get ( 'ngx-dropdown' ) . as ( 'addPropDropdown' ) . scrollIntoView ( ) . should ( 'be.visible' ) ;
527
+ cy . get ( 'ngx-dropdown' ) . as ( 'addPropDropdown' ) . scrollIntoView ( ) ;
528
+ cy . get ( '@addPropDropdown' ) . should ( 'be.visible' ) ;
513
529
cy . get ( '@addPropDropdown' ) . find ( 'ngx-dropdown-toggle' ) . should ( 'contain.text' , 'Add a property' ) . click ( ) ;
514
530
cy . get ( '@addPropDropdown' ) . find ( 'ngx-dropdown-menu' ) . should ( 'exist' ) ;
515
531
cy . contains ( 'li' , 'String' ) . click ( ) ;
@@ -540,7 +556,7 @@ describe('Json Editor', () => {
540
556
. should ( 'be.visible' )
541
557
. within ( ( ) => {
542
558
cy . get ( 'ngx-dropdown-toggle' ) . should ( 'be.visible' ) . click ( ) ;
543
- cy . contains ( 'li ' , 'Remove' ) . click ( ) ;
559
+ cy . contains ( 'button ' , 'Remove' ) . click ( ) ;
544
560
} ) ;
545
561
cy . get ( 'ngx-json-editor-flat' ) . as ( 'jsonEditorFlat' ) ;
546
562
cy . get ( '@jsonEditorFlat' ) . within ( ( ) => {
0 commit comments