@@ -83,6 +83,35 @@ describe('<GatewayServiceForm />', { viewportHeight: 800, viewportWidth: 700 },
83
83
cy . getTestId ( 'form-submit' ) . should ( 'be.disabled' )
84
84
} )
85
85
86
+ it ( "should check for name's validity" , ( ) => {
87
+ cy . mount ( GatewayServiceForm , {
88
+ props : {
89
+ config : baseConfigKonnect ,
90
+ } ,
91
+ } )
92
+
93
+ cy . get ( '.kong-ui-entities-gateway-service-form' ) . should ( 'be.visible' )
94
+ cy . get ( '.kong-ui-entities-gateway-service-form form' ) . should ( 'be.visible' )
95
+
96
+ cy . getTestId ( 'gateway-service-name-input' ) . should ( 'be.visible' )
97
+ cy . getTestId ( 'gateway-service-name-input' ) . parents ( '.k-input-wrapper.input-error' )
98
+ . should ( 'not.exist' )
99
+
100
+ cy . getTestId ( 'gateway-service-name-input' ) . type ( 'service' )
101
+ cy . getTestId ( 'gateway-service-name-input' ) . parents ( '.k-input-wrapper.input-error' )
102
+ . should ( 'not.exist' )
103
+
104
+ cy . getTestId ( 'gateway-service-name-input' ) . clear ( )
105
+ cy . getTestId ( 'gateway-service-name-input' ) . type ( 'service abc' ) // with a space
106
+ cy . getTestId ( 'gateway-service-name-input' ) . parents ( '.k-input-wrapper.input-error' )
107
+ . first ( ) . find ( '.help-text' ) . should ( 'be.visible' )
108
+
109
+ cy . getTestId ( 'gateway-service-name-input' ) . clear ( )
110
+ cy . getTestId ( 'gateway-service-name-input' ) . type ( 'Hello-ÆBČÐẼF-你好-妳好-こんにちは-안녕하세요-𑁦𑁧𑁨𑁩𑁪𑁫𑁬𑁭𑁮𑁯' ) // UTF-8
111
+ cy . getTestId ( 'gateway-service-name-input' ) . parents ( '.k-input-wrapper.input-error' )
112
+ . should ( 'not.exist' )
113
+ } )
114
+
86
115
it ( 'should enable Save button if Upstream URL is selected and Upstream URL field is filled in' , ( ) => {
87
116
cy . mount ( GatewayServiceForm , {
88
117
props : {
@@ -436,6 +465,35 @@ describe('<GatewayServiceForm />', { viewportHeight: 800, viewportWidth: 700 },
436
465
cy . getTestId ( 'form-submit' ) . should ( 'be.disabled' )
437
466
} )
438
467
468
+ it ( "should check for name's validity" , ( ) => {
469
+ cy . mount ( GatewayServiceForm , {
470
+ props : {
471
+ config : baseConfigKonnect ,
472
+ } ,
473
+ } )
474
+
475
+ cy . get ( '.kong-ui-entities-gateway-service-form' ) . should ( 'be.visible' )
476
+ cy . get ( '.kong-ui-entities-gateway-service-form form' ) . should ( 'be.visible' )
477
+
478
+ cy . getTestId ( 'gateway-service-name-input' ) . should ( 'be.visible' )
479
+ cy . getTestId ( 'gateway-service-name-input' ) . parents ( '.k-input-wrapper.input-error' )
480
+ . should ( 'not.exist' )
481
+
482
+ cy . getTestId ( 'gateway-service-name-input' ) . type ( 'service' )
483
+ cy . getTestId ( 'gateway-service-name-input' ) . parents ( '.k-input-wrapper.input-error' )
484
+ . should ( 'not.exist' )
485
+
486
+ cy . getTestId ( 'gateway-service-name-input' ) . clear ( )
487
+ cy . getTestId ( 'gateway-service-name-input' ) . type ( 'service abc' ) // with a space
488
+ cy . getTestId ( 'gateway-service-name-input' ) . parents ( '.k-input-wrapper.input-error' )
489
+ . first ( ) . find ( '.help-text' ) . should ( 'be.visible' )
490
+
491
+ cy . getTestId ( 'gateway-service-name-input' ) . clear ( )
492
+ cy . getTestId ( 'gateway-service-name-input' ) . type ( 'Hello-ÆBČÐẼF-你好-妳好-こんにちは-안녕하세요-𑁦𑁧𑁨𑁩𑁪𑁫𑁬𑁭𑁮𑁯' ) // UTF-8
493
+ cy . getTestId ( 'gateway-service-name-input' ) . parents ( '.k-input-wrapper.input-error' )
494
+ . should ( 'not.exist' )
495
+ } )
496
+
439
497
it ( 'should enable Save button if Upstream URL is selected and Upstream URL field is filled in' , ( ) => {
440
498
cy . mount ( GatewayServiceForm , {
441
499
props : {
0 commit comments