Skip to content

Commit

Permalink
fix: disable global plugin invalid (#2757)
Browse files Browse the repository at this point in the history
  • Loading branch information
Baoyuantop authored Mar 15, 2023
1 parent df0452e commit 85fadb6
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
47 changes: 47 additions & 0 deletions web/cypress/e2e/plugin/create-delete-in-drawer-plugin.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,53 @@ context('Delete Plugin List with the Drawer', () => {
cy.get(selector.empty).should('be.visible');
});

it('should disabled global plugin normally', () => {
cy.visit('/plugin/list');
cy.get(selector.refresh).click();
cy.contains('button', 'Enable').click();
cy.contains(data.basicAuthPlugin)
.parents(selector.pluginCardBordered)
.within(() => {
cy.get('button').click({
force: true,
});
});
cy.get(selector.drawer)
.should('be.visible')
.within(() => {
cy.get('#disable').should('have.attr', 'aria-checked', 'false');
cy.get(selector.disabledSwitcher).click();
cy.get(selector.checkedSwitcher).should('exist');
});
cy.contains('button', 'Submit').click({ force: true });
cy.wait(timeout);
cy.visit('/plugin/list');
cy.contains(data.basicAuthPlugin).siblings().contains('Configure').click();
cy.get(selector.drawer)
.should('be.visible')
.within(() => {
cy.get('#disable').should('have.attr', 'aria-checked', 'true');
cy.get(selector.disabledSwitcher).click();
});
cy.contains('button', 'Submit').click({ force: true });
cy.get(selector.drawer).should('not.exist');
cy.contains(data.basicAuthPlugin).should('be.visible');
cy.contains(data.basicAuthPlugin).siblings().contains('Configure').click();
cy.get(selector.drawer)
.should('be.visible')
.within(() => {
cy.get('#disable').should('have.attr', 'aria-checked', 'false');
});

cy.contains('button', 'Cancel').click({
force: true,
});
cy.contains(data.basicAuthPlugin).siblings().contains('Delete').click();
cy.contains('button', 'Confirm').click({
force: true,
});
});

it('should be deleted one of the plugins instead of all', function () {
cy.visit('/plugin/list');
cy.get(selector.refresh).click();
Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/Plugin/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ const Page: React.FC = () => {
const disable = !formData.disable;
let plugins = {
...initialData,
[name]: { ...monacoData, disable },
[name]: { ...monacoData, _meta: { disable } },
};
if (shouldDelete === true) {
plugins = omit(plugins, name);
Expand Down

0 comments on commit 85fadb6

Please sign in to comment.