mirror of https://github.com/rancher/dashboard.git
Fix a problem with deleting role templates from their detail pages
We were attempting to navigate back to a non-existent page when deleting role templates from their corresponding detail pages. This caused the Prompt Remove dialog to show an error button and not close. https://github.com/rancher/dashboard/issues/12217
This commit is contained in:
parent
49829dad21
commit
62e88ef845
|
|
@ -1,11 +1,18 @@
|
|||
import RoleDetailPo from '@/cypress/e2e/po/detail/role.po';
|
||||
import RoleTemplateEditPo from '@/cypress/e2e/po/edit/management.cattle.io.roletemplate.po';
|
||||
import ResourceDetailPo from '@/cypress/e2e/po/edit/resource-detail.po';
|
||||
import ActionMenu from '@/cypress/e2e/po/components/action-menu.po';
|
||||
|
||||
class RoleTemplateDetailComponentPo extends ResourceDetailPo {
|
||||
userCreateEditView(clusterId: string, userId?: string ) {
|
||||
return new RoleTemplateEditPo(clusterId, userId);
|
||||
}
|
||||
|
||||
openMastheadActionMenu() {
|
||||
this.self().get('[data-testid="mathead-action-menu"]').click();
|
||||
|
||||
return new ActionMenu(undefined);
|
||||
}
|
||||
}
|
||||
|
||||
export default class RoleTemplateDetailPo extends RoleDetailPo {
|
||||
|
|
|
|||
|
|
@ -228,6 +228,25 @@ describe('Roles Templates', { tags: ['@usersAndAuths', '@adminUser'] }, () => {
|
|||
promptRemove.warning().first().should('contain.text', 'Caution:'); // Check warning message content
|
||||
});
|
||||
|
||||
it('can delete a role template from the detail page', () => {
|
||||
// Delete role and verify role is removed from list
|
||||
roles.waitForRequests();
|
||||
const oneRoleTemplateId = roleTemplatesToDelete.splice(0, 1)[0];
|
||||
const detailPage = roles.detailRole(oneRoleTemplateId);
|
||||
|
||||
detailPage.goTo();
|
||||
detailPage.waitForPage();
|
||||
|
||||
const actionMenu = detailPage.detail().openMastheadActionMenu();
|
||||
|
||||
actionMenu.clickMenuItem(5);
|
||||
|
||||
const promptRemove = new PromptRemove();
|
||||
|
||||
promptRemove.remove();
|
||||
roles.list('CLUSTER').elementWithName(oneRoleTemplateId).should('not.exist');
|
||||
});
|
||||
|
||||
it('can delete a role template', () => {
|
||||
// Delete role and verify role is removed from list
|
||||
roles.waitForRequests();
|
||||
|
|
|
|||
|
|
@ -105,8 +105,8 @@ export default {
|
|||
return null;
|
||||
}
|
||||
|
||||
if (this.toRemove[0].doneLocationRemove) {
|
||||
return this.toRemove[0].doneLocationRemove;
|
||||
if (this.toRemove[0].doneOverride) {
|
||||
return this.toRemove[0].doneOverride;
|
||||
}
|
||||
|
||||
const currentRoute = this.toRemove[0].currentRoute();
|
||||
|
|
|
|||
|
|
@ -521,6 +521,7 @@ export default {
|
|||
<button
|
||||
v-if="isView"
|
||||
ref="actions"
|
||||
data-testid="mathead-action-menu"
|
||||
aria-haspopup="true"
|
||||
type="button"
|
||||
class="btn role-multi-action actions"
|
||||
|
|
|
|||
Loading…
Reference in New Issue