diff --git a/web/cypress/fixtures/plugin-list.json b/web/cypress/fixtures/plugin-list.json deleted file mode 100644 index 587b28e331..0000000000 --- a/web/cypress/fixtures/plugin-list.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "api-breaker": [ - { - "data": { - "break_response_code": 502, - "disable": false, - "healthy": { - "successes": 3 - }, - "max_breaker_sec": 10, - "unhealthy": { - "failures": 1, - "http_statuses": [500, 503] - } - } - } - ], - "echo": [ - { - "data": { - "before_body": "before the body modification ", - "disable": false - } - } - ], - "jwt-auth": [ - { - "data": { - "disable": false - } - } - ], - "hmac-auth": [ - { - "data": {} - } - ] -} diff --git a/web/cypress/integration/plugin/create-edit-delete-plugin.spec.js b/web/cypress/integration/plugin/create-edit-delete-plugin.spec.js index d4348fd850..017a5cd584 100644 --- a/web/cypress/integration/plugin/create-edit-delete-plugin.spec.js +++ b/web/cypress/integration/plugin/create-edit-delete-plugin.spec.js @@ -18,24 +18,20 @@ context('Create and Delete Plugin List', () => { const timeout = 5000; - const data = { - name: 'hmac-auth', - }; beforeEach(() => { cy.login(); - cy.fixture('plugin-list.json').as('cases'); cy.fixture('selector.json').as('domSelector'); cy.fixture('data.json').as('data'); + cy.fixture('plugin-dataset.json').as('cases'); }); - it('should create plugins', function () { + it('should visit plugin market', function () { cy.visit('/'); cy.contains('Plugin').click(); cy.contains('Create').click(); - // add test plugins cy.get('@cases').then((cases) => { cy.configurePlugins(cases); }); @@ -43,27 +39,26 @@ context('Create and Delete Plugin List', () => { it('should edit the plugin', function () { cy.visit('/plugin/list'); + cy.get(this.domSelector.refresh).click(); - cy.contains(data.name).should('exist').siblings().contains('Edit').click({ - force: true, - }); + cy.contains('Edit').click(); cy.get(this.domSelector.codemirror) .first() .then(() => { cy.get(this.domSelector.disabledSwitcher).click(); cy.contains('button', 'Submit').click(); }); - cy.contains(data.name).should('not.exist'); }); it('should delete plugin list', function () { cy.visit('/plugin/list'); - cy.get(this.domSelector.deleteButton, { timeout }).each(function ($el) { + cy.get(this.domSelector.refresh).click(); + cy.get(this.domSelector.deleteButton, { timeout }).should('exist').each(function ($el) { cy.wrap($el).click().click({ timeout }); cy.contains('button', 'Confirm').click({ force: true }); cy.get(this.domSelector.notification).should('contain', this.data.deletePluginSuccess); - cy.get(this.domSelector.notificationCloseIcon).click(); + cy.get(this.domSelector.notificationCloseIcon).click().should('not.exist'); }); // check if plugin list is empty diff --git a/web/cypress/integration/plugin/schema-smocktest.spec.js b/web/cypress/integration/plugin/schema-smocktest.spec.js deleted file mode 100644 index 65510525f1..0000000000 --- a/web/cypress/integration/plugin/schema-smocktest.spec.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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('smoke test for plugin schema', () => { - beforeEach(() => { - cy.login(); - - cy.fixture('selector.json').as('selector'); - cy.fixture('plugin-dataset.json').as('cases'); - }); - - it('should visit plugin market', function () { - cy.visit('/'); - cy.contains('Plugin').click(); - cy.contains('Create').click(); - - cy.get('@cases').then((cases) => { - cy.configurePlugins(cases); - }); - }); -}); diff --git a/web/cypress/support/commands.js b/web/cypress/support/commands.js index 2fb03a7cf2..59e8ad5b0d 100644 --- a/web/cypress/support/commands.js +++ b/web/cypress/support/commands.js @@ -62,7 +62,7 @@ Cypress.Commands.add('configurePlugins', (cases) => { }); // NOTE: wait for the Drawer to appear on the DOM - cy.wait(300); + cy.focused(domSelectors.drawer).should('exist'); cy.get(domSelectors.drawer, { timeout }).within(() => { cy.get(domSelectors.switch).click({ force: true, @@ -73,20 +73,21 @@ Cypress.Commands.add('configurePlugins', (cases) => { if (codemirror) { codemirror.setValue(JSON.stringify(data)); } + cy.get(domSelectors.drawer).should('exist'); cy.get(domSelectors.drawer, { timeout }).within(() => { cy.contains('Submit').click({ force: true, }); + cy.get(domSelectors.drawer).should('not.exist'); }); }); - cy.wait(300); if (shouldValid === true) { cy.get(domSelectors.drawer).should('not.exist'); } else if (shouldValid === false) { - cy.get(this.selector.notification).should('contain', 'Invalid plugin data'); + cy.get(this.domSelector.notification).should('contain', 'Invalid plugin data'); - cy.get(domSelectors.close).click({ + cy.get(domSelectors.close).should('be.visible').click({ force: true, multiple: true, });