juzhiyuan commented on a change in pull request #1302:
URL: https://github.com/apache/apisix-dashboard/pull/1302#discussion_r561446058
##########
File path: web/src/pages/Route/components/CreateStep4/CreateStep4.tsx
##########
@@ -50,7 +50,7 @@ const CreateStep4: React.FC<Props> = ({ form1, form2,
redirect, upstreamRef, ...
<h2 style={style}>
{formatMessage({ id:
'page.route.steps.stepTitle.defineApiBackendServe' })}
</h2>
- <Step2 form={form2} upstreamRef={upstreamRef} disabled />
+ <Step2 form={form2} upstreamRef={upstreamRef} disabled
isServiceId={form1.getFieldValue('service_id') !== ''} />
Review comment:
there should be `hasServiceId`
##########
File path: web/src/pages/Route/components/CreateStep4/CreateStep4.tsx
##########
@@ -50,7 +50,7 @@ const CreateStep4: React.FC<Props> = ({ form1, form2,
redirect, upstreamRef, ...
<h2 style={style}>
{formatMessage({ id:
'page.route.steps.stepTitle.defineApiBackendServe' })}
</h2>
- <Step2 form={form2} upstreamRef={upstreamRef} disabled />
+ <Step2 form={form2} upstreamRef={upstreamRef} disabled
isServiceId={form1.getFieldValue('service_id') !== ''} />
Review comment:
or `serviceExist`
##########
File path: web/cypress/integration/route/create-route-can-skip-upstream.spec.js
##########
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* eslint-disable no-undef */
+
+context('Can select service_id skip upstream in route', () => {
+ const data = {
+ upstreamName: 'test_upstream',
+ serviceName: 'test_service',
+ routeName: 'test_route',
+ ip: '127.0.0.1',
+ }
+ const domSelector = {
+ name: '#name',
+ nodes_0_host: '#nodes_0_host',
+ upstream_id: '#upstream_id',
+ input: ':input',
+ custom: '[title=Custom]',
+ titleName: '[title=Name]',
+ testService: '[title=test_service]',
+ };
+
+ beforeEach(() => {
+ cy.login();
+ });
+
+ it('should create test upstream and service', () => {
+ cy.visit('/');
+ cy.contains('Upstream').click();
+ cy.contains('Create').click();
+
+ cy.get(domSelector.name).type(data.upstreamName);
+ cy.get(domSelector.nodes_0_host).type(data.ip);
+ cy.contains('Next').click();
+ cy.contains('Submit').click();
+
+ cy.visit('/');
+ cy.contains('Service').click();
+ cy.contains('Create').click();
+ cy.get(domSelector.name).type(data.serviceName);
+ cy.get(domSelector.custom).click();
Review comment:
custom what? custom upstream here.
##########
File path: web/cypress/integration/route/create-route-can-skip-upstream.spec.js
##########
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* eslint-disable no-undef */
+
+context('Can select service_id skip upstream in route', () => {
+ const data = {
+ upstreamName: 'test_upstream',
+ serviceName: 'test_service',
+ routeName: 'test_route',
+ ip: '127.0.0.1',
+ }
+ const domSelector = {
+ name: '#name',
+ nodes_0_host: '#nodes_0_host',
+ upstream_id: '#upstream_id',
+ input: ':input',
+ custom: '[title=Custom]',
+ titleName: '[title=Name]',
+ testService: '[title=test_service]',
+ };
+
+ beforeEach(() => {
+ cy.login();
+ });
+
+ it('should create test upstream and service', () => {
+ cy.visit('/');
+ cy.contains('Upstream').click();
+ cy.contains('Create').click();
+
+ cy.get(domSelector.name).type(data.upstreamName);
+ cy.get(domSelector.nodes_0_host).type(data.ip);
+ cy.contains('Next').click();
+ cy.contains('Submit').click();
+
+ cy.visit('/');
+ cy.contains('Service').click();
+ cy.contains('Create').click();
+ cy.get(domSelector.name).type(data.serviceName);
+ cy.get(domSelector.custom).click();
+ cy.contains(data.upstreamName).click();
+ cy.contains('Next').click();
+ cy.contains('Next').click();
+ cy.contains('Submit').click();
+ });
+
+ it('should select service_id can skip upstream when create route', () => {
Review comment:
```suggestion
it('should skip upstream module after service is selected when creating
route', () => {
```
##########
File path: web/cypress/integration/route/create-route-can-skip-upstream.spec.js
##########
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* eslint-disable no-undef */
+
+context('Can select service_id skip upstream in route', () => {
+ const data = {
+ upstreamName: 'test_upstream',
+ serviceName: 'test_service',
+ routeName: 'test_route',
+ ip: '127.0.0.1',
+ }
+ const domSelector = {
+ name: '#name',
+ nodes_0_host: '#nodes_0_host',
+ upstream_id: '#upstream_id',
+ input: ':input',
+ custom: '[title=Custom]',
+ titleName: '[title=Name]',
+ testService: '[title=test_service]',
+ };
+
+ beforeEach(() => {
+ cy.login();
+ });
+
+ it('should create test upstream and service', () => {
+ cy.visit('/');
+ cy.contains('Upstream').click();
+ cy.contains('Create').click();
+
+ cy.get(domSelector.name).type(data.upstreamName);
+ cy.get(domSelector.nodes_0_host).type(data.ip);
+ cy.contains('Next').click();
+ cy.contains('Submit').click();
+
+ cy.visit('/');
+ cy.contains('Service').click();
+ cy.contains('Create').click();
+ cy.get(domSelector.name).type(data.serviceName);
+ cy.get(domSelector.custom).click();
+ cy.contains(data.upstreamName).click();
+ cy.contains('Next').click();
+ cy.contains('Next').click();
+ cy.contains('Submit').click();
+ });
+
+ it('should select service_id can skip upstream when create route', () => {
+ cy.visit('/');
+ cy.contains('Route').click();
+ cy.contains('Create').click();
+
+ // When no select service_id, the option None does not exist
+ cy.get(domSelector.name).type(data.routeName);
+ cy.contains('Next').click();
+ cy.get(domSelector.custom).click();
+ cy.contains('None').should('not.exist');
+
+ cy.contains('Previous').click();
+ cy.contains('None').click();
+ cy.contains(data.serviceName).click();
+ cy.contains('Next').click();
+
+ // make sure upstream data can be saved
+ cy.get(domSelector.custom).click();
Review comment:
L72-L75 is creating a route with Service, why we still need to set
upstream?
##########
File path: web/cypress/integration/route/create-route-can-skip-upstream.spec.js
##########
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* eslint-disable no-undef */
+
+context('Can select service_id skip upstream in route', () => {
+ const data = {
+ upstreamName: 'test_upstream',
+ serviceName: 'test_service',
+ routeName: 'test_route',
+ ip: '127.0.0.1',
+ }
+ const domSelector = {
+ name: '#name',
+ nodes_0_host: '#nodes_0_host',
+ upstream_id: '#upstream_id',
+ input: ':input',
+ custom: '[title=Custom]',
+ titleName: '[title=Name]',
+ testService: '[title=test_service]',
+ };
+
+ beforeEach(() => {
+ cy.login();
+ });
+
+ it('should create test upstream and service', () => {
+ cy.visit('/');
+ cy.contains('Upstream').click();
+ cy.contains('Create').click();
+
+ cy.get(domSelector.name).type(data.upstreamName);
+ cy.get(domSelector.nodes_0_host).type(data.ip);
+ cy.contains('Next').click();
+ cy.contains('Submit').click();
+
+ cy.visit('/');
+ cy.contains('Service').click();
+ cy.contains('Create').click();
+ cy.get(domSelector.name).type(data.serviceName);
+ cy.get(domSelector.custom).click();
+ cy.contains(data.upstreamName).click();
+ cy.contains('Next').click();
+ cy.contains('Next').click();
+ cy.contains('Submit').click();
+ });
+
+ it('should select service_id can skip upstream when create route', () => {
+ cy.visit('/');
+ cy.contains('Route').click();
+ cy.contains('Create').click();
+
+ // When no select service_id, the option None does not exist
+ cy.get(domSelector.name).type(data.routeName);
+ cy.contains('Next').click();
+ cy.get(domSelector.custom).click();
+ cy.contains('None').should('not.exist');
+
+ cy.contains('Previous').click();
+ cy.contains('None').click();
+ cy.contains(data.serviceName).click();
+ cy.contains('Next').click();
+
+ // make sure upstream data can be saved
+ cy.get(domSelector.custom).click();
+ cy.contains(data.upstreamName).click();
+ cy.get(domSelector.input).should('be.disabled');
+
+ cy.contains(data.upstreamName).click();
+ cy.contains('None').click();
+ cy.contains('Next').click();
+ cy.contains('Next').click();
+ cy.contains('Submit').click();
+ cy.contains('Goto List').click();
+ });
+
+ it('should select service_id can skip upstream when edit route', () => {
+ cy.visit('/');
+ cy.contains('Route').click();
+
+ cy.get(domSelector.titleName).type(data.routeName);
+ cy.contains('Search').click();
+ cy.contains(data.routeName).siblings().contains('Edit').click();
+ cy.get(domSelector.testService).click();
+ cy.contains('None').click();
+ cy.contains('Next').click();
+ cy.get(domSelector.upstream_id).click();
+ cy.contains('None').should('not.exist');
+ cy.contains(data.upstreamName).click();
+ cy.contains('Next').click();
+ cy.contains('Next').click();
+ cy.contains('Submit').click();
+ });
+
+ it('should delete upstream service and route', () => {
+ cy.visit('/');
+ cy.contains('Upstream').click();
+ cy.contains(data.upstreamName).siblings().contains('Delete').click();
+ cy.contains('button', 'Confirm').click();
+
Review comment:
successfully?
##########
File path: web/cypress/integration/route/create-route-can-skip-upstream.spec.js
##########
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* eslint-disable no-undef */
+
+context('Can select service_id skip upstream in route', () => {
+ const data = {
+ upstreamName: 'test_upstream',
+ serviceName: 'test_service',
+ routeName: 'test_route',
+ ip: '127.0.0.1',
+ }
+ const domSelector = {
+ name: '#name',
+ nodes_0_host: '#nodes_0_host',
+ upstream_id: '#upstream_id',
+ input: ':input',
+ custom: '[title=Custom]',
+ titleName: '[title=Name]',
+ testService: '[title=test_service]',
+ };
+
+ beforeEach(() => {
+ cy.login();
+ });
+
+ it('should create test upstream and service', () => {
+ cy.visit('/');
+ cy.contains('Upstream').click();
+ cy.contains('Create').click();
+
+ cy.get(domSelector.name).type(data.upstreamName);
+ cy.get(domSelector.nodes_0_host).type(data.ip);
+ cy.contains('Next').click();
+ cy.contains('Submit').click();
+
+ cy.visit('/');
+ cy.contains('Service').click();
+ cy.contains('Create').click();
+ cy.get(domSelector.name).type(data.serviceName);
+ cy.get(domSelector.custom).click();
+ cy.contains(data.upstreamName).click();
+ cy.contains('Next').click();
+ cy.contains('Next').click();
+ cy.contains('Submit').click();
+ });
+
+ it('should select service_id can skip upstream when create route', () => {
+ cy.visit('/');
+ cy.contains('Route').click();
+ cy.contains('Create').click();
+
+ // When no select service_id, the option None does not exist
Review comment:
```suggestion
// The None option doesn't exist when service isn't selected
```
##########
File path: web/cypress/integration/route/create-route-can-skip-upstream.spec.js
##########
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* eslint-disable no-undef */
+
+context('Can select service_id skip upstream in route', () => {
+ const data = {
+ upstreamName: 'test_upstream',
+ serviceName: 'test_service',
+ routeName: 'test_route',
+ ip: '127.0.0.1',
+ }
+ const domSelector = {
+ name: '#name',
+ nodes_0_host: '#nodes_0_host',
+ upstream_id: '#upstream_id',
+ input: ':input',
+ custom: '[title=Custom]',
+ titleName: '[title=Name]',
Review comment:
we may use sanke_case in the future.
##########
File path: web/cypress/integration/route/create-route-can-skip-upstream.spec.js
##########
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* eslint-disable no-undef */
+
+context('Can select service_id skip upstream in route', () => {
+ const data = {
+ upstreamName: 'test_upstream',
+ serviceName: 'test_service',
+ routeName: 'test_route',
+ ip: '127.0.0.1',
+ }
+ const domSelector = {
+ name: '#name',
+ nodes_0_host: '#nodes_0_host',
+ upstream_id: '#upstream_id',
+ input: ':input',
+ custom: '[title=Custom]',
+ titleName: '[title=Name]',
+ testService: '[title=test_service]',
+ };
+
+ beforeEach(() => {
+ cy.login();
+ });
+
+ it('should create test upstream and service', () => {
+ cy.visit('/');
+ cy.contains('Upstream').click();
+ cy.contains('Create').click();
+
+ cy.get(domSelector.name).type(data.upstreamName);
+ cy.get(domSelector.nodes_0_host).type(data.ip);
+ cy.contains('Next').click();
+ cy.contains('Submit').click();
+
+ cy.visit('/');
+ cy.contains('Service').click();
+ cy.contains('Create').click();
+ cy.get(domSelector.name).type(data.serviceName);
+ cy.get(domSelector.custom).click();
+ cy.contains(data.upstreamName).click();
+ cy.contains('Next').click();
+ cy.contains('Next').click();
+ cy.contains('Submit').click();
+ });
+
+ it('should select service_id can skip upstream when create route', () => {
+ cy.visit('/');
+ cy.contains('Route').click();
+ cy.contains('Create').click();
+
+ // When no select service_id, the option None does not exist
+ cy.get(domSelector.name).type(data.routeName);
+ cy.contains('Next').click();
+ cy.get(domSelector.custom).click();
+ cy.contains('None').should('not.exist');
+
+ cy.contains('Previous').click();
+ cy.contains('None').click();
+ cy.contains(data.serviceName).click();
+ cy.contains('Next').click();
+
+ // make sure upstream data can be saved
+ cy.get(domSelector.custom).click();
+ cy.contains(data.upstreamName).click();
+ cy.get(domSelector.input).should('be.disabled');
+
+ cy.contains(data.upstreamName).click();
+ cy.contains('None').click();
+ cy.contains('Next').click();
+ cy.contains('Next').click();
+ cy.contains('Submit').click();
+ cy.contains('Goto List').click();
+ });
+
+ it('should select service_id can skip upstream when edit route', () => {
+ cy.visit('/');
+ cy.contains('Route').click();
+
+ cy.get(domSelector.titleName).type(data.routeName);
+ cy.contains('Search').click();
+ cy.contains(data.routeName).siblings().contains('Edit').click();
+ cy.get(domSelector.testService).click();
+ cy.contains('None').click();
+ cy.contains('Next').click();
+ cy.get(domSelector.upstream_id).click();
+ cy.contains('None').should('not.exist');
+ cy.contains(data.upstreamName).click();
+ cy.contains('Next').click();
+ cy.contains('Next').click();
+ cy.contains('Submit').click();
Review comment:
Edit successfully?
##########
File path: web/cypress/integration/route/create-route-can-skip-upstream.spec.js
##########
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* eslint-disable no-undef */
+
+context('Can select service_id skip upstream in route', () => {
+ const data = {
+ upstreamName: 'test_upstream',
+ serviceName: 'test_service',
+ routeName: 'test_route',
+ ip: '127.0.0.1',
+ }
+ const domSelector = {
+ name: '#name',
+ nodes_0_host: '#nodes_0_host',
+ upstream_id: '#upstream_id',
+ input: ':input',
+ custom: '[title=Custom]',
+ titleName: '[title=Name]',
+ testService: '[title=test_service]',
+ };
+
+ beforeEach(() => {
+ cy.login();
+ });
+
+ it('should create test upstream and service', () => {
+ cy.visit('/');
+ cy.contains('Upstream').click();
+ cy.contains('Create').click();
+
+ cy.get(domSelector.name).type(data.upstreamName);
+ cy.get(domSelector.nodes_0_host).type(data.ip);
+ cy.contains('Next').click();
+ cy.contains('Submit').click();
+
+ cy.visit('/');
+ cy.contains('Service').click();
+ cy.contains('Create').click();
+ cy.get(domSelector.name).type(data.serviceName);
+ cy.get(domSelector.custom).click();
+ cy.contains(data.upstreamName).click();
+ cy.contains('Next').click();
+ cy.contains('Next').click();
+ cy.contains('Submit').click();
+ });
+
+ it('should select service_id can skip upstream when create route', () => {
+ cy.visit('/');
+ cy.contains('Route').click();
+ cy.contains('Create').click();
+
+ // When no select service_id, the option None does not exist
+ cy.get(domSelector.name).type(data.routeName);
+ cy.contains('Next').click();
+ cy.get(domSelector.custom).click();
+ cy.contains('None').should('not.exist');
+
+ cy.contains('Previous').click();
+ cy.contains('None').click();
+ cy.contains(data.serviceName).click();
+ cy.contains('Next').click();
+
+ // make sure upstream data can be saved
+ cy.get(domSelector.custom).click();
+ cy.contains(data.upstreamName).click();
+ cy.get(domSelector.input).should('be.disabled');
+
+ cy.contains(data.upstreamName).click();
+ cy.contains('None').click();
+ cy.contains('Next').click();
+ cy.contains('Next').click();
+ cy.contains('Submit').click();
+ cy.contains('Goto List').click();
+ });
+
+ it('should select service_id can skip upstream when edit route', () => {
+ cy.visit('/');
+ cy.contains('Route').click();
+
+ cy.get(domSelector.titleName).type(data.routeName);
+ cy.contains('Search').click();
+ cy.contains(data.routeName).siblings().contains('Edit').click();
+ cy.get(domSelector.testService).click();
+ cy.contains('None').click();
+ cy.contains('Next').click();
+ cy.get(domSelector.upstream_id).click();
+ cy.contains('None').should('not.exist');
+ cy.contains(data.upstreamName).click();
+ cy.contains('Next').click();
+ cy.contains('Next').click();
+ cy.contains('Submit').click();
+ });
+
+ it('should delete upstream service and route', () => {
Review comment:
```suggestion
it('should delete upstream, service and route', () => {
```
##########
File path: web/cypress/integration/route/create-route-can-skip-upstream.spec.js
##########
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* eslint-disable no-undef */
+
+context('Can select service_id skip upstream in route', () => {
+ const data = {
+ upstreamName: 'test_upstream',
+ serviceName: 'test_service',
+ routeName: 'test_route',
+ ip: '127.0.0.1',
+ }
+ const domSelector = {
+ name: '#name',
+ nodes_0_host: '#nodes_0_host',
+ upstream_id: '#upstream_id',
+ input: ':input',
+ custom: '[title=Custom]',
+ titleName: '[title=Name]',
+ testService: '[title=test_service]',
+ };
+
+ beforeEach(() => {
+ cy.login();
+ });
+
+ it('should create test upstream and service', () => {
+ cy.visit('/');
+ cy.contains('Upstream').click();
+ cy.contains('Create').click();
+
+ cy.get(domSelector.name).type(data.upstreamName);
+ cy.get(domSelector.nodes_0_host).type(data.ip);
+ cy.contains('Next').click();
+ cy.contains('Submit').click();
+
+ cy.visit('/');
+ cy.contains('Service').click();
+ cy.contains('Create').click();
+ cy.get(domSelector.name).type(data.serviceName);
+ cy.get(domSelector.custom).click();
+ cy.contains(data.upstreamName).click();
+ cy.contains('Next').click();
+ cy.contains('Next').click();
+ cy.contains('Submit').click();
Review comment:
Need to check if those two resources are created.
##########
File path: web/cypress/integration/route/create-route-can-skip-upstream.spec.js
##########
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* eslint-disable no-undef */
+
+context('Can select service_id skip upstream in route', () => {
+ const data = {
+ upstreamName: 'test_upstream',
+ serviceName: 'test_service',
+ routeName: 'test_route',
+ ip: '127.0.0.1',
+ }
+ const domSelector = {
+ name: '#name',
+ nodes_0_host: '#nodes_0_host',
+ upstream_id: '#upstream_id',
+ input: ':input',
+ custom: '[title=Custom]',
+ titleName: '[title=Name]',
+ testService: '[title=test_service]',
+ };
+
+ beforeEach(() => {
+ cy.login();
+ });
+
+ it('should create test upstream and service', () => {
+ cy.visit('/');
+ cy.contains('Upstream').click();
+ cy.contains('Create').click();
+
+ cy.get(domSelector.name).type(data.upstreamName);
+ cy.get(domSelector.nodes_0_host).type(data.ip);
+ cy.contains('Next').click();
+ cy.contains('Submit').click();
+
+ cy.visit('/');
+ cy.contains('Service').click();
+ cy.contains('Create').click();
+ cy.get(domSelector.name).type(data.serviceName);
+ cy.get(domSelector.custom).click();
+ cy.contains(data.upstreamName).click();
+ cy.contains('Next').click();
+ cy.contains('Next').click();
+ cy.contains('Submit').click();
+ });
+
+ it('should select service_id can skip upstream when create route', () => {
+ cy.visit('/');
+ cy.contains('Route').click();
+ cy.contains('Create').click();
+
+ // When no select service_id, the option None does not exist
+ cy.get(domSelector.name).type(data.routeName);
+ cy.contains('Next').click();
+ cy.get(domSelector.custom).click();
+ cy.contains('None').should('not.exist');
+
+ cy.contains('Previous').click();
+ cy.contains('None').click();
+ cy.contains(data.serviceName).click();
+ cy.contains('Next').click();
+
+ // make sure upstream data can be saved
+ cy.get(domSelector.custom).click();
+ cy.contains(data.upstreamName).click();
+ cy.get(domSelector.input).should('be.disabled');
+
+ cy.contains(data.upstreamName).click();
+ cy.contains('None').click();
+ cy.contains('Next').click();
+ cy.contains('Next').click();
+ cy.contains('Submit').click();
+ cy.contains('Goto List').click();
+ });
+
+ it('should select service_id can skip upstream when edit route', () => {
Review comment:
```suggestion
it('should skip Upstream module after service is selected when editing
route', () => {
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]