You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2020/12/18 16:54:43 UTC

[GitHub] [apisix-dashboard] moonming commented on a change in pull request #1068: test: add frontend e2e test (create and delete consumer with key-auth)

moonming commented on a change in pull request #1068:
URL: https://github.com/apache/apisix-dashboard/pull/1068#discussion_r545959525



##########
File path: web/cypress/integration/consumer/create_and_delete_consumer.spec.js
##########
@@ -0,0 +1,61 @@
+/*
+ * 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 Consumer', () => {
+        const root_name = `root_${new Date().valueOf()}`;

Review comment:
       what is `root_name` for?

##########
File path: web/cypress/integration/consumer/create_and_delete_consumer.spec.js
##########
@@ -0,0 +1,61 @@
+/*
+ * 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 Consumer', () => {
+        const root_name = `root_${new Date().valueOf()}`;
+      
+        beforeEach(() => {
+          // init login 
+          cy.login();
+        })
+      
+        it('create consumer with key-auth', () => {
+          // go to consumer create page
+          cy.visit('/consumer/create');
+          cy.contains('Consumer').click();
+          cy.wait(500);
+          cy.contains('Create').click();
+
+          // Basic Information
+          cy.get('#username').type('autotest_'+root_name);
+          cy.get('#desc').type('desc_by_autotest');
+          cy.contains('Next').click();
+          cy.wait(300);
+
+          // Plugin Config
+          cy.contains('.ant-card', 'key-auth').within(($form) => {
+            cy.get('button').first().click();
+          })
+          // edit CodeMirror
+          cy.get('.CodeMirror')
+            .first()
+            .then((editor) => {
+              editor[0].CodeMirror.setValue('{"key":"test","disable": false}');

Review comment:
       why we need `"disable": false`? which is not in the json schema

##########
File path: web/cypress/integration/consumer/create_and_delete_consumer.spec.js
##########
@@ -0,0 +1,61 @@
+/*
+ * 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 Consumer', () => {
+        const root_name = `root_${new Date().valueOf()}`;
+      
+        beforeEach(() => {
+          // init login 
+          cy.login();
+        })
+      
+        it('create consumer with key-auth', () => {
+          // go to consumer create page
+          cy.visit('/consumer/create');
+          cy.contains('Consumer').click();
+          cy.wait(500);
+          cy.contains('Create').click();
+
+          // Basic Information
+          cy.get('#username').type('autotest_'+root_name);
+          cy.get('#desc').type('desc_by_autotest');
+          cy.contains('Next').click();
+          cy.wait(300);
+
+          // Plugin Config
+          cy.contains('.ant-card', 'key-auth').within(($form) => {
+            cy.get('button').first().click();
+          })
+          // edit CodeMirror
+          cy.get('.CodeMirror')
+            .first()
+            .then((editor) => {
+              editor[0].CodeMirror.setValue('{"key":"test","disable": false}');

Review comment:
       And we need to test invalid json data




----------------------------------------------------------------
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:
users@infra.apache.org