[GitHub] [apisix-dashboard] guoqqqi commented on a change in pull request #1558: feat:Support duplicate one existing Route

2021-03-22 Thread GitBox


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



##
File path: 
web/cypress/integration/route/create-edit-duplicate-delete-route.spec.js
##
@@ -131,12 +132,46 @@ context('Create and Delete Route', () => {
 });
   });
 
-  it('should delete the route', function () {
-cy.visit('/routes/list');
+  it('should duplicate the route', function () {
+cy.visit('/');
+cy.contains('Route').click();
+
 cy.get(this.domSelector.nameSelector).type(newName);
 cy.contains('Search').click();
-cy.contains(newName).siblings().contains('Delete').click();
-cy.contains('button', 'Confirm').click();
-cy.get(this.domSelector.notification).should('contain', 
this.data.deleteRouteSuccess);
+cy.contains(newName).siblings().contains('Duplicate').click();
+
+cy.get(this.domSelector.name).clear().type(duplicateNewName);
+cy.get(this.domSelector.description).clear().type(this.data.description2);
+cy.contains('Next').click();
+cy.contains('Next').click();
+cy.contains('Next').click();
+cy.contains('Submit').click();
+cy.contains(this.data.submitSuccess);
+cy.contains('Goto List').click();
+cy.url().should('contains', 'routes/list');
+cy.contains(duplicateNewName).siblings().should('contain', 
this.data.description2);
+
+// test view
+cy.contains(duplicateNewName).siblings().contains('View').click();
+cy.get(this.domSelector.drawer).should('be.visible');
+
+cy.get(this.domSelector.codemirrorScroll).within(() => {
+  cy.contains('upstream').should("exist");
+  cy.contains(duplicateNewName).should('exist');
+});
+  });
+
+  it('should delete the route', function () {
+cy.visit('/routes/list');
+const { domSelector, data } = this;
+const routeNames = [newName, duplicateNewName];
+routeNames.forEach(function (routeName) {
+  cy.get(`${domSelector.nameSelector} .ant-input`).clear().type(routeName);

Review comment:
   ```suggestion
 cy.get(domSelector.name).clear().type(routeName);
   ```
   This will fix the CI error.




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




[GitHub] [apisix-dashboard] guoqqqi commented on a change in pull request #1558: feat:Support duplicate one existing Route

2021-03-18 Thread GitBox


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



##
File path: web/config/routes.ts
##
@@ -39,6 +39,10 @@ const routes = [
 path: '/routes/:rid/edit',
 component: './Route/Create',
   },
+  {
+path: '/routes/:rid/duplicate',

Review comment:
   Hi, I have fixed the problem with the relevant test and wait for #1608.





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