-
Notifications
You must be signed in to change notification settings - Fork 534
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
test: add the create and delete plugin in drawer #1597
test: add the create and delete plugin in drawer #1597
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1597 +/- ##
==========================================
+ Coverage 71.05% 71.24% +0.19%
==========================================
Files 47 47
Lines 3116 3116
==========================================
+ Hits 2214 2220 +6
+ Misses 658 653 -5
+ Partials 244 243 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
also cc @guoqqqi to review |
cy.fixture('plugin-dataset.json').as('cases'); | ||
cy.get('@cases').then((cases) => { | ||
cy.configurePlugins(cases); | ||
}); | ||
}); |
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.
In this test we don't need to create all the plugins, it takes up more time than necessary, we just need to create a few plugin examples to test that the deletion functions properly.
@@ -45,7 +45,6 @@ context('Create and Delete Plugin List', () => { | |||
.then(() => { | |||
cy.get('.ant-drawer-footer').contains('button', 'Delete').click(); | |||
cy.contains('button', 'Confirm').click({ force: true }); | |||
cy.get(this.domSelector.empty).should('be.visible'); | |||
}); |
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.
This assertion ensures that the plugin can be removed in its entirety properly, and I think it's best that we don't remove it
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.
any update here?
Hi, We need to test the functionality not only on the plug-in page but also on the route page and the service page to make sure it works. |
ping~ |
ping @stu01509 |
Hi Actually, I only found it the plugin page, where could I find in the route page and services page? |
Hi,you can find it in the Create, Configure Plugin step. |
CI error: https://github.com/apache/apisix-dashboard/pull/1597/checks?check_run_id=2148899222 |
Hi @guoqqqi and @juzhiyuan Update the commit. |
@stu01509 FE e2e test failed |
…ete-plugin-in-darwer
I updated the commit, but it seems like occurred the error in backend test case. |
*/ | ||
/* eslint-disable no-undef */ | ||
|
||
context('Create and Delete Plugin List', () => { |
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.
context('Create and Delete Plugin List', () => { | |
context('Delete Plugin List with the Drawer', () => { |
cy.contains('basic-auth').parents('.ant-card-bordered').within(() => { | ||
cy.get('button').click({ force: true }); | ||
}); | ||
|
||
cy.get('.ant-drawer-content').should('be.visible').within(() => { | ||
cy.get('#disable').click(); | ||
cy.get('.ant-switch-checked').should('exist'); | ||
}); | ||
|
||
cy.contains('button', 'Submit').click(); | ||
cy.get('.ant-drawer-content', { timeout }).should('not.exist'); | ||
}); |
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.
Please use this.domSelector...
and this.data...
, refer to other test cases.
cy.visit('/plugin/list'); | ||
cy.get(this.domSelector.refresh).click(); | ||
cy.contains('button', 'Edit').click(); | ||
cy.get('.ant-drawer-footer').contains('button', 'Delete').click({ force: true }); |
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.
The dom element can be moved to public data for other tests use.
cy.contains('prometheus').parents('.ant-card-bordered').within(() => { | ||
cy.get('button').click({ force: true }); | ||
}); | ||
|
||
cy.get('.ant-drawer-content').should('be.visible').within(() => { | ||
cy.get('#disable').click(); | ||
cy.get('.ant-switch-checked').should('exist'); | ||
}); | ||
|
||
cy.contains('button', 'Submit').click(); | ||
cy.get('.ant-drawer-content', { timeout }).should('not.exist'); | ||
|
||
cy.contains('prometheus').parents('.ant-card-bordered').within(() => { | ||
cy.get('button').click({ force: true }); | ||
}); | ||
cy.contains('button', 'Cancel').click(); | ||
|
||
cy.get('.ant-drawer-footer').contains('button', 'Delete').click({ force: true }); | ||
cy.contains('button', 'Confirm').click({ force: true }); | ||
|
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.
Also use this.domSelector..
and this.data...
I think another step should be added: check that the plugin was successfully removed after it was deleted.
cy.contains('prometheus').parents('.ant-card-bordered').within(() => { | ||
cy.get('button').click({ force: true }); | ||
}); | ||
|
||
cy.get('.ant-drawer-content').should('be.visible').within(() => { | ||
cy.get('#disable').click(); | ||
cy.get('.ant-switch-checked').should('exist'); | ||
}); | ||
|
||
cy.contains('button', 'Submit').click(); | ||
cy.get('.ant-drawer-content', { timeout }).should('not.exist'); | ||
|
||
cy.contains('prometheus').parents('.ant-card-bordered').within(() => { | ||
cy.get('button').click({ force: true }); | ||
}); | ||
|
||
cy.get('.ant-drawer-footer').contains('button', 'Delete').click({ force: true }); | ||
cy.contains('button', 'Confirm').click({ force: true }); | ||
|
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.
ditto
Hi @guoqqqi Update the commit, please review it again. |
@stu01509 please sync codes from branch master |
Hello @nic-chen Update the commit. |
Hi, @guoqqqi, I remember that you developed this delete feature, please make sure that this test is fully covered |
Hi, @stu01509 Again these pages need to be tested. |
As the function is in a public component, it can be tested once and there is no need to add tests for other pages. Thanks. |
The tests corresponding to route and service are unnecessary? @guoqqqi |
Update the commit. |
…u01509/apisix-dashboard into fix-#1411-add-delete-plugin-in-darwer
Please answer these questions before submitting a pull request
Why submit this pull request?
Bugfix
New feature provided
Improve performance
Backport patches
Related issues
Fix test: delete button in plugin drawer #1411
New feature or improvement
Add the cypress test case to testing the plugin delete in the drawer.
Please add the corresponding test cases if necessary.