catch errors when removing scope type

This commit is contained in:
Erik Jan de Wit 2021-05-27 13:41:29 +02:00
parent df5a06a3be
commit bb090200fe
2 changed files with 20 additions and 24 deletions

View file

@ -1,26 +1,15 @@
export default class ListingPage { export default class ListingPage {
searchInput: string; private searchInput = '.pf-c-toolbar__item [type="search"]:visible';
itemsRows: string; private itemsRows = "table";
itemRowDrpDwn: string; private itemRowDrpDwn = ".pf-c-dropdown__toggle";
exportBtn: string; public exportBtn = '[role="menuitem"]:nth-child(1)';
deleteBtn: string; public deleteBtn = '[role="menuitem"]:nth-child(2)';
searchBtn: string; private searchBtn =
createBtn: string;
importBtn: string;
constructor() {
this.searchInput = '.pf-c-toolbar__item [type="search"]:visible';
this.itemsRows = "table";
this.itemRowDrpDwn = ".pf-c-dropdown > button";
this.exportBtn = '[role="menuitem"]:nth-child(1)';
this.deleteBtn = '[role="menuitem"]:nth-child(2)';
this.searchBtn =
".pf-c-page__main .pf-c-toolbar__content-section button.pf-m-control:visible"; ".pf-c-page__main .pf-c-toolbar__content-section button.pf-m-control:visible";
this.createBtn = private createBtn =
".pf-c-page__main .pf-c-toolbar__content-section button.pf-m-primary:visible"; ".pf-c-page__main .pf-c-toolbar__content-section button.pf-m-primary:visible";
this.importBtn = private importBtn =
".pf-c-page__main .pf-c-toolbar__content-section button.pf-m-link"; ".pf-c-page__main .pf-c-toolbar__content-section button.pf-m-link";
}
goToCreateItem() { goToCreateItem() {
cy.get(this.createBtn).click(); cy.get(this.createBtn).click();
@ -50,7 +39,7 @@ export default class ListingPage {
clickRowDetails(itemName: string) { clickRowDetails(itemName: string) {
cy.get(this.itemsRows) cy.get(this.itemsRows)
.contains(itemName) .contains(itemName)
.parentsUntil("tr") .parentsUntil("tbody")
.find(this.itemRowDrpDwn) .find(this.itemRowDrpDwn)
.click(); .click();
return this; return this;

View file

@ -83,7 +83,14 @@ export const ClientScopesSection = () => {
onConfirm: async () => { onConfirm: async () => {
try { try {
for (const scope of selectedScopes) { for (const scope of selectedScopes) {
try {
await removeScope(adminClient, scope); await removeScope(adminClient, scope);
} catch (error) {
console.warn(
"could not remove scope",
error.response?.data?.errorMessage || error
);
}
await adminClient.clientScopes.del({ id: scope.id! }); await adminClient.clientScopes.del({ id: scope.id! });
} }
addAlert(t("deletedSuccess"), AlertVariant.success); addAlert(t("deletedSuccess"), AlertVariant.success);