juzhiyuan commented on a change in pull request #1317:
URL: https://github.com/apache/apisix-dashboard/pull/1317#discussion_r563166817



##########
File path: web/cypress/integration/plugin/create_and_delete_plugin.spec.js
##########
@@ -0,0 +1,60 @@
+/*
+ * 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 domSelectors = {
+    tableCell: '.ant-table-cell',
+    empty: '.ant-empty-normal',
+  };
+
+  beforeEach(() => {
+    cy.login();
+
+    cy.fixture('plugin-list.json').as('cases');

Review comment:
       why not use 
https://github.com/guoqqqi/apisix-dashboard/blob/fix-globalPlugin/web/cypress/fixtures/plugin-dataset.json
 and choose part of cases?

##########
File path: web/cypress/integration/plugin/create_and_delete_plugin.spec.js
##########
@@ -0,0 +1,60 @@
+/*
+ * 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 domSelectors = {
+    tableCell: '.ant-table-cell',
+    empty: '.ant-empty-normal',
+  };
+
+  beforeEach(() => {
+    cy.login();
+
+    cy.fixture('plugin-list.json').as('cases');
+  });
+
+  it('should create plugins', function () {
+    cy.visit('/');
+    cy.contains('Plugin').click();
+    cy.contains('Create').click();
+
+    // add test plugins
+    cy.addPlugins(this.cases);

Review comment:
       not a good name, `configurePlugins`

##########
File path: web/cypress/support/commands.js
##########
@@ -34,3 +34,81 @@ Cypress.Commands.add('login', () => {
     localStorage.setItem('umi_locale', 'en-US');
   });
 });
+
+Cypress.Commands.add('addPlugins', (cases) => {
+  const timeout = 50000;
+  const domSelectors = {
+    name: '[data-cy-plugin-name]',
+    parents: '.ant-card-bordered',
+    drawer: '.ant-drawer-content',
+    switch: '#disable',
+    close: '.anticon-close',
+  };
+
+  cy.get(domSelectors.name).then(function (cards) {
+    [...cards].forEach((card) => {
+      const name = card.innerText;
+      const pluginCases = cases[name] || [];
+      // eslint-disable-next-line consistent-return
+      pluginCases.forEach(({ shouldValid, data, type = '' }) => {
+        /**
+         * NOTE: This test is mainly for GlobalPlugin, which is using 
non-consumer-type schema.
+         */

Review comment:
       No need those tips

##########
File path: web/cypress/support/commands.js
##########
@@ -34,3 +34,81 @@ Cypress.Commands.add('login', () => {
     localStorage.setItem('umi_locale', 'en-US');
   });
 });
+
+Cypress.Commands.add('addPlugins', (cases) => {
+  const timeout = 50000;
+  const domSelectors = {
+    name: '[data-cy-plugin-name]',
+    parents: '.ant-card-bordered',
+    drawer: '.ant-drawer-content',
+    switch: '#disable',
+    close: '.anticon-close',
+  };
+
+  cy.get(domSelectors.name).then(function (cards) {
+    [...cards].forEach((card) => {
+      const name = card.innerText;
+      const pluginCases = cases[name] || [];
+      // eslint-disable-next-line consistent-return
+      pluginCases.forEach(({ shouldValid, data, type = '' }) => {
+        /**
+         * NOTE: This test is mainly for GlobalPlugin, which is using 
non-consumer-type schema.
+         */

Review comment:
       because this is a public function




----------------------------------------------------------------
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