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 2020/12/18 16:58:23 UTC

[GitHub] [apisix-dashboard] moonming commented on a change in pull request #1066: test: add frontend e2e test (create_and_delete_upstream)

moonming commented on a change in pull request #1066:
URL: https://github.com/apache/apisix-dashboard/pull/1066#discussion_r545961566



##########
File path: web/cypress/integration/upstream/create_and_delete_upstream.spec.js
##########
@@ -0,0 +1,101 @@
+/*
+ * 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('Create and Delete Upstream', () => {
+        const root_name = `root_${new Date().valueOf()}`;

Review comment:
       what is `root_name`?

##########
File path: web/cypress/integration/upstream/create_and_delete_upstream.spec.js
##########
@@ -0,0 +1,101 @@
+/*
+ * 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('Create and Delete Upstream', () => {
+        const root_name = `root_${new Date().valueOf()}`;
+      
+        beforeEach(() => {
+          // init login 
+          cy.login();
+        })
+      
+        it('create roundrobin upstream', () => {
+          //  go to upstream create page
+          cy.visit('/upstream/create');
+          cy.contains('Upstream').click();
+          cy.contains('Create').click();
+      
+          // input Name And Description
+          cy.get('#name').type('autotest_'+root_name);
+          cy.get('#desc').type('desc_by_autotest');
+      
+          // input information
+          cy.get('#nodes_0_host').type('127.0.0.1');
+          cy.get('#nodes_0_port').clear().type('7000');
+          cy.contains('Next').click();
+          cy.contains('Submit').click();
+          cy.get('.ant-notification-notice-message').should('contain', 'Create upstream successfully');
+          cy.contains('Create upstream successfully');
+          cy.wait(1000)
+          cy.url().should('contains', 'upstream/list');
+        });
+      
+        it('delete the upstream', () => {
+          cy.visit('/upstream/list');
+          cy.contains(root_name).siblings().contains('Delete').click();
+          cy.contains('button', 'Confirm').click();
+          cy.get('.ant-notification-notice-message').should('contain', 'Delete successfully');
+        });
+
+        it('create chash upstream', () => {
+          // go to upstream create page
+          cy.visit('/upstream/create');
+          cy.contains('Upstream').click();
+          cy.wait(500)
+          cy.contains('Create').click();
+
+          // input `Name And Description`
+          cy.get('#name').type('autotest_'+root_name);
+          cy.get('#desc').type('desc_by_autotest');
+      
+          // change upstream type to chash, todo: optimize the search method
+          cy.get('.ant-select-selection-item').click();
+          cy.wait(100)
+          cy.get('.ant-select-item:nth-child(2)').click();
+          cy.get('#hash_on').click();
+          cy.wait(100)
+          cy.get('.ant-select-item-option-active:nth-child(1) > .ant-select-item-option-content').click();
+          cy.get('#key').click();
+          cy.wait(100)
+          cy.get('div:nth-child(8) .ant-select-item:nth-child(1) > .ant-select-item-option-content:nth-child(1)').click();
+

Review comment:
       Can't understand

##########
File path: web/cypress/integration/upstream/create_and_delete_upstream.spec.js
##########
@@ -0,0 +1,101 @@
+/*
+ * 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('Create and Delete Upstream', () => {
+        const root_name = `root_${new Date().valueOf()}`;
+      
+        beforeEach(() => {
+          // init login 
+          cy.login();
+        })
+      
+        it('create roundrobin upstream', () => {
+          //  go to upstream create page
+          cy.visit('/upstream/create');

Review comment:
       No, we should click button to visit upstream page.




----------------------------------------------------------------
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