Make the export tab tests more stable (#2339)

This commit is contained in:
Erik Jan de Wit 2022-03-25 12:19:15 +01:00 committed by GitHub
parent 2fec454098
commit bd82872282
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 2 deletions

View file

@ -152,7 +152,6 @@ describe("Client authentication subtab", () => {
it("Should copy auth details", () => { it("Should copy auth details", () => {
authenticationTab.goToExportSubTab(); authenticationTab.goToExportSubTab();
authenticationTab.copy(); authenticationTab.copy();
masthead.checkNotificationMessage("Authorization details copied.", true); masthead.checkNotificationMessage("Authorization details copied.", true);
}); });

View file

@ -48,7 +48,11 @@ export default class AuthorizationTab {
} }
goToExportSubTab() { goToExportSubTab() {
cy.intercept(
"/admin/realms/master/clients/*/authz/resource-server/settings"
).as("export-load");
cy.findByTestId(this.exportTabName).click(); cy.findByTestId(this.exportTabName).click();
cy.wait(["@export-load"]);
return this; return this;
} }

View file

@ -15,10 +15,12 @@ import { useAdminClient, useFetch } from "../../context/auth/AdminClient";
import { useParams } from "react-router-dom"; import { useParams } from "react-router-dom";
import FileSaver from "file-saver"; import FileSaver from "file-saver";
import { prettyPrintJSON } from "../../util"; import { prettyPrintJSON } from "../../util";
import "./authorization-details.css";
import { useAlerts } from "../../components/alert/Alerts"; import { useAlerts } from "../../components/alert/Alerts";
import type { ClientParams } from "../routes/Client"; import type { ClientParams } from "../routes/Client";
import type ResourceServerRepresentation from "@keycloak/keycloak-admin-client/lib/defs/resourceServerRepresentation"; import type ResourceServerRepresentation from "@keycloak/keycloak-admin-client/lib/defs/resourceServerRepresentation";
import { KeycloakSpinner } from "../../components/keycloak-spinner/KeycloakSpinner";
import "./authorization-details.css";
export const AuthorizationExport = () => { export const AuthorizationExport = () => {
const { t } = useTranslation("clients"); const { t } = useTranslation("clients");
@ -57,6 +59,10 @@ export const AuthorizationExport = () => {
} }
}; };
if (!code) {
return <KeycloakSpinner />;
}
return ( return (
<PageSection> <PageSection>
<FormAccess isHorizontal role="manage-realm" className="pf-u-mt-lg"> <FormAccess isHorizontal role="manage-realm" className="pf-u-mt-lg">