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 759c784  chore: added global test data file (#1444)
759c784 is described below

commit 759c78486d79392892e8ef037403f429a06888fe
Author: guoqqqi <[email protected]>
AuthorDate: Wed Feb 10 09:52:29 2021 +0800

    chore: added global test data file (#1444)
---
 web/cypress/fixtures/data.json                     | 31 +++++++++
 web/cypress/fixtures/selector.json                 |  5 +-
 .../consumer/create_and_delete_consumer.spec.js    | 26 ++++----
 .../plugin/create-edit-delete-plugin.spec.js       |  4 +-
 ...an-skip-upstream-when-select-service-id.spec.js | 58 +++++++----------
 .../route/create-edit-delete-route.spec.js         | 24 +++----
 .../route/create-route-with-upstream.spec.js       | 68 +++++++++----------
 web/cypress/integration/route/search-route.spec.js | 12 ++--
 .../service/create-edit-delete-service.spec.js     | 49 ++++++--------
 .../service/edit-service-with-upstream.spec.js     | 76 ++++++++--------------
 .../settings/settings-smoketest.spec.js            | 13 ++--
 web/cypress/integration/ssl/ssl-smoketest.spec.js  |  5 +-
 .../upstream/create_and_delete_upstream.spec.js    | 35 +++++-----
 web/src/pages/Setting/locales/en-US.ts             |  2 +-
 14 files changed, 191 insertions(+), 217 deletions(-)

diff --git a/web/cypress/fixtures/data.json b/web/cypress/fixtures/data.json
new file mode 100644
index 0000000..536a71b
--- /dev/null
+++ b/web/cypress/fixtures/data.json
@@ -0,0 +1,31 @@
+{
+  "deletePluginSuccess": "Delete Plugin Successfully",
+  "createUpstreamSuccess": "Create Upstream Successfully",
+  "createServiceSuccess": "Create Service Successfully",
+  "editServiceSuccess": "Edit Service Successfully",
+  "deleteServiceSuccess": "Delete Service Successfully",
+  "deleteRouteSuccess": "Delete Route Successfully",
+  "submitSuccess": "Submit Successfully",
+  "deleteUpstreamSuccess": "Delete Upstream Successfully",
+  "createConsumerSuccess": "Create Consumer Successfully",
+  "deleteConsumerSuccess": "Delete Consumer Successfully",
+  "upstreamName": "test_upstream",
+  "serviceName": "test_service",
+  "serviceName2": "test_service2",
+  "routeName": "test_route",
+  "consumerName": "test_consumer",
+  "ip1": "127.0.0.1",
+  "ip2": "127.0.0.2",
+  "host1": "11.11.11.11",
+  "host2": "12.12.12.12",
+  "host3": "10.10.10.10",
+  "description": "desc_by_autotest",
+  "description2": "description2",
+  "grafanaAddress": "Grafana Address",
+  "grafanaExplanation1": "Grafana address should begin with HTTP or HTTPS",
+  "grafanaExplanation2": "Address is invalid",
+  "updateSuccessfully": "Update Configuration Successfully",
+  "deleteSSLSuccess": "Remove target SSL successfully",
+  "sslErrorAlert": "key and cert don't match",
+  "pluginErrorAlert": "Invalid plugin data"
+}
diff --git a/web/cypress/fixtures/selector.json 
b/web/cypress/fixtures/selector.json
index c87af12..59ededb 100644
--- a/web/cypress/fixtures/selector.json
+++ b/web/cypress/fixtures/selector.json
@@ -1,4 +1,7 @@
 {
+  "codeMirror": ".CodeMirror",
+  "username": "#username",
+
   "languageSwitcher": ".ant-space-align-center",
   "dropdown": ".rc-virtual-list",
   "notification": ".ant-notification-notice-message",
@@ -18,6 +21,7 @@
 
   "name": "#name",
   "nodes_0_host": "#nodes_0_host",
+  "nodes_0_port": "#nodes_0_port",
   "upstream_id": "#upstream_id",
   "input": ":input",
   "nameSelector": "[title=Name]",
@@ -36,7 +40,6 @@
   "operator": "#operator",
   "value": "#value",
   
-
   "fileSelector": "[type=file]",
   "fileTypeRadio": "[type=radio]",
 
diff --git 
a/web/cypress/integration/consumer/create_and_delete_consumer.spec.js 
b/web/cypress/integration/consumer/create_and_delete_consumer.spec.js
index f15b7f1..5896edf 100644
--- a/web/cypress/integration/consumer/create_and_delete_consumer.spec.js
+++ b/web/cypress/integration/consumer/create_and_delete_consumer.spec.js
@@ -17,23 +17,21 @@
 /* eslint-disable no-undef */
 
 context('Create and Delete Consumer', () => {
-  const name = `consumerName${new Date().valueOf()}`;
-
   beforeEach(() => {
     cy.login();
 
     cy.fixture('selector.json').as('domSelector');
+    cy.fixture('data.json').as('data');
   });
 
   it('creates consumer with key-auth', function () {
-    // go to consumer create page
     cy.visit('/');
     cy.contains('Consumer').click();
     cy.contains('Create').click();
 
     // basic information
-    cy.get('#username').type(name);
-    cy.get('#desc').type('desc_by_autotest');
+    cy.get(this.domSelector.username).type(this.data.consumerName);
+    cy.get(this.domSelector.description).type(this.data.description);
     cy.contains('Next').click();
 
     // plugin config
@@ -41,9 +39,9 @@ context('Create and Delete Consumer', () => {
       cy.get('button').first().click();
     });
 
-    cy.get('#disable').click();
+    cy.get(this.domSelector.disabledSwitcher).click();
     // edit codemirror
-    cy.get('.CodeMirror')
+    cy.get(this.domSelector.codeMirror)
       .first()
       .then((editor) => {
         editor[0].CodeMirror.setValue(
@@ -55,15 +53,15 @@ context('Create and Delete Consumer', () => {
       });
     cy.contains('button', 'Next').click();
     cy.contains('button', 'Submit').click();
-    cy.get(this.domSelector.notification).should('contain', 'Create Consumer 
Successfully');
+    cy.get(this.domSelector.notification).should('contain', 
this.data.createConsumerSuccess);
   });
 
   it('delete the consumer', function () {
     cy.visit('/');
     cy.contains('Consumer').click();
-    cy.contains(name).siblings().contains('Delete').click();
+    cy.contains(this.data.consumerName).siblings().contains('Delete').click();
     cy.contains('button', 'Confirm').click();
-    cy.get(this.domSelector.notification).should('contain', 'Delete Consumer 
Successfully');
+    cy.get(this.domSelector.notification).should('contain', 
this.data.deleteConsumerSuccess);
   });
 
   it('creates consumer with wrong json', function () {
@@ -72,8 +70,8 @@ context('Create and Delete Consumer', () => {
     cy.contains('Consumer').click();
     cy.contains('Create').click();
     // basic information
-    cy.get('#username').type(name);
-    cy.get('#desc').type('desc_by_autotest');
+    cy.get(this.domSelector.username).type(this.data.consumerName);
+    cy.get(this.domSelector.description).type(this.data.description);
     cy.contains('Next').click();
 
     // plugin config
@@ -81,7 +79,7 @@ context('Create and Delete Consumer', () => {
       cy.get('button').first().click();
     });
     // edit codeMirror
-    cy.get('.CodeMirror')
+    cy.get(this.domSelector.codeMirror)
       .first()
       .then((editor) => {
         editor[0].CodeMirror.setValue(
@@ -91,6 +89,6 @@ context('Create and Delete Consumer', () => {
         );
         cy.contains('button', 'Submit').click();
       });
-    cy.get(this.domSelector.notification).should('contain', 'Invalid plugin 
data');
+    cy.get(this.domSelector.notification).should('contain', 
this.data.pluginErrorAlert);
   });
 });
diff --git a/web/cypress/integration/plugin/create-edit-delete-plugin.spec.js 
b/web/cypress/integration/plugin/create-edit-delete-plugin.spec.js
index b718193..d4348fd 100644
--- a/web/cypress/integration/plugin/create-edit-delete-plugin.spec.js
+++ b/web/cypress/integration/plugin/create-edit-delete-plugin.spec.js
@@ -20,7 +20,6 @@ context('Create and Delete Plugin List', () => {
   const timeout = 5000;
   const data = {
     name: 'hmac-auth',
-    deleteSuccess: 'Delete Plugin Successfully',
   };
 
   beforeEach(() => {
@@ -28,6 +27,7 @@ context('Create and Delete Plugin List', () => {
 
     cy.fixture('plugin-list.json').as('cases');
     cy.fixture('selector.json').as('domSelector');
+    cy.fixture('data.json').as('data');
   });
 
   it('should create plugins', function () {
@@ -62,7 +62,7 @@ context('Create and Delete Plugin List', () => {
     cy.get(this.domSelector.deleteButton, { timeout }).each(function ($el) {
       cy.wrap($el).click().click({ timeout });
       cy.contains('button', 'Confirm').click({ force: true });
-      cy.get(this.domSelector.notification).should('contain', 
data.deleteSuccess);
+      cy.get(this.domSelector.notification).should('contain', 
this.data.deletePluginSuccess);
       cy.get(this.domSelector.notificationCloseIcon).click();
     });
 
diff --git 
a/web/cypress/integration/route/can-skip-upstream-when-select-service-id.spec.js
 
b/web/cypress/integration/route/can-skip-upstream-when-select-service-id.spec.js
index 5721a80..597914c 100644
--- 
a/web/cypress/integration/route/can-skip-upstream-when-select-service-id.spec.js
+++ 
b/web/cypress/integration/route/can-skip-upstream-when-select-service-id.spec.js
@@ -17,23 +17,11 @@
 /* eslint-disable no-undef */
 
 context('Can select service_id skip upstream in route', () => {
-  const data = {
-    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',
-  }
-
   beforeEach(() => {
     cy.login();
 
     cy.fixture('selector.json').as('domSelector');
+    cy.fixture('data.json').as('data');
   });
 
   it('should create test upstream and service', function () {
@@ -41,24 +29,24 @@ context('Can select service_id skip upstream in route', () 
=> {
     cy.contains('Upstream').click();
     cy.contains('Create').click();
 
-    cy.get(this.domSelector.name).type(data.upstream_name);
-    cy.get(this.domSelector.nodes_0_host).type(data.ip);
+    cy.get(this.domSelector.name).type(this.data.upstreamName);
+    cy.get(this.domSelector.nodes_0_host).type(this.data.ip1);
     cy.contains('Next').click();
     cy.contains('Submit').click();
-    cy.get(this.domSelector.notification).should('contain', 
data.creat_upstream_success);
-    cy.contains(data.creat_upstream_success);
+    cy.get(this.domSelector.notification).should('contain', 
this.data.createUpstreamSuccess);
+    cy.contains(this.data.createUpstreamSuccess);
 
     cy.visit('/');
     cy.contains('Service').click();
     cy.contains('Create').click();
-    cy.get(this.domSelector.name).type(data.service_name);
+    cy.get(this.domSelector.name).type(this.data.serviceName);
     cy.get(this.domSelector.upstreamSelector).click();
-    cy.contains(data.upstream_name).click();
+    cy.contains(this.data.upstreamName).click();
     cy.contains('Next').click();
     cy.contains('Next').click();
     cy.contains('Submit').click();
-    cy.get(this.domSelector.notification).should('contain', 
data.creat_service_success);
-    cy.contains(data.creat_service_success);
+    cy.get(this.domSelector.notification).should('contain', 
this.data.createServiceSuccess);
+    cy.contains(this.data.createServiceSuccess);
   });
 
   it('should skip upstream module after service is selected when creating 
route', function () {
@@ -67,22 +55,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(this.domSelector.name).type(data.route_name);
+    cy.get(this.domSelector.name).type(this.data.routeName);
     cy.contains('Next').click();
     cy.get(this.domSelector.upstreamSelector).click();
     cy.contains('None').should('not.exist');
 
     cy.contains('Previous').click();
     cy.contains('None').click();
-    cy.contains(data.service_name).click();
+    cy.contains(this.data.serviceName).click();
     cy.contains('Next').click();
 
     // make sure upstream data can be saved
     cy.get(this.domSelector.upstreamSelector).click();
-    cy.contains(data.upstream_name).click();
+    cy.contains(this.data.upstreamName).click();
     cy.get(this.domSelector.input).should('be.disabled');
 
-    cy.contains(data.upstream_name).click();
+    cy.contains(this.data.upstreamName).click();
     cy.contains('None').click();
     cy.contains('Next').click();
     cy.contains('Next').click();
@@ -94,38 +82,38 @@ context('Can select service_id skip upstream in route', () 
=> {
     cy.visit('/');
     cy.contains('Route').click();
 
-    cy.get(this.domSelector.nameSelector).type(data.route_name);
+    cy.get(this.domSelector.nameSelector).type(this.data.routeName);
     cy.contains('Search').click();
-    cy.contains(data.route_name).siblings().contains('Edit').click();
+    cy.contains(this.data.routeName).siblings().contains('Edit').click();
     cy.get(this.domSelector.serviceSelector).click();
     cy.contains('None').click();
     cy.contains('Next').click();
     cy.get(this.domSelector.upstream_id).click();
     cy.contains('None').should('not.exist');
-    cy.contains(data.upstream_name).click();
+    cy.contains(this.data.upstreamName).click();
     cy.contains('Next').click();
     cy.contains('Next').click();
     cy.contains('Submit').click();
-    cy.contains(data.submit_success);
+    cy.contains(this.data.submitSuccess);
   });
 
   it('should delete upstream, service and route', function () {
     cy.visit('/');
     cy.contains('Upstream').click();
-    cy.contains(data.upstream_name).siblings().contains('Delete').click();
+    cy.contains(this.data.upstreamName).siblings().contains('Delete').click();
     cy.contains('button', 'Confirm').click();
-    cy.get(this.domSelector.notification).should('contain', 
data.delete_success);
+    cy.get(this.domSelector.notification).should('contain', 
this.data.deleteUpstreamSuccess);
 
     cy.visit('/');
     cy.contains('Service').click();
-    cy.contains(data.service_name).siblings().contains('Delete').click();
+    cy.contains(this.data.serviceName).siblings().contains('Delete').click();
     cy.contains('button', 'Confirm').click();
-    cy.get(this.domSelector.notification).should('contain', 
data.delete_service_success);
+    cy.get(this.domSelector.notification).should('contain', 
this.data.deleteServiceSuccess);
 
     cy.visit('/');
     cy.contains('Route').click();
-    cy.contains(data.route_name).siblings().contains('Delete').click();
+    cy.contains(this.data.routeName).siblings().contains('Delete').click();
     cy.contains('button', 'Confirm').click();
-    cy.get(this.domSelector.notification).should('contain', 
data.delete_route_success);
+    cy.get(this.domSelector.notification).should('contain', 
this.data.deleteRouteSuccess);
   });
 });
diff --git a/web/cypress/integration/route/create-edit-delete-route.spec.js 
b/web/cypress/integration/route/create-edit-delete-route.spec.js
index 99ec734..a0f3119 100644
--- a/web/cypress/integration/route/create-edit-delete-route.spec.js
+++ b/web/cypress/integration/route/create-edit-delete-route.spec.js
@@ -25,6 +25,7 @@ context('Create and Delete Route', () => {
     cy.login();
 
     cy.fixture('selector.json').as('domSelector');
+    cy.fixture('data.json').as('data');
   });
 
   it('should create route', function () {
@@ -32,15 +33,15 @@ context('Create and Delete Route', () => {
     cy.contains('Route').click();
     cy.contains('Create').click();
     cy.get(this.domSelector.name).type(name);
-    cy.get(this.domSelector.description).type('desc');
+    cy.get(this.domSelector.description).type(this.data.description);
 
     // input request basic define
-    cy.get(this.domSelector.hosts_0).type('11.11.11.11');
+    cy.get(this.domSelector.hosts_0).type(this.data.host1);
     cy.get(this.domSelector.addHost).click();
-    cy.get(this.domSelector.hosts_1).type('12.12.12.12');
-    cy.get(this.domSelector.remoteHost).type('12.12.12.12');
+    cy.get(this.domSelector.hosts_1).type(this.data.host2);
+    cy.get(this.domSelector.remoteHost).type(this.data.host2);
     cy.get(this.domSelector.remoteAddress).click();
-    cy.get(this.domSelector.address1).type('10.10.10.10');
+    cy.get(this.domSelector.address1).type(this.data.host3);
     cy.contains('Advanced Routing Matching Conditions')
       .parent()
       .siblings()
@@ -58,9 +59,8 @@ context('Create and Delete Route', () => {
     cy.get(this.domSelector.value).type('value');
     cy.contains('Confirm').click();
 
-
     cy.contains('Next').click();
-    cy.get(this.domSelector.nodes_0_host).type('12.12.12.12');
+    cy.get(this.domSelector.nodes_0_host).type(this.data.host2);
     cy.contains('Next').click();
 
     // redirect plugin should not display in route step3
@@ -78,7 +78,7 @@ context('Create and Delete Route', () => {
     cy.contains('button', 'Cancel').click();
     cy.contains('Next').click();
     cy.contains('Submit').click();
-    cy.contains('Submit Successfully');
+    cy.contains(this.data.submitSuccess);
 
     // back to route list page
     cy.contains('Goto List').click();
@@ -94,15 +94,15 @@ context('Create and Delete Route', () => {
     cy.contains(name).siblings().contains('Edit').click();
 
     cy.get(this.domSelector.name).clear().type(newName);
-    cy.get(this.domSelector.description).clear().type('new desc');
+    cy.get(this.domSelector.description).clear().type(this.data.description2);
     cy.contains('Next').click();
     cy.contains('Next').click();
     cy.contains('Next').click();
     cy.contains('Submit').click();
-    cy.contains('Submit Successfully');
+    cy.contains(this.data.submitSuccess);
     cy.contains('Goto List').click();
     cy.url().should('contains', 'routes/list');
-    cy.contains(newName).siblings().should('contain', 'new desc');
+    cy.contains(newName).siblings().should('contain', this.data.description2);
   });
 
   it('should delete the route', function () {
@@ -111,6 +111,6 @@ context('Create and Delete Route', () => {
     cy.contains('Search').click();
     cy.contains(newName).siblings().contains('Delete').click();
     cy.contains('button', 'Confirm').click();
-    cy.get(this.domSelector.notification).should('contain', 'Delete Route 
Successfully');
+    cy.get(this.domSelector.notification).should('contain', 
this.data.deleteRouteSuccess);
   });
 });
diff --git a/web/cypress/integration/route/create-route-with-upstream.spec.js 
b/web/cypress/integration/route/create-route-with-upstream.spec.js
index dbe9348..24d4699 100644
--- a/web/cypress/integration/route/create-route-with-upstream.spec.js
+++ b/web/cypress/integration/route/create-route-with-upstream.spec.js
@@ -17,22 +17,11 @@
 /* eslint-disable no-undef */
 
 context('Create Route with Upstream', () => {
-  const data = {
-    upstream_name: 'test_upstream',
-    route_name: 'test_route',
-    description: 'desc_by_autotes',
-    host: '10.89.90.237',
-    ip1: '127.0.0.1',
-    ip2: '127.0.0.2',
-    delete_route_success: 'Delete Route Successfully',
-    delete_upstream_success: 'Delete Upstream Successfully',
-    submitSuccess: 'Submit Successfully',
-  };
-
   beforeEach(() => {
     cy.login();
 
     cy.fixture('selector.json').as('domSelector');
+    cy.fixture('data.json').as('data');
   });
 
   it('should create an upstream', function () {
@@ -40,9 +29,9 @@ context('Create Route with Upstream', () => {
     cy.contains('Upstream').click();
     cy.contains('Create').click();
 
-    cy.get(this.domSelector.name).type(data.upstream_name);
-    cy.get(this.domSelector.description).type(data.description);
-    cy.get(this.domSelector.nodes_0_host).type(data.host);
+    cy.get(this.domSelector.name).type(this.data.upstreamName);
+    cy.get(this.domSelector.description).type(this.data.description);
+    cy.get(this.domSelector.nodes_0_host).type(this.data.host1);
     cy.contains('Next').click();
     cy.contains('Submit').click();
   });
@@ -52,22 +41,22 @@ context('Create Route with Upstream', () => {
     cy.contains('Route').click();
     cy.contains('Create').click();
 
-    cy.get(this.domSelector.name).type(data.route_name);
+    cy.get(this.domSelector.name).type(this.data.routeName);
     cy.contains('Next').click();
     // should disable Upstream input boxes after selecting an existing upstream
     cy.get(this.domSelector.upstreamSelector).click();
-    cy.contains(data.upstream_name).click();
+    cy.contains(this.data.upstreamName).click();
     cy.get(this.domSelector.input).should('be.disabled');
     // should enable Upstream input boxes after selecting Custom mode
     cy.get(this.domSelector.upstreamSelector).click();
     cy.contains('Custom').click();
     cy.get(this.domSelector.input).should('not.be.disabled');
-    
-    cy.get(this.domSelector.nodes_0_host).clear().type(data.ip1);
+
+    cy.get(this.domSelector.nodes_0_host).clear().type(this.data.ip1);
     cy.contains('Next').click();
     cy.contains('Next').click();
     cy.contains('Submit').click();
-    cy.contains(data.submitSuccess).should('be.visible');
+    cy.contains(this.data.submitSuccess).should('be.visible');
     cy.contains('Goto List').click();
     cy.url().should('contains', 'routes/list');
   });
@@ -75,58 +64,59 @@ context('Create Route with Upstream', () => {
   it('should edit this route with upstream', function () {
     cy.visit('/');
     cy.contains('Route').click();
+    cy.get(this.domSelector.nameSelector).type(this.data.routeName);
 
-    cy.get(this.domSelector.nameSelector).type(data.route_name);
     cy.contains('Search').click();
-    cy.contains(data.route_name).siblings().contains('Edit').click();
+    cy.contains(this.data.routeName).siblings().contains('Edit').click();
 
-    cy.get(this.domSelector.name).should('value', data.route_name);
+    cy.get(this.domSelector.name).should('value', this.data.routeName);
     cy.contains('Next').click({ force: true });
 
     // check if the changes have been saved
-    cy.get(this.domSelector.nodes_0_host).should('value', data.ip1);
+    cy.get(this.domSelector.nodes_0_host).should('value', this.data.ip1);
 
     cy.get(this.domSelector.upstreamSelector).click();
-    cy.contains(data.upstream_name).click();
+    cy.contains(this.data.upstreamName).click();
     cy.get(this.domSelector.input).should('be.disabled');
 
-    cy.contains(data.upstream_name).click();
+    cy.contains(this.data.upstreamName).click();
     cy.contains('Custom').click();
     cy.get(this.domSelector.input).should('not.be.disabled');
 
-    cy.get(this.domSelector.nodes_0_host).clear().type(data.ip2);
+    cy.get(this.domSelector.nodes_0_host).clear().type(this.data.ip2);
     cy.contains('Next').click();
     cy.contains('Next').click();
     cy.contains('Submit').click();
-    cy.contains(data.submitSuccess).should('be.visible');
+    cy.contains(this.data.submitSuccess).should('be.visible');
     cy.contains('Goto List').click();
     cy.url().should('contains', 'routes/list');
 
     // check if the changes have been saved
-    cy.get(this.domSelector.nameSelector).type(data.route_name);
+    cy.get(this.domSelector.nameSelector).type(this.data.routeName);
     cy.contains('Search').click();
-    cy.contains(data.route_name).siblings().contains('Edit').click();
-    // ensure it has already change to edit page
-    cy.get(this.domSelector.name).should('value', data.route_name);
-    cy.contains('Next').click({force: true});
-    cy.get(this.domSelector.nodes_0_host).should('value', data.ip2);
+
+    cy.contains(this.data.routeName).siblings().contains('Edit').click();
+    // ensure it has already changed to edit page
+    cy.get(this.domSelector.name).should('value', this.data.routeName);
+    cy.contains('Next').click({ force: true });
+    cy.get(this.domSelector.nodes_0_host).should('value', this.data.ip2);
   });
 
   it('should delete this test route and upstream', function () {
     cy.visit('/routes/list');
-    cy.get(this.domSelector.nameSelector).type(data.route_name);
+    cy.get(this.domSelector.nameSelector).type(this.data.routeName);
     cy.contains('Search').click();
-    cy.contains(data.route_name).siblings().contains('Delete').click();
+    cy.contains(this.data.routeName).siblings().contains('Delete').click();
     cy.contains('button', 'Confirm').click();
-    cy.get(this.domSelector.notification).should('contain', 
data.delete_route_success);
+    cy.get(this.domSelector.notification).should('contain', 
this.data.deleteRouteSuccess);
 
     cy.visit('/');
     cy.contains('Upstream').click();
-    cy.contains(data.upstream_name).siblings().contains('Delete').click();
+    cy.contains(this.data.upstreamName).siblings().contains('Delete').click();
     cy.contains('button', 'Confirm').click();
     cy.get(this.domSelector.notification).should(
       'contain',
-      data.delete_upstream_success,
+      this.data.deleteUpstreamSuccess,
     );
   });
 });
diff --git a/web/cypress/integration/route/search-route.spec.js 
b/web/cypress/integration/route/search-route.spec.js
index 4b4f89b..d6ffa17 100644
--- a/web/cypress/integration/route/search-route.spec.js
+++ b/web/cypress/integration/route/search-route.spec.js
@@ -19,8 +19,6 @@
 context('Create and Search Route', () => {
   const timeout = 500;
   const data = {
-    host1: '11.11.11.11',
-    host2: '12.12.12.12',
     test: 'test',
     test0: 'test0',
     test1: 'test1',
@@ -31,13 +29,13 @@ context('Create and Search Route', () => {
     desc2: 'desc2',
     value0: 'value0',
     label0_value0: 'label0:value0',
-    deleteRouteSuccess: 'Delete Route Successfully',
   };
 
   beforeEach(() => {
     cy.login();
 
     cy.fixture('selector.json').as('domSelector');
+    cy.fixture('data.json').as('data');
   });
 
   it('should create route test1, test2, test3', function () {
@@ -47,7 +45,7 @@ context('Create and Search Route', () => {
       cy.contains('Create').click();
       cy.get(this.domSelector.name).type(`test${i}`);
       cy.get(this.domSelector.description).type(`desc${i}`);
-      cy.get(this.domSelector.hosts_0).type(data.host1);
+      cy.get(this.domSelector.hosts_0).type(this.data.host1);
 
       // config label
       cy.contains('Manage').click();
@@ -61,13 +59,13 @@ context('Create and Search Route', () => {
       });
 
       cy.contains('Next').click();
-      cy.get(this.domSelector.nodes_0_host).type(data.host2, {
+      cy.get(this.domSelector.nodes_0_host).type(this.data.host2, {
         timeout,
       });
       cy.contains('Next').click();
       cy.contains('Next').click();
       cy.contains('Submit').click();
-      cy.contains('Submit Successfully');
+      cy.contains(this.data.submitSuccess);
       cy.contains('Goto List').click();
       cy.url().should('contains', 'routes/list');
     }
@@ -120,7 +118,7 @@ context('Create and Search Route', () => {
     for (let i = 0; i < 3; i += 1) {
       cy.contains(`test${i}`).siblings().contains('Delete').click({ timeout });
       cy.contains('button', 'Confirm').click({ timeout });
-      cy.get(this.domSelector.notification).should('contain', 
data.deleteRouteSuccess);
+      cy.get(this.domSelector.notification).should('contain', 
this.data.deleteRouteSuccess);
     }
   });
 });
diff --git a/web/cypress/integration/service/create-edit-delete-service.spec.js 
b/web/cypress/integration/service/create-edit-delete-service.spec.js
index 2c66306..b112e52 100644
--- a/web/cypress/integration/service/create-edit-delete-service.spec.js
+++ b/web/cypress/integration/service/create-edit-delete-service.spec.js
@@ -17,22 +17,11 @@
 /* eslint-disable no-undef */
 
 context('create and delete service ', () => {
-  const data = {
-    service_name1: 'service',
-    service_name2: 'new service',
-    desc1: 'desc',
-    desc2: 'new desc',
-    ip1: '12.12.12.12',
-    ip2: '12.12.12.10',
-    create_service_success: 'Create Service Successfully',
-    edit_service_success: 'Edit Service Successfully',
-    delete_service_success: 'Delete Service Successfully',
-  };
-
   beforeEach(() => {
     cy.login();
 
     cy.fixture('selector.json').as('domSelector');
+    cy.fixture('data.json').as('data');
   });
 
   it('should create service', function () {
@@ -40,50 +29,50 @@ context('create and delete service ', () => {
     cy.contains('Service').click();
     cy.contains('Create').click();
 
-    cy.get(this.domSelector.name).type(data.service_name1);
-    cy.get(this.domSelector.description).type(data.desc1);
+    cy.get(this.domSelector.name).type(this.data.serviceName);
+    cy.get(this.domSelector.description).type(this.data.description);
     cy.get(this.domSelector.nodes_0_host).click();
-    cy.get(this.domSelector.nodes_0_host).type(data.ip1);
+    cy.get(this.domSelector.nodes_0_host).type(this.data.ip1);
 
     cy.contains('Next').click();
     cy.contains('Next').click();
     cy.contains('Submit').click();
-    cy.get(this.domSelector.notification).should('contain', 
data.create_service_success);
+    cy.get(this.domSelector.notification).should('contain', 
this.data.createServiceSuccess);
   });
 
   it('should edit the service', function () {
     cy.visit('/');
     cy.contains('Service').click();
 
-    cy.get(this.domSelector.nameSelector).type(data.service_name1);
+    cy.get(this.domSelector.nameSelector).type(this.data.serviceName);
     cy.contains('Search').click();
-    cy.contains(data.service_name1).siblings().contains('Edit').click();
+    cy.contains(this.data.serviceName).siblings().contains('Edit').click();
 
     // Confirm whether the created data is saved.
-    cy.get(this.domSelector.nodes_0_host).should('value', data.ip1);
-    cy.get(this.domSelector.description).should('value', data.desc1)
-    cy.get(this.domSelector.name).clear().type(data.service_name2);
-    cy.get(this.domSelector.description).clear().type(data.desc2);
+    cy.get(this.domSelector.nodes_0_host).should('value', this.data.ip1);
+    cy.get(this.domSelector.description).should('value', this.data.description)
+    cy.get(this.domSelector.name).clear().type(this.data.serviceName2);
+    cy.get(this.domSelector.description).clear().type(this.data.description2);
     cy.get(this.domSelector.nodes_0_host).click();
-    cy.get(this.domSelector.nodes_0_host).clear().type(data.ip2);
+    cy.get(this.domSelector.nodes_0_host).clear().type(this.data.ip2);
     cy.contains('Next').click();
     cy.contains('Next').click();
     cy.contains('Submit').click();
-    cy.get(this.domSelector.notification).should('contain', 
data.edit_service_success);
+    cy.get(this.domSelector.notification).should('contain', 
this.data.editServiceSuccess);
   });
 
   it('should delete the service', function () {
     // Confirm whether the edited data is saved.
-    cy.get(this.domSelector.nameSelector).type(data.service_name2);
+    cy.get(this.domSelector.nameSelector).type(this.data.serviceName2);
     cy.contains('Search').click();
-    cy.contains(data.service_name2).siblings().contains('Edit').click();
-    cy.get(this.domSelector.nodes_0_host).should('value', data.ip2);
-    cy.get(this.domSelector.description).should('value', data.desc2);
+    cy.contains(this.data.serviceName2).siblings().contains('Edit').click();
+    cy.get(this.domSelector.nodes_0_host).should('value', this.data.ip2);
+    cy.get(this.domSelector.description).should('value', 
this.data.description2);
 
     cy.visit('/');
     cy.contains('Service').click();
-    cy.contains(data.service_name2).siblings().contains('Delete').click();
+    cy.contains(this.data.serviceName2).siblings().contains('Delete').click();
     cy.contains('button', 'Confirm').click();
-    cy.get(this.domSelector.notification).should('contain', 
data.delete_service_success);
+    cy.get(this.domSelector.notification).should('contain', 
this.data.deleteServiceSuccess);
   });
 });
diff --git a/web/cypress/integration/service/edit-service-with-upstream.spec.js 
b/web/cypress/integration/service/edit-service-with-upstream.spec.js
index 5c56777..b4f773f 100644
--- a/web/cypress/integration/service/edit-service-with-upstream.spec.js
+++ b/web/cypress/integration/service/edit-service-with-upstream.spec.js
@@ -17,94 +17,74 @@
 /* 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]',
-    upstream_selector: '[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',
-    ip2: '127.0.0.2',
-    create_service_success: 'Create Service Successfully',
-    create_upstream_success: 'Create Upstream Successfully',
-    edit_service_success: 'Edit Service Successfully',
-    delete_service_success: 'Delete Service Successfully',
-    delete_upstream_success: 'Delete Upstream Successfully',
-  };
-
   beforeEach(() => {
     cy.login();
+
+    cy.fixture('selector.json').as('domSelector');
+    cy.fixture('data.json').as('data');
   });
 
-  it('should create a test upstream', () => {
+  it('should create a test upstream', function () {
     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.get(this.domSelector.name).type(this.data.upstreamName);
+    cy.get(this.domSelector.nodes_0_host).type(this.data.ip1);
     cy.contains('Next').click();
     cy.contains('Submit').click();
-    cy.get(domSelector.notification).should('contain', 
data.create_upstream_success);
+    cy.get(this.domSelector.notification).should('contain', 
this.data.createUpstreamSuccess);
     cy.url().should('contains', 'upstream/list');
   });
 
-  it('should create a test service', () => {
+  it('should create a test service', function () {
     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.upstream_selector).click();
-    cy.contains(data.test_upstream).click();
-    cy.get(domSelector.input).should('be.disabled');
+    cy.get(this.domSelector.name).type(this.data.serviceName);
+    cy.get(this.domSelector.description).type(this.data.description);
+    cy.get(this.domSelector.upstreamSelector).click();
+    cy.contains(this.data.upstreamName).click();
+    cy.get(this.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);
+    cy.get(this.domSelector.notification).should('contain', 
this.data.createServiceSuccess);
   });
 
-  it('should edit the service', () => {
+  it('should edit the service', function () {
     cy.visit('/');
     cy.contains('Service').click();
 
-    cy.get(domSelector.search_name).type(data.service_name);
+    cy.get(this.domSelector.nameSearch).type(this.data.serviceName);
     cy.contains('Search').click();
-    cy.contains(data.service_name).siblings().contains('Edit').click();
+    cy.contains(this.data.serviceName).siblings().contains('Edit').click();
 
-    cy.get(domSelector.nodes_0_host).click({ force: true }).should('value', 
data.ip);
-    cy.get(domSelector.input).should('be.disabled');
+    cy.get(this.domSelector.nodes_0_host).click({ force: true 
}).should('value', this.data.ip1);
+    cy.get(this.domSelector.input).should('be.disabled');
 
-    cy.get(domSelector.test_upstream).click();
+    cy.get(this.domSelector.upstreamSelector).click();
     cy.contains('Custom').click();
-    
cy.get(domSelector.nodes_0_host).should('not.be.disabled').clear().type(data.ip2);
+    
cy.get(this.domSelector.nodes_0_host).should('not.be.disabled').clear().type(this.data.ip2);
     cy.contains('Next').click();
     cy.contains('Next').click();
     cy.contains('Submit').click();
-    cy.get(domSelector.notification).should('contain', 
data.edit_service_success);
+    cy.get(this.domSelector.notification).should('contain', 
this.data.editServiceSuccess);
   });
 
-  it('should delete this service and upstream', () => {
+  it('should delete this service and upstream', function () {
     cy.visit('/service/list');
-    cy.get(domSelector.search_name).type(data.service_name);
+    cy.get(this.domSelector.nameSearch).type(this.data.serviceName);
     cy.contains('Search').click();
-    cy.contains(data.service_name).siblings().contains('Delete').click();
+    cy.contains(this.data.serviceName).siblings().contains('Delete').click();
     cy.contains('button', 'Confirm').click();
-    cy.get(domSelector.notification).should('contain', 
data.delete_service_success);
+    cy.get(this.domSelector.notification).should('contain', 
this.data.deleteServiceSuccess);
 
     cy.visit('/');
     cy.contains('Upstream').click();
-    cy.contains(data.test_upstream).siblings().contains('Delete').click();
+    cy.contains(this.data.upstreamName).siblings().contains('Delete').click();
     cy.contains('button', 'Confirm').click();
-    cy.get(domSelector.notification).should('contain', 
data.delete_upstream_success);
+    cy.get(this.domSelector.notification).should('contain', 
this.data.deleteUpstreamSuccess);
   });
 });
diff --git a/web/cypress/integration/settings/settings-smoketest.spec.js 
b/web/cypress/integration/settings/settings-smoketest.spec.js
index 0eff48a..64804d8 100644
--- a/web/cypress/integration/settings/settings-smoketest.spec.js
+++ b/web/cypress/integration/settings/settings-smoketest.spec.js
@@ -18,10 +18,6 @@
 
 context('settings page smoke test', () => {
   const data = {
-    grafanaAddress: 'Grafana Address',
-    grafanaExplanation1: 'Grafana address should begin with HTTP or HTTPS',
-    grafanaExplanation2: 'Address is illegality',
-    updateSuccessfully: 'Update Configuration Successfully',
     invalidURL: 'httx://www.test.com',
     validURL: 'http://localhost:8000/routes/list',
     fetchURL: 'fetchURL',
@@ -32,6 +28,7 @@ context('settings page smoke test', () => {
     cy.login();
 
     cy.fixture('selector.json').as('domSelector');
+    cy.fixture('data.json').as('data');
   });
 
   it('should visit settings page', function () {
@@ -42,8 +39,8 @@ context('settings page smoke test', () => {
     cy.get(this.domSelector.pageContainer)
       .children()
       .should('contain', 'Setting')
-      .and('contain', data.grafanaAddress)
-      .and('contain', data.grafanaExplanation1);
+      .and('contain', this.data.grafanaAddress)
+      .and('contain', this.data.grafanaExplanation1);
   });
 
   it('should set a invalid url', function () {
@@ -52,7 +49,7 @@ context('settings page smoke test', () => {
     cy.contains('Settings').click();
     cy.url().should('contains', '/settings');
     cy.get(this.domSelector.grafanaURL).clear().type(data.invalidURL);
-    cy.get(this.domSelector.explain).should('contain', 
data.grafanaExplanation2);
+    cy.get(this.domSelector.explain).should('contain', 
this.data.grafanaExplanation2);
   });
 
   it('should set a accessible URL', function () {
@@ -63,7 +60,7 @@ context('settings page smoke test', () => {
     cy.get(this.domSelector.grafanaURL).clear().type(data.validURL);
     cy.contains('Submit').click();
 
-    cy.get(this.domSelector.notificationMessage).should('contain', 
data.updateSuccessfully);
+    cy.get(this.domSelector.notificationMessage).should('contain', 
this.data.updateSuccessfully);
     cy.intercept(data.validURL).as(data.fetchURL);
     cy.wait(data.fetch);
     cy.get(this.domSelector.pageContainer).children().should('contain', 
'Metrics');
diff --git a/web/cypress/integration/ssl/ssl-smoketest.spec.js 
b/web/cypress/integration/ssl/ssl-smoketest.spec.js
index 185679e..1e35a80 100644
--- a/web/cypress/integration/ssl/ssl-smoketest.spec.js
+++ b/web/cypress/integration/ssl/ssl-smoketest.spec.js
@@ -22,6 +22,7 @@ context('ssl smoke test', () => {
 
     cy.fixture('certificate.json').as('certificate');
     cy.fixture('selector.json').as('domSelector');
+    cy.fixture('data.json').as('data');
   });
 
   it('should set match certificate and key by input', function () {
@@ -47,7 +48,7 @@ context('ssl smoke test', () => {
     const sni = this.certificate.valid.sni;
     cy.contains(sni).parents().contains('Delete').click();
     cy.contains('button', 'Confirm').click();
-    cy.get(this.domSelector.notificationMessage).should('contain', 'Remove 
target SSL successfully');
+    cy.get(this.domSelector.notificationMessage).should('contain', 
this.data.deleteSSLSuccess);
   });
 
   it('should set unmatch certificate and key by input', function () {
@@ -62,6 +63,6 @@ context('ssl smoke test', () => {
     cy.get('#key').type(invalidKey);
 
     cy.contains('Next').click();
-    cy.get(this.domSelector.notificationDesc).should('contain', "key and cert 
don't match");
+    cy.get(this.domSelector.notificationDesc).should('contain', 
this.data.sslErrorAlert);
   });
 });
diff --git 
a/web/cypress/integration/upstream/create_and_delete_upstream.spec.js 
b/web/cypress/integration/upstream/create_and_delete_upstream.spec.js
index b1ec87a..18b590f 100644
--- a/web/cypress/integration/upstream/create_and_delete_upstream.spec.js
+++ b/web/cypress/integration/upstream/create_and_delete_upstream.spec.js
@@ -17,12 +17,11 @@
 /* eslint-disable no-undef */
 
 context('Create and Delete Upstream', () => {
-  const name = `upstreamName${new Date().valueOf()}`;
-
   beforeEach(() => {
     cy.login();
 
     cy.fixture('selector.json').as('domSelector');
+    cy.fixture('data.json').as('data');
   });
 
   it('should create upstream with default type (roundrobin)', function () {
@@ -30,24 +29,24 @@ context('Create and Delete Upstream', () => {
     cy.contains('Upstream').click();
     cy.contains('Create').click();
 
-    cy.get('#name').type(name);
-    cy.get('#desc').type('desc_by_autotest');
+    cy.get(this.domSelector.name).type(this.data.upstreamName);
+    cy.get(this.domSelector.description).type(this.data.description);
 
-    cy.get('#nodes_0_host').type('127.0.0.1');
-    cy.get('#nodes_0_port').clear().type('7000');
+    cy.get(this.domSelector.nodes_0_host).type(this.data.ip1);
+    cy.get(this.domSelector.nodes_0_port).clear().type('7000');
     cy.contains('Next').click();
     cy.contains('Submit').click();
-    cy.get(this.domSelector.notification).should('contain', 'Create Upstream 
Successfully');
-    cy.contains('Create Upstream Successfully');
+    cy.get(this.domSelector.notification).should('contain', 
this.data.createUpstreamSuccess);
+    cy.contains(this.data.createUpstreamSuccess);
     cy.url().should('contains', 'upstream/list');
   });
 
   it('should delete the upstream', function () {
     cy.visit('/');
     cy.contains('Upstream').click();
-    cy.contains(name).siblings().contains('Delete').click();
+    cy.contains(this.data.upstreamName).siblings().contains('Delete').click();
     cy.contains('button', 'Confirm').click();
-    cy.get(this.domSelector.notification).should('contain', 'Delete Upstream 
Successfully');
+    cy.get(this.domSelector.notification).should('contain', 
this.data.deleteUpstreamSuccess);
   });
 
   it('should create chash upstream', function () {
@@ -55,8 +54,8 @@ context('Create and Delete Upstream', () => {
     cy.contains('Upstream').click();
     cy.contains('Create').click();
 
-    cy.get('#name').type(name);
-    cy.get('#desc').type('desc_by_autotest');
+    cy.get(this.domSelector.name).type(this.data.upstreamName);
+    cy.get(this.domSelector.description).type(this.data.description);
 
     // change upstream type to chash, todo: optimize the search method
     cy.get('[title=roundrobin]').click();
@@ -73,27 +72,27 @@ context('Create and Delete Upstream', () => {
     });
 
     // add first upstream node
-    cy.get('#nodes_0_host').type('127.0.0.1');
-    cy.get('#nodes_0_port').clear().type('7000');
+    cy.get(this.domSelector.nodes_0_host).type(this.data.ip1);
+    cy.get(this.domSelector.nodes_0_port).clear().type('7000');
 
     // add second upstream node
     cy.get('.ant-btn-dashed').click();
-    cy.get('#nodes_1_host').type('127.0.0.1');
+    cy.get('#nodes_1_host').type(this.data.ip1);
     cy.get('#nodes_1_port').clear().type('7001');
     cy.get('#nodes_1_weight').clear().type('2');
 
     // next to finish
     cy.contains('Next').click();
     cy.contains('Submit').click();
-    cy.get(this.domSelector.notification).should('contain', 'Create Upstream 
Successfully');
+    cy.get(this.domSelector.notification).should('contain', 
this.data.createUpstreamSuccess);
     cy.url().should('contains', 'upstream/list');
   });
 
   it('should delete the upstream', function () {
     cy.visit('/');
     cy.contains('Upstream').click();
-    cy.contains(name).siblings().contains('Delete').click();
+    cy.contains(this.data.upstreamName).siblings().contains('Delete').click();
     cy.contains('button', 'Confirm').click();
-    cy.get(this.domSelector.notification).should('contain', 'Delete Upstream 
Successfully');
+    cy.get(this.domSelector.notification).should('contain', 
this.data.deleteUpstreamSuccess);
   });
 });
diff --git a/web/src/pages/Setting/locales/en-US.ts 
b/web/src/pages/Setting/locales/en-US.ts
index f5a3ef2..dc27a8e 100644
--- a/web/src/pages/Setting/locales/en-US.ts
+++ b/web/src/pages/Setting/locales/en-US.ts
@@ -21,5 +21,5 @@ export default {
   'page.setting.form.item.grafanaURL': 'Grafana Address',
   'page.setting.form.item.grafanaURL.inputHelpMessage':
     'Grafana address should begin with HTTP or HTTPS',
-  'page.setting.form.item.grafanaURL.inputErrorMessage': 'Address is 
illegality',
+  'page.setting.form.item.grafanaURL.inputErrorMessage': 'Address is invalid',
 };

Reply via email to