@@ -875,15 +875,8 @@ describe('OrgHead', () => {
875875 cy . get ( 'button' ) . first ( ) . click ( ) ;
876876 cy . get ( '[role="menu"]' ) . should ( 'be.visible' ) ;
877877
878- // First two menu items should be visible on desktop
879878 cy . contains ( 'Team Settings' ) . should ( 'be.visible' ) ;
880- // Edit Workflow may or may not be visible depending on canModify
881- cy . get ( 'body' ) . then ( ( $body ) => {
882- if ( $body . find ( '[role="menuitem"]' ) . length > 1 ) {
883- // If Edit Workflow is visible, it should be the second item
884- cy . get ( '[role="menuitem"]' ) . eq ( 1 ) . should ( 'be.visible' ) ;
885- }
886- } ) ;
879+ cy . get ( '#orgHeadEditWorkflow' ) . should ( 'be.visible' ) ;
887880 } ) ;
888881
889882 it ( 'should show team settings menu on mobile width when online admin' , ( ) => {
@@ -910,7 +903,67 @@ describe('OrgHead', () => {
910903 cy . get ( '[role="menu"]' ) . should ( 'be.visible' ) ;
911904
912905 cy . contains ( 'Team Settings' ) . should ( 'be.visible' ) ;
913- cy . contains ( 'Edit Workflow' ) . should ( 'be.visible' ) ;
906+ cy . get ( '#orgHeadEditWorkflow' ) . should ( 'be.visible' ) ;
907+ cy . contains ( 'Sort Projects' ) . should ( 'be.visible' ) ;
908+ } ) ;
909+
910+ it ( 'should hide Edit Workflow when mobile view is on at desktop width' , ( ) => {
911+ cy . viewport ( 1024 , 768 ) ;
912+ cy . window ( ) . then ( ( win ) => {
913+ win . localStorage . setItem ( localUserKey ( LocalKey . mobileView ) , 'true' ) ;
914+ } ) ;
915+ const orgId = 'test-org-id' ;
916+ const orgName = 'Test Organization' ;
917+ const orgData = createMockOrganization ( orgId , orgName ) ;
918+ const project1 = createMockProject ( 'project-1' , 'Project 1' ) ;
919+ const project2 = createMockProject ( 'project-2' , 'Project 2' ) ;
920+ const projectData = [ project1 , project2 ] ;
921+
922+ mountOrgHead (
923+ createInitialState ( { mobileView : true } , orgData , projectData ) ,
924+ [ '/team' ] ,
925+ orgId ,
926+ orgData ,
927+ true ,
928+ undefined ,
929+ projectData
930+ ) ;
931+
932+ cy . get ( 'button' ) . first ( ) . click ( ) ;
933+ cy . get ( '[role="menu"]' ) . should ( 'be.visible' ) ;
934+
935+ cy . contains ( 'Team Settings' ) . should ( 'be.visible' ) ;
936+ cy . get ( '#orgHeadEditWorkflow' ) . should ( 'not.exist' ) ;
937+ cy . contains ( 'Sort Projects' ) . should ( 'be.visible' ) ;
938+ } ) ;
939+
940+ it ( 'should hide Edit Workflow on narrow viewport when mobile view toggle is on' , ( ) => {
941+ cy . viewport ( 375 , 667 ) ;
942+ cy . window ( ) . then ( ( win ) => {
943+ win . localStorage . setItem ( localUserKey ( LocalKey . mobileView ) , 'true' ) ;
944+ } ) ;
945+ const orgId = 'test-org-id' ;
946+ const orgName = 'Test Organization' ;
947+ const orgData = createMockOrganization ( orgId , orgName ) ;
948+ const project1 = createMockProject ( 'project-1' , 'Project 1' ) ;
949+ const project2 = createMockProject ( 'project-2' , 'Project 2' ) ;
950+ const projectData = [ project1 , project2 ] ;
951+
952+ mountOrgHead (
953+ createInitialState ( { mobileView : true } , orgData , projectData ) ,
954+ [ '/team' ] ,
955+ orgId ,
956+ orgData ,
957+ true ,
958+ undefined ,
959+ projectData
960+ ) ;
961+
962+ cy . get ( 'button' ) . first ( ) . click ( ) ;
963+ cy . get ( '[role="menu"]' ) . should ( 'be.visible' ) ;
964+
965+ cy . contains ( 'Team Settings' ) . should ( 'be.visible' ) ;
966+ cy . get ( '#orgHeadEditWorkflow' ) . should ( 'not.exist' ) ;
914967 cy . contains ( 'Sort Projects' ) . should ( 'be.visible' ) ;
915968 } ) ;
916969
@@ -999,6 +1052,7 @@ describe('OrgHead', () => {
9991052 cy . get ( '[role="menu"]' ) . should ( 'be.visible' ) ;
10001053
10011054 cy . contains ( 'Team Settings' ) . should ( 'be.visible' ) ;
1055+ cy . get ( '#orgHeadEditWorkflow' ) . should ( 'be.visible' ) ;
10021056 cy . contains ( 'Sort Projects' ) . should ( 'be.visible' ) ;
10031057 } ) ;
10041058
0 commit comments