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 a3a135d  feat: update the menu order of the sidebar (#1376)
a3a135d is described below

commit a3a135d2690c1f96c6e131aed0c4b9d902b1943d
Author: guoqqqi <[email protected]>
AuthorDate: Fri Jan 29 11:10:03 2021 +0800

    feat: update the menu order of the sidebar (#1376)
---
 .../route/create-route-with-upstream.spec.js       |  1 +
 .../settings/settings-smoketest.spec.js            | 43 +++++++++++++++-------
 web/src/helpers.tsx                                | 15 +++-----
 web/src/locales/en-US/menu.ts                      |  2 +-
 web/src/locales/zh-CN/menu.ts                      |  4 +-
 5 files changed, 38 insertions(+), 27 deletions(-)

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 aa8c21e..9a0f6df 100644
--- a/web/cypress/integration/route/create-route-with-upstream.spec.js
+++ b/web/cypress/integration/route/create-route-with-upstream.spec.js
@@ -88,6 +88,7 @@ context('Create Route with Upstream', () => {
     cy.visit('/');
     cy.contains('Route').click();
 
+    cy.reload();
     cy.get(domSelector.search_name).type(data.route_name);
     cy.contains('Search').click();
     cy.contains(data.route_name).siblings().contains('Edit').click();
diff --git a/web/cypress/integration/settings/settings-smoketest.spec.js 
b/web/cypress/integration/settings/settings-smoketest.spec.js
index 33ae217..e7c4617 100644
--- a/web/cypress/integration/settings/settings-smoketest.spec.js
+++ b/web/cypress/integration/settings/settings-smoketest.spec.js
@@ -17,9 +17,22 @@
 /* eslint-disable no-undef */
 
 context('settings page smoke test', () => {
-  const domSelectors = {
-    pageContent: '.ant-pro-page-container',
+  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: 'https://apisix.apache.org/',
+    fetchURL: 'fetchURL',
+    fetch: '@fetchURL',
+  }
+  const domSelector = {
+    pageContainer: '.ant-pro-page-container',
     notificationMsg: '.ant-notification-notice-message',
+    setting: '.ant-space-align-center',
+    grafanaURL: '#grafanaURL',
+    explain: '.ant-form-item-explain',
   };
 
   beforeEach(() => {
@@ -27,35 +40,37 @@ context('settings page smoke test', () => {
   });
 
   it('should visit settings page', () => {
-    // go to settings page
     cy.visit('/');
+    cy.get(domSelector.setting).invoke('show').click('center');
     cy.contains('Settings').click();
     cy.url().should('contains', '/settings');
-    cy.get(domSelectors.pageContent)
+    cy.get(domSelector.pageContainer)
       .children()
       .should('contain', 'Setting')
-      .and('contain', 'Grafana Address')
-      .and('contain', 'Grafana address should begin with HTTP or HTTPS');
+      .and('contain', data.grafanaAddress)
+      .and('contain', data.grafanaExplanation1);
   });
 
   it('should set a invalid url', () => {
     cy.visit('/');
+    cy.get(domSelector.setting).invoke('show').click('center');
     cy.contains('Settings').click();
     cy.url().should('contains', '/settings');
-    cy.get('#grafanaURL').clear().type('httx://www.test.com');
-    cy.get('.ant-form-item-explain').should('contain', 'Address is 
illegality');
+    cy.get(domSelector.grafanaURL).clear().type(data.invalidURL);
+    cy.get(domSelector.explain).should('contain', data.grafanaExplanation2);
   });
 
-  it('should set a accessible url', () => {
+  it('should set a accessible URL', () => {
     cy.visit('/');
+    cy.get(domSelector.setting).invoke('show').click('center');
     cy.contains('Settings').click();
     cy.url().should('contains', '/settings');
-    cy.get('#grafanaURL').clear().type('https://apisix.apache.org/');
+    cy.get(domSelector.grafanaURL).clear().type(data.validURL);
     cy.contains('Submit').click();
 
-    cy.get(domSelectors.notificationMsg).should('contain', 'Update 
Configuration Successfully');
-    cy.intercept('https://apisix.apache.org/').as('fetchurl');
-    cy.wait('@fetchurl');
-    cy.get(domSelectors.pageContent).children().should('contain', 'Metrics');
+    cy.get(domSelector.notificationMsg).should('contain', 
data.updateSuccessfully);
+    cy.intercept(data.validURL).as(data.fetchURL);
+    cy.wait(data.fetch);
+    cy.get(domSelector.pageContainer).children().should('contain', 'Metrics');
   });
 });
diff --git a/web/src/helpers.tsx b/web/src/helpers.tsx
index 0af4ab9..aee3e76 100644
--- a/web/src/helpers.tsx
+++ b/web/src/helpers.tsx
@@ -32,11 +32,6 @@ export const getMenuData = (): MenuDataItem[] => {
       icon: <IconFont name="icondashboard" />,
     },
     {
-      name: 'service',
-      path: '/service/list',
-      icon: <IconFont name="iconconsumer" />,
-    },
-    {
       name: 'routes',
       path: '/routes/list',
       icon: <IconFont name="iconroute" />,
@@ -47,6 +42,11 @@ export const getMenuData = (): MenuDataItem[] => {
       icon: <IconFont name="iconserver" />,
     },
     {
+      name: 'service',
+      path: '/service/list',
+      icon: <IconFont name="iconconsumer" />,
+    },
+    {
       name: 'consumer',
       path: '/consumer/list',
       icon: <IconFont name="iconconsumer" />,
@@ -62,11 +62,6 @@ export const getMenuData = (): MenuDataItem[] => {
       icon: <IconFont name="iconssl" />,
     },
     {
-      name: 'setting',
-      path: '/settings',
-      icon: <IconFont name="iconsetting" />,
-    },
-    {
       name: 'serverinfo',
       path: '/serverinfo',
       icon: <IconFont name="iconinfocircle"/>,
diff --git a/web/src/locales/en-US/menu.ts b/web/src/locales/en-US/menu.ts
index b0b72d3..c2dac51 100644
--- a/web/src/locales/en-US/menu.ts
+++ b/web/src/locales/en-US/menu.ts
@@ -71,5 +71,5 @@ export default {
   'menu.plugin': 'Plugin',
   'menu.service': 'Service',
   'menu.setting': 'Settings',
-  'menu.serverinfo': 'Server Info',
+  'menu.serverinfo': 'System Status',
 };
diff --git a/web/src/locales/zh-CN/menu.ts b/web/src/locales/zh-CN/menu.ts
index 0fbc78a..59129c1 100644
--- a/web/src/locales/zh-CN/menu.ts
+++ b/web/src/locales/zh-CN/menu.ts
@@ -67,6 +67,6 @@ export default {
   'menu.consumer': '消费者',
   'menu.plugin': '插件',
   'menu.service': '服务',
-  'menu.setting': '设置',
-  'menu.serverinfo': '服务端信息',
+  'menu.setting': '系统设置',
+  'menu.serverinfo': '系统状态',
 };

Reply via email to