@@ -656,184 +656,184 @@ describe('Credentials', () => {
656
656
cy . getByDataCy ( 'create-template' ) . click ( ) ;
657
657
cy . verifyPageTitle ( 'Create Job Template' ) ;
658
658
cy . getByDataCy ( 'name' ) . type ( jobTemplateName ) ;
659
- cy . selectDropdownOptionByResourceName ( 'inventory' , awxInventory . name ) ;
660
- cy . selectDropdownOptionByResourceName ( 'project' , `${ project . name } ` ) ;
659
+ cy . singleSelectByDataCy ( 'inventory' , awxInventory . name ) ;
660
+ cy . singleSelectByDataCy ( 'project' , `${ ( this . globalProject as Project ) . name } ` ) ;
661
661
cy . selectDropdownOptionByResourceName ( 'playbook' , 'hello_world.yml' ) ;
662
- cy . multiSelectByDataCy ( 'credential' , [ machineCredential . name ] ) ;
662
+ cy . selectItemFromLookupModal ( 'credential-select ' , machineCredential . name ) ;
663
663
cy . getByDataCy ( 'Submit' ) . click ( ) ;
664
664
} ) ;
665
665
} ) ;
666
- } ) ;
667
-
668
- tag ( [ 'upstream' ] , ( ) => {
669
- //these tests will not work downstream
670
- describe ( 'Credentials Tabbed View - Team and User Access' , ( ) => {
671
- let machineCredential : Credential ;
672
- let createdAwxUser : AwxUser ;
673
- let awxOrganization : Organization ;
674
- let awxTeam : Team ;
675
666
676
- beforeEach ( ( ) => {
677
- cy . createAwxOrganization ( ) . then ( ( awxOrg ) => {
678
- awxOrganization = awxOrg ;
679
- cy . createAwxUser ( { organization : awxOrganization . id } ) . then ( ( awxUser ) => {
680
- createdAwxUser = awxUser ;
681
- cy . createAWXCredential ( {
682
- kind : 'machine' ,
683
- organization : awxOrganization . id ,
684
- credential_type : 1 ,
685
- } ) . then ( ( cred ) => {
686
- machineCredential = cred ;
667
+ tag ( [ 'upstream' ] , ( ) => {
668
+ //these tests will not work downstream
669
+ describe ( 'Credentials Tabbed View - Team and User Access' , ( ) => {
670
+ let machineCredential : Credential ;
671
+ let createdAwxUser : AwxUser ;
672
+ let awxOrganization : Organization ;
673
+ let awxTeam : Team ;
674
+
675
+ beforeEach ( ( ) => {
676
+ cy . createAwxOrganization ( ) . then ( ( awxOrg ) => {
677
+ awxOrganization = awxOrg ;
678
+ cy . createAwxUser ( { organization : awxOrganization . id } ) . then ( ( awxUser ) => {
679
+ createdAwxUser = awxUser ;
680
+ cy . createAWXCredential ( {
681
+ kind : 'machine' ,
682
+ organization : awxOrganization . id ,
683
+ credential_type : 1 ,
684
+ } ) . then ( ( cred ) => {
685
+ machineCredential = cred ;
686
+ } ) ;
687
+ } ) ;
688
+ cy . createAwxTeam ( { organization : awxOrganization . id } ) . then ( ( createdAwxTeam ) => {
689
+ awxTeam = createdAwxTeam ;
687
690
} ) ;
688
- } ) ;
689
- cy . createAwxTeam ( { organization : awxOrganization . id } ) . then ( ( createdAwxTeam ) => {
690
- awxTeam = createdAwxTeam ;
691
691
} ) ;
692
692
} ) ;
693
- } ) ;
694
693
695
- afterEach ( ( ) => {
696
- cy . deleteAwxCredential ( machineCredential , { failOnStatusCode : false } ) ;
697
- cy . deleteAwxUser ( createdAwxUser , { failOnStatusCode : false } ) ;
698
- cy . deleteAwxTeam ( awxTeam , { failOnStatusCode : false } ) ;
699
- cy . deleteAwxOrganization ( awxOrganization , { failOnStatusCode : false } ) ;
700
- } ) ;
701
-
702
- function removeRoleFromListRow ( roleName : string , assignmentType : string ) {
703
- cy . intercept ( 'DELETE' , awxAPI `/role_${ assignmentType } _assignments/*` ) . as ( 'deleteRole' ) ;
704
- cy . clickTableRowPinnedAction ( roleName , 'remove-role' , false ) ;
705
- cy . getModal ( ) . within ( ( ) => {
706
- cy . get ( '#confirm' ) . click ( ) ;
707
- cy . clickButton ( / ^ R e m o v e r o l e / ) ;
708
- cy . wait ( '@deleteRole' )
709
- . its ( 'response' )
710
- . then ( ( deleted ) => {
711
- expect ( deleted ?. statusCode ) . to . eql ( 204 ) ;
712
- cy . contains ( / ^ S u c c e s s $ / ) . should ( 'be.visible' ) ;
713
- cy . containsBy ( 'button' , / ^ C l o s e $ / ) . click ( ) ;
714
- } ) ;
694
+ afterEach ( ( ) => {
695
+ cy . deleteAwxCredential ( machineCredential , { failOnStatusCode : false } ) ;
696
+ cy . deleteAwxUser ( createdAwxUser , { failOnStatusCode : false } ) ;
697
+ cy . deleteAwxTeam ( awxTeam , { failOnStatusCode : false } ) ;
698
+ cy . deleteAwxOrganization ( awxOrganization , { failOnStatusCode : false } ) ;
715
699
} ) ;
716
- }
717
700
718
- it ( 'can create a new credential, assign a team and apply role(s)' , ( ) => {
719
- cy . intercept ( 'POST' , awxAPI `/role_team_assignments/` ) . as ( 'teamRoleAssignment' ) ;
720
- cy . navigateTo ( 'awx' , 'credentials' ) ;
721
- cy . filterTableByMultiSelect ( 'name' , [ machineCredential . name ] ) ;
722
- cy . clickTableRowLink ( 'name' , machineCredential . name , { disableFilter : true } ) ;
723
- cy . clickTab ( 'Team Access' , true ) ;
724
- cy . getByDataCy ( 'add-roles' ) . click ( ) ;
725
- cy . verifyPageTitle ( 'Add roles' ) ;
726
- cy . getWizard ( ) . within ( ( ) => {
727
- cy . contains ( 'h1' , 'Select team(s)' ) . should ( 'be.visible' ) ;
728
- cy . filterTableByMultiSelect ( 'name' , [ awxTeam . name ] ) ;
729
- cy . selectTableRowByCheckbox ( 'name' , awxTeam . name , { disableFilter : true } ) ;
730
- cy . clickButton ( / ^ N e x t / ) ;
731
- cy . contains ( 'h1' , 'Select roles to apply' ) . should ( 'be.visible' ) ;
732
- cy . filterTableByTextFilter ( 'name' , 'Credential Admin' , {
733
- disableFilterSelection : true ,
701
+ function removeRoleFromListRow ( roleName : string , assignmentType : string ) {
702
+ cy . intercept ( 'DELETE' , awxAPI `/role_${ assignmentType } _assignments/*` ) . as ( 'deleteRole' ) ;
703
+ cy . clickTableRowPinnedAction ( roleName , 'remove-role' , false ) ;
704
+ cy . getModal ( ) . within ( ( ) => {
705
+ cy . get ( '#confirm' ) . click ( ) ;
706
+ cy . clickButton ( / ^ R e m o v e r o l e / ) ;
707
+ cy . wait ( '@deleteRole' )
708
+ . its ( 'response' )
709
+ . then ( ( deleted ) => {
710
+ expect ( deleted ?. statusCode ) . to . eql ( 204 ) ;
711
+ cy . contains ( / ^ S u c c e s s $ / ) . should ( 'be.visible' ) ;
712
+ cy . containsBy ( 'button' , / ^ C l o s e $ / ) . click ( ) ;
713
+ } ) ;
734
714
} ) ;
735
- cy . selectTableRowByCheckbox ( 'name' , 'Credential Admin' , {
736
- disableFilter : true ,
715
+ }
716
+
717
+ it ( 'can create a new credential, assign a team and apply role(s)' , ( ) => {
718
+ cy . intercept ( 'POST' , awxAPI `/role_team_assignments/` ) . as ( 'teamRoleAssignment' ) ;
719
+ cy . navigateTo ( 'awx' , 'credentials' ) ;
720
+ cy . filterTableByMultiSelect ( 'name' , [ machineCredential . name ] ) ;
721
+ cy . clickTableRowLink ( 'name' , machineCredential . name , { disableFilter : true } ) ;
722
+ cy . clickTab ( 'Team Access' , true ) ;
723
+ cy . getByDataCy ( 'add-roles' ) . click ( ) ;
724
+ cy . verifyPageTitle ( 'Add roles' ) ;
725
+ cy . getWizard ( ) . within ( ( ) => {
726
+ cy . contains ( 'h1' , 'Select team(s)' ) . should ( 'be.visible' ) ;
727
+ cy . filterTableByMultiSelect ( 'name' , [ awxTeam . name ] ) ;
728
+ cy . selectTableRowByCheckbox ( 'name' , awxTeam . name , { disableFilter : true } ) ;
729
+ cy . clickButton ( / ^ N e x t / ) ;
730
+ cy . contains ( 'h1' , 'Select roles to apply' ) . should ( 'be.visible' ) ;
731
+ cy . filterTableByTextFilter ( 'name' , 'Credential Admin' , {
732
+ disableFilterSelection : true ,
733
+ } ) ;
734
+ cy . selectTableRowByCheckbox ( 'name' , 'Credential Admin' , {
735
+ disableFilter : true ,
736
+ } ) ;
737
+ cy . filterTableByTextFilter ( 'name' , 'Credential Use' , {
738
+ disableFilterSelection : true ,
739
+ } ) ;
740
+ cy . selectTableRowByCheckbox ( 'name' , 'Credential Use' , {
741
+ disableFilter : true ,
742
+ } ) ;
743
+ cy . clickButton ( / ^ N e x t / ) ;
744
+ cy . contains ( 'h1' , 'Review' ) . should ( 'be.visible' ) ;
745
+ cy . verifyReviewStepWizardDetails ( 'teams' , [ awxTeam . name ] , '1' ) ;
746
+ cy . verifyReviewStepWizardDetails (
747
+ 'awxRoles' ,
748
+ [
749
+ 'Credential Admin' ,
750
+ 'Has all permissions to a single credential' ,
751
+ 'Credential Use' ,
752
+ 'Has use permissions to a single credential' ,
753
+ ] ,
754
+ '2'
755
+ ) ;
756
+ cy . clickButton ( / ^ F i n i s h / ) ;
757
+ cy . wait ( '@teamRoleAssignment' )
758
+ . its ( 'response' )
759
+ . then ( ( response ) => {
760
+ expect ( response ?. statusCode ) . to . eql ( 201 ) ;
761
+ } ) ;
737
762
} ) ;
738
- cy . filterTableByTextFilter ( 'name' , 'Credential Use' , {
739
- disableFilterSelection : true ,
763
+ cy . getModal ( ) . within ( ( ) => {
764
+ cy . clickButton ( / ^ C l o s e $ / ) ;
740
765
} ) ;
741
- cy . selectTableRowByCheckbox ( 'name' , 'Credential Use' , {
766
+ cy . getModal ( ) . should ( 'not.exist' ) ;
767
+ cy . verifyPageTitle ( machineCredential . name ) ;
768
+ cy . selectTableRowByCheckbox ( 'team-name' , awxTeam . name , {
742
769
disableFilter : true ,
743
770
} ) ;
744
- cy . clickButton ( / ^ N e x t / ) ;
745
- cy . contains ( 'h1' , 'Review' ) . should ( 'be.visible' ) ;
746
- cy . verifyReviewStepWizardDetails ( 'teams' , [ awxTeam . name ] , '1' ) ;
747
- cy . verifyReviewStepWizardDetails (
748
- 'awxRoles' ,
749
- [
750
- 'Credential Admin' ,
751
- 'Has all permissions to a single credential' ,
752
- 'Credential Use' ,
753
- 'Has use permissions to a single credential' ,
754
- ] ,
755
- '2'
756
- ) ;
757
- cy . clickButton ( / ^ F i n i s h / ) ;
758
- cy . wait ( '@teamRoleAssignment' )
759
- . its ( 'response' )
760
- . then ( ( response ) => {
761
- expect ( response ?. statusCode ) . to . eql ( 201 ) ;
762
- } ) ;
763
- } ) ;
764
- cy . getModal ( ) . within ( ( ) => {
765
- cy . clickButton ( / ^ C l o s e $ / ) ;
766
- } ) ;
767
- cy . getModal ( ) . should ( 'not.exist' ) ;
768
- cy . verifyPageTitle ( machineCredential . name ) ;
769
- cy . selectTableRowByCheckbox ( 'team-name' , awxTeam . name , {
770
- disableFilter : true ,
771
- } ) ;
772
- removeRoleFromListRow ( 'Credential Admin' , 'team' ) ;
773
- cy . selectTableRowByCheckbox ( 'team-name' , awxTeam . name , {
774
- disableFilter : true ,
771
+ removeRoleFromListRow ( 'Credential Admin' , 'team' ) ;
772
+ cy . selectTableRowByCheckbox ( 'team-name' , awxTeam . name , {
773
+ disableFilter : true ,
774
+ } ) ;
775
+ removeRoleFromListRow ( 'Credential Use' , 'team' ) ;
775
776
} ) ;
776
- removeRoleFromListRow ( 'Credential Use' , 'team' ) ;
777
- } ) ;
778
777
779
- it ( 'can create a new credential, assign a user and apply role(s)' , ( ) => {
780
- cy . intercept ( 'POST' , awxAPI `/role_user_assignments/` ) . as ( 'userRoleAssignment' ) ;
781
- cy . navigateTo ( 'awx' , 'credentials' ) ;
782
- cy . filterTableByMultiSelect ( 'name' , [ machineCredential . name ] ) ;
783
- cy . clickTableRowLink ( 'name' , machineCredential . name , { disableFilter : true } ) ;
784
- cy . clickTab ( 'User Access' , true ) ;
785
- cy . getByDataCy ( 'add-roles' ) . click ( ) ;
786
- cy . verifyPageTitle ( 'Add roles' ) ;
787
- cy . getWizard ( ) . within ( ( ) => {
788
- cy . contains ( 'h1' , 'Select user(s)' ) . should ( 'be.visible' ) ;
789
- cy . selectTableRowByCheckbox ( 'username' , createdAwxUser . username ) ;
790
- cy . clickButton ( / ^ N e x t / ) ;
791
- cy . contains ( 'h1' , 'Select roles to apply' ) . should ( 'be.visible' ) ;
792
- cy . filterTableByTextFilter ( 'name' , 'Credential Admin' , {
793
- disableFilterSelection : true ,
778
+ it ( 'can create a new credential, assign a user and apply role(s)' , ( ) => {
779
+ cy . intercept ( 'POST' , awxAPI `/role_user_assignments/` ) . as ( 'userRoleAssignment' ) ;
780
+ cy . navigateTo ( 'awx' , 'credentials' ) ;
781
+ cy . filterTableByMultiSelect ( 'name' , [ machineCredential . name ] ) ;
782
+ cy . clickTableRowLink ( 'name' , machineCredential . name , { disableFilter : true } ) ;
783
+ cy . clickTab ( 'User Access' , true ) ;
784
+ cy . getByDataCy ( 'add-roles' ) . click ( ) ;
785
+ cy . verifyPageTitle ( 'Add roles' ) ;
786
+ cy . getWizard ( ) . within ( ( ) => {
787
+ cy . contains ( 'h1' , 'Select user(s)' ) . should ( 'be.visible' ) ;
788
+ cy . selectTableRowByCheckbox ( 'username' , createdAwxUser . username ) ;
789
+ cy . clickButton ( / ^ N e x t / ) ;
790
+ cy . contains ( 'h1' , 'Select roles to apply' ) . should ( 'be.visible' ) ;
791
+ cy . filterTableByTextFilter ( 'name' , 'Credential Admin' , {
792
+ disableFilterSelection : true ,
793
+ } ) ;
794
+ cy . selectTableRowByCheckbox ( 'name' , 'Credential Admin' , {
795
+ disableFilter : true ,
796
+ } ) ;
797
+ cy . filterTableByTextFilter ( 'name' , 'Credential Use' , {
798
+ disableFilterSelection : true ,
799
+ } ) ;
800
+ cy . selectTableRowByCheckbox ( 'name' , 'Credential Use' , {
801
+ disableFilter : true ,
802
+ } ) ;
803
+ cy . clickButton ( / ^ N e x t / ) ;
804
+ cy . contains ( 'h1' , 'Review' ) . should ( 'be.visible' ) ;
805
+ cy . verifyReviewStepWizardDetails ( 'users' , [ createdAwxUser . username ] , '1' ) ;
806
+ cy . verifyReviewStepWizardDetails (
807
+ 'awxRoles' ,
808
+ [
809
+ 'Credential Admin' ,
810
+ 'Has all permissions to a single credential' ,
811
+ 'Credential Use' ,
812
+ 'Has use permissions to a single credential' ,
813
+ ] ,
814
+ '2'
815
+ ) ;
816
+ cy . clickButton ( / ^ F i n i s h / ) ;
817
+ cy . wait ( '@userRoleAssignment' )
818
+ . its ( 'response' )
819
+ . then ( ( response ) => {
820
+ expect ( response ?. statusCode ) . to . eql ( 201 ) ;
821
+ } ) ;
794
822
} ) ;
795
- cy . selectTableRowByCheckbox ( 'name' , 'Credential Admin' , {
796
- disableFilter : true ,
823
+ cy . getModal ( ) . within ( ( ) => {
824
+ cy . clickButton ( / ^ C l o s e $ / ) ;
797
825
} ) ;
798
- cy . filterTableByTextFilter ( 'name' , 'Credential Use' , {
799
- disableFilterSelection : true ,
826
+ cy . getModal ( ) . should ( 'not.exist' ) ;
827
+ cy . verifyPageTitle ( machineCredential . name ) ;
828
+ cy . selectTableRowByCheckbox ( 'username' , createdAwxUser . username , {
829
+ disableFilter : true ,
800
830
} ) ;
801
- cy . selectTableRowByCheckbox ( 'name' , 'Credential Use' , {
831
+ removeRoleFromListRow ( 'Credential Admin' , 'user' ) ;
832
+ cy . selectTableRowByCheckbox ( 'username' , createdAwxUser . username , {
802
833
disableFilter : true ,
803
834
} ) ;
804
- cy . clickButton ( / ^ N e x t / ) ;
805
- cy . contains ( 'h1' , 'Review' ) . should ( 'be.visible' ) ;
806
- cy . verifyReviewStepWizardDetails ( 'users' , [ createdAwxUser . username ] , '1' ) ;
807
- cy . verifyReviewStepWizardDetails (
808
- 'awxRoles' ,
809
- [
810
- 'Credential Admin' ,
811
- 'Has all permissions to a single credential' ,
812
- 'Credential Use' ,
813
- 'Has use permissions to a single credential' ,
814
- ] ,
815
- '2'
816
- ) ;
817
- cy . clickButton ( / ^ F i n i s h / ) ;
818
- cy . wait ( '@userRoleAssignment' )
819
- . its ( 'response' )
820
- . then ( ( response ) => {
821
- expect ( response ?. statusCode ) . to . eql ( 201 ) ;
822
- } ) ;
823
- } ) ;
824
- cy . getModal ( ) . within ( ( ) => {
825
- cy . clickButton ( / ^ C l o s e $ / ) ;
826
- } ) ;
827
- cy . getModal ( ) . should ( 'not.exist' ) ;
828
- cy . verifyPageTitle ( machineCredential . name ) ;
829
- cy . selectTableRowByCheckbox ( 'username' , createdAwxUser . username , {
830
- disableFilter : true ,
831
- } ) ;
832
- removeRoleFromListRow ( 'Credential Admin' , 'user' ) ;
833
- cy . selectTableRowByCheckbox ( 'username' , createdAwxUser . username , {
834
- disableFilter : true ,
835
+ removeRoleFromListRow ( 'Credential Use' , 'user' ) ;
835
836
} ) ;
836
- removeRoleFromListRow ( 'Credential Use' , 'user' ) ;
837
837
} ) ;
838
838
} ) ;
839
839
} ) ;
0 commit comments