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/05/04 09:47:20 UTC

[apisix-dashboard] 01/01: test: added testcase

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

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

commit 601acd72dfdbd3bdf82b3616545cd742d637e846
Author: juzhiyuan <ju...@apache.org>
AuthorDate: Tue May 4 17:46:22 2021 +0800

    test: added testcase
---
 web/cypress/fixtures/selector.json                       |  5 ++++-
 .../route/create-edit-duplicate-delete-route.spec.js     | 16 ++++++++++++++--
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/web/cypress/fixtures/selector.json b/web/cypress/fixtures/selector.json
index f075bc0..86a9b20 100644
--- a/web/cypress/fixtures/selector.json
+++ b/web/cypress/fixtures/selector.json
@@ -75,5 +75,8 @@
   "selectDropdown": ".ant-select-dropdown",
   "codeMirrorMode": "[data-cy='code-mirror-mode']",
   "selectJSON": ".ant-select-dropdown [label=JSON]",
-  "deleteAlert": ".ant-modal-body"
+  "deleteAlert": ".ant-modal-body",
+  "schemaErrorMessage": ".ant-form-item-explain.ant-form-item-explain-error",
+  "advancedMatchingTable": ".ant-table-row.ant-table-row-level-0",
+  "advancedMatchingTableOperation": ".ant-space"
 }
diff --git a/web/cypress/integration/route/create-edit-duplicate-delete-route.spec.js b/web/cypress/integration/route/create-edit-duplicate-delete-route.spec.js
index 5157f86..bac6611 100644
--- a/web/cypress/integration/route/create-edit-duplicate-delete-route.spec.js
+++ b/web/cypress/integration/route/create-edit-duplicate-delete-route.spec.js
@@ -64,7 +64,12 @@ context('Create and Delete Route', () => {
     cy.contains('Confirm').click();
 
     cy.contains('Next').click();
-    cy.get(this.domSelector.nodes_0_host).type(this.data.host2);
+    cy.get(this.domSelector.nodes_0_host).type('@');
+    cy.get(this.domSelector.schemaErrorMessage).should('exist');
+    cy.get(this.domSelector.nodes_0_host).clear().type('*1');
+    cy.get(this.domSelector.schemaErrorMessage).should('not.exist');
+
+    cy.get(this.domSelector.nodes_0_host).clear().type(this.data.host2);
     cy.get(this.domSelector.nodes_0_port).type(this.data.port);
     cy.get(this.domSelector.nodes_0_weight).type(this.data.weight);
     cy.contains('Next').click();
@@ -128,7 +133,8 @@ context('Create and Delete Route', () => {
     cy.get(this.domSelector.drawer).should('be.visible');
 
     cy.get(this.domSelector.codemirrorScroll).within(() => {
-      cy.contains('upstream').should("exist");
+      cy.contains('upstream').should('exist');
+      cy.contains('vars').should('exist')
       cy.contains(name).should('exist');
     });
   });
@@ -145,6 +151,11 @@ context('Create and Delete Route', () => {
     cy.get('#status').should('have.class', 'ant-switch-checked');
     cy.get(this.domSelector.name).clear().type(newName);
     cy.get(this.domSelector.description).clear().type(this.data.description2);
+    cy.get(this.domSelector.advancedMatchingTable).should('exist');
+    cy.get(this.domSelector.advancedMatchingTableOperation).within(() => {
+      cy.contains('Delete').click().should('not.exist');
+    });
+
     cy.contains('Next').click();
     cy.contains('Next').click();
     cy.contains('Next').click();
@@ -161,6 +172,7 @@ context('Create and Delete Route', () => {
 
     cy.get(this.domSelector.codemirrorScroll).within(() => {
       cy.contains('upstream').should("exist");
+      cy.contains('vars').should('not.exist');
       cy.contains(newName).should('exist');
     });
   });