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



##########
File path: web/cypress/integration/upstream/create_and_delete_upstream.spec.js
##########
@@ -0,0 +1,109 @@
+/*
+ * 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 name = `upstreamName${new Date().valueOf()}`;
+  const sleepTime = 100;
+  const domSelectors = {
+    notification: '.ant-notification-notice-message'
+  };
+
+  beforeEach(() => {
+    // init login 
+    cy.login();
+  })
+
+  it('create roundrobin upstream', () => {
+    //  go to upstream create page
+    cy.visit('/');
+    cy.contains('Upstream').click();
+    cy.wait(sleepTime*5);
+    cy.contains('Create').click();
+
+    // input Name And Description
+    cy.get('#name').type(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(domSelectors.notification).should('contain', 'Create upstream 
successfully');
+    cy.contains('Create upstream successfully');
+    cy.wait(sleepTime*5);
+    cy.url().should('contains', 'upstream/list');
+  });
+
+  it('delete the upstream', () => {
+    cy.visit('/');
+    cy.contains('Upstream').click();
+    cy.wait(sleepTime*5)
+    cy.contains(name).siblings().contains('Delete').click();
+    cy.contains('button', 'Confirm').click();
+    cy.get(domSelectors.notification).should('contain', 'Delete successfully');
+  });
+
+  it('create chash upstream', () => {
+    // go to upstream create page
+    cy.visit('/');
+    cy.contains('Upstream').click();
+    cy.wait(sleepTime*5);
+    cy.contains('Create').click();
+
+    // input `Name And Description`
+    cy.get('#name').type(name);
+    cy.get('#desc').type('desc_by_autotest');
+
+    // change upstream type to chash, todo: optimize the search method

Review comment:
       @LiteSun please confirm if we have a good way for those steps now. if 
not, we can create a todo issue and update it later in a new PR @idbeta 




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


Reply via email to