@@ -188,138 +188,135 @@ function toggleHiddenWorkflowVersion() {
188
188
cy . contains ( 'button' , 'Save Changes' ) . click ( ) ;
189
189
}
190
190
191
- function testTool ( registry : string , repo : string , name : string ) {
192
- describe ( 'Register, publish, unpublish, and delete a tool' , ( ) => {
193
- registerQuayTool ( repo , name ) ;
194
- unpublishTool ( ) ;
195
- deleteTool ( ) ;
191
+ describe ( 'add entry to and remove from collection' , ( ) => {
192
+ const repo = toolTuple [ 1 ] ;
193
+ const name = toolTuple [ 2 ] ;
194
+ const org = collectionTuple [ 0 ] ;
195
+ const collection = collectionTuple [ 1 ] ;
196
+ registerQuayTool ( repo , name ) ;
197
+ it ( 'be able to add an entry to the collection ' + collection , ( ) => {
198
+ storeToken ( ) ;
199
+ // define routes to watch for
200
+ cy . intercept ( 'post' , '**/collections/**' ) . as ( 'postToCollection' ) ;
201
+ cy . visit ( `/containers/quay.io/${ repo } /${ name } :develop?tab=info` ) ;
202
+ cy . get ( '#addToolToCollectionButton' ) . should ( 'be.visible' ) . click ( ) ;
203
+ cy . get ( '#addEntryToCollectionButton' ) . should ( 'be.disabled' ) ;
204
+ cy . get ( '#selectOrganization' ) . should ( 'be.visible' ) . click ( ) ;
205
+ cy . get ( 'mat-option' ) . contains ( org ) . should ( 'be.visible' ) . click ( ) ;
206
+ cy . get ( '#addEntryToCollectionButton' ) . should ( 'be.disabled' ) ;
207
+ cy . get ( '#selectCollection' ) . should ( 'be.visible' ) . click ( ) ;
208
+ cy . get ( 'mat-option' ) . contains ( collection ) . click ( ) ;
209
+ cy . get ( '#addEntryToCollectionButton' ) . should ( 'not.be.disabled' ) . click ( ) ;
210
+ cy . wait ( '@postToCollection' ) ;
211
+ cy . get ( '#addEntryToCollectionButton' ) . should ( 'not.exist' ) ;
212
+ cy . get ( 'mat-progress-bar' ) . should ( 'not.exist' ) ;
213
+ } ) ;
196
214
197
- registerRemoteSitesTool ( repo , name ) ;
198
- unpublishTool ( ) ;
199
- deleteTool ( ) ;
215
+ it ( 'be able to remove an entry from a collection ' + collection , ( ) => {
216
+ storeToken ( ) ;
217
+ cy . visit ( `/organizations/${ org } /collections/${ collection } ` ) ;
218
+ cy . contains ( `quay.io/${ repo } /${ name } ` ) ;
219
+ cy . get ( '#removeEntryButton' ) . should ( 'be.visible' ) . click ( ) ;
220
+ cy . get ( '[data-cy=accept-remove-entry-from-org]' ) . should ( 'be.visible' ) . click ( ) ;
221
+ cy . contains ( 'This collection has no associated entries' ) ;
222
+ cy . visit ( `/organizations/${ org } ` ) ;
223
+ cy . contains ( 'Members' ) . should ( 'be.visible' ) ;
200
224
201
- registerToolOnDockstore ( repo , name ) ;
202
- deleteTool ( ) ;
225
+ cy . intercept ( '**/tokens' ) . as ( 'tokens' ) ;
226
+ cy . visit ( '/my-tools' ) ;
227
+ cy . wait ( '@tokens' ) ;
203
228
} ) ;
204
-
205
- describe ( 'Hide and un-hide a tool version' , ( ) => {
206
- registerQuayTool ( repo , name ) ;
207
- it ( 'hide a version' , ( ) => {
208
- storeToken ( ) ;
209
- cy . visit ( '/my-tools' ) ;
210
- goToTab ( 'Versions' ) ;
211
- toggleHiddenToolVersion ( ) ;
212
- cy . get ( '[data-cy=hiddenCheck]' ) . should ( 'have.length' , 1 ) ;
213
- // un-hide and verify
214
- toggleHiddenToolVersion ( ) ;
215
- cy . get ( '[data-cy=hiddenCheck]' ) . should ( 'not.exist' ) ;
216
- } ) ;
217
- it ( 'refresh namespace' , ( ) => {
218
- storeToken ( ) ;
219
- cy . visit ( '/my-tools' ) ;
220
- cy . contains ( 'button' , 'Refresh Namespace' ) . first ( ) . click ( ) ;
221
- // check that the 'refresh succeeded' message appears
222
- cy . contains ( 'succeeded' ) ;
223
- } ) ;
224
- unpublishTool ( ) ;
225
- deleteTool ( ) ;
229
+ unpublishTool ( ) ;
230
+ deleteTool ( ) ;
231
+ } ) ;
232
+ describe ( 'Register, publish, unpublish, and delete a tool' , ( ) => {
233
+ const repo = toolTuple [ 1 ] ;
234
+ const name = toolTuple [ 2 ] ;
235
+ registerQuayTool ( repo , name ) ;
236
+ unpublishTool ( ) ;
237
+ deleteTool ( ) ;
238
+
239
+ registerRemoteSitesTool ( repo , name ) ;
240
+ unpublishTool ( ) ;
241
+ deleteTool ( ) ;
242
+
243
+ registerToolOnDockstore ( repo , name ) ;
244
+ deleteTool ( ) ;
245
+ } ) ;
246
+
247
+ describe ( 'Hide and un-hide a tool version' , ( ) => {
248
+ const repo = toolTuple [ 1 ] ;
249
+ const name = toolTuple [ 2 ] ;
250
+ registerQuayTool ( repo , name ) ;
251
+ it ( 'hide a version' , ( ) => {
252
+ storeToken ( ) ;
253
+ cy . visit ( '/my-tools' ) ;
254
+ goToTab ( 'Versions' ) ;
255
+ toggleHiddenToolVersion ( ) ;
256
+ cy . get ( '[data-cy=hiddenCheck]' ) . should ( 'have.length' , 1 ) ;
257
+ // un-hide and verify
258
+ toggleHiddenToolVersion ( ) ;
259
+ cy . get ( '[data-cy=hiddenCheck]' ) . should ( 'not.exist' ) ;
226
260
} ) ;
227
- }
228
-
229
- function testWorkflow ( registry : string , repo : string , name : string ) {
230
- describe ( 'Refresh, publish, unpublish, and restub a workflow' , ( ) => {
231
- it ( 'refresh and publish' , ( ) => {
232
- storeToken ( ) ;
233
-
234
- // define routes to watch for
235
- cy . intercept ( '**/tokens' ) . as ( 'tokens' ) ;
236
- cy . intercept ( '**/workflows/path/workflow/**' ) . as ( 'workflow' ) ;
237
-
238
- cy . visit ( `/my-workflows` ) ;
239
- cy . wait ( '@tokens' ) ;
240
- cy . wait ( '@workflow' ) ;
261
+ it ( 'refresh namespace' , ( ) => {
262
+ storeToken ( ) ;
263
+ cy . visit ( '/my-tools' ) ;
264
+ cy . contains ( 'button' , 'Refresh Namespace' ) . first ( ) . click ( ) ;
265
+ // check that the 'refresh succeeded' message appears
266
+ cy . contains ( 'succeeded' ) ;
267
+ } ) ;
268
+ unpublishTool ( ) ;
269
+ deleteTool ( ) ;
270
+ } ) ;
241
271
242
- // refresh stubbed workflow to full and publish
243
- cy . intercept ( '**/refresh?hardRefresh=false' ) . as ( 'refresh' ) ;
244
- cy . get ( '[data-cy=refreshButton]' ) . click ( ) ;
245
- cy . wait ( '@refresh' ) ;
246
- cy . intercept ( 'post' , '**/publish' ) . as ( 'publish' ) ;
247
- cy . contains ( 'button' , 'Publish' ) . should ( 'be.enabled' ) . click ( ) ;
248
- cy . wait ( '@publish' ) ;
272
+ describe ( 'Refresh, publish, unpublish, and restub a workflow' , ( ) => {
273
+ it ( 'refresh and publish' , ( ) => {
274
+ storeToken ( ) ;
249
275
250
- // Test some snapshot and versions stuff
251
- // WARNING: don't actually snapshot since it can't be undone
252
- // define routes to watch for
276
+ // define routes to watch for
277
+ cy . intercept ( '**/tokens' ) . as ( 'tokens' ) ;
278
+ cy . intercept ( '**/workflows/path/workflow/**' ) . as ( 'workflow' ) ;
253
279
254
- goToTab ( 'Versions' ) ;
280
+ cy . visit ( `/my-workflows` ) ;
281
+ cy . wait ( '@tokens' ) ;
282
+ cy . wait ( '@workflow' ) ;
255
283
256
- cy . contains ( 'button' , 'Actions' ) . should ( 'be.visible' ) ;
257
- cy . contains ( 'td' , 'Actions' ) . first ( ) . click ( ) ;
258
- cy . get ( '.mat-menu-content ' ) . within ( ( ) => {
259
- cy . contains ( 'button' , 'Snapshot ') ;
260
- cy . contains ( 'button ', 'Edit ' ) . click ( ) ;
261
- } ) ;
262
- cy . contains ( 'button' , 'Cancel' ) . click ( ) ;
284
+ // refresh stubbed workflow to full and publish
285
+ cy . intercept ( '**/refresh?hardRefresh=false' ) . as ( 'refresh' ) ;
286
+ cy . get ( '[data-cy=refreshButton] ' ) . click ( ) ;
287
+ cy . wait ( '@refresh ') ;
288
+ cy . intercept ( 'post ', '**/publish ' ) . as ( 'publish' ) ;
289
+ cy . contains ( 'button' , 'Publish' ) . should ( 'be.enabled' ) . click ( ) ;
290
+ cy . wait ( '@publish' ) ;
263
291
264
- storeToken ( ) ;
265
- cy . get ( '#publishButton' ) . contains ( 'Unpublish' ) . click ( { force : true } ) ;
292
+ // Test some snapshot and versions stuff
293
+ // WARNING: don't actually snapshot since it can't be undone
294
+ // define routes to watch for
266
295
267
- goToTab ( 'Info' ) ;
268
- cy . contains ( 'button' , 'Restub' ) . click ( ) ;
269
- cy . contains ( 'button' , 'Publish' ) . should ( 'be.disabled' ) ;
296
+ goToTab ( 'Versions' ) ;
270
297
271
- cy . get ( '[data-cy=refreshButton]' ) . click ( ) ;
272
- goToTab ( 'Versions' ) ;
273
- // hide
274
- toggleHiddenWorkflowVersion ( ) ;
275
- cy . get ( '[data-cy=hidden]' ) . should ( 'have.length' , 1 ) ;
276
- // un-hide
277
- toggleHiddenWorkflowVersion ( ) ;
278
- cy . get ( '[data-cy=hidden]' ) . should ( 'not.exist' ) ;
298
+ cy . contains ( 'button' , 'Actions' ) . should ( 'be.visible' ) ;
299
+ cy . contains ( 'td' , 'Actions' ) . first ( ) . click ( ) ;
300
+ cy . get ( '.mat-menu-content' ) . within ( ( ) => {
301
+ cy . contains ( 'button' , 'Snapshot' ) ;
302
+ cy . contains ( 'button' , 'Edit' ) . click ( ) ;
279
303
} ) ;
280
- } ) ;
281
- }
304
+ cy . contains ( 'button' , 'Cancel' ) . click ( ) ;
282
305
283
- function testCollection ( org : string , collection : string , registry : string , repo : string , name : string ) {
284
- describe ( 'add entry to and remove from collection' , ( ) => {
285
- registerQuayTool ( repo , name ) ;
286
- it ( 'be able to add an entry to the collection' , ( ) => {
287
- storeToken ( ) ;
288
- // define routes to watch for
289
- cy . intercept ( 'post' , '**/collections/**' ) . as ( 'postToCollection' ) ;
290
- cy . visit ( `/containers/quay.io/${ repo } /${ name } :develop?tab=info` ) ;
291
- cy . get ( '#addToolToCollectionButton' ) . should ( 'be.visible' ) . click ( ) ;
292
- cy . get ( '#addEntryToCollectionButton' ) . should ( 'be.disabled' ) ;
293
- cy . get ( '#selectOrganization' ) . should ( 'be.visible' ) . click ( ) ;
294
- cy . get ( 'mat-option' ) . contains ( org ) . should ( 'be.visible' ) . click ( ) ;
295
- cy . get ( '#addEntryToCollectionButton' ) . should ( 'be.disabled' ) ;
296
- cy . get ( '#selectCollection' ) . should ( 'be.visible' ) . click ( ) ;
297
- cy . get ( 'mat-option' ) . contains ( collection ) . click ( ) ;
298
- cy . get ( '#addEntryToCollectionButton' ) . should ( 'not.be.disabled' ) . click ( ) ;
299
- cy . wait ( '@postToCollection' ) ;
300
- cy . get ( '#addEntryToCollectionButton' ) . should ( 'not.exist' ) ;
301
- cy . get ( 'mat-progress-bar' ) . should ( 'not.exist' ) ;
302
- } ) ;
306
+ storeToken ( ) ;
307
+ cy . get ( '#publishButton' ) . contains ( 'Unpublish' ) . click ( { force : true } ) ;
303
308
304
- it ( 'be able to remove an entry from a collection' , ( ) => {
305
- storeToken ( ) ;
306
- cy . visit ( `/organizations/${ org } /collections/${ collection } ` ) ;
307
- cy . contains ( `quay.io/${ repo } /${ name } ` ) ;
308
- cy . get ( '#removeEntryButton' ) . should ( 'be.visible' ) . click ( ) ;
309
- cy . get ( '[data-cy=accept-remove-entry-from-org]' ) . should ( 'be.visible' ) . click ( ) ;
310
- cy . contains ( 'This collection has no associated entries' ) ;
311
- cy . visit ( `/organizations/${ org } ` ) ;
312
- cy . contains ( 'Members' ) . should ( 'be.visible' ) ;
309
+ goToTab ( 'Info' ) ;
310
+ cy . contains ( 'button' , 'Restub' ) . click ( ) ;
311
+ cy . contains ( 'button' , 'Publish' ) . should ( 'be.disabled' ) ;
313
312
314
- cy . intercept ( '**/tokens' ) . as ( 'tokens' ) ;
315
- cy . visit ( '/my-tools' ) ;
316
- cy . wait ( '@tokens' ) ;
317
- } ) ;
318
- unpublishTool ( ) ;
319
- deleteTool ( ) ;
313
+ cy . get ( '[data-cy=refreshButton]' ) . click ( ) ;
314
+ goToTab ( 'Versions' ) ;
315
+ // hide
316
+ toggleHiddenWorkflowVersion ( ) ;
317
+ cy . get ( '[data-cy=hidden]' ) . should ( 'have.length' , 1 ) ;
318
+ // un-hide
319
+ toggleHiddenWorkflowVersion ( ) ;
320
+ cy . get ( '[data-cy=hidden]' ) . should ( 'not.exist' ) ;
320
321
} ) ;
321
- }
322
-
323
- testCollection ( collectionTuple [ 0 ] , collectionTuple [ 1 ] , toolTuple [ 0 ] , toolTuple [ 1 ] , toolTuple [ 2 ] ) ;
324
- testTool ( toolTuple [ 0 ] , toolTuple [ 1 ] , toolTuple [ 2 ] ) ;
325
- testWorkflow ( workflowTuple [ 0 ] , workflowTuple [ 1 ] , workflowTuple [ 2 ] ) ;
322
+ } ) ;
0 commit comments