You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by su...@apache.org on 2021/05/17 10:04:59 UTC

[apisix-dashboard] branch master updated: chore: refactored test create-delete-in-drawer-plugin (#1854)

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

sunyi 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 ddfecc6  chore: refactored test create-delete-in-drawer-plugin (#1854)
ddfecc6 is described below

commit ddfecc682f2e95ed0aafcf8c46643ff5f75d13d3
Author: Ayush das <ay...@gmail.com>
AuthorDate: Mon May 17 15:34:50 2021 +0530

    chore: refactored test create-delete-in-drawer-plugin (#1854)
---
 .../plugin/create-delete-in-drawer-plugin.spec.js  | 44 ++++++++++++++--------
 1 file changed, 29 insertions(+), 15 deletions(-)

diff --git a/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js b/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js
index 0ce3a3b..bcde1e3 100644
--- a/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js
+++ b/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js
@@ -19,11 +19,25 @@
 context('Delete Plugin List with the Drawer', () => {
   const timeout = 5000;
 
+  const selector = {
+    pluginCardBordered: '.ant-card-bordered',
+    drawer: '.ant-drawer-content',
+    selectDropdown: '.ant-select-dropdown',
+    codeMirrorMode: "[data-cy='code-mirror-mode']",
+    selectJSON: '.ant-select-dropdown [label=JSON]',
+    drawerFooter: '.ant-drawer-footer',
+    disabledSwitcher: '#disable',
+    checkedSwitcher: '.ant-switch-checked',
+    refresh: '.anticon-reload',
+    empty: '.ant-empty-normal',
+  }
+
+  const data = {
+    basicAuthPlugin: 'basic-auth',
+  }
+
   beforeEach(() => {
     cy.login();
-
-    cy.fixture('selector.json').as('domSelector');
-    cy.fixture('data.json').as('data');
   });
 
   it('should visit plugin market and enable plugin', function () {
@@ -31,41 +45,41 @@ context('Delete Plugin List with the Drawer', () => {
     cy.contains('Plugin').click();
     cy.contains('Enable').click();
 
-    cy.contains(this.data.basicAuthPlugin).parents(this.domSelector.pluginCardBordered).within(() => {
+    cy.contains(data.basicAuthPlugin).parents(selector.pluginCardBordered).within(() => {
       cy.get('button').click({
         force: true
       });
     });
 
-    cy.get(this.domSelector.codeMirrorMode).invoke('text').then(text => {
+    cy.get(selector.codeMirrorMode).invoke('text').then(text => {
       if (text === 'Form') {
-        cy.get(this.domSelector.codeMirrorMode).click();
-        cy.get(this.domSelector.selectDropdown).should('be.visible');
-        cy.get(this.domSelector.selectJSON).click();
+        cy.get(selector.codeMirrorMode).click();
+        cy.get(selector.selectDropdown).should('be.visible');
+        cy.get(selector.selectJSON).click();
       }
     });
 
-    cy.get(this.domSelector.drawer).should('be.visible').within(() => {
-      cy.get(this.domSelector.disabledSwitcher).click();
-      cy.get(this.domSelector.checkedSwitcher).should('exist');
+    cy.get(selector.drawer).should('be.visible').within(() => {
+      cy.get(selector.disabledSwitcher).click();
+      cy.get(selector.checkedSwitcher).should('exist');
     });
 
     cy.contains('button', 'Submit').click();
-    cy.get(this.domSelector.drawer, {
+    cy.get(selector.drawer, {
       timeout
     }).should('not.exist');
   });
 
   it('should delete the plugin with the drawer', function () {
     cy.visit('/plugin/list');
-    cy.get(this.domSelector.refresh).click();
+    cy.get(selector.refresh).click();
     cy.contains('button', 'Configure').click();
-    cy.get(this.domSelector.drawerFooter).contains('button', 'Delete').click({
+    cy.get(selector.drawerFooter).contains('button', 'Delete').click({
       force: true
     });
     cy.contains('button', 'Confirm').click({
       force: true
     });
-    cy.get(this.domSelector.empty).should('be.visible');
+    cy.get(selector.empty).should('be.visible');
   });
 });