You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/02/03 10:55:20 UTC

[GitHub] [apisix-dashboard] juzhiyuan commented on a change in pull request #1413: fix: Upstream information is lost when editing services

juzhiyuan commented on a change in pull request #1413:
URL: https://github.com/apache/apisix-dashboard/pull/1413#discussion_r569310746



##########
File path: web/cypress/integration/service/edit-service-with-upstream.spec.js
##########
@@ -0,0 +1,104 @@
+/*
+ * 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('edit service with upstream', () => {
+  const domSelector = {
+    name: '#name',
+    desc: '#desc',
+    nodes_0_host: '#nodes_0_host',
+    notification: '.ant-notification-notice-message',
+    search_name: '[title=Name]',
+    custom_upstream: '[title=Custom]',
+    test_upstream: '[title=test_upstream]',
+    input: ':input',
+  };
+  const data = {
+    service_name: 'service',
+    test_upstream: 'test_upstream',
+    desc: 'desc',
+    ip: '127.0.0.1',
+    create_service_success: 'Create Service Successfully',
+    create_upstream_success: 'Create Upstream Successfully',
+    delete_service_success: 'Delete Service Successfully',
+    delete_upstream_success: 'Delete Upstream Successfully',
+  };
+
+  beforeEach(() => {
+    cy.login();
+  });
+
+  it('should create test upstream', () => {

Review comment:
       ```suggestion
     it('should create a test upstream', () => {
   ```

##########
File path: web/cypress/integration/service/edit-service-with-upstream.spec.js
##########
@@ -0,0 +1,104 @@
+/*
+ * 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('edit service with upstream', () => {

Review comment:
       `Edit Service with Upstream`

##########
File path: web/cypress/integration/service/edit-service-with-upstream.spec.js
##########
@@ -0,0 +1,104 @@
+/*
+ * 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('edit service with upstream', () => {
+  const domSelector = {
+    name: '#name',
+    desc: '#desc',
+    nodes_0_host: '#nodes_0_host',
+    notification: '.ant-notification-notice-message',
+    search_name: '[title=Name]',
+    custom_upstream: '[title=Custom]',
+    test_upstream: '[title=test_upstream]',
+    input: ':input',
+  };
+  const data = {
+    service_name: 'service',
+    test_upstream: 'test_upstream',
+    desc: 'desc',
+    ip: '127.0.0.1',
+    create_service_success: 'Create Service Successfully',
+    create_upstream_success: 'Create Upstream Successfully',
+    delete_service_success: 'Delete Service Successfully',
+    delete_upstream_success: 'Delete Upstream Successfully',
+  };
+
+  beforeEach(() => {
+    cy.login();
+  });
+
+  it('should create test upstream', () => {
+    cy.visit('/');
+    cy.contains('Upstream').click();
+    cy.contains('Create').click();
+
+    cy.get(domSelector.name).type(data.test_upstream);
+    cy.get(domSelector.nodes_0_host).type(data.ip);
+    cy.contains('Next').click();
+    cy.contains('Submit').click();
+    cy.get(domSelector.notification).should('contain', data.create_upstream_success);
+    cy.url().should('contains', 'upstream/list');
+  });
+
+  it('should create test service', () => {
+    cy.visit('/');
+    cy.contains('Service').click();
+    cy.contains('Create').click();
+    cy.get(domSelector.name).type(data.service_name);
+    cy.get(domSelector.desc).type(data.desc);
+    cy.get(domSelector.custom_upstream).click();

Review comment:
       `custom_upstream` -> `upstream_selector`?

##########
File path: web/cypress/integration/service/edit-service-with-upstream.spec.js
##########
@@ -0,0 +1,104 @@
+/*
+ * 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('edit service with upstream', () => {
+  const domSelector = {
+    name: '#name',
+    desc: '#desc',
+    nodes_0_host: '#nodes_0_host',
+    notification: '.ant-notification-notice-message',
+    search_name: '[title=Name]',
+    custom_upstream: '[title=Custom]',
+    test_upstream: '[title=test_upstream]',
+    input: ':input',
+  };
+  const data = {
+    service_name: 'service',
+    test_upstream: 'test_upstream',
+    desc: 'desc',
+    ip: '127.0.0.1',
+    create_service_success: 'Create Service Successfully',
+    create_upstream_success: 'Create Upstream Successfully',
+    delete_service_success: 'Delete Service Successfully',
+    delete_upstream_success: 'Delete Upstream Successfully',
+  };
+
+  beforeEach(() => {
+    cy.login();
+  });
+
+  it('should create test upstream', () => {
+    cy.visit('/');
+    cy.contains('Upstream').click();
+    cy.contains('Create').click();
+
+    cy.get(domSelector.name).type(data.test_upstream);
+    cy.get(domSelector.nodes_0_host).type(data.ip);
+    cy.contains('Next').click();
+    cy.contains('Submit').click();
+    cy.get(domSelector.notification).should('contain', data.create_upstream_success);
+    cy.url().should('contains', 'upstream/list');
+  });
+
+  it('should create test service', () => {
+    cy.visit('/');
+    cy.contains('Service').click();
+    cy.contains('Create').click();
+    cy.get(domSelector.name).type(data.service_name);
+    cy.get(domSelector.desc).type(data.desc);
+    cy.get(domSelector.custom_upstream).click();
+    cy.contains(data.test_upstream).click();
+    cy.get(domSelector.input).should('be.disabled');
+
+    cy.contains('Next').click();
+    cy.contains('Next').click();
+    cy.contains('Submit').click();
+    cy.get(domSelector.notification).should('contain', data.create_service_success);
+  });
+
+  it('should edit the service', () => {
+    cy.visit('/');
+    cy.contains('Service').click();
+
+    cy.get(domSelector.search_name).type(data.service_name);
+    cy.contains('Search').click();
+    cy.contains(data.service_name).siblings().contains('Edit').click();
+
+    cy.get(domSelector.nodes_0_host).click().should('value', data.ip);
+    cy.get(domSelector.input).should('be.disabled');
+
+    cy.get(domSelector.test_upstream).click();
+    cy.contains('Custom').click();
+    cy.get(domSelector.nodes_0_host).should('not.be.disabled');
+  });
+
+  it('should delete service and upstream', () => {

Review comment:
       both and

##########
File path: web/cypress/integration/service/edit-service-with-upstream.spec.js
##########
@@ -0,0 +1,104 @@
+/*
+ * 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('edit service with upstream', () => {
+  const domSelector = {
+    name: '#name',
+    desc: '#desc',
+    nodes_0_host: '#nodes_0_host',
+    notification: '.ant-notification-notice-message',
+    search_name: '[title=Name]',
+    custom_upstream: '[title=Custom]',
+    test_upstream: '[title=test_upstream]',
+    input: ':input',
+  };
+  const data = {
+    service_name: 'service',
+    test_upstream: 'test_upstream',
+    desc: 'desc',
+    ip: '127.0.0.1',
+    create_service_success: 'Create Service Successfully',
+    create_upstream_success: 'Create Upstream Successfully',
+    delete_service_success: 'Delete Service Successfully',
+    delete_upstream_success: 'Delete Upstream Successfully',
+  };
+
+  beforeEach(() => {
+    cy.login();
+  });
+
+  it('should create test upstream', () => {
+    cy.visit('/');
+    cy.contains('Upstream').click();
+    cy.contains('Create').click();
+
+    cy.get(domSelector.name).type(data.test_upstream);
+    cy.get(domSelector.nodes_0_host).type(data.ip);
+    cy.contains('Next').click();
+    cy.contains('Submit').click();
+    cy.get(domSelector.notification).should('contain', data.create_upstream_success);
+    cy.url().should('contains', 'upstream/list');
+  });
+
+  it('should create test service', () => {

Review comment:
       `a test xx`

##########
File path: web/cypress/integration/service/edit-service-with-upstream.spec.js
##########
@@ -0,0 +1,104 @@
+/*
+ * 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('edit service with upstream', () => {
+  const domSelector = {
+    name: '#name',
+    desc: '#desc',
+    nodes_0_host: '#nodes_0_host',
+    notification: '.ant-notification-notice-message',
+    search_name: '[title=Name]',
+    custom_upstream: '[title=Custom]',
+    test_upstream: '[title=test_upstream]',
+    input: ':input',
+  };
+  const data = {
+    service_name: 'service',
+    test_upstream: 'test_upstream',
+    desc: 'desc',
+    ip: '127.0.0.1',
+    create_service_success: 'Create Service Successfully',
+    create_upstream_success: 'Create Upstream Successfully',
+    delete_service_success: 'Delete Service Successfully',
+    delete_upstream_success: 'Delete Upstream Successfully',
+  };
+
+  beforeEach(() => {
+    cy.login();
+  });
+
+  it('should create test upstream', () => {
+    cy.visit('/');
+    cy.contains('Upstream').click();
+    cy.contains('Create').click();
+
+    cy.get(domSelector.name).type(data.test_upstream);
+    cy.get(domSelector.nodes_0_host).type(data.ip);
+    cy.contains('Next').click();
+    cy.contains('Submit').click();
+    cy.get(domSelector.notification).should('contain', data.create_upstream_success);
+    cy.url().should('contains', 'upstream/list');
+  });
+
+  it('should create test service', () => {
+    cy.visit('/');
+    cy.contains('Service').click();
+    cy.contains('Create').click();
+    cy.get(domSelector.name).type(data.service_name);
+    cy.get(domSelector.desc).type(data.desc);
+    cy.get(domSelector.custom_upstream).click();
+    cy.contains(data.test_upstream).click();
+    cy.get(domSelector.input).should('be.disabled');
+
+    cy.contains('Next').click();
+    cy.contains('Next').click();
+    cy.contains('Submit').click();
+    cy.get(domSelector.notification).should('contain', data.create_service_success);
+  });
+
+  it('should edit the service', () => {

Review comment:
       doesn't edit the service actually..




----------------------------------------------------------------
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:
users@infra.apache.org