Skip to content

Commit

Permalink
fix: select Use the domain or IP from Node List (#2168)
Browse files Browse the repository at this point in the history
  • Loading branch information
okaybase authored Oct 20, 2021
1 parent 9f17637 commit 0fc4be7
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -307,4 +307,36 @@ context('Create and Delete Upstream', () => {
cy.contains('button', 'Confirm').click();
cy.get(selector.notification).should('contain', data.deleteUpstreamSuccess);
});

it('should create upstream with Use the domain or IP from Node List', function () {
cy.visit('/');
cy.contains('Upstream').click();
cy.contains('Create').click();

cy.get(selector.name).type(data.upstreamName);
cy.get(selector.description).type(data.description);

cy.get(selector.nodes_0_host).type(data.ip1);
cy.get(selector.nodes_0_port).clear().type('7000');
cy.get(selector.nodes_0_weight).clear().type(1);

cy.get('[title="Keep the same Host from client request"]').click();
cy.get(selector.selectItem).within(() => {
cy.contains('Use the domain or IP from Node List').click();
});

cy.contains('Next').click();
cy.get(selector.input).should('be.disabled');
cy.contains('Submit').click();
cy.get(selector.notification).should('contain', data.createUpstreamSuccess);
cy.url().should('contains', 'upstream/list');
});

it('should delete the upstream', function () {
cy.visit('/');
cy.contains('Upstream').click();
cy.contains(data.upstreamName).siblings().contains('Delete').click();
cy.contains('button', 'Confirm').click();
cy.get(selector.notification).should('contain', data.deleteUpstreamSuccess);
});
});
2 changes: 1 addition & 1 deletion web/src/components/Upstream/components/PassHost.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const Component: React.FC<Props> = ({ form, readonly }) => {

if (
form.getFieldValue('pass_host') === 'node' &&
(form.getFieldValue('nodes') || []).length !== 1
(form.getFieldValue('submitNodes') || []).length !== 1
) {
notification.warning({
message: formatMessage({
Expand Down

0 comments on commit 0fc4be7

Please sign in to comment.