@@ -3,7 +3,7 @@ import PromptRemove from '@/cypress/e2e/po/prompts/promptRemove.po';
33import ChartRepositoriesPagePo from '@/cypress/e2e/po/pages/chart-repositories.po' ;
44import * as path from 'path' ;
55import * as jsyaml from 'js-yaml' ;
6- import { LONG_TIMEOUT_OPT } from '@/cypress/support/utils/timeouts' ;
6+ import { LONG_TIMEOUT_OPT , MEDIUM_TIMEOUT_OPT } from '@/cypress/support/utils/timeouts' ;
77import { CLUSTER_REPOS_BASE_URL } from '@/cypress/support/utils/api-endpoints' ;
88
99const chartBranch = `release-v${ CURRENT_RANCHER_VERSION } ` ;
@@ -62,6 +62,7 @@ describe('Cluster Management Helm Repositories', { testIsolation: 'off', tags: [
6262 // check list details
6363 repositoriesPage . list ( ) . details ( this . repoName , 2 ) . should ( 'be.visible' ) ;
6464 repositoriesPage . list ( ) . details ( this . repoName , 1 ) . contains ( 'In Progress' ) . should ( 'be.visible' ) ;
65+ cy . waitForRepositoryDownload ( 'v1' , 'catalog.cattle.io.clusterrepos' , this . repoName ) ;
6566 repositoriesPage . list ( ) . details ( this . repoName , 1 ) . contains ( 'Active' , LONG_TIMEOUT_OPT ) . should ( 'be.visible' ) ;
6667 } ) ;
6768
@@ -268,18 +269,8 @@ describe('Cluster Management Helm Repositories', { testIsolation: 'off', tags: [
268269 // check list details
269270 repositoriesPage . list ( ) . details ( this . repoName , 2 ) . should ( 'be.visible' ) ;
270271
271- repositoriesPage . list ( ) . actionMenu ( this . repoName ) . getMenuItem ( 'Delete' ) . click ( ) ;
272-
273- const promptRemove = new PromptRemove ( ) ;
274-
275- cy . intercept ( 'DELETE' , `v1/catalog.cattle.io.clusterrepos/${ this . repoName } ` ) . as ( 'deleteRepository' ) ;
276-
277- promptRemove . remove ( ) ;
278- cy . wait ( '@deleteRepository' ) ;
279- repositoriesPage . waitForPage ( ) ;
280-
281- // check list details
282- cy . contains ( this . repoName ) . should ( 'not.exist' ) ;
272+ // delete repo
273+ cy . deleteRancherResource ( 'v1' , 'catalog.cattle.io.clusterrepos' , this . repoName ) ;
283274 } ) ;
284275
285276 it ( 'can disable/enable a repository' , function ( ) {
@@ -300,45 +291,34 @@ describe('Cluster Management Helm Repositories', { testIsolation: 'off', tags: [
300291 repositoriesPage . waitForPage ( ) ;
301292
302293 // check list details
303- repositoriesPage . list ( ) . details ( this . repoName , 2 ) . should ( 'be.visible' ) ;
304- repositoriesPage . list ( ) . details ( this . repoName , 1 ) . contains ( 'In Progress' ) . should ( 'be.visible' ) ;
305-
306- // refresh should be displayed for an enabled repo
307- repositoriesPage . list ( ) . actionMenu ( this . repoName ) . getMenuItem ( 'Refresh' ) . should ( 'be.visible' ) ;
308- // close action menu
309- repositoriesPage . list ( ) . closeActionMenu ( ) ;
294+ cy . waitForRepositoryDownload ( 'v1' , 'catalog.cattle.io.clusterrepos' , this . repoName ) . then ( ( ) => {
295+ repositoriesPage . list ( ) . details ( this . repoName , 1 ) . contains ( 'Active' , MEDIUM_TIMEOUT_OPT ) . should ( 'be.visible' ) ;
296+ // refresh should be displayed for an enabled repo
297+ repositoriesPage . list ( ) . actionMenu ( this . repoName ) . getMenuItem ( 'Refresh' ) . should ( 'be.visible' ) ;
298+ // close action menu
299+ repositoriesPage . list ( ) . actionMenuClose ( this . repoName ) ;
300+ } ) ;
310301
311302 // disable repo
312- // eslint-disable-next-line cypress/no-unnecessary-waiting
313- cy . wait ( 1500 ) ;
314- repositoriesPage . list ( ) . actionMenu ( this . repoName ) . getMenuItem ( 'Disable' ) . click ( ) ;
315- repositoriesPage . list ( ) . details ( this . repoName , 1 ) . contains ( 'Disabled' , { timeout : 10000 } ) . scrollIntoView ( )
316- . should ( 'be.visible' ) ;
303+ cy . waitForResourceState ( 'v1' , 'catalog.cattle.io.clusterrepos' , this . repoName ) . then ( ( ) => {
304+ repositoriesPage . list ( ) . actionMenu ( this . repoName ) . getMenuItem ( 'Disable' ) . click ( ) ;
305+ repositoriesPage . list ( ) . details ( this . repoName , 1 ) . contains ( 'Disabled' ) . should ( 'be.visible' ) ;
306+ } ) ;
317307
318308 // refresh should NOT be displayed for a disabled repo
319- repositoriesPage . list ( ) . actionMenu ( this . repoName ) . getMenuItem ( 'Refresh' ) . should ( 'not.exist' ) ;
320- // close action menu
321- repositoriesPage . list ( ) . closeActionMenu ( ) ;
309+ cy . waitForResourceState ( 'v1' , 'catalog.cattle.io.clusterrepos' , this . repoName ) . then ( ( ) => {
310+ repositoriesPage . list ( ) . actionMenu ( this . repoName ) . getMenuItem ( 'Refresh' ) . should ( 'not.exist' ) ;
311+ // close action menu
312+ repositoriesPage . list ( ) . actionMenuClose ( this . repoName ) ;
313+ } ) ;
322314
323315 // enable repo
324- // eslint-disable-next-line cypress/no-unnecessary-waiting
325- cy . wait ( 1500 ) ;
326- repositoriesPage . list ( ) . actionMenu ( this . repoName ) . getMenuItem ( 'Enable' ) . click ( ) ;
327- repositoriesPage . list ( ) . details ( this . repoName , 1 ) . contains ( 'Active' , LONG_TIMEOUT_OPT ) . scrollIntoView ( )
328- . should ( 'be.visible' ) ;
316+ cy . waitForResourceState ( 'v1' , 'catalog.cattle.io.clusterrepos' , this . repoName ) . then ( ( ) => {
317+ repositoriesPage . list ( ) . actionMenu ( this . repoName ) . getMenuItem ( 'Enable' ) . click ( ) ;
318+ repositoriesPage . list ( ) . details ( this . repoName , 1 ) . contains ( 'Active' , MEDIUM_TIMEOUT_OPT ) . should ( 'be.visible' ) ;
319+ } ) ;
329320
330321 // delete repo
331- repositoriesPage . list ( ) . actionMenu ( this . repoName ) . getMenuItem ( 'Delete' ) . click ( ) ;
332-
333- const promptRemove = new PromptRemove ( ) ;
334-
335- cy . intercept ( 'DELETE' , `v1/catalog.cattle.io.clusterrepos/${ this . repoName } ` ) . as ( 'deleteRepository' ) ;
336-
337- promptRemove . remove ( ) ;
338- cy . wait ( '@deleteRepository' ) ;
339- repositoriesPage . waitForPage ( ) ;
340-
341- // check list details
342- cy . contains ( this . repoName ) . should ( 'not.exist' ) ;
322+ cy . deleteRancherResource ( 'v1' , 'catalog.cattle.io.clusterrepos' , this . repoName ) ;
343323 } ) ;
344324} ) ;
0 commit comments