This is an automated email from the ASF dual-hosted git repository.

juzhiyuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git


The following commit(s) were added to refs/heads/master by this push:
     new 7a157af  test: remove unnecessary wait in E2E (#1362)
7a157af is described below

commit 7a157af60cc57fb49e5c1dcf2addca75c05857f1
Author: guoqqqi <[email protected]>
AuthorDate: Mon Jan 25 11:59:11 2021 +0800

    test: remove unnecessary wait in E2E (#1362)
---
 .../integration/consumer/create_and_delete_consumer.spec.js       | 7 -------
 web/cypress/integration/metrics/metrics-smoketest.spec.js         | 2 --
 web/cypress/integration/route/create-edit-delete-route.spec.js    | 3 ---
 web/cypress/integration/settings/settings-smoketest.spec.js       | 8 +++-----
 4 files changed, 3 insertions(+), 17 deletions(-)

diff --git 
a/web/cypress/integration/consumer/create_and_delete_consumer.spec.js 
b/web/cypress/integration/consumer/create_and_delete_consumer.spec.js
index f94c260..fd68dd0 100644
--- a/web/cypress/integration/consumer/create_and_delete_consumer.spec.js
+++ b/web/cypress/integration/consumer/create_and_delete_consumer.spec.js
@@ -18,7 +18,6 @@
 
 context('Create and Delete Consumer', () => {
   const name = `consumerName${new Date().valueOf()}`;
-  const sleepTime = 100;
   const domSelectors = {
     notification: '.ant-notification-notice-message',
     pluginsCard: '.ant-card',
@@ -33,14 +32,12 @@ context('Create and Delete Consumer', () => {
     // go to consumer create page
     cy.visit('/');
     cy.contains('Consumer').click();
-    cy.wait(sleepTime * 5);
     cy.contains('Create').click();
 
     // basic information
     cy.get('#username').type(name);
     cy.get('#desc').type('desc_by_autotest');
     cy.contains('Next').click();
-    cy.wait(sleepTime * 3);
 
     // plugin config
     cy.contains(domSelectors.pluginsCard, 'key-auth').within(() => {
@@ -61,14 +58,12 @@ context('Create and Delete Consumer', () => {
       });
     cy.contains('button', 'Next').click();
     cy.contains('button', 'Submit').click();
-    cy.wait(sleepTime);
     cy.get(domSelectors.notification).should('contain', 'Create Consumer 
Successfully');
   });
 
   it('delete the consumer', () => {
     cy.visit('/');
     cy.contains('Consumer').click();
-    cy.wait(sleepTime * 5);
     cy.contains(name).siblings().contains('Delete').click();
     cy.contains('button', 'Confirm').click();
     cy.get(domSelectors.notification).should('contain', 'Delete Consumer 
Successfully');
@@ -78,14 +73,12 @@ context('Create and Delete Consumer', () => {
     // go to consumer create page
     cy.visit('/');
     cy.contains('Consumer').click();
-    cy.wait(sleepTime * 5);
     cy.contains('Create').click();
 
     // basic information
     cy.get('#username').type(name);
     cy.get('#desc').type('desc_by_autotest');
     cy.contains('Next').click();
-    cy.wait(sleepTime * 3);
 
     // plugin config
     cy.contains(domSelectors.pluginsCard, 'key-auth').within(() => {
diff --git a/web/cypress/integration/metrics/metrics-smoketest.spec.js 
b/web/cypress/integration/metrics/metrics-smoketest.spec.js
index cd10c4a..c616cf4 100644
--- a/web/cypress/integration/metrics/metrics-smoketest.spec.js
+++ b/web/cypress/integration/metrics/metrics-smoketest.spec.js
@@ -22,7 +22,6 @@ context('metrics page smoke test', () => {
   };
 
   beforeEach(() => {
-    // init login
     cy.login();
   });
 
@@ -30,7 +29,6 @@ context('metrics page smoke test', () => {
     // go to metrics page
     cy.visit('/');
     cy.contains('Metrics').click();
-    cy.wait(500);
     cy.url().should('contains', '/metrics');
     cy.get(domSelectors.pageContent)
       .children()
diff --git a/web/cypress/integration/route/create-edit-delete-route.spec.js 
b/web/cypress/integration/route/create-edit-delete-route.spec.js
index 510efc6..2350ef1 100644
--- a/web/cypress/integration/route/create-edit-delete-route.spec.js
+++ b/web/cypress/integration/route/create-edit-delete-route.spec.js
@@ -62,7 +62,6 @@ context('Create and Delete Route', () => {
 
     // go to step2
     cy.contains('Next').click();
-    cy.wait(sleepTime * 3);
     cy.get('#nodes_0_host').type('12.12.12.12');
 
     // go to step3
@@ -98,13 +97,11 @@ context('Create and Delete Route', () => {
 
     cy.get('[title=Name]').type(name);
     cy.contains('Search').click();
-    cy.wait(1000);
     cy.contains(name).siblings().contains('Edit').click();
 
     cy.get('#name').clear().type(newName);
     cy.get('#desc').clear().type('new desc');
     cy.contains('Next').click();
-    cy.wait(1000);
     cy.contains('Next').click();
     cy.contains('Next').click();
     cy.contains('Submit').click();
diff --git a/web/cypress/integration/settings/settings-smoketest.spec.js 
b/web/cypress/integration/settings/settings-smoketest.spec.js
index 3b8448d..33ae217 100644
--- a/web/cypress/integration/settings/settings-smoketest.spec.js
+++ b/web/cypress/integration/settings/settings-smoketest.spec.js
@@ -23,7 +23,6 @@ context('settings page smoke test', () => {
   };
 
   beforeEach(() => {
-    // init login
     cy.login();
   });
 
@@ -31,7 +30,6 @@ context('settings page smoke test', () => {
     // go to settings page
     cy.visit('/');
     cy.contains('Settings').click();
-    cy.wait(500);
     cy.url().should('contains', '/settings');
     cy.get(domSelectors.pageContent)
       .children()
@@ -43,7 +41,6 @@ context('settings page smoke test', () => {
   it('should set a invalid url', () => {
     cy.visit('/');
     cy.contains('Settings').click();
-    cy.wait(500);
     cy.url().should('contains', '/settings');
     cy.get('#grafanaURL').clear().type('httx://www.test.com');
     cy.get('.ant-form-item-explain').should('contain', 'Address is 
illegality');
@@ -52,12 +49,13 @@ context('settings page smoke test', () => {
   it('should set a accessible url', () => {
     cy.visit('/');
     cy.contains('Settings').click();
-    cy.wait(500);
     cy.url().should('contains', '/settings');
     cy.get('#grafanaURL').clear().type('https://apisix.apache.org/');
     cy.contains('Submit').click();
+
     cy.get(domSelectors.notificationMsg).should('contain', 'Update 
Configuration Successfully');
-    cy.wait(1000);
+    cy.intercept('https://apisix.apache.org/').as('fetchurl');
+    cy.wait('@fetchurl');
     cy.get(domSelectors.pageContent).children().should('contain', 'Metrics');
   });
 });

Reply via email to