-
Notifications
You must be signed in to change notification settings - Fork 527
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add plugin template config feature (#1540)
Co-authored-by: guoqqqi <979918879@qq.com>
- Loading branch information
Showing
35 changed files
with
925 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,3 +51,6 @@ api/build-tools/apisix | |
api/coverage.txt | ||
api/dag-to-lua/ | ||
|
||
# frontend e2e test output | ||
web/.nyc_output | ||
web/coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
web/cypress/integration/pluginTemplate/create-edit-delete-plugin-template.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/* | ||
* 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 Edit and Delete PluginTemplate', () => { | ||
const timeout = 5000; | ||
beforeEach(() => { | ||
cy.login(); | ||
|
||
cy.fixture('selector.json').as('domSelector'); | ||
cy.fixture('data.json').as('data'); | ||
}); | ||
|
||
it('should create pluginTemplate', function () { | ||
cy.visit('/'); | ||
cy.contains('Route').click(); | ||
cy.contains('Plugin Template Config').click(); | ||
cy.contains('Create').click(); | ||
|
||
cy.get(this.domSelector.description).type(this.data.pluginTemplateName); | ||
cy.contains('Next').click(); | ||
cy.contains('Enable').click({ | ||
force: true | ||
}); | ||
cy.focused(this.domSelector.drawer).should('exist'); | ||
cy.get(this.domSelector.drawer, { | ||
timeout | ||
}).within(() => { | ||
cy.get(this.domSelector.disabledSwitcher).click({ | ||
force: true, | ||
}); | ||
}); | ||
cy.contains('Submit').click(); | ||
cy.contains('Next').click(); | ||
cy.contains('Submit').click(); | ||
cy.get(this.domSelector.notification).should('contain', this.data.createPluginTemplateSuccess); | ||
}); | ||
|
||
it('should edit the pluginTemplate', function () { | ||
cy.visit('plugin-template/list'); | ||
|
||
cy.get(this.domSelector.refresh).click(); | ||
cy.get(this.domSelector.descriptionSelector).type(this.data.pluginTemplateName); | ||
cy.contains('button', 'Search').click(); | ||
cy.contains(this.data.pluginTemplateName).siblings().contains('Edit').click(); | ||
|
||
cy.get(this.domSelector.description).clear().type(this.data.pluginTemplateName2); | ||
cy.contains('Next').click(); | ||
cy.contains('Next').click(); | ||
cy.contains('Submit').click(); | ||
|
||
cy.get(this.domSelector.notification).should('contain', this.data.editPluginTemplateSuccess); | ||
}); | ||
|
||
it('should delete pluginTemplate', function () { | ||
cy.visit('plugin-template/list'); | ||
|
||
cy.get(this.domSelector.refresh).click(); | ||
cy.get(this.domSelector.descriptionSelector).type(this.data.pluginTemplateName); | ||
cy.contains('button', 'Search').click(); | ||
cy.get(this.domSelector.empty).should('exist'); | ||
|
||
cy.contains('button', 'Reset').click(); | ||
cy.get(this.domSelector.descriptionSelector).type(this.data.pluginTemplateName2); | ||
cy.contains('button', 'Search').click(); | ||
cy.contains(this.data.pluginTemplateName2).siblings().contains('Delete').click(); | ||
cy.contains('button', 'Confirm').click(); | ||
cy.get(this.domSelector.notification).should('contain', this.data.deletePluginTemplateSuccess); | ||
}); | ||
}); |
102 changes: 102 additions & 0 deletions
102
web/cypress/integration/pluginTemplate/create-plugin-template-with-route.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
/* | ||
* 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 PluginTemplate Binding To Route', () => { | ||
beforeEach(() => { | ||
cy.login(); | ||
|
||
cy.fixture('selector.json').as('domSelector'); | ||
cy.fixture('data.json').as('data'); | ||
}); | ||
|
||
it('should create test pluginTemplate', function () { | ||
cy.visit('/'); | ||
cy.contains('Route').click(); | ||
cy.contains('Plugin Template Config').click(); | ||
cy.contains('Create').click(); | ||
cy.get(this.domSelector.description).type(this.data.pluginTemplateName); | ||
cy.contains('Next').click(); | ||
cy.contains('Next').click(); | ||
cy.contains('Submit').click(); | ||
cy.get(this.domSelector.notification).should('contain', this.data.createPluginTemplateSuccess); | ||
|
||
cy.visit('routes/list'); | ||
cy.contains('Create').click(); | ||
cy.get(this.domSelector.name).type(this.data.routeName); | ||
cy.contains('Next').click(); | ||
cy.get(this.domSelector.nodes_0_host).type(this.data.ip1); | ||
cy.contains('Next').click(); | ||
cy.get(this.domSelector.customSelector).click(); | ||
cy.contains(this.data.pluginTemplateName).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'); | ||
}); | ||
|
||
it('should delete the pluginTemplate failure', function () { | ||
cy.visit('plugin-template/list'); | ||
cy.get(this.domSelector.refresh).click(); | ||
|
||
cy.get(this.domSelector.descriptionSelector).type(this.data.pluginTemplateName); | ||
cy.contains('button', 'Search').click(); | ||
cy.contains(this.data.pluginTemplateName).siblings().contains('Delete').click(); | ||
cy.contains('button', 'Confirm').click(); | ||
cy.get(this.domSelector.notification).should('contain', this.data.pluginTemplateErrorAlert); | ||
cy.get(this.domSelector.errorAlertClose).should('be.visible').click(); | ||
}); | ||
|
||
it('should edit the route with pluginTemplate', function () { | ||
cy.visit('routes/list'); | ||
|
||
cy.get(this.domSelector.nameSelector).type(this.data.routeName); | ||
cy.contains('Search').click(); | ||
cy.contains(this.data.routeName).siblings().contains('Edit').click(); | ||
|
||
cy.contains('Forbidden').click(); | ||
cy.contains('Custom').click(); | ||
cy.get(this.domSelector.redirectURIInput).clear().type('123'); | ||
cy.get(this.domSelector.redirectCodeSelector).click(); | ||
cy.contains('301(Permanent Redirect)').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'); | ||
}); | ||
|
||
it('should delete the pluginTemplate successfully', function () { | ||
cy.visit('plugin-template/list'); | ||
|
||
cy.get(this.domSelector.refresh).click(); | ||
cy.get(this.domSelector.descriptionSelector).type(this.data.pluginTemplateName); | ||
cy.contains('button', 'Search').click(); | ||
cy.contains(this.data.pluginTemplateName).siblings().contains('Delete').click(); | ||
cy.contains('button', 'Confirm').click(); | ||
cy.get(this.domSelector.notification).should('contain', this.data.deletePluginTemplateSuccess); | ||
|
||
cy.visit('/routes/list'); | ||
cy.get(this.domSelector.nameSelector).type(this.data.routeName); | ||
cy.contains('Search').click(); | ||
cy.contains(this.data.routeName).siblings().contains('Delete').click(); | ||
cy.contains('button', 'Confirm').click(); | ||
cy.get(this.domSelector.notification).should('contain', this.data.deleteRouteSuccess); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* 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. | ||
*/ | ||
export { default } from './LabelsDrawer'; |
Oops, something went wrong.