This is an automated email from the ASF dual-hosted git repository.

juzhiyuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git


The following commit(s) were added to refs/heads/master by this push:
     new f95e1df  test: skip upstream after service is seleted (#1361)
f95e1df is described below

commit f95e1df26aea6e6ece452606fee21c64ddfbb459
Author: guoqqqi <72343596+guoq...@users.noreply.github.com>
AuthorDate: Mon Jan 25 09:56:07 2021 +0800

    test: skip upstream after service is seleted (#1361)
---
 ...n-skip-upstream-when-select-service-id.spec.js} | 69 ++++++++++++----------
 1 file changed, 39 insertions(+), 30 deletions(-)

diff --git 
a/web/cypress/integration/route/create-route-can-skip-upstream.spec.js 
b/web/cypress/integration/route/can-skip-upstream-when-select-service-id.spec.js
similarity index 60%
rename from web/cypress/integration/route/create-route-can-skip-upstream.spec.js
rename to 
web/cypress/integration/route/can-skip-upstream-when-select-service-id.spec.js
index af78885..a467e11 100644
--- a/web/cypress/integration/route/create-route-can-skip-upstream.spec.js
+++ 
b/web/cypress/integration/route/can-skip-upstream-when-select-service-id.spec.js
@@ -18,19 +18,25 @@
 
 context('Can select service_id skip upstream in route', () => {
   const data = {
-    upstreamName: 'test_upstream',
-    serviceName: 'test_service',
-    routeName: 'test_route',
+    upstream_name: 'test_upstream',
+    service_name: 'test_service',
+    route_name: 'test_route',
     ip: '127.0.0.1',
+    creat_upstream_success: 'Create Upstream Successfully',
+    creat_service_success: 'Create Service Successfully',
+    delete_service_success: 'Delete Service Successfully',
+    delete_route_success: 'Delete Route Successfully',
+    submit_success: 'Submit Successfully',
+    delete_success: 'Delete Upstream Successfully',
   }
   const domSelector = {
     name: '#name',
     nodes_0_host: '#nodes_0_host',
     upstream_id: '#upstream_id',
     input: ':input',
-    customUpstream: '[title=Custom]',
-    titleName: '[title=Name]',
-    testService: '[title=test_service]',
+    custom_upstream: '[title=Custom]',
+    title_name: '[title=Name]',
+    test_service: '[title=test_service]',
     notification: '.ant-notification-notice-message',
   };
 
@@ -43,22 +49,24 @@ context('Can select service_id skip upstream in route', () 
=> {
     cy.contains('Upstream').click();
     cy.contains('Create').click();
 
-    cy.get(domSelector.name).type(data.upstreamName);
+    cy.get(domSelector.name).type(data.upstream_name);
     cy.get(domSelector.nodes_0_host).type(data.ip);
     cy.contains('Next').click();
     cy.contains('Submit').click();
-    cy.get(domSelector.notification).should('contain', 'Create Upstream 
Successfully');
+    cy.get(domSelector.notification).should('contain', 
data.creat_upstream_success);
+    cy.contains(data.creat_upstream_success);
 
     cy.visit('/');
     cy.contains('Service').click();
     cy.contains('Create').click();
-    cy.get(domSelector.name).type(data.serviceName);
-    cy.get(domSelector.customUpstream).click();
-    cy.contains(data.upstreamName).click();
+    cy.get(domSelector.name).type(data.service_name);
+    cy.get(domSelector.custom_upstream).click();
+    cy.contains(data.upstream_name).click();
     cy.contains('Next').click();
     cy.contains('Next').click();
     cy.contains('Submit').click();
-    cy.get(domSelector.notification).should('contain', 'Create Service 
Successfully');
+    cy.get(domSelector.notification).should('contain', 
data.creat_service_success);
+    cy.contains(data.creat_service_success);
   });
 
   it('should skip upstream module after service is selected when creating 
route', () => {
@@ -67,22 +75,22 @@ context('Can select service_id skip upstream in route', () 
=> {
     cy.contains('Create').click();
 
     // The None option doesn't exist when service isn't selected
-    cy.get(domSelector.name).type(data.routeName);
+    cy.get(domSelector.name).type(data.route_name);
     cy.contains('Next').click();
-    cy.get(domSelector.customUpstream).click();
+    cy.get(domSelector.custom_upstream).click();
     cy.contains('None').should('not.exist');
 
     cy.contains('Previous').click();
     cy.contains('None').click();
-    cy.contains(data.serviceName).click();
+    cy.contains(data.service_name).click();
     cy.contains('Next').click();
 
     // make sure upstream data can be saved
-    cy.get(domSelector.customUpstream).click();
-    cy.contains(data.upstreamName).click();
+    cy.get(domSelector.custom_upstream).click();
+    cy.contains(data.upstream_name).click();
     cy.get(domSelector.input).should('be.disabled');
 
-    cy.contains(data.upstreamName).click();
+    cy.contains(data.upstream_name).click();
     cy.contains('None').click();
     cy.contains('Next').click();
     cy.contains('Next').click();
@@ -90,43 +98,44 @@ context('Can select service_id skip upstream in route', () 
=> {
     cy.contains('Goto List').click();
   });
 
-  it('should skip Upstream module after service is selected when editing 
route', () => {
+  it('should skip upstream module after service is selected when editing 
route', () => {
     cy.visit('/');
     cy.contains('Route').click();
 
-    cy.get(domSelector.titleName).type(data.routeName);
+    cy.get(domSelector.title_name).type(data.route_name);
     cy.contains('Search').click();
-    cy.contains(data.routeName).siblings().contains('Edit').click();
-    cy.get(domSelector.testService).click();
+    cy.contains(data.route_name).siblings().contains('Edit').click();
+    cy.get(domSelector.test_service).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(data.upstream_name).click();
     cy.contains('Next').click();
     cy.contains('Next').click();
     cy.contains('Submit').click();
-    cy.contains('Submit Successfully');
+    cy.contains(data.submit_success);
   });
 
   it('should delete upstream, service and route', () => {
     cy.visit('/');
     cy.contains('Upstream').click();
-    cy.contains(data.upstreamName).siblings().contains('Delete').click();
+    cy.contains(data.upstream_name).siblings().contains('Delete').click();
     cy.contains('button', 'Confirm').click();
-    cy.get(domSelector.notification).should('contain', 'Delete Upstream 
Successfully');
+    cy.get(domSelector.notification).should('contain', data.delete_success);
 
     cy.visit('/');
     cy.contains('Service').click();
-    cy.contains(data.serviceName).siblings().contains('Delete').click();
+    cy.contains(data.service_name).siblings().contains('Delete').click();
     cy.contains('button', 'Confirm').click();
-    cy.get(domSelector.notification).should('contain', 'Delete Service 
Successfully');
+    cy.get(domSelector.notification).should('contain', 
data.delete_service_success);
 
     cy.visit('/');
     cy.contains('Route').click();
-    cy.contains(data.routeName).siblings().contains('Delete').click();
+    cy.contains(data.route_name).siblings().contains('Delete').click();
     cy.contains('button', 'Confirm').click();
-    cy.get(domSelector.notification).should('contain', 'Delete Route 
Successfully');
+    cy.get(domSelector.notification).should('contain', 
data.delete_route_success);
   });
 });
 
+

Reply via email to