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/16 08:57:05 UTC

[GitHub] [apisix-dashboard] LiteSun commented on a change in pull request #1056: feat: Refactor frontend e2e

LiteSun commented on a change in pull request #1056:
URL: https://github.com/apache/apisix-dashboard/pull/1056#discussion_r544121514



##########
File path: web/cypress/integration/route/create_and_delete_route.spec.js
##########
@@ -0,0 +1,73 @@
+/* eslint-disable no-undef */
+/// <reference types="cypress" />
+
+context('Create and Delete Route', () => {
+  const root_name = `root_${new Date().valueOf()}`
+
+  beforeEach(() => {
+    // init login 
+    cy.login();
+  })
+
+  it('create route', () => {
+    //  go to route create page
+    cy.visit('/routes/create');
+    cy.contains('Route').click();
+    cy.contains('Create').click();
+
+    // input Name And Description
+    cy.get('#name').type(root_name);
+    cy.get('#desc').type('desc');
+
+    // input Request Basic Define
+    cy.get('#hosts_0').type('11.11.11.11');
+    cy.contains('Domain Name').parent().parent().parent().contains(' Create').click();
+    cy.get('#hosts_1').type('12.12.12.12');
+    cy.get('#remote_addrs_0').type('12.12.12.12');
+    cy.contains('Remote Addrs').parent().parent().parent().contains(' Create').click();
+    cy.get('#remote_addrs_1').type('10.10.10.10');
+    cy.contains('Advanced Routing Matching Conditions').parent().siblings().contains('Create').click();
+
+    // create rule 
+    cy.get('#position').click();
+    cy.contains('Cookie').click();
+    cy.get('.ant-modal').within(() => {
+      cy.get('#name').type('modalName');
+    })
+    cy.get('#operator').click();
+    cy.contains('Equal').click();
+    cy.get('#value').type('value');
+    cy.contains('Confirm').click();
+
+    // go to step2
+    cy.contains('Next').click();
+    cy.wait(400)
+    cy.get('#nodes_0_host').type('12.12.12.12', {
+      timeout: 4000
+    });
+
+    // go to step3
+    cy.contains('Next').click();
+
+    // config prometheus plugin
+    cy.contains('.ant-card', 'prometheus').get('button').first().click();
+    cy.contains('button','Cancel').click();

Review comment:
       > why `Cancel`? could you use the `limit-req` as plugin example? because most of plugins should pass json data into the edit control.
   
   1. because when I click `Submit`, an error will display and the route won't create success. refer to https://github.com/apache/apisix-dashboard/issues/1035
   2. this PR aims to use cypress instead of the puppeteer and when this pr is merged I'll help you to write `limit-req` test cases 😄




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