@@ -13,15 +13,30 @@ describe('Jobs: List', () => {
13
13
let inventory : Inventory ;
14
14
let jobTemplate : JobTemplate ;
15
15
let job : Job ;
16
+ let project : Project ;
17
+ let organization : Organization ;
18
+
19
+ before ( ( ) => {
20
+ cy . createAwxOrganization ( ) . then ( ( org ) => {
21
+ organization = org ;
22
+ cy . createAwxProject ( { organization : org . id } ) . then ( ( p ) => {
23
+ project = p ;
24
+ } ) ;
25
+ } ) ;
26
+ } ) ;
27
+
28
+ after ( ( ) => {
29
+ cy . deleteAwxProject ( project , { failOnStatusCode : false } ) . then ( ( ) => {
30
+ cy . deleteAwxOrganization ( organization , { failOnStatusCode : false } ) ;
31
+ } ) ;
32
+ } ) ;
16
33
17
34
beforeEach ( function ( ) {
18
- const globalAwxOrganization = this . globalAwxOrganization as Organization ;
19
- const globalProject = this . globalProject as Project ;
20
- cy . createAwxInventory ( { organization : globalAwxOrganization . id } ) . then ( ( inv ) => {
35
+ cy . createAwxInventory ( { organization : organization . id } ) . then ( ( inv ) => {
21
36
inventory = inv ;
22
37
cy . createAwxJobTemplate ( {
23
- organization : globalAwxOrganization . id ,
24
- project : globalProject . id ,
38
+ organization : organization . id ,
39
+ project : project . id ,
25
40
inventory : inv . id ,
26
41
} ) . then ( ( jt ) => {
27
42
jobTemplate = jt ;
@@ -52,6 +67,7 @@ describe('Jobs: List', () => {
52
67
cy . contains ( jobName ) ;
53
68
cy . clearAllFilters ( ) ;
54
69
} ) ;
70
+
55
71
it ( 'can relaunch the job and navigate to job output' , ( ) => {
56
72
cy . navigateTo ( 'awx' , 'jobs' ) ;
57
73
const jobId = job . id ? job . id . toString ( ) : '' ;
@@ -108,28 +124,38 @@ describe('Jobs: List', () => {
108
124
describe ( 'Jobs: Delete' , ( ) => {
109
125
let inventory : Inventory ;
110
126
let jobTemplate : JobTemplate ;
127
+ let project : Project ;
111
128
let organization : Organization ;
112
129
113
- beforeEach ( function ( ) {
114
- const globalProject = this . globalProject as Project ;
115
-
116
- cy . createAwxOrganization ( 'E2E Organization' + randomString ( 4 ) ) . then ( ( org ) => {
130
+ before ( ( ) => {
131
+ cy . createAwxOrganization ( ) . then ( ( org ) => {
117
132
organization = org ;
118
- cy . createAwxInventory ( { organization : organization . id } ) . then ( ( inv ) => {
119
- inventory = inv ;
120
- cy . createAwxJobTemplate ( {
121
- organization : organization . id ,
122
- project : globalProject . id ,
123
- inventory : inv . id ,
124
- } ) . then ( ( jt ) => {
125
- jobTemplate = jt ;
126
- } ) ;
133
+ cy . createAwxProject ( { organization : org . id } ) . then ( ( p ) => {
134
+ project = p ;
135
+ } ) ;
136
+ } ) ;
137
+ } ) ;
138
+
139
+ after ( ( ) => {
140
+ cy . deleteAwxProject ( project , { failOnStatusCode : false } ) . then ( ( ) => {
141
+ cy . deleteAwxOrganization ( organization , { failOnStatusCode : false } ) ;
142
+ } ) ;
143
+ } ) ;
144
+
145
+ beforeEach ( function ( ) {
146
+ cy . createAwxInventory ( { organization : organization . id } ) . then ( ( inv ) => {
147
+ inventory = inv ;
148
+ cy . createAwxJobTemplate ( {
149
+ organization : organization . id ,
150
+ project : project . id ,
151
+ inventory : inv . id ,
152
+ } ) . then ( ( jt ) => {
153
+ jobTemplate = jt ;
127
154
} ) ;
128
155
} ) ;
129
156
} ) ;
130
157
131
158
afterEach ( ( ) => {
132
- cy . deleteAwxOrganization ( organization ) ;
133
159
cy . deleteAwxJobTemplate ( jobTemplate , { failOnStatusCode : false } ) ;
134
160
cy . deleteAwxInventory ( inventory , { failOnStatusCode : false } ) ;
135
161
} ) ;
@@ -162,6 +188,7 @@ describe('Jobs: Delete', () => {
162
188
}
163
189
) ;
164
190
} ) ;
191
+
165
192
it ( 'can delete a job from the jobs list toolbar' , ( ) => {
166
193
const jobTemplateId = jobTemplate . id ? jobTemplate . id . toString ( ) : '' ;
167
194
cy . requestPost < UnifiedJobList > ( awxAPI `/job_templates/${ jobTemplateId } /launch/` , { } ) . then (
@@ -195,6 +222,17 @@ describe('Jobs: Delete', () => {
195
222
196
223
describe ( 'Jobs: Output and Details Screen' , ( ) => {
197
224
let thisId : string ;
225
+ let organization : Organization ;
226
+
227
+ before ( ( ) => {
228
+ cy . createAwxOrganization ( ) . then ( ( org ) => {
229
+ organization = org ;
230
+ } ) ;
231
+ } ) ;
232
+
233
+ after ( ( ) => {
234
+ cy . deleteAwxOrganization ( organization , { failOnStatusCode : false } ) ;
235
+ } ) ;
198
236
199
237
it ( 'can launch a Management job, let it finish, and assert expected results on the output screen' , ( ) => {
200
238
cy . navigateTo ( 'awx' , 'management-jobs' ) ;
@@ -223,13 +261,14 @@ describe('Jobs: Output and Details Screen', () => {
223
261
cy . getByDataCy ( 'status' ) . should ( 'contain' , 'Success' ) ;
224
262
cy . getByDataCy ( 'type' ) . should ( 'contain' , 'Management job' ) ;
225
263
} ) ;
264
+
226
265
it ( 'can launch a Source Control Update job, let it finish, and assert expected results on the output screen' , function ( ) {
227
266
const projectName = 'E2E Project Jobs ' + randomString ( 4 ) ;
228
267
cy . navigateTo ( 'awx' , 'projects' ) ;
229
268
cy . verifyPageTitle ( 'Projects' ) ;
230
269
cy . clickLink ( / ^ C r e a t e p r o j e c t $ / ) ;
231
270
cy . get ( '[data-cy="name"]' ) . type ( projectName ) ;
232
- cy . singleSelectByDataCy ( 'organization' , `${ ( this . globalAwxOrganization as Organization ) . name } ` ) ;
271
+ cy . singleSelectByDataCy ( 'organization' , `${ organization . name } ` ) ;
233
272
cy . selectDropdownOptionByResourceName ( 'source_control_type' , 'Git' ) ;
234
273
cy . get ( '[data-cy="scm-url"]' ) . type ( 'https://github.com/ansible/ansible-ui' ) ;
235
274
cy . intercept ( 'POST' , awxAPI `/projects/` ) . as ( 'newProject' ) ;
@@ -267,28 +306,40 @@ describe('Job template: Output and Details Screen', () => {
267
306
let inventory : Inventory ;
268
307
let jobTemplate : JobTemplate ;
269
308
let thisId : string ;
309
+ let project : Project ;
270
310
let organization : Organization ;
271
311
312
+ before ( ( ) => {
313
+ cy . createAwxOrganization ( ) . then ( ( org ) => {
314
+ organization = org ;
315
+ cy . createAwxProject ( { organization : org . id } ) . then ( ( p ) => {
316
+ project = p ;
317
+ } ) ;
318
+ } ) ;
319
+ } ) ;
320
+
321
+ after ( ( ) => {
322
+ cy . deleteAwxProject ( project , { failOnStatusCode : false } ) . then ( ( ) => {
323
+ cy . deleteAwxOrganization ( organization , { failOnStatusCode : false } ) ;
324
+ } ) ;
325
+ } ) ;
326
+
272
327
beforeEach ( function ( ) {
273
- cy . createAwxOrganization ( ) . then ( ( o ) => {
274
- organization = o ;
275
- cy . createAwxInventory ( { organization : organization . id } ) . then ( ( i ) => {
276
- inventory = i ;
277
- cy . createAwxJobTemplate ( {
278
- organization : organization . id ,
279
- project : ( this . globalProject as Project ) . id ,
280
- inventory : i . id ,
281
- } ) . then ( ( jt ) => {
282
- jobTemplate = jt ;
283
- } ) ;
328
+ cy . createAwxInventory ( { organization : organization . id } ) . then ( ( i ) => {
329
+ inventory = i ;
330
+ cy . createAwxJobTemplate ( {
331
+ organization : organization . id ,
332
+ project : project . id ,
333
+ inventory : i . id ,
334
+ } ) . then ( ( jt ) => {
335
+ jobTemplate = jt ;
284
336
} ) ;
285
337
} ) ;
286
338
} ) ;
287
339
288
340
afterEach ( ( ) => {
289
341
cy . deleteAwxJobTemplate ( jobTemplate , { failOnStatusCode : false } ) ;
290
342
cy . deleteAwxInventory ( inventory , { failOnStatusCode : false } ) ;
291
- cy . deleteAwxOrganization ( organization , { failOnStatusCode : false } ) ;
292
343
} ) ;
293
344
294
345
it ( 'can launch a Playbook Run job, let it finish, and assert expected results on the output screen' , ( ) => {
@@ -325,25 +376,38 @@ describe('Job template: Output and Details Screen', () => {
325
376
describe ( 'Inventory source: Output and Details Screen' , ( ) => {
326
377
let inventory : Inventory ;
327
378
let inventorySource : InventorySource ;
328
- let organization : Organization ;
329
379
let thisId : string ;
330
380
381
+ let project : Project ;
382
+ let organization : Organization ;
383
+
384
+ before ( ( ) => {
385
+ cy . createAwxOrganization ( ) . then ( ( org ) => {
386
+ organization = org ;
387
+ cy . createAwxProject ( { organization : org . id } ) . then ( ( p ) => {
388
+ project = p ;
389
+ } ) ;
390
+ } ) ;
391
+ } ) ;
392
+
393
+ after ( ( ) => {
394
+ cy . deleteAwxProject ( project , { failOnStatusCode : false } ) . then ( ( ) => {
395
+ cy . deleteAwxOrganization ( organization , { failOnStatusCode : false } ) ;
396
+ } ) ;
397
+ } ) ;
398
+
331
399
beforeEach ( function ( ) {
332
- cy . createAwxOrganization ( ) . then ( ( o ) => {
333
- organization = o ;
334
- cy . createAwxInventory ( { organization : organization . id } ) . then ( ( i ) => {
335
- inventory = i ;
336
- cy . createAwxInventorySource ( i , this . globalProject as Project ) . then ( ( invSrc ) => {
337
- inventorySource = invSrc ;
338
- } ) ;
400
+ cy . createAwxInventory ( { organization : organization . id } ) . then ( ( i ) => {
401
+ inventory = i ;
402
+ cy . createAwxInventorySource ( i , project ) . then ( ( invSrc ) => {
403
+ inventorySource = invSrc ;
339
404
} ) ;
340
405
} ) ;
341
406
} ) ;
342
407
343
408
afterEach ( ( ) => {
344
409
cy . deleteAwxInventorySource ( inventorySource , { failOnStatusCode : false } ) ;
345
410
cy . deleteAwxInventory ( inventory , { failOnStatusCode : false } ) ;
346
- cy . deleteAwxOrganization ( organization , { failOnStatusCode : false } ) ;
347
411
} ) ;
348
412
349
413
it ( 'can launch an Inventory Sync job, let it finish, and assert expected results on the output screen' , ( ) => {
@@ -379,35 +443,48 @@ describe('Inventory source: Output and Details Screen', () => {
379
443
describe ( 'Workflow template: Output and Details Screen' , ( ) => {
380
444
let workflowJobTemplate : WorkflowJobTemplate ;
381
445
let jobTemplate : JobTemplate ;
382
- let organization : Organization ;
383
446
let inventory : Inventory ;
447
+ let project : Project ;
448
+ let organization : Organization ;
449
+
450
+ before ( ( ) => {
451
+ cy . createAwxOrganization ( ) . then ( ( org ) => {
452
+ organization = org ;
453
+ cy . createAwxProject ( { organization : org . id } ) . then ( ( p ) => {
454
+ project = p ;
455
+ } ) ;
456
+ } ) ;
457
+ } ) ;
458
+
459
+ after ( ( ) => {
460
+ cy . deleteAwxProject ( project , { failOnStatusCode : false } ) . then ( ( ) => {
461
+ cy . deleteAwxOrganization ( organization , { failOnStatusCode : false } ) ;
462
+ } ) ;
463
+ } ) ;
384
464
385
465
beforeEach ( function ( ) {
386
- cy . createAwxOrganization ( ) . then ( ( orgB ) => {
387
- organization = orgB ;
388
- cy . createAwxInventory ( { organization : organization . id } ) . then ( ( i ) => {
389
- inventory = i ;
390
- cy . createAwxJobTemplate ( {
466
+ cy . createAwxInventory ( { organization : organization . id } ) . then ( ( i ) => {
467
+ inventory = i ;
468
+ cy . createAwxJobTemplate ( {
469
+ organization : organization . id ,
470
+ project : project . id ,
471
+ inventory : inventory . id ,
472
+ } ) . then ( ( jt ) => {
473
+ jobTemplate = jt ;
474
+ cy . createAwxWorkflowJobTemplate ( {
391
475
organization : organization . id ,
392
- project : ( this . globalProject as Project ) . id ,
393
476
inventory : inventory . id ,
394
- } ) . then ( ( jt ) => {
395
- jobTemplate = jt ;
396
- cy . createAwxWorkflowJobTemplate ( {
397
- organization : organization . id ,
398
- inventory : inventory . id ,
399
- } ) . then ( ( wfjt ) => {
400
- workflowJobTemplate = wfjt ;
401
- cy . createAwxWorkflowVisualizerJobTemplateNode ( workflowJobTemplate , jobTemplate ) . then (
402
- ( jobTemplateNode ) => {
403
- cy . createAwxWorkflowVisualizerManagementNode ( workflowJobTemplate , 2 ) . then (
404
- ( managementNode ) => {
405
- cy . createWorkflowJTFailureNodeLink ( jobTemplateNode , managementNode ) ;
406
- }
407
- ) ;
408
- }
409
- ) ;
410
- } ) ;
477
+ } ) . then ( ( wfjt ) => {
478
+ workflowJobTemplate = wfjt ;
479
+ cy . createAwxWorkflowVisualizerJobTemplateNode ( workflowJobTemplate , jobTemplate ) . then (
480
+ ( jobTemplateNode ) => {
481
+ cy . createAwxWorkflowVisualizerManagementNode ( workflowJobTemplate , 2 ) . then (
482
+ ( managementNode ) => {
483
+ cy . createWorkflowJTFailureNodeLink ( jobTemplateNode , managementNode ) ;
484
+ }
485
+ ) ;
486
+ }
487
+ ) ;
411
488
} ) ;
412
489
} ) ;
413
490
} ) ;
@@ -417,7 +494,6 @@ describe('Workflow template: Output and Details Screen', () => {
417
494
cy . deleteAwxWorkflowJobTemplate ( workflowJobTemplate , { failOnStatusCode : false } ) ;
418
495
cy . deleteAwxJobTemplate ( jobTemplate , { failOnStatusCode : false } ) ;
419
496
cy . deleteAwxInventory ( inventory , { failOnStatusCode : false } ) ;
420
- cy . deleteAwxOrganization ( organization , { failOnStatusCode : false } ) ;
421
497
} ) ;
422
498
423
499
it ( 'can launch a Workflow job, let it finish, and assert expected results on the output screen' , ( ) => {
0 commit comments