guoqqqi commented on a change in pull request #1597:
URL: https://github.com/apache/apisix-dashboard/pull/1597#discussion_r598300862



##########
File path: web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js
##########
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* eslint-disable no-undef */
+
+context('Create and Delete Plugin List', () => {

Review comment:
       ```suggestion
   context('Delete Plugin List with the Drawer', () => {
   ```

##########
File path: web/cypress/integration/route/create-edit-delete-route.spec.js
##########
@@ -72,12 +73,25 @@ context('Create and Delete Route', () => {
     });
 
     // config prometheus plugin
-    cy.contains(this.domSelector.pluginCard, 'prometheus').within(() => {
-      cy.get('button').first().click({
-        force: true
-      });
+    cy.contains('prometheus').parents('.ant-card-bordered').within(() => {
+      cy.get('button').click({ force: true });
+    });
+
+    cy.get('.ant-drawer-content').should('be.visible').within(() => {
+      cy.get('#disable').click();
+      cy.get('.ant-switch-checked').should('exist');
+    });
+
+    cy.contains('button', 'Submit').click();
+    cy.get('.ant-drawer-content', { timeout }).should('not.exist');
+
+    cy.contains('prometheus').parents('.ant-card-bordered').within(() => {
+      cy.get('button').click({ force: true });
     });
-    cy.contains('button', 'Cancel').click();
+
+    cy.get('.ant-drawer-footer').contains('button', 'Delete').click({ force: 
true });
+    cy.contains('button', 'Confirm').click({ force: true });
+

Review comment:
       Also use `this.domSelector..` and `this.data...`
   I think another step should be added: check that the plugin was successfully 
removed after it was deleted.

##########
File path: web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js
##########
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* eslint-disable no-undef */
+
+context('Create and Delete Plugin List', () => {
+  const timeout = 5000;
+
+  beforeEach(() => {
+    cy.login();
+
+    cy.fixture('selector.json').as('domSelector');
+    cy.fixture('data.json').as('data');
+  });
+
+  it('should visit plugin market and create plugin', function () {
+    cy.visit('/');
+    cy.contains('Plugin').click();
+    cy.contains('Create').click();
+
+    cy.contains('basic-auth').parents('.ant-card-bordered').within(() => {
+      cy.get('button').click({ force: true });
+    });
+
+    cy.get('.ant-drawer-content').should('be.visible').within(() => {
+      cy.get('#disable').click();
+      cy.get('.ant-switch-checked').should('exist');
+    });
+
+    cy.contains('button', 'Submit').click();
+    cy.get('.ant-drawer-content', { timeout }).should('not.exist');
+  });
+
+  it('should delete the plugin in drawer', function () {
+    cy.visit('/plugin/list');
+    cy.get(this.domSelector.refresh).click();
+    cy.contains('button', 'Edit').click();
+    cy.get('.ant-drawer-footer').contains('button', 'Delete').click({ force: 
true });

Review comment:
       The dom element can be moved to public data for other tests use.

##########
File path: web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js
##########
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* eslint-disable no-undef */
+
+context('Create and Delete Plugin List', () => {
+  const timeout = 5000;
+
+  beforeEach(() => {
+    cy.login();
+
+    cy.fixture('selector.json').as('domSelector');
+    cy.fixture('data.json').as('data');
+  });
+
+  it('should visit plugin market and create plugin', function () {
+    cy.visit('/');
+    cy.contains('Plugin').click();
+    cy.contains('Create').click();
+
+    cy.contains('basic-auth').parents('.ant-card-bordered').within(() => {
+      cy.get('button').click({ force: true });
+    });
+
+    cy.get('.ant-drawer-content').should('be.visible').within(() => {
+      cy.get('#disable').click();
+      cy.get('.ant-switch-checked').should('exist');
+    });
+
+    cy.contains('button', 'Submit').click();
+    cy.get('.ant-drawer-content', { timeout }).should('not.exist');
+  });

Review comment:
       Please use `this.domSelector...` and `this.data...`, refer to other test 
cases.

##########
File path: web/cypress/integration/service/create-edit-delete-service.spec.js
##########
@@ -35,6 +37,26 @@ context('Create and Delete Service ', () => {
     cy.get(this.domSelector.nodes_0_host).type(this.data.ip1);
 
     cy.contains('Next').click();
+
+    cy.contains('prometheus').parents('.ant-card-bordered').within(() => {
+      cy.get('button').click({ force: true });
+    });
+
+    cy.get('.ant-drawer-content').should('be.visible').within(() => {
+      cy.get('#disable').click();
+      cy.get('.ant-switch-checked').should('exist');
+    });
+
+    cy.contains('button', 'Submit').click();
+    cy.get('.ant-drawer-content', { timeout }).should('not.exist');
+
+    cy.contains('prometheus').parents('.ant-card-bordered').within(() => {
+      cy.get('button').click({ force: true });
+    });
+
+    cy.get('.ant-drawer-footer').contains('button', 'Delete').click({ force: 
true });
+    cy.contains('button', 'Confirm').click({ force: true });
+

Review comment:
       ditto




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to