Add tests for bearer-only client details (#1270)

This commit is contained in:
Jon Koops 2021-09-30 12:04:50 +02:00 committed by GitHub
parent 4d5c8f3f18
commit 8e8c6d74ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 2 deletions

View file

@ -258,4 +258,33 @@ describe("Clients test", function () {
cy.findByTestId("delete-client").should("not.exist"); cy.findByTestId("delete-client").should("not.exist");
}); });
}); });
describe("Bearer only", () => {
const clientId = "bearer-only";
before(() => {
new AdminClient().createClient({
clientId,
protocol: "openid-connect",
publicClient: false,
bearerOnly: true,
});
});
after(() => {
new AdminClient().deleteClient(clientId);
});
beforeEach(() => {
keycloakBefore();
loginPage.logIn();
sidebarPage.goToClients();
listingPage.searchItem(clientId).goToItemDetails(clientId);
});
it("shows an explainer text for bearer only clients", () => {
cy.findByTestId("bearer-only-explainer-label").trigger("mouseenter");
cy.findByTestId("bearer-only-explainer-tooltip").should("exist");
});
});
}); });

View file

@ -89,8 +89,16 @@ const ClientDetailHeader = ({
} }
const text = client.bearerOnly ? ( const text = client.bearerOnly ? (
<Tooltip content={t("explainBearerOnly")}> <Tooltip
<Label icon={<InfoCircleIcon />}>{client.protocol}</Label> data-testid="bearer-only-explainer-tooltip"
content={t("explainBearerOnly")}
>
<Label
data-testid="bearer-only-explainer-label"
icon={<InfoCircleIcon />}
>
{client.protocol}
</Label>
</Tooltip> </Tooltip>
) : ( ) : (
<Label>{client.protocol}</Label> <Label>{client.protocol}</Label>