@@ -37,7 +37,6 @@ const clusterNamePartial = `${ runPrefix }-create`;
3737const rke2CustomName = `${ clusterNamePartial } -rke2-custom` ;
3838const importGenericName = `${ clusterNamePartial } -import-generic` ;
3939let reenableAKS = false ;
40- let importedClusterName = '' ;
4140
4241const downloadsFolder = Cypress . config ( 'downloadsFolder' ) ;
4342
@@ -244,6 +243,13 @@ describe('Cluster Manager', { testIsolation: 'off', tags: ['@manager', '@adminUs
244243 } ) ;
245244
246245 it ( 'can copy config to clipboard' , ( ) => {
246+ // Stub clipboard methods to avoid permission prompts
247+ cy . visit ( '/' , {
248+ onBeforeLoad ( win ) {
249+ cy . stub ( win . navigator . clipboard , 'writeText' ) . resolves ( ) ;
250+ } ,
251+ } ) ;
252+
247253 ClusterManagerListPagePo . navTo ( ) ;
248254
249255 cy . intercept ( 'POST' , '*action=generateKubeconfig' ) . as ( 'copyKubeConfig' ) ;
@@ -405,9 +411,7 @@ describe('Cluster Manager', { testIsolation: 'off', tags: ['@manager', '@adminUs
405411 importClusterPage . create ( ) ;
406412
407413 cy . wait ( '@importRequest' ) . then ( ( intercept ) => {
408- importedClusterName = intercept . response . body . id ;
409- cy . wrap ( intercept . response . body . id ) . as ( 'importedClusterId' ) ;
410-
414+ expect ( intercept . response . statusCode ) . to . eq ( 201 ) ;
411415 expect ( intercept . request . body ) . to . deep . equal ( {
412416 type : importType ,
413417 agentEnvVars : [ ] ,
@@ -418,8 +422,8 @@ describe('Cluster Manager', { testIsolation: 'off', tags: ['@manager', '@adminUs
418422 } ) ;
419423 } ) ;
420424
421- cy . get ( '@importedClusterId' ) . then ( ( importedClusterId ) => {
422- const detailClusterPage = new ClusterManagerDetailImportedGenericPagePo ( undefined , importedClusterId . toString ( ) ) ;
425+ cy . getClusterIdByName ( importGenericName ) . then ( ( clusterId ) => {
426+ const detailClusterPage = new ClusterManagerDetailImportedGenericPagePo ( undefined , clusterId ) ;
423427
424428 detailClusterPage . waitForPage ( undefined , 'registration' ) ;
425429 detailClusterPage . kubectlCommandForImported ( ) . contains ( '--insecure' ) . then ( ( $value ) => {
@@ -437,65 +441,73 @@ describe('Cluster Manager', { testIsolation: 'off', tags: ['@manager', '@adminUs
437441
438442 ClusterManagerListPagePo . navTo ( ) ;
439443 clusterList . waitForPage ( ) ;
440- clusterList . list ( ) . state ( importGenericName ) . contains ( 'Pending' ) ;
441- clusterList . list ( ) . state ( importGenericName ) . contains ( 'Waiting' , EXTRA_LONG_TIMEOUT_OPT ) ;
444+ clusterList . list ( ) . state ( importGenericName ) . should ( 'be.visible' , EXTRA_LONG_TIMEOUT_OPT )
445+ . and ( ( $el ) => {
446+ const status = $el . text ( ) . trim ( ) ;
447+
448+ expect ( [ 'Provisioning' , 'Waiting' ] ) . to . include ( status ) ;
449+ } ) ;
442450 clusterList . list ( ) . state ( importGenericName ) . contains ( 'Active' , EXTRA_LONG_TIMEOUT_OPT ) ;
443451 // Issue #6836: Provider field on Imported clusters states "Imported" instead of cluster type
444452 clusterList . list ( ) . provider ( importGenericName ) . should ( 'contain.text' , 'Imported' ) ;
445453 clusterList . list ( ) . providerSubType ( importGenericName ) . should ( 'contain.text' , 'K3s' ) ;
446454 } ) ;
447455
448456 it ( 'can edit imported cluster and see changes afterwards' , ( ) => {
449- const editImportedClusterPage = new ClusterManagerEditImportedPagePo ( undefined , 'fleet-default' , importedClusterName ) ;
457+ cy . getClusterIdByName ( importGenericName ) . then ( ( clusterId ) => {
458+ const editImportedClusterPage = new ClusterManagerEditImportedPagePo ( undefined , 'fleet-default' , clusterId ) ;
450459
451- cy . intercept ( 'GET' , '/v1-rke2-release/releases' ) . as ( 'getRke2Releases' ) ;
452- clusterList . goTo ( ) ;
453- clusterList . list ( ) . actionMenu ( importGenericName ) . getMenuItem ( 'Edit Config' ) . click ( ) ;
454- editImportedClusterPage . waitForPage ( 'mode=edit' ) ;
460+ cy . intercept ( 'GET' , `${ USERS_BASE_URL } ?*` ) . as ( 'pageLoad' ) ;
461+ clusterList . goTo ( ) ;
462+ clusterList . list ( ) . actionMenu ( importGenericName ) . getMenuItem ( 'Edit Config' ) . click ( ) ;
455463
456- editImportedClusterPage . nameNsDescription ( ) . name ( ) . value ( ) . should ( 'eq' , importGenericName ) ;
464+ editImportedClusterPage . waitForPage ( 'mode=edit' ) ;
457465
458- // check accordions are properly displayed
459- editImportedClusterPage . accordion ( 2 , 'Basics' ) . should ( 'be.visible' ) ;
460- editImportedClusterPage . accordion ( 3 , 'Member Roles' ) . should ( 'be.visible' ) ;
461- editImportedClusterPage . accordion ( 4 , 'Labels and Annotations' ) . scrollIntoView ( ) . should ( 'be.visible' ) ;
462- editImportedClusterPage . accordion ( 5 , 'Networking' ) . scrollIntoView ( ) . should ( 'be.visible' ) ;
463- editImportedClusterPage . accordion ( 6 , 'Registries' ) . scrollIntoView ( ) . should ( 'be.visible' ) ;
464- editImportedClusterPage . accordion ( 7 , 'Advanced' ) . scrollIntoView ( ) . should ( 'be.visible' ) ;
466+ editImportedClusterPage . nameNsDescription ( ) . name ( ) . value ( ) . should ( 'eq' , importGenericName ) ;
467+ cy . wait ( '@pageLoad' ) ;
465468
466- // Issue #10432: Edit Cluster screen falsely gives impression imported cluster's name and description can be edited
467- editImportedClusterPage . nameNsDescription ( ) . name ( ) . expectToBeDisabled ( ) ;
469+ // check accordions are properly displayed
470+ editImportedClusterPage . accordion ( 2 , 'K3S Options' ) . should ( 'be.visible' ) ;
471+ editImportedClusterPage . accordion ( 3 , 'Member Roles' ) . should ( 'be.visible' ) ;
472+ editImportedClusterPage . accordion ( 4 , 'Labels and Annotations' ) . scrollIntoView ( ) . should ( 'be.visible' ) ;
473+ editImportedClusterPage . accordion ( 5 , 'Networking' ) . scrollIntoView ( ) . should ( 'be.visible' ) ;
474+ editImportedClusterPage . accordion ( 6 , 'Registries' ) . scrollIntoView ( ) . should ( 'be.visible' ) ;
475+ editImportedClusterPage . accordion ( 7 , 'Advanced' ) . scrollIntoView ( ) . should ( 'be.visible' ) ;
468476
469- // Issue #13614: Imported Cluster Version Mgmt: Conditionally show warning message
470- editImportedClusterPage . versionManagementBanner ( ) . should ( 'not.exist' ) ;
477+ // Issue #10432: Edit Cluster screen falsely gives impression imported cluster's name and description can be edited
478+ editImportedClusterPage . nameNsDescription ( ) . name ( ) . expectToBeDisabled ( ) ;
471479
472- editImportedClusterPage . enableVersionManagement ( ) ;
473- editImportedClusterPage . versionManagementBanner ( ) . should ( 'exist' ) . and ( 'be.visible' ) ;
474- editImportedClusterPage . defaultVersionManagement ( ) ;
480+ // Issue #13614: Imported Cluster Version Mgmt: Conditionally show warning message
481+ editImportedClusterPage . versionManagementBanner ( ) . should ( 'not.exist' ) ;
475482
476- editImportedClusterPage . toggleAccordion ( 5 , 'Networking' ) ;
477- editImportedClusterPage . ace ( ) . enable ( ) ;
478- editImportedClusterPage . ace ( ) . enterFdqn ( fqdn ) ;
479- editImportedClusterPage . ace ( ) . enterCaCerts ( cacert ) ;
483+ editImportedClusterPage . enableVersionManagement ( ) ;
484+ editImportedClusterPage . versionManagementBanner ( ) . should ( 'exist' ) . and ( 'be.visible' ) ;
485+ editImportedClusterPage . defaultVersionManagement ( ) ;
480486
481- editImportedClusterPage . toggleAccordion ( 6 , 'Registries' ) ;
482- editImportedClusterPage . enablePrivateRegistryCheckbox ( ) ;
483- editImportedClusterPage . privateRegistry ( ) . set ( privateRegistry ) ;
487+ editImportedClusterPage . toggleAccordion ( 5 , 'Networking' ) ;
488+ editImportedClusterPage . ace ( ) . enable ( ) ;
489+ editImportedClusterPage . ace ( ) . enterFdqn ( fqdn ) ;
490+ editImportedClusterPage . ace ( ) . enterCaCerts ( cacert ) ;
484491
485- editImportedClusterPage . save ( ) ;
492+ editImportedClusterPage . toggleAccordion ( 6 , 'Registries' ) ;
493+ editImportedClusterPage . enablePrivateRegistryCheckbox ( ) ;
494+ editImportedClusterPage . privateRegistry ( ) . set ( privateRegistry ) ;
486495
487- // We should be taken back to the list page if the save was successful
488- clusterList . waitForPage ( ) ;
496+ editImportedClusterPage . save ( ) ;
497+
498+ // We should be taken back to the list page if the save was successful
499+ clusterList . waitForPage ( ) ;
489500
490- clusterList . list ( ) . actionMenu ( importGenericName ) . getMenuItem ( 'Edit Config' ) . click ( ) ;
501+ clusterList . list ( ) . actionMenu ( importGenericName ) . getMenuItem ( 'Edit Config' ) . click ( ) ;
491502
492- editImportedClusterPage . waitForPage ( 'mode=edit' ) ;
493- editImportedClusterPage . ace ( ) . fqdn ( ) . value ( ) . should ( 'eq' , fqdn ) ;
494- editImportedClusterPage . ace ( ) . caCerts ( ) . value ( ) . should ( 'eq' , cacert ) ;
503+ editImportedClusterPage . waitForPage ( 'mode=edit' ) ;
504+ editImportedClusterPage . ace ( ) . fqdn ( ) . value ( ) . should ( 'eq' , fqdn ) ;
505+ editImportedClusterPage . ace ( ) . caCerts ( ) . value ( ) . should ( 'eq' , cacert ) ;
495506
496- // Verify the private registry values
497- editImportedClusterPage . privateRegistryCheckbox ( ) . isChecked ( ) ;
498- editImportedClusterPage . privateRegistry ( ) . value ( ) . should ( 'eq' , privateRegistry ) ;
507+ // Verify the private registry values
508+ editImportedClusterPage . privateRegistryCheckbox ( ) . isChecked ( ) ;
509+ editImportedClusterPage . privateRegistry ( ) . value ( ) . should ( 'eq' , privateRegistry ) ;
510+ } ) ;
499511 } ) ;
500512
501513 it ( 'can delete cluster by bulk actions' , ( ) => {
@@ -605,19 +617,19 @@ describe('Cluster Manager', { testIsolation: 'off', tags: ['@manager', '@adminUs
605617 } ) ;
606618 } ) ;
607619
608- describe ( 'Local' , { tags : [ '@jenkins' , '@localCluster' ] } , ( ) => {
620+ describe ( 'Local' , ( ) => {
609621 it ( `can open edit for local cluster` , ( ) => {
610622 const editLocalClusterPage = new ClusterManagerEditImportedPagePo ( undefined , 'fleet-local' , 'local' ) ;
611623
612- cy . intercept ( 'GET' , '/v1-rke2-release/releases' ) . as ( 'getRke2Releases ' ) ;
624+ cy . intercept ( 'GET' , ` ${ USERS_BASE_URL } ?*` ) . as ( 'pageLoad ' ) ;
613625 clusterList . goTo ( ) ;
614626 clusterList . list ( ) . actionMenu ( 'local' ) . getMenuItem ( 'Edit Config' ) . click ( ) ;
615627 editLocalClusterPage . waitForPage ( 'mode=edit' ) ;
616-
628+ cy . wait ( '@pageLoad' ) ;
617629 editLocalClusterPage . nameNsDescription ( ) . name ( ) . value ( ) . should ( 'eq' , 'local' ) ;
618630
619631 // check accordions are properly displayed
620- editLocalClusterPage . accordion ( 2 , 'Basics ' ) . should ( 'be.visible' ) ;
632+ editLocalClusterPage . accordion ( 2 , 'K3S Options ' ) . should ( 'be.visible' ) ; // for K3S local cluster its K3S Options
621633 editLocalClusterPage . accordion ( 3 , 'Member Roles' ) . scrollIntoView ( ) . should ( 'be.visible' ) ;
622634 editLocalClusterPage . accordion ( 4 , 'Labels and Annotations' ) . scrollIntoView ( ) . should ( 'be.visible' ) ;
623635 editLocalClusterPage . accordion ( 5 , 'Networking' ) . scrollIntoView ( ) . should ( 'be.visible' ) ;
@@ -628,16 +640,15 @@ describe('Cluster Manager', { testIsolation: 'off', tags: ['@manager', '@adminUs
628640 editLocalClusterPage . versionManagementBanner ( ) . should ( 'not.exist' ) ;
629641
630642 editLocalClusterPage . enableVersionManagement ( ) ;
631- editLocalClusterPage . versionManagementBanner ( ) . should ( 'exist' ) . and ( 'be.visible' ) ;
632643 editLocalClusterPage . versionManagementBanner ( ) . should ( 'not.contain.text' , 'This change will trigger cluster agent redeployment.' ) ;
633644 editLocalClusterPage . disableVersionManagement ( ) ;
634- editLocalClusterPage . versionManagementBanner ( ) . should ( 'exist' ) . and ( 'be.visible' ) ;
635645 editLocalClusterPage . versionManagementBanner ( ) . should ( 'not.contain.text' , 'This change will trigger cluster agent redeployment.' ) ;
636646 editLocalClusterPage . cancel ( ) ;
637647
638648 // We should be taken back to the list page if the save was successful
639649 clusterList . waitForPage ( ) ;
640650 } ) ;
651+
641652 it ( `can navigate to local cluster's explore product` , ( ) => {
642653 const clusterName = 'local' ;
643654 const clusterDashboard = new ClusterDashboardPagePo ( clusterName ) ;
0 commit comments