-
Notifications
You must be signed in to change notification settings - Fork 542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: supports search by name for service options when add router. #2066
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1c1625b
1. supports search by name for service options when add router.
TkClark 5e59e0a
Merge remote-tracking branch 'origin/master' into dev/zc
TkClark f17e0f1
Merge remote-tracking branch 'origin/master' into dev/zc
TkClark 388bd1d
feat: supports search by name for service options when add router
TkClark 80861ae
fix: add check whether service_id exist for the test case
TkClark File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
151 changes: 151 additions & 0 deletions
151
web/cypress/integration/route/create-route-with-search-service-and-set-priority.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,151 @@ | ||
/* | ||
* 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 Route with search service name', () => { | ||
const selector = { | ||
name: '#name', | ||
description: '#desc', | ||
priority: '#priority', | ||
nodes_0_host: '#submitNodes_0_host', | ||
nodes_0_port: '#submitNodes_0_port', | ||
nodes_0_weight: '#submitNodes_0_weight', | ||
drawer: '.ant-drawer-content', | ||
monacoScroll: '.monaco-scrollable-element', | ||
notification: '.ant-notification-notice-message', | ||
result: '.ant-result', | ||
nameSelector: '[title=Name]', | ||
serviceSelector: '[title="None"]', | ||
upstreamSelector: '#upstream_id', | ||
deleteAlert: '.ant-modal-body', | ||
drawer: '.ant-drawer-content', | ||
}; | ||
|
||
const data = { | ||
serviceName: 'service_test1', | ||
description: 'desc_by_autotest', | ||
ip: '127.0.0.1', | ||
port: 8000, | ||
weight: 1, | ||
serviceName2: 'service_test2', | ||
ip2: '127.0.0.1', | ||
port2: 8000, | ||
weight2: 1, | ||
priority: 1, | ||
createServiceSuccess: 'Create Service Successfully', | ||
deleteServiceSuccess: 'Delete Service Successfully', | ||
createRouteSuccess: 'Submit Successfully', | ||
deleteRouteSuccess: 'Delete Route Successfully', | ||
routeName: 'route_test1', | ||
searchServiceName: 'service_test2', | ||
upstreamName: 'None', | ||
}; | ||
|
||
beforeEach(() => { | ||
cy.login(); | ||
}); | ||
|
||
it('should create two services', function () { | ||
cy.visit('/'); | ||
cy.contains('Service').click(); | ||
cy.contains('Create').click(); | ||
|
||
cy.get(selector.name).type(data.serviceName); | ||
cy.get(selector.description).type(data.description); | ||
cy.get(selector.nodes_0_host).click(); | ||
cy.get(selector.nodes_0_host).type(data.ip); | ||
cy.get(selector.nodes_0_port).clear().type(data.port); | ||
cy.get(selector.nodes_0_weight).clear().type(data.weight); | ||
|
||
cy.contains('Next').click(); | ||
cy.contains('Next').click(); | ||
cy.contains('Submit').click(); | ||
cy.get(selector.notification).should('contain', data.createServiceSuccess); | ||
|
||
cy.visit('/'); | ||
cy.contains('Service').click(); | ||
cy.contains('Create').click(); | ||
|
||
cy.get(selector.name).type(data.serviceName2); | ||
cy.get(selector.description).type(data.description); | ||
cy.get(selector.nodes_0_host).click(); | ||
cy.get(selector.nodes_0_host).type(data.ip2); | ||
cy.get(selector.nodes_0_port).clear().type(data.port2); | ||
cy.get(selector.nodes_0_weight).clear().type(data.weight2); | ||
|
||
cy.contains('Next').click(); | ||
cy.contains('Next').click(); | ||
cy.contains('Submit').click(); | ||
cy.get(selector.notification).should('contain', data.createServiceSuccess); | ||
}); | ||
|
||
it('should create route with search service and set priority', function () { | ||
cy.visit('/'); | ||
cy.contains('Route').click(); | ||
cy.contains('Create').click(); | ||
cy.contains('Next').click().click(); | ||
|
||
// set name | ||
cy.get(selector.name).type(data.routeName); | ||
cy.get(selector.serviceSelector).type(data.serviceName2 + '\n'); | ||
// set priority | ||
cy.get(selector.priority).type(data.priority); | ||
cy.contains('Next').click(); | ||
// select upstream with None | ||
cy.get(selector.upstreamSelector).type(data.upstreamName + '\n'); | ||
cy.contains('Next').click(); | ||
cy.contains('Next').click(); | ||
cy.contains('Submit').click(); | ||
cy.get(selector.result).should('contain', data.createRouteSuccess); | ||
}); | ||
|
||
it('should check the priority was seted', function () { | ||
cy.visit('/'); | ||
cy.contains('Route').click(); | ||
cy.get(selector.name).type(data.routeName + '\n'); | ||
cy.contains(data.routeName).siblings().contains('More').click(); | ||
cy.contains('View').click(); | ||
cy.get(selector.drawer).should('be.visible'); | ||
cy.get(selector.monacoScroll).within(() => { | ||
cy.contains('priority').should('exist'); | ||
}); | ||
}); | ||
|
||
it('should delete the route and services', function () { | ||
cy.visit('/'); | ||
cy.contains('Route').click(); | ||
cy.get(selector.name).type(data.routeName + '\n'); | ||
cy.contains(data.routeName).siblings().contains('More').click(); | ||
cy.contains('Delete').click(); | ||
cy.get(selector.deleteAlert) | ||
.should('be.visible') | ||
.within(() => { | ||
cy.contains('OK').click(); | ||
}); | ||
cy.get(selector.notification).should('contain', data.deleteRouteSuccess); | ||
|
||
cy.visit('/'); | ||
cy.contains('Service').click(); | ||
cy.contains(data.serviceName).siblings().contains('Delete').click(); | ||
cy.contains('button', 'Confirm').click(); | ||
cy.get(selector.notification).should('contain', data.deleteServiceSuccess); | ||
|
||
cy.contains(data.serviceName2).siblings().contains('Delete').click(); | ||
cy.contains('button', 'Confirm').click(); | ||
cy.get(selector.notification).should('contain', data.deleteServiceSuccess); | ||
}); | ||
}); |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
It would be better to check whether
service_id
existThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i was add check whether service_id exist for the test case