-
Notifications
You must be signed in to change notification settings - Fork 534
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into limit-count-plugin-form
- Loading branch information
Showing
27 changed files
with
1,811 additions
and
31 deletions.
There are no files selected for viewing
101 changes: 101 additions & 0 deletions
101
web/cypress/integration/consumer/create-consumer-with-api-breaker-plugin-form.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,101 @@ | ||
/* | ||
* 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 consumer with api-breaker plugin form', () => { | ||
beforeEach(() => { | ||
cy.login(); | ||
|
||
cy.fixture('selector.json').as('domSelector'); | ||
cy.fixture('data.json').as('data'); | ||
}); | ||
|
||
const selector = { | ||
break_response_code: "#break_response_code" | ||
} | ||
|
||
const data = { | ||
break_response_code: 200, | ||
} | ||
|
||
it('creates consumer with api-breaker form', function () { | ||
cy.visit('/'); | ||
cy.contains('Consumer').click(); | ||
cy.get(this.domSelector.empty).should('be.visible'); | ||
cy.contains('Create').click(); | ||
// basic information | ||
cy.get(this.domSelector.username).type(this.data.consumerName); | ||
cy.get(this.domSelector.description).type(this.data.description); | ||
cy.contains('Next').click(); | ||
|
||
// config auth plugin | ||
cy.contains(this.domSelector.pluginCard, 'key-auth').within(() => { | ||
cy.contains('Enable').click({ | ||
force: true, | ||
}); | ||
}); | ||
cy.focused(this.domSelector.drawer).should('exist'); | ||
cy.get(this.domSelector.disabledSwitcher).click(); | ||
// edit codemirror | ||
cy.get(this.domSelector.codeMirror) | ||
.first() | ||
.then((editor) => { | ||
editor[0].CodeMirror.setValue( | ||
JSON.stringify({ | ||
key: 'test', | ||
}), | ||
); | ||
cy.contains('button', 'Submit').click(); | ||
}); | ||
|
||
cy.contains(this.domSelector.pluginCard, 'api-breaker').within(() => { | ||
cy.contains('Enable').click({ | ||
force: true, | ||
}); | ||
}); | ||
|
||
cy.focused(this.domSelector.drawer).should('exist'); | ||
|
||
// config api-breaker form | ||
cy.get(this.domSelector.drawer).within(() => { | ||
cy.contains('Submit').click({ | ||
force: true, | ||
}); | ||
}); | ||
cy.get(this.domSelector.notification).should('contain', 'Invalid plugin data'); | ||
|
||
cy.get(selector.break_response_code).type(data.break_response_code); | ||
cy.get(this.domSelector.disabledSwitcher).click(); | ||
cy.get(this.domSelector.drawer).within(() => { | ||
cy.contains('Submit').click({ | ||
force: true, | ||
}); | ||
}); | ||
cy.get(this.domSelector.drawer).should('not.exist'); | ||
|
||
cy.contains('button', 'Next').click(); | ||
cy.contains('button', 'Submit').click(); | ||
cy.get(this.domSelector.notification).should('contain', this.data.createConsumerSuccess); | ||
}); | ||
|
||
it('delete the consumer', function () { | ||
cy.visit('/consumer/list'); | ||
cy.contains(this.data.consumerName).should('be.visible').siblings().contains('Delete').click(); | ||
cy.contains('button', 'Confirm').click(); | ||
cy.get(this.domSelector.notification).should('contain', this.data.deleteConsumerSuccess); | ||
}); | ||
}); |
103 changes: 103 additions & 0 deletions
103
web/cypress/integration/consumer/create-consumer-with-proxy-mirror-form.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,103 @@ | ||
/* | ||
* 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 consumer with proxy-mirror plugin form', () => { | ||
beforeEach(() => { | ||
cy.login(); | ||
|
||
cy.fixture('selector.json').as('domSelector'); | ||
cy.fixture('data.json').as('data'); | ||
}); | ||
|
||
const selector = { | ||
host: "#host", | ||
alert: "[role=alert]" | ||
} | ||
|
||
it('should create consumer with proxy-mirror form', function () { | ||
cy.visit('/'); | ||
cy.contains('Consumer').click(); | ||
cy.get(this.domSelector.empty).should('be.visible'); | ||
cy.contains('Create').click(); | ||
// basic information | ||
cy.get(this.domSelector.username).type(this.data.consumerName); | ||
cy.get(this.domSelector.description).type(this.data.description); | ||
cy.contains('Next').click(); | ||
|
||
// config auth plugin | ||
cy.contains(this.domSelector.pluginCard, 'key-auth').within(() => { | ||
cy.contains('Enable').click({ | ||
force: true, | ||
}); | ||
}); | ||
cy.focused(this.domSelector.drawer).should('exist'); | ||
cy.get(this.domSelector.disabledSwitcher).click(); | ||
// edit codemirror | ||
cy.get(this.domSelector.codeMirror) | ||
.first() | ||
.then((editor) => { | ||
editor[0].CodeMirror.setValue( | ||
JSON.stringify({ | ||
key: 'test', | ||
}), | ||
); | ||
cy.contains('button', 'Submit').click(); | ||
}); | ||
|
||
cy.contains(this.domSelector.pluginCard, 'proxy-mirror').within(() => { | ||
cy.contains('Enable').click({ | ||
force: true, | ||
}); | ||
}); | ||
|
||
cy.focused(this.domSelector.drawer).should('exist'); | ||
|
||
// config proxy-mirror form with wrong host | ||
cy.get(selector.host).type('127.0.0.1:1999'); | ||
cy.get(selector.alert).contains('address needs to contain schema: http or https, not URI part'); | ||
cy.get(this.domSelector.drawer).within(() => { | ||
cy.contains('Submit').click({ | ||
force: true, | ||
}); | ||
}); | ||
cy.get(this.domSelector.notification).should('contain', 'Invalid plugin data'); | ||
cy.get(this.domSelector.notificationCloseIcon).click(); | ||
|
||
// config proxy-mirror form with correct host | ||
cy.get(selector.host).clear().type('http://127.0.0.1:1999'); | ||
cy.get(selector.alert).should('not.exist'); | ||
cy.get(this.domSelector.disabledSwitcher).click(); | ||
cy.get(this.domSelector.drawer).within(() => { | ||
cy.contains('Submit').click({ | ||
force: true, | ||
}); | ||
}); | ||
cy.get(this.domSelector.drawer).should('not.exist'); | ||
|
||
cy.contains('button', 'Next').click(); | ||
cy.contains('button', 'Submit').click(); | ||
cy.get(this.domSelector.notification).should('contain', this.data.createConsumerSuccess); | ||
}); | ||
|
||
it('should delete the consumer', function () { | ||
cy.visit('/consumer/list'); | ||
cy.contains(this.data.consumerName).should('be.visible').siblings().contains('Delete').click(); | ||
cy.contains('button', 'Confirm').click(); | ||
cy.get(this.domSelector.notification).should('contain', this.data.deleteConsumerSuccess); | ||
}); | ||
}); |
101 changes: 101 additions & 0 deletions
101
web/cypress/integration/consumer/create-upstream-with-cors-form.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,101 @@ | ||
/* | ||
* 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 Consumer', () => { | ||
beforeEach(() => { | ||
cy.login(); | ||
|
||
cy.fixture('selector.json').as('domSelector'); | ||
cy.fixture('data.json').as('data'); | ||
}); | ||
|
||
const selector = { | ||
max_age: "#max_age" | ||
} | ||
|
||
const data = { | ||
time: 2, | ||
} | ||
|
||
it('creates consumer with cors form', function () { | ||
cy.visit('/'); | ||
cy.contains('Consumer').click(); | ||
cy.get(this.domSelector.empty).should('be.visible'); | ||
cy.contains('Create').click(); | ||
// basic information | ||
cy.get(this.domSelector.username).type(this.data.consumerName); | ||
cy.get(this.domSelector.description).type(this.data.description); | ||
cy.contains('Next').click(); | ||
|
||
// config auth plugin | ||
cy.contains(this.domSelector.pluginCard, 'key-auth').within(() => { | ||
cy.contains('Enable').click({ force: true }); | ||
}); | ||
cy.focused(this.domSelector.drawer).should('exist'); | ||
cy.get(this.domSelector.disabledSwitcher).click().should('have.class', 'ant-switch-checked'); | ||
// edit codemirror | ||
cy.get(this.domSelector.codeMirror) | ||
.first() | ||
.then((editor) => { | ||
editor[0].CodeMirror.setValue( | ||
JSON.stringify({ | ||
key: 'test', | ||
}), | ||
); | ||
cy.contains('button', 'Submit').click(); | ||
}); | ||
|
||
cy.contains(this.domSelector.pluginCard, 'cors').within(() => { | ||
cy.contains('Enable').click({ | ||
force: true, | ||
}); | ||
}); | ||
|
||
cy.get(this.domSelector.drawer).should('be.visible'); | ||
|
||
cy.get(selector.max_age).clear(); | ||
// config proxy-mirror form | ||
cy.get(this.domSelector.drawer).within(() => { | ||
cy.contains('Submit').click({ | ||
force: true, | ||
}); | ||
}); | ||
cy.get(this.domSelector.notification).should('contain', 'Invalid plugin data'); | ||
cy.get(this.domSelector.notificationCloseIcon).click().should('not.exist'); | ||
|
||
cy.get(selector.max_age).type(data.time); | ||
cy.get(this.domSelector.drawer).within(() => { | ||
cy.contains('Submit').click({ | ||
force: true, | ||
}); | ||
}); | ||
cy.get(this.domSelector.drawer).should('not.exist'); | ||
|
||
cy.contains('button', 'Next').click(); | ||
cy.contains('button', 'Submit').click(); | ||
cy.get(this.domSelector.notification).should('contain', this.data.createConsumerSuccess); | ||
cy.get(this.domSelector.notificationCloseIcon).click().should('not.exist'); | ||
}); | ||
|
||
it('delete the consumer', function () { | ||
cy.visit('/consumer/list'); | ||
cy.contains(this.data.consumerName).should('be.visible').siblings().contains('Delete').click(); | ||
cy.contains('button', 'Confirm').click(); | ||
cy.get(this.domSelector.notification).should('contain', this.data.deleteConsumerSuccess); | ||
}); | ||
}); |
Oops, something went wrong.