import client tests (#3452)

This commit is contained in:
Dominik Kawka 2022-10-03 12:00:26 +01:00 committed by GitHub
parent b90487af39
commit 3694dad23c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 92 additions and 0 deletions

View file

@ -432,6 +432,47 @@ describe("Clients test", () => {
});
initialAccessTokenTab.shouldBeEmpty();
});
it("Should fail to create imported client with empty ID", () => {
commonPage.sidebar().goToClients();
commonPage.masthead().closeAllAlertMessages();
cy.findByTestId("importClient").click();
cy.findByTestId("kc-client-id").click();
cy.findByText("Save").click();
cy.findByText("Required field");
});
const identicalClientId = "identical";
it("Should fail to create client with same ID", () => {
commonPage.sidebar().goToClients();
commonPage.tableToolbarUtils().createClient();
createClientPage.fillClientData(identicalClientId).continue().save();
commonPage.masthead().closeAllAlertMessages();
commonPage.sidebar().goToClients();
cy.findByTestId("importClient").click();
cy.findByTestId("realm-file").selectFile(
"cypress/fixtures/partial-import-test-data/import-identical-client.json",
{ action: "drag-drop" }
);
cy.wait(1000);
//cy.findByTestId("realm-file").contains('"clientId": "identical"')
cy.findByTestId("kc-client-id").click();
cy.findByText("Save").click();
commonPage
.masthead()
.checkNotificationMessage(
"Could not import client: Client identical already exists",
true
);
});
it("should delete 'identical' client id", () => {
commonPage.sidebar().goToClients();
adminClient.deleteClient(identicalClientId);
});
});
describe("Roles tab test", () => {

View file

@ -0,0 +1,48 @@
{
"clientId": "identical",
"name": "",
"description": "",
"surrogateAuthRequired": false,
"enabled": true,
"alwaysDisplayInConsole": false,
"clientAuthenticatorType": "client-secret",
"redirectUris": [],
"webOrigins": [],
"notBefore": 0,
"bearerOnly": false,
"consentRequired": false,
"standardFlowEnabled": true,
"implicitFlowEnabled": false,
"directAccessGrantsEnabled": true,
"serviceAccountsEnabled": false,
"publicClient": true,
"frontchannelLogout": true,
"protocol": "openid-connect",
"attributes": {
"oidc.ciba.grant.enabled": "false",
"oauth2.device.authorization.grant.enabled": "false",
"backchannel.logout.session.required": "true",
"backchannel.logout.revoke.offline.tokens": "false"
},
"authenticationFlowBindingOverrides": {},
"fullScopeAllowed": true,
"nodeReRegistrationTimeout": -1,
"defaultClientScopes": [
"web-origins",
"acr",
"roles",
"profile",
"email"
],
"optionalClientScopes": [
"address",
"phone",
"offline_access",
"microprofile-jwt"
],
"access": {
"view": true,
"configure": true,
"manage": true
}
}

View file

@ -40,6 +40,7 @@ export const ClientDescription = ({
ref={register({ required: true })}
type="text"
id="kc-client-id"
data-testid="kc-client-id"
name="clientId"
validated={
errors.clientId ? ValidatedOptions.error : ValidatedOptions.default

View file

@ -125,6 +125,7 @@ export default function ClientsSection() {
<Link {...props} to={toImportClient({ realm })} />
)}
variant="link"
data-testid="importClient"
>
{t("importClient")}
</Button>

View file

@ -127,6 +127,7 @@ export const FileUploadForm = ({
helperText={t(helpText)}
>
<FileUpload
data-testid={id}
id={id}
{...rest}
type="text"