From 4a93880149c69384cd47c4a25d5d398a2b6432fb Mon Sep 17 00:00:00 2001 From: Cliff Su Date: Tue, 16 Mar 2021 07:19:02 +0800 Subject: [PATCH 01/14] test: add the create and delter plugin in drawer --- .../create-delete-in-drawer-plugin.spec.js | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js diff --git a/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js b/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js new file mode 100644 index 0000000000..4ddbf54ac9 --- /dev/null +++ b/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js @@ -0,0 +1,51 @@ +/* + * 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 timeout = 5000; + + beforeEach(() => { + cy.login(); + + cy.fixture('selector.json').as('domSelector'); + cy.fixture('data.json').as('data'); + }); + + it('should visit plugin market', function () { + cy.visit('/'); + cy.contains('Plugin').click(); + cy.contains('Create').click(); + cy.fixture('plugin-dataset.json').as('cases'); + cy.get('@cases').then((cases) => { + cy.configurePlugins(cases); + }); + }); + + it('should delete the plugin in drawer', function () { + cy.visit('/plugin/list'); + cy.get(this.domSelector.refresh).click(); + cy.contains('Edit').click(); + cy.get(this.domSelector.codemirror) + .first() + .then(() => { + cy.get('.ant-drawer-footer').contains('button', 'Delete').click(); + cy.contains('button', 'Confirm').click({ force: true }); + cy.get(this.domSelector.empty).should('be.visible'); + }); + }); +}); From fc1016714b1151c99b10b214d9730f37f1c8ffff Mon Sep 17 00:00:00 2001 From: Cliff Su Date: Tue, 16 Mar 2021 09:22:26 +0800 Subject: [PATCH 02/14] test: add the create and delter plugin in drawer --- .../integration/plugin/create-delete-in-drawer-plugin.spec.js | 1 - 1 file changed, 1 deletion(-) diff --git a/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js b/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js index 4ddbf54ac9..58071498ce 100644 --- a/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js +++ b/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js @@ -45,7 +45,6 @@ context('Create and Delete Plugin List', () => { .then(() => { cy.get('.ant-drawer-footer').contains('button', 'Delete').click(); cy.contains('button', 'Confirm').click({ force: true }); - cy.get(this.domSelector.empty).should('be.visible'); }); }); }); From bf6915f5dbc6f1ab50590ff221cd576176c603c7 Mon Sep 17 00:00:00 2001 From: Cliff Su Date: Fri, 19 Mar 2021 21:38:05 +0800 Subject: [PATCH 03/14] test: add the create and delter plugin in drawer --- .../integration/plugin/create-delete-in-drawer-plugin.spec.js | 1 + 1 file changed, 1 insertion(+) diff --git a/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js b/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js index 58071498ce..4ddbf54ac9 100644 --- a/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js +++ b/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js @@ -45,6 +45,7 @@ context('Create and Delete Plugin List', () => { .then(() => { cy.get('.ant-drawer-footer').contains('button', 'Delete').click(); cy.contains('button', 'Confirm').click({ force: true }); + cy.get(this.domSelector.empty).should('be.visible'); }); }); }); From 9577f5167d3993a34a82513a5114fa85c2baf9f7 Mon Sep 17 00:00:00 2001 From: Cliff Su Date: Sat, 20 Mar 2021 13:19:42 +0800 Subject: [PATCH 04/14] test: adjust the create and delter plugin in drawer --- .../create-delete-in-drawer-plugin.spec.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js b/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js index 4ddbf54ac9..6b44e2f5ef 100644 --- a/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js +++ b/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js @@ -39,13 +39,16 @@ context('Create and Delete Plugin List', () => { it('should delete the plugin in drawer', function () { cy.visit('/plugin/list'); cy.get(this.domSelector.refresh).click(); - cy.contains('Edit').click(); - cy.get(this.domSelector.codemirror) - .first() - .then(() => { - cy.get('.ant-drawer-footer').contains('button', 'Delete').click(); - cy.contains('button', 'Confirm').click({ force: true }); - cy.get(this.domSelector.empty).should('be.visible'); + + cy.get('.ant-table-content').find('div:nth-child(1) > button.ant-btn-primary').each(function ($el) { + cy.wrap($el).click(); + cy.get(this.domSelector.codemirror) + .first() + .then(() => { + cy.get('.ant-drawer-footer').contains('button', 'Delete').click(); + cy.contains('button', 'Confirm').click({ force: true }); + }); }); + cy.get(this.domSelector.empty).should('be.visible'); }); }); From 00545917691d6d7c35679ad6bd8f03624d6a96d9 Mon Sep 17 00:00:00 2001 From: Cliff Su Date: Sat, 20 Mar 2021 14:46:51 +0800 Subject: [PATCH 05/14] test: adjust the create and delter plugin in drawer --- .../integration/plugin/create-delete-in-drawer-plugin.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js b/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js index 6b44e2f5ef..dc11d446e4 100644 --- a/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js +++ b/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js @@ -41,7 +41,7 @@ context('Create and Delete Plugin List', () => { cy.get(this.domSelector.refresh).click(); cy.get('.ant-table-content').find('div:nth-child(1) > button.ant-btn-primary').each(function ($el) { - cy.wrap($el).click(); + cy.wrap($el).click().click({ timeout }); cy.get(this.domSelector.codemirror) .first() .then(() => { From 053740e749b0da5d8b92c50b21f8014c8c1dad6b Mon Sep 17 00:00:00 2001 From: Cliff Su Date: Sat, 20 Mar 2021 16:19:39 +0800 Subject: [PATCH 06/14] test: adjust the create and delter plugin in drawer --- .../plugin/create-delete-in-drawer-plugin.spec.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js b/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js index dc11d446e4..86a0232351 100644 --- a/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js +++ b/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js @@ -39,16 +39,17 @@ context('Create and Delete Plugin List', () => { it('should delete the plugin in drawer', function () { cy.visit('/plugin/list'); cy.get(this.domSelector.refresh).click(); - - cy.get('.ant-table-content').find('div:nth-child(1) > button.ant-btn-primary').each(function ($el) { - cy.wrap($el).click().click({ timeout }); - cy.get(this.domSelector.codemirror) + cy.get('.ant-btn-primary').each(function ($el) { + if ($el.text() === 'Edit') { + cy.wrap($el).click({ timeout }); + cy.get(this.domSelector.codemirror) .first() .then(() => { cy.get('.ant-drawer-footer').contains('button', 'Delete').click(); - cy.contains('button', 'Confirm').click({ force: true }); + cy.contains('button', 'Confirm').click({ force: true, timeout }); }); - }); + } + }); cy.get(this.domSelector.empty).should('be.visible'); }); }); From 2e49eca4b1162174ddfee3732abe4f459b9e2870 Mon Sep 17 00:00:00 2001 From: Cliff Su Date: Sun, 21 Mar 2021 14:00:17 +0800 Subject: [PATCH 07/14] test: adjust the create and delter plugin in drawer --- .../plugin/create-delete-in-drawer-plugin.spec.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js b/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js index 86a0232351..c80de147d9 100644 --- a/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js +++ b/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js @@ -41,13 +41,9 @@ context('Create and Delete Plugin List', () => { cy.get(this.domSelector.refresh).click(); cy.get('.ant-btn-primary').each(function ($el) { if ($el.text() === 'Edit') { - cy.wrap($el).click({ timeout }); - cy.get(this.domSelector.codemirror) - .first() - .then(() => { - cy.get('.ant-drawer-footer').contains('button', 'Delete').click(); - cy.contains('button', 'Confirm').click({ force: true, timeout }); - }); + cy.wrap($el).click(); + cy.get('.ant-drawer-footer').contains('button', 'Delete').click(); + cy.contains('button', 'Confirm').click({ force: true }); } }); cy.get(this.domSelector.empty).should('be.visible'); From 9ec5acbac065e6a5cbf3ddc86ed41f250d8a2798 Mon Sep 17 00:00:00 2001 From: Cliff Su Date: Sun, 21 Mar 2021 15:55:23 +0800 Subject: [PATCH 08/14] test: adjust the create and delter plugin in drawer --- .../create-delete-in-drawer-plugin.spec.js | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js b/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js index c80de147d9..220f352199 100644 --- a/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js +++ b/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js @@ -26,23 +26,28 @@ context('Create and Delete Plugin List', () => { cy.fixture('data.json').as('data'); }); - it('should visit plugin market', function () { - cy.visit('/'); - cy.contains('Plugin').click(); - cy.contains('Create').click(); - cy.fixture('plugin-dataset.json').as('cases'); - cy.get('@cases').then((cases) => { - cy.configurePlugins(cases); - }); - }); + // it('should visit plugin market', function () { + // cy.visit('/'); + // cy.contains('Plugin').click(); + // cy.contains('Create').click(); + // cy.wait(3000); + // cy.fixture('plugin-dataset.json').as('cases'); + // cy.get('@cases').then((cases) => { + // cy.configurePlugins(cases); + // }); + // }); it('should delete the plugin in drawer', function () { cy.visit('/plugin/list'); cy.get(this.domSelector.refresh).click(); - cy.get('.ant-btn-primary').each(function ($el) { + cy.get(this.domSelector.paginationOptions).click(); + cy.contains('50 / page').should('be.visible').click(); + cy.get(this.domSelector.fiftyPerPage).should('exist'); + cy.location('href').should('include', 'pageSize=50'); + cy.get('.ant-btn-primary').should('exist').each(function ($el) { if ($el.text() === 'Edit') { cy.wrap($el).click(); - cy.get('.ant-drawer-footer').contains('button', 'Delete').click(); + cy.get('.ant-drawer-footer').contains('button', 'Delete').click({ force: true }); cy.contains('button', 'Confirm').click({ force: true }); } }); From bb289923d0cc5cdf5436bdc74f77ad41e7baadf3 Mon Sep 17 00:00:00 2001 From: Cliff Su Date: Sun, 21 Mar 2021 15:58:57 +0800 Subject: [PATCH 09/14] test: adjust the create and delter plugin in drawer --- .../create-delete-in-drawer-plugin.spec.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js b/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js index 220f352199..d60b1a4342 100644 --- a/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js +++ b/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js @@ -26,16 +26,15 @@ context('Create and Delete Plugin List', () => { cy.fixture('data.json').as('data'); }); - // it('should visit plugin market', function () { - // cy.visit('/'); - // cy.contains('Plugin').click(); - // cy.contains('Create').click(); - // cy.wait(3000); - // cy.fixture('plugin-dataset.json').as('cases'); - // cy.get('@cases').then((cases) => { - // cy.configurePlugins(cases); - // }); - // }); + it('should visit plugin market', function () { + cy.visit('/'); + cy.contains('Plugin').click(); + cy.contains('Create').click(); + cy.fixture('plugin-dataset.json').as('cases'); + cy.get('@cases').then((cases) => { + cy.configurePlugins(cases); + }); + }); it('should delete the plugin in drawer', function () { cy.visit('/plugin/list'); From 13674774992f15efbd9f1e54353eb0e5338c5507 Mon Sep 17 00:00:00 2001 From: Cliff Su Date: Sun, 21 Mar 2021 17:21:15 +0800 Subject: [PATCH 10/14] test: adjust the create and delter plugin in drawer --- .../integration/plugin/create-delete-in-drawer-plugin.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js b/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js index d60b1a4342..86561a0974 100644 --- a/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js +++ b/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js @@ -43,10 +43,10 @@ context('Create and Delete Plugin List', () => { cy.contains('50 / page').should('be.visible').click(); cy.get(this.domSelector.fiftyPerPage).should('exist'); cy.location('href').should('include', 'pageSize=50'); - cy.get('.ant-btn-primary').should('exist').each(function ($el) { + cy.get('.ant-btn-primary', { timeout }).should('exist').each(function ($el) { if ($el.text() === 'Edit') { cy.wrap($el).click(); - cy.get('.ant-drawer-footer').contains('button', 'Delete').click({ force: true }); + cy.get('.ant-drawer-footer').contains('button', 'Delete').click(); cy.contains('button', 'Confirm').click({ force: true }); } }); From 99a42752b835bfb139f79861849dcb608f879b86 Mon Sep 17 00:00:00 2001 From: Cliff Su Date: Sun, 21 Mar 2021 20:32:20 +0800 Subject: [PATCH 11/14] test: adjust the create and delter plugin in drawer --- .../create-delete-in-drawer-plugin.spec.js | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js b/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js index 86561a0974..7d97f9ab36 100644 --- a/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js +++ b/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js @@ -26,30 +26,30 @@ context('Create and Delete Plugin List', () => { cy.fixture('data.json').as('data'); }); - it('should visit plugin market', function () { + it('should visit plugin market and create plugin', function () { cy.visit('/'); cy.contains('Plugin').click(); cy.contains('Create').click(); - cy.fixture('plugin-dataset.json').as('cases'); - cy.get('@cases').then((cases) => { - cy.configurePlugins(cases); + + cy.contains('basic-auth').parents('.ant-card-bordered').within(() => { + cy.get('button').click({ force: true }); + }); + + cy.get('.ant-drawer-content').should('be.visible').within(() => { + cy.get('#disable').click(); + cy.get('.ant-switch-checked').should('exist'); }); + + cy.contains('button', 'Submit').click(); + cy.get('.ant-drawer-content', { timeout }).should('not.exist'); }); it('should delete the plugin in drawer', function () { cy.visit('/plugin/list'); cy.get(this.domSelector.refresh).click(); - cy.get(this.domSelector.paginationOptions).click(); - cy.contains('50 / page').should('be.visible').click(); - cy.get(this.domSelector.fiftyPerPage).should('exist'); - cy.location('href').should('include', 'pageSize=50'); - cy.get('.ant-btn-primary', { timeout }).should('exist').each(function ($el) { - if ($el.text() === 'Edit') { - cy.wrap($el).click(); - cy.get('.ant-drawer-footer').contains('button', 'Delete').click(); - cy.contains('button', 'Confirm').click({ force: true }); - } - }); + cy.contains('button', 'Edit').click(); + cy.get('.ant-drawer-footer').contains('button', 'Delete').click({ force: true }); + cy.contains('button', 'Confirm').click({ force: true }); cy.get(this.domSelector.empty).should('be.visible'); }); }); From 2a561acfe6c9bce705c8b30019131526e99a8b81 Mon Sep 17 00:00:00 2001 From: Cliff Su Date: Sun, 21 Mar 2021 21:30:34 +0800 Subject: [PATCH 12/14] test: adjust the create and delter plugin in drawer --- .../route/create-edit-delete-route.spec.js | 24 +++++++++++++++---- .../create-edit-delete-service.spec.js | 22 +++++++++++++++++ 2 files changed, 41 insertions(+), 5 deletions(-) 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 86d9fb261d..cf6d4dee4e 100644 --- a/web/cypress/integration/route/create-edit-delete-route.spec.js +++ b/web/cypress/integration/route/create-edit-delete-route.spec.js @@ -20,6 +20,7 @@ context('Create and Delete Route', () => { const name = `routeName${new Date().valueOf()}`; const newName = `newName${new Date().valueOf()}`; const sleepTime = 100; + const timeout = 5000; beforeEach(() => { cy.login(); @@ -72,12 +73,25 @@ context('Create and Delete Route', () => { }); // config prometheus plugin - cy.contains(this.domSelector.pluginCard, 'prometheus').within(() => { - cy.get('button').first().click({ - force: true - }); + cy.contains('prometheus').parents('.ant-card-bordered').within(() => { + cy.get('button').click({ force: true }); + }); + + cy.get('.ant-drawer-content').should('be.visible').within(() => { + cy.get('#disable').click(); + cy.get('.ant-switch-checked').should('exist'); + }); + + cy.contains('button', 'Submit').click(); + cy.get('.ant-drawer-content', { timeout }).should('not.exist'); + + cy.contains('prometheus').parents('.ant-card-bordered').within(() => { + cy.get('button').click({ force: true }); }); - cy.contains('button', 'Cancel').click(); + + cy.get('.ant-drawer-footer').contains('button', 'Delete').click({ force: true }); + cy.contains('button', 'Confirm').click({ force: true }); + cy.contains('Next').click(); cy.contains('Submit').click(); cy.contains(this.data.submitSuccess); diff --git a/web/cypress/integration/service/create-edit-delete-service.spec.js b/web/cypress/integration/service/create-edit-delete-service.spec.js index 83f5641b12..c5e60ec64b 100644 --- a/web/cypress/integration/service/create-edit-delete-service.spec.js +++ b/web/cypress/integration/service/create-edit-delete-service.spec.js @@ -17,6 +17,8 @@ /* eslint-disable no-undef */ context('Create and Delete Service ', () => { + const timeout = 5000; + beforeEach(() => { cy.login(); @@ -35,6 +37,26 @@ context('Create and Delete Service ', () => { cy.get(this.domSelector.nodes_0_host).type(this.data.ip1); cy.contains('Next').click(); + + cy.contains('prometheus').parents('.ant-card-bordered').within(() => { + cy.get('button').click({ force: true }); + }); + + cy.get('.ant-drawer-content').should('be.visible').within(() => { + cy.get('#disable').click(); + cy.get('.ant-switch-checked').should('exist'); + }); + + cy.contains('button', 'Submit').click(); + cy.get('.ant-drawer-content', { timeout }).should('not.exist'); + + cy.contains('prometheus').parents('.ant-card-bordered').within(() => { + cy.get('button').click({ force: true }); + }); + + cy.get('.ant-drawer-footer').contains('button', 'Delete').click({ force: true }); + cy.contains('button', 'Confirm').click({ force: true }); + cy.contains('Next').click(); cy.contains('Submit').click(); cy.get(this.domSelector.notification).should('contain', this.data.createServiceSuccess); From b7857f0c409ad8fd071764c0dcc490d145c22782 Mon Sep 17 00:00:00 2001 From: Cliff Su Date: Mon, 22 Mar 2021 08:32:23 +0800 Subject: [PATCH 13/14] test: adjust test data.json and selector.json files --- web/cypress/fixtures/data.json | 1 + web/cypress/fixtures/selector.json | 5 ++++ .../create-delete-in-drawer-plugin.spec.js | 16 ++++++------- .../route/create-edit-delete-route.spec.js | 23 ++++++++++++------- .../create-edit-delete-service.spec.js | 21 +++++++++++------ 5 files changed, 43 insertions(+), 23 deletions(-) diff --git a/web/cypress/fixtures/data.json b/web/cypress/fixtures/data.json index 94be061069..7f7b0fb8e5 100644 --- a/web/cypress/fixtures/data.json +++ b/web/cypress/fixtures/data.json @@ -14,6 +14,7 @@ "serviceName2": "test_service2", "routeName": "test_route", "consumerName": "test_consumer", + "basicAuthPlugin": "basic-auth", "ip1": "127.0.0.1", "ip2": "127.0.0.2", "host1": "11.11.11.11", diff --git a/web/cypress/fixtures/selector.json b/web/cypress/fixtures/selector.json index 121adf187f..6a2c165672 100644 --- a/web/cypress/fixtures/selector.json +++ b/web/cypress/fixtures/selector.json @@ -11,13 +11,18 @@ "errorNotification:": ".ant-notification-notice-error", "pluginCard": ".ant-card", + "pluginCardBordered": ".ant-card-bordered", "pageContent": ".ant-pro-page-container", + "drawerContent": ".ant-drawer-content", + "drawerFooter": ".ant-drawer-footer", + "tableCell": ".ant-table-cell", "empty": ".ant-empty-normal", "refresh": ".anticon-reload", "codemirror": ".CodeMirror", "disabledSwitcher": "#disable", + "checkedSwitcher": ".ant-switch-checked", "deleteButton": ".ant-btn-dangerous", "name": "#name", diff --git a/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js b/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js index 7d97f9ab36..10c9a24303 100644 --- a/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js +++ b/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js @@ -16,7 +16,7 @@ */ /* eslint-disable no-undef */ -context('Create and Delete Plugin List', () => { +context('Delete Plugin List with the Drawer', () => { const timeout = 5000; beforeEach(() => { @@ -31,24 +31,24 @@ context('Create and Delete Plugin List', () => { cy.contains('Plugin').click(); cy.contains('Create').click(); - cy.contains('basic-auth').parents('.ant-card-bordered').within(() => { + cy.contains(this.data.basicAuthPlugin).parents(this.domSelector.pluginCardBordered).within(() => { cy.get('button').click({ force: true }); }); - cy.get('.ant-drawer-content').should('be.visible').within(() => { - cy.get('#disable').click(); - cy.get('.ant-switch-checked').should('exist'); + cy.get(this.domSelector.drawerContent).should('be.visible').within(() => { + cy.get(this.domSelector.disabledSwitcher).click(); + cy.get(this.domSelector.checkedSwitcher).should('exist'); }); cy.contains('button', 'Submit').click(); - cy.get('.ant-drawer-content', { timeout }).should('not.exist'); + cy.get(this.domSelector.drawerContent, { timeout }).should('not.exist'); }); - it('should delete the plugin in drawer', function () { + it('should delete the plugin with the drawer', function () { cy.visit('/plugin/list'); cy.get(this.domSelector.refresh).click(); cy.contains('button', 'Edit').click(); - cy.get('.ant-drawer-footer').contains('button', 'Delete').click({ force: true }); + cy.get(this.domSelector.drawerFooter).contains('button', 'Delete').click({ force: true }); cy.contains('button', 'Confirm').click({ force: true }); cy.get(this.domSelector.empty).should('be.visible'); }); 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 cf6d4dee4e..0d4df02bb8 100644 --- a/web/cypress/integration/route/create-edit-delete-route.spec.js +++ b/web/cypress/integration/route/create-edit-delete-route.spec.js @@ -72,26 +72,33 @@ context('Create and Delete Route', () => { }); }); - // config prometheus plugin - cy.contains('prometheus').parents('.ant-card-bordered').within(() => { + // config basic auth plugin + cy.contains(this.data.basicAuthPlugin).parents(this.domSelector.pluginCardBordered).within(() => { cy.get('button').click({ force: true }); }); - cy.get('.ant-drawer-content').should('be.visible').within(() => { - cy.get('#disable').click(); - cy.get('.ant-switch-checked').should('exist'); + cy.get(this.domSelector.drawerContent).should('be.visible').within(() => { + cy.get(this.domSelector.disabledSwitcher).click(); + cy.get(this.domSelector.checkedSwitcher).should('exist'); }); cy.contains('button', 'Submit').click(); - cy.get('.ant-drawer-content', { timeout }).should('not.exist'); + cy.get(this.domSelector.drawerContent, { timeout }).should('not.exist'); - cy.contains('prometheus').parents('.ant-card-bordered').within(() => { + cy.contains(this.data.basicAuthPlugin).parents(this.domSelector.pluginCardBordered).within(() => { cy.get('button').click({ force: true }); }); - cy.get('.ant-drawer-footer').contains('button', 'Delete').click({ force: true }); + cy.get(this.domSelector.drawerFooter).contains('button', 'Delete').click({ force: true }); cy.contains('button', 'Confirm').click({ force: true }); + cy.contains(this.data.basicAuthPlugin).parents(this.domSelector.pluginCardBordered).within(() => { + cy.get('button').click({ force: true }); + }); + + cy.get(this.domSelector.drawerFooter).contains('button', 'Delete').should('not.exist'); + cy.contains('button', 'Cancel').click({ force: true }); + cy.contains('Next').click(); cy.contains('Submit').click(); cy.contains(this.data.submitSuccess); diff --git a/web/cypress/integration/service/create-edit-delete-service.spec.js b/web/cypress/integration/service/create-edit-delete-service.spec.js index c5e60ec64b..508e58e68a 100644 --- a/web/cypress/integration/service/create-edit-delete-service.spec.js +++ b/web/cypress/integration/service/create-edit-delete-service.spec.js @@ -38,25 +38,32 @@ context('Create and Delete Service ', () => { cy.contains('Next').click(); - cy.contains('prometheus').parents('.ant-card-bordered').within(() => { + cy.contains(this.data.basicAuthPlugin).parents(this.domSelector.pluginCardBordered).within(() => { cy.get('button').click({ force: true }); }); - cy.get('.ant-drawer-content').should('be.visible').within(() => { - cy.get('#disable').click(); - cy.get('.ant-switch-checked').should('exist'); + cy.get(this.domSelector.drawerContent).should('be.visible').within(() => { + cy.get(this.domSelector.disabledSwitcher).click(); + cy.get(this.domSelector.checkedSwitcher).should('exist'); }); cy.contains('button', 'Submit').click(); - cy.get('.ant-drawer-content', { timeout }).should('not.exist'); + cy.get(this.domSelector.drawerContent, { timeout }).should('not.exist'); - cy.contains('prometheus').parents('.ant-card-bordered').within(() => { + cy.contains(this.data.basicAuthPlugin).parents(this.domSelector.pluginCardBordered).within(() => { cy.get('button').click({ force: true }); }); - cy.get('.ant-drawer-footer').contains('button', 'Delete').click({ force: true }); + cy.get(this.domSelector.drawerFooter).contains('button', 'Delete').click({ force: true }); cy.contains('button', 'Confirm').click({ force: true }); + cy.contains(this.data.basicAuthPlugin).parents(this.domSelector.pluginCardBordered).within(() => { + cy.get('button').click({ force: true }); + }); + + cy.get(this.domSelector.drawerFooter).contains('button', 'Delete').should('not.exist'); + cy.contains('button', 'Cancel').click({ force: true }); + cy.contains('Next').click(); cy.contains('Submit').click(); cy.get(this.domSelector.notification).should('contain', this.data.createServiceSuccess); From 34b2d85662100948c505c8fddd701fad3a0a75ed Mon Sep 17 00:00:00 2001 From: Cliff Su Date: Mon, 22 Mar 2021 17:33:31 +0800 Subject: [PATCH 14/14] test: adjust test data.json and selector.json files --- web/cypress/fixtures/selector.json | 4 +--- .../integration/plugin/create-delete-in-drawer-plugin.spec.js | 4 ++-- .../integration/route/create-edit-delete-route.spec.js | 4 ++-- .../integration/service/create-edit-delete-service.spec.js | 4 ++-- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/web/cypress/fixtures/selector.json b/web/cypress/fixtures/selector.json index 6a2c165672..2b9e0728ae 100644 --- a/web/cypress/fixtures/selector.json +++ b/web/cypress/fixtures/selector.json @@ -14,9 +14,6 @@ "pluginCardBordered": ".ant-card-bordered", "pageContent": ".ant-pro-page-container", - "drawerContent": ".ant-drawer-content", - "drawerFooter": ".ant-drawer-footer", - "tableCell": ".ant-table-cell", "empty": ".ant-empty-normal", "refresh": ".anticon-reload", @@ -70,6 +67,7 @@ "usernameInput": "#control-ref_username", "passwordInput": "#control-ref_password", "drawer": ".ant-drawer-content", + "drawerFooter": ".ant-drawer-footer", "codemirrorScroll": ".CodeMirror-scroll", "drawerClose": ".ant-drawer-close", "descriptionSelector": "[title=Description]", diff --git a/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js b/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js index 10c9a24303..dfc70ef673 100644 --- a/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js +++ b/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js @@ -35,13 +35,13 @@ context('Delete Plugin List with the Drawer', () => { cy.get('button').click({ force: true }); }); - cy.get(this.domSelector.drawerContent).should('be.visible').within(() => { + cy.get(this.domSelector.drawer).should('be.visible').within(() => { cy.get(this.domSelector.disabledSwitcher).click(); cy.get(this.domSelector.checkedSwitcher).should('exist'); }); cy.contains('button', 'Submit').click(); - cy.get(this.domSelector.drawerContent, { timeout }).should('not.exist'); + cy.get(this.domSelector.drawer, { timeout }).should('not.exist'); }); it('should delete the plugin with the drawer', function () { 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 0d4df02bb8..d0f4e83e1a 100644 --- a/web/cypress/integration/route/create-edit-delete-route.spec.js +++ b/web/cypress/integration/route/create-edit-delete-route.spec.js @@ -77,13 +77,13 @@ context('Create and Delete Route', () => { cy.get('button').click({ force: true }); }); - cy.get(this.domSelector.drawerContent).should('be.visible').within(() => { + cy.get(this.domSelector.drawer).should('be.visible').within(() => { cy.get(this.domSelector.disabledSwitcher).click(); cy.get(this.domSelector.checkedSwitcher).should('exist'); }); cy.contains('button', 'Submit').click(); - cy.get(this.domSelector.drawerContent, { timeout }).should('not.exist'); + cy.get(this.domSelector.drawer, { timeout }).should('not.exist'); cy.contains(this.data.basicAuthPlugin).parents(this.domSelector.pluginCardBordered).within(() => { cy.get('button').click({ force: true }); diff --git a/web/cypress/integration/service/create-edit-delete-service.spec.js b/web/cypress/integration/service/create-edit-delete-service.spec.js index 508e58e68a..70ba29af0f 100644 --- a/web/cypress/integration/service/create-edit-delete-service.spec.js +++ b/web/cypress/integration/service/create-edit-delete-service.spec.js @@ -42,13 +42,13 @@ context('Create and Delete Service ', () => { cy.get('button').click({ force: true }); }); - cy.get(this.domSelector.drawerContent).should('be.visible').within(() => { + cy.get(this.domSelector.drawer).should('be.visible').within(() => { cy.get(this.domSelector.disabledSwitcher).click(); cy.get(this.domSelector.checkedSwitcher).should('exist'); }); cy.contains('button', 'Submit').click(); - cy.get(this.domSelector.drawerContent, { timeout }).should('not.exist'); + cy.get(this.domSelector.drawer, { timeout }).should('not.exist'); cy.contains(this.data.basicAuthPlugin).parents(this.domSelector.pluginCardBordered).within(() => { cy.get('button').click({ force: true });