1515 * limitations under the License.
1616 */
1717/* eslint-disable no-undef */
18- import menuLocaleUS from '../../../src/locales/en-US/menu' ;
1918import componentLocaleUS from '../../../src/locales/en-US/component' ;
19+ import menuLocaleUS from '../../../src/locales/en-US/menu' ;
2020import routeLocaleUS from '../../../src/pages/Route/locales/en-US' ;
2121
2222context ( 'create route with proxy-rewrite plugin' , ( ) => {
@@ -29,6 +29,7 @@ context('create route with proxy-rewrite plugin', () => {
2929 deleteAlert : '.ant-modal-body' ,
3030 notification : '.ant-notification-notice-message' ,
3131 staticUri : '[data-cy=uri-static]' ,
32+ regexUri : '[data-cy=uri-regex]' ,
3233 staticHost : '[data-cy=host-static]' ,
3334 keepHost : '[data-cy=host-keep]' ,
3435 newUri : '#proxyRewrite_uri' ,
@@ -56,6 +57,7 @@ context('create route with proxy-rewrite plugin', () => {
5657 rewriteHeaderKey2 : 'test2' ,
5758 rewriteHeaderValue1 : '1' ,
5859 rewriteHeaderValue2 : '2' ,
60+ regex : '^/iresty/(.)/(.)/(.*)' ,
5961 } ;
6062
6163 beforeEach ( ( ) => {
@@ -154,6 +156,30 @@ context('create route with proxy-rewrite plugin', () => {
154156 cy . contains ( data . submitSuccess ) . should ( 'be.visible' ) ;
155157 } ) ;
156158
159+ it ( 'should use proxy rewrite in regex uri moode without template' , ( ) => {
160+ cy . visit ( '/' ) ;
161+ cy . contains ( menuLocaleUS [ 'menu.routes' ] ) . click ( ) ;
162+
163+ cy . get ( selector . nameSelector ) . type ( data . routeName ) ;
164+ cy . contains ( 'Search' ) . click ( ) ;
165+ cy . contains ( data . routeName ) . siblings ( ) . contains ( 'Configure' ) . click ( ) ;
166+
167+ cy . get ( '#status' ) . should ( 'have.class' , 'ant-switch-checked' ) ;
168+ cy . get ( selector . regexUri ) . click ( ) ;
169+ cy . get ( selector . uriRewriteReg ) . should ( 'be.visible' ) . type ( data . regex ) ;
170+ cy . get ( selector . uriRewriteTemp ) . should ( 'have.value' , '' ) ;
171+ cy . contains ( 'Next' ) . click ( ) ;
172+ cy . get ( selector . nodes_0_host ) . type ( data . host2 ) ;
173+ cy . get ( selector . nodes_0_port ) . type ( data . port ) ;
174+ cy . get ( selector . nodes_0_weight ) . type ( data . weight ) ;
175+ cy . contains ( 'Next' ) . click ( ) ;
176+
177+ cy . contains ( 'proxy-rewrite' ) . should ( 'not.exist' ) ;
178+ cy . contains ( 'Next' ) . click ( ) ;
179+ cy . contains ( 'Submit' ) . click ( ) ;
180+ cy . contains ( data . submitSuccess ) . should ( 'be.visible' ) ;
181+ } ) ;
182+
157183 it ( 'should delete the route' , function ( ) {
158184 cy . visit ( '/routes/list' ) ;
159185 cy . get ( selector . nameSelector ) . type ( data . routeName ) ;
0 commit comments