You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by ju...@apache.org on 2021/02/25 13:08:41 UTC
[apisix-dashboard] branch master updated: test: front-end e2e test
for rawDataEditor (#1515)
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 63f9059 test: front-end e2e test for rawDataEditor (#1515)
63f9059 is described below
commit 63f9059a3c7d2390e51e8f7b607afd4a1d052ce8
Author: guoqqqi <72...@users.noreply.github.com>
AuthorDate: Thu Feb 25 21:08:34 2021 +0800
test: front-end e2e test for rawDataEditor (#1515)
---
web/cypress/fixtures/selector.json | 4 ++-
.../consumer/create_and_delete_consumer.spec.js | 16 +++++++++++
.../route/create-edit-delete-route.spec.js | 25 +++++++++++++++++
.../service/create-edit-delete-service.spec.js | 26 ++++++++++++++++++
.../upstream/create_and_delete_upstream.spec.js | 32 ++++++++++++++++++++++
web/yarn.lock | 7 +++++
6 files changed, 109 insertions(+), 1 deletion(-)
diff --git a/web/cypress/fixtures/selector.json b/web/cypress/fixtures/selector.json
index e47045b..8f76ac4 100644
--- a/web/cypress/fixtures/selector.json
+++ b/web/cypress/fixtures/selector.json
@@ -60,5 +60,7 @@
"errorExplain": ".ant-form-item-explain",
"usernameInput": "#control-ref_username",
- "passwordInput": "#control-ref_password"
+ "passwordInput": "#control-ref_password",
+ "drawer": ".ant-drawer-content",
+ "codemirrorScroll": ".CodeMirror-scroll"
}
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 5896edf..69cd8c5 100644
--- a/web/cypress/integration/consumer/create_and_delete_consumer.spec.js
+++ b/web/cypress/integration/consumer/create_and_delete_consumer.spec.js
@@ -56,6 +56,21 @@ context('Create and Delete Consumer', () => {
cy.get(this.domSelector.notification).should('contain', this.data.createConsumerSuccess);
});
+ it('should view the consumer', function () {
+ cy.visit('/');
+ cy.contains('Consumer').click();
+
+ cy.get(this.domSelector.nameSelector).type(this.data.consumerName);
+ cy.contains('Search').click();
+ cy.contains(this.data.consumerName).siblings().contains('View').click();
+ cy.get(this.domSelector.drawer).should('be.visible');
+
+ cy.get(this.domSelector.codemirrorScroll).within(() => {
+ cy.contains('plugins').should("exist");
+ cy.contains(this.data.consumerName).should('exist');
+ });
+ });
+
it('delete the consumer', function () {
cy.visit('/');
cy.contains('Consumer').click();
@@ -92,3 +107,4 @@ context('Create and Delete Consumer', () => {
cy.get(this.domSelector.notification).should('contain', this.data.pluginErrorAlert);
});
});
+
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 a0f3119..f799a69 100644
--- a/web/cypress/integration/route/create-edit-delete-route.spec.js
+++ b/web/cypress/integration/route/create-edit-delete-route.spec.js
@@ -85,6 +85,21 @@ context('Create and Delete Route', () => {
cy.url().should('contains', 'routes/list');
});
+ it('should view the route', function () {
+ cy.visit('/');
+ cy.contains('Route').click();
+
+ cy.get(this.domSelector.nameSelector).type(name);
+ cy.contains('Search').click();
+ cy.contains(name).siblings().contains('View').click();
+ cy.get(this.domSelector.drawer).should('be.visible');
+
+ cy.get(this.domSelector.codemirrorScroll).within(() => {
+ cy.contains('upstream').should("exist");
+ cy.contains(name).should('exist');
+ });
+ });
+
it('should edit the route', function () {
cy.visit('/');
cy.contains('Route').click();
@@ -103,6 +118,15 @@ context('Create and Delete Route', () => {
cy.contains('Goto List').click();
cy.url().should('contains', 'routes/list');
cy.contains(newName).siblings().should('contain', this.data.description2);
+
+ // test view
+ cy.contains(newName).siblings().contains('View').click();
+ cy.get(this.domSelector.drawer).should('be.visible');
+
+ cy.get(this.domSelector.codemirrorScroll).within(() => {
+ cy.contains('upstream').should("exist");
+ cy.contains(newName).should('exist');
+ });
});
it('should delete the route', function () {
@@ -114,3 +138,4 @@ context('Create and Delete Route', () => {
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 b112e52..e7e3507 100644
--- a/web/cypress/integration/service/create-edit-delete-service.spec.js
+++ b/web/cypress/integration/service/create-edit-delete-service.spec.js
@@ -40,6 +40,21 @@ context('create and delete service ', () => {
cy.get(this.domSelector.notification).should('contain', this.data.createServiceSuccess);
});
+ it('should view the service', function () {
+ cy.visit('/');
+ cy.contains('Service').click();
+
+ cy.get(this.domSelector.nameSelector).type(this.data.serviceName);
+ cy.contains('Search').click();
+ cy.contains(this.data.serviceName).siblings().contains('View').click();
+ cy.get(this.domSelector.drawer).should('be.visible');
+
+ cy.get(this.domSelector.codemirrorScroll).within(() => {
+ cy.contains('upstream').should("exist");
+ cy.contains(this.data.serviceName).should('exist');
+ });
+ });
+
it('should edit the service', function () {
cy.visit('/');
cy.contains('Service').click();
@@ -59,10 +74,20 @@ context('create and delete service ', () => {
cy.contains('Next').click();
cy.contains('Submit').click();
cy.get(this.domSelector.notification).should('contain', this.data.editServiceSuccess);
+
+ // test view
+ cy.contains(this.data.serviceName2).siblings().contains('View').click();
+ cy.get(this.domSelector.drawer).should('be.visible');
+
+ cy.get(this.domSelector.codemirrorScroll).within(() => {
+ cy.contains('upstream').should('exist');
+ cy.contains(this.data.serviceName2).should('exist');
+ });
});
it('should delete the service', function () {
// Confirm whether the edited data is saved.
+ cy.visit('/service/list');
cy.get(this.domSelector.nameSelector).type(this.data.serviceName2);
cy.contains('Search').click();
cy.contains(this.data.serviceName2).siblings().contains('Edit').click();
@@ -76,3 +101,4 @@ context('create and delete service ', () => {
cy.get(this.domSelector.notification).should('contain', this.data.deleteServiceSuccess);
});
});
+
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 18b590f..7183155 100644
--- a/web/cypress/integration/upstream/create_and_delete_upstream.spec.js
+++ b/web/cypress/integration/upstream/create_and_delete_upstream.spec.js
@@ -41,6 +41,22 @@ context('Create and Delete Upstream', () => {
cy.url().should('contains', 'upstream/list');
});
+ it('should view the (roundrobin) upstream', function () {
+ cy.visit('/');
+ cy.contains('Upstream').click();
+
+ cy.get(this.domSelector.nameSelector).type(this.data.upstreamName);
+ cy.contains('Search').click();
+ cy.contains(this.data.upstreamName).siblings().contains('View').click();
+ cy.get('.ant-drawer-content').should('be.visible');
+
+ cy.get('.CodeMirror-scroll').within(() => {
+ cy.contains('nodes').should("exist");
+ cy.contains('roundrobin').should('exist');
+ cy.contains(this.data.upstreamName).should('exist');
+ });
+ });
+
it('should delete the upstream', function () {
cy.visit('/');
cy.contains('Upstream').click();
@@ -88,6 +104,22 @@ context('Create and Delete Upstream', () => {
cy.url().should('contains', 'upstream/list');
});
+ it('should view the (chash) upstream', function () {
+ cy.visit('/');
+ cy.contains('Upstream').click();
+
+ cy.get(this.domSelector.nameSelector).type(this.data.upstreamName);
+ cy.contains('Search').click();
+ cy.contains(this.data.upstreamName).siblings().contains('View').click();
+ cy.get(this.domSelector.drawer).should('be.visible');
+
+ cy.get(this.domSelector.codemirrorScroll).within(() => {
+ cy.contains('nodes').should("exist");
+ cy.contains('chash').should('exist');
+ cy.contains(this.data.upstreamName).should('exist');
+ });
+ });
+
it('should delete the upstream', function () {
cy.visit('/');
cy.contains('Upstream').click();
diff --git a/web/yarn.lock b/web/yarn.lock
index c956847..e9f189d 100644
--- a/web/yarn.lock
+++ b/web/yarn.lock
@@ -2824,6 +2824,13 @@
resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.3.tgz#7ee330ba7caafb98090bece86a5ee44115904c2c"
integrity sha512-ewFXqrQHlFsgc09MK5jP5iR7vumV/BYayNC6PgJO2LPe8vrnNFyjQjSppfEngITi0qvfKtzFvgKymGheFM9UOA==
+"@types/react-copy-to-clipboard@^5.0.0":
+ version "5.0.0"
+ resolved "https://registry.yarnpkg.com/@types/react-copy-to-clipboard/-/react-copy-to-clipboard-5.0.0.tgz#38b035ca0c28334d3e0efaf3f319b81eea9690cd"
+ integrity sha512-faUg6Kx3Dfv0MBIcs+xzIptlRtjEVSaNjqyC14YAp4UwSiTHghnKtBOt9ERRTZZJfoJgnw10tomVaqG86GzdAw==
+ dependencies:
+ "@types/react" "*"
+
"@types/react-dom@^16.8.4", "@types/react-dom@^16.9.8":
version "16.9.10"
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-16.9.10.tgz#4485b0bec3d41f856181b717f45fd7831101156f"