Skip to content

Commit

Permalink
fix: plugin configuration lost in editor (#2718)
Browse files Browse the repository at this point in the history
  • Loading branch information
Baoyuantop authored Jan 20, 2023
1 parent 7b8d9c5 commit 688afa2
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
30 changes: 30 additions & 0 deletions web/cypress/e2e/plugin/plugin-schema.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,35 @@ describe('Plugin Schema Test', () => {
// check if plugin list is empty
cy.get(domSelector.empty).should('be.visible');
});

it('click plugin Edit button the existing configuration should display', () => {
cy.visit('/');
cy.contains('Consumer').click();
cy.get('.ant-empty-normal').should('be.visible');
cy.contains('Create').click();

cy.get('#username').type('test');
cy.contains('Next').click();
cy.contains('.ant-card', 'client-control').within(() => {
cy.contains('Enable').click({
force: true,
});
});
cy.focused('.ant-drawer-content').should('exist');
cy.get('.view-zones').should('exist');
cy.contains('max_body_size').should('be.visible');
cy.window().then((window) => {
window.monacoEditor.setValue(JSON.stringify({ max_body_size: 1024 }));
cy.contains('button', 'Submit').click();
});
cy.wait(3000);
cy.contains('.ant-card', 'client-control').within(() => {
cy.contains('Enable').click({
force: true,
});
});
cy.focused('.ant-drawer-content').should('exist');
cy.contains('1024').should('be.visible');
});
});
});
2 changes: 1 addition & 1 deletion web/src/components/Plugin/PluginDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ const PluginDetail: React.FC<Props> = ({
// NOTE: for debug & test
// @ts-ignore
window.monacoEditor = editor;
if (targetModel) editor.setValue(targetModelCode);
if (targetModel && content === '{}') editor.setValue(targetModelCode);
}}
options={{
scrollbar: {
Expand Down

0 comments on commit 688afa2

Please sign in to comment.