2021-04-21 13:18:45 +00:00
|
|
|
import Masthead from "../support/pages/admin_console/Masthead";
|
|
|
|
import SidebarPage from "../support/pages/admin_console/SidebarPage";
|
|
|
|
import LoginPage from "../support/pages/LoginPage";
|
|
|
|
import { keycloakBefore } from "../support/util/keycloak_before";
|
|
|
|
import ListingPage from "../support/pages/admin_console/ListingPage";
|
|
|
|
|
|
|
|
import CreateProviderPage from "../support/pages/admin_console/manage/identity_providers/CreateProviderPage";
|
|
|
|
import ModalUtils from "../support/util/ModalUtils";
|
|
|
|
import OrderDialog from "../support/pages/admin_console/manage/identity_providers/OrderDialog";
|
2021-09-13 09:17:00 +00:00
|
|
|
import AddMapperPage from "../support/pages/admin_console/manage/identity_providers/AddMapperPage";
|
2021-04-21 13:18:45 +00:00
|
|
|
|
|
|
|
describe("Identity provider test", () => {
|
|
|
|
const loginPage = new LoginPage();
|
|
|
|
const sidebarPage = new SidebarPage();
|
|
|
|
const masthead = new Masthead();
|
|
|
|
const listingPage = new ListingPage();
|
|
|
|
const createProviderPage = new CreateProviderPage();
|
2021-09-13 09:17:00 +00:00
|
|
|
const addMapperPage = new AddMapperPage();
|
|
|
|
|
2021-08-19 14:41:27 +00:00
|
|
|
const createSuccessMsg = "Identity provider successfully created";
|
2021-09-13 09:17:00 +00:00
|
|
|
const createMapperSuccessMsg = "Mapper created successfully.";
|
2021-09-22 20:27:30 +00:00
|
|
|
const saveMapperSuccessMsg = "Mapper saved successfully.";
|
|
|
|
|
2021-08-19 14:41:27 +00:00
|
|
|
const changeSuccessMsg =
|
|
|
|
"Successfully changed display order of identity providers";
|
|
|
|
const deletePrompt = "Delete provider?";
|
|
|
|
const deleteSuccessMsg = "Provider successfully deleted";
|
|
|
|
|
|
|
|
const keycloakServer = Cypress.env("KEYCLOAK_SERVER");
|
|
|
|
const discoveryUrl = `${keycloakServer}/auth/realms/master/.well-known/openid-configuration`;
|
|
|
|
const authorizationUrl = `${keycloakServer}/auth/realms/master/protocol/openid-connect/auth`;
|
|
|
|
const ssoServiceUrl = `${keycloakServer}/auth/realms/sso`;
|
2021-04-21 13:18:45 +00:00
|
|
|
|
|
|
|
describe("Identity provider creation", () => {
|
|
|
|
const identityProviderName = "github";
|
|
|
|
|
|
|
|
beforeEach(function () {
|
|
|
|
keycloakBefore();
|
|
|
|
loginPage.logIn();
|
|
|
|
sidebarPage.goToIdentityProviders();
|
|
|
|
});
|
|
|
|
|
2021-05-07 14:46:50 +00:00
|
|
|
it("should create provider", () => {
|
2021-04-21 13:18:45 +00:00
|
|
|
createProviderPage.checkGitHubCardVisible().clickGitHubCard();
|
|
|
|
|
|
|
|
createProviderPage.checkAddButtonDisabled();
|
|
|
|
createProviderPage
|
|
|
|
.fill(identityProviderName)
|
|
|
|
.clickAdd()
|
|
|
|
.checkClientIdRequiredMessage(true);
|
|
|
|
createProviderPage.fill(identityProviderName, "123").clickAdd();
|
2021-08-19 14:41:27 +00:00
|
|
|
masthead.checkNotificationMessage(createSuccessMsg);
|
2021-04-21 13:18:45 +00:00
|
|
|
|
2021-05-06 18:59:00 +00:00
|
|
|
sidebarPage.goToIdentityProviders();
|
2021-04-21 13:18:45 +00:00
|
|
|
listingPage.itemExist(identityProviderName);
|
|
|
|
});
|
|
|
|
|
2021-09-13 09:17:00 +00:00
|
|
|
it("should create facebook provider", () => {
|
2021-04-21 13:18:45 +00:00
|
|
|
createProviderPage
|
2021-09-22 20:27:30 +00:00
|
|
|
.clickCreateDropdown()
|
|
|
|
.clickItem("facebook")
|
2021-04-21 13:18:45 +00:00
|
|
|
.fill("facebook", "123")
|
|
|
|
.clickAdd();
|
2021-09-13 09:17:00 +00:00
|
|
|
masthead.checkNotificationMessage(createSuccessMsg);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should change order of providers", () => {
|
|
|
|
const orderDialog = new OrderDialog();
|
2021-09-22 20:27:30 +00:00
|
|
|
const providers = [identityProviderName, "facebook", "bitbucket"];
|
2021-05-07 14:46:50 +00:00
|
|
|
|
|
|
|
sidebarPage.goToIdentityProviders();
|
2021-04-21 13:18:45 +00:00
|
|
|
listingPage.itemExist("facebook");
|
|
|
|
|
2021-05-07 14:46:50 +00:00
|
|
|
sidebarPage.goToIdentityProviders();
|
|
|
|
listingPage.itemExist(identityProviderName);
|
|
|
|
|
2021-04-21 13:18:45 +00:00
|
|
|
createProviderPage
|
|
|
|
.clickCreateDropdown()
|
|
|
|
.clickItem("bitbucket")
|
|
|
|
.fill("bitbucket", "123")
|
|
|
|
.clickAdd();
|
|
|
|
|
2021-05-07 20:43:10 +00:00
|
|
|
cy.wait(2000);
|
2021-09-22 20:27:30 +00:00
|
|
|
|
2021-05-07 14:46:50 +00:00
|
|
|
sidebarPage.goToIdentityProviders();
|
|
|
|
listingPage.itemExist(identityProviderName);
|
|
|
|
|
2021-04-21 13:18:45 +00:00
|
|
|
orderDialog.openDialog().checkOrder(providers);
|
|
|
|
orderDialog.moveRowTo("facebook", identityProviderName);
|
|
|
|
|
2021-09-22 20:27:30 +00:00
|
|
|
orderDialog.checkOrder(["bitbucket", identityProviderName, "facebook"]);
|
2021-04-21 13:18:45 +00:00
|
|
|
|
|
|
|
orderDialog.clickSave();
|
2021-08-19 14:41:27 +00:00
|
|
|
masthead.checkNotificationMessage(changeSuccessMsg);
|
2021-05-07 14:46:50 +00:00
|
|
|
});
|
2021-05-06 18:59:00 +00:00
|
|
|
|
|
|
|
it("should create a oidc provider using discovery url", () => {
|
|
|
|
const oidcProviderName = "oidc";
|
|
|
|
createProviderPage
|
|
|
|
.clickCreateDropdown()
|
|
|
|
.clickItem(oidcProviderName)
|
2021-08-19 14:41:27 +00:00
|
|
|
.fillDiscoveryUrl(discoveryUrl)
|
2021-05-06 18:59:00 +00:00
|
|
|
.shouldBeSuccessful()
|
|
|
|
.fill("oidc", "123")
|
|
|
|
.clickAdd();
|
2021-08-19 14:41:27 +00:00
|
|
|
masthead.checkNotificationMessage(createSuccessMsg);
|
|
|
|
createProviderPage.shouldHaveAuthorizationUrl(authorizationUrl);
|
|
|
|
});
|
2021-05-06 18:59:00 +00:00
|
|
|
|
2021-08-19 14:41:27 +00:00
|
|
|
it("should create a SAML provider using SSO service url", () => {
|
|
|
|
const samlProviderName = "saml";
|
|
|
|
createProviderPage
|
|
|
|
.clickCreateDropdown()
|
|
|
|
.clickItem(samlProviderName)
|
|
|
|
.toggleEntityDescriptor()
|
|
|
|
.fillSsoServiceUrl(ssoServiceUrl)
|
|
|
|
.clickAdd();
|
|
|
|
masthead.checkNotificationMessage(createSuccessMsg);
|
2021-04-21 13:18:45 +00:00
|
|
|
});
|
2021-05-06 05:31:40 +00:00
|
|
|
|
2021-09-22 20:27:30 +00:00
|
|
|
it("should delete provider", () => {
|
|
|
|
const modalUtils = new ModalUtils();
|
|
|
|
listingPage.deleteItem(identityProviderName);
|
|
|
|
modalUtils.checkModalTitle(deletePrompt).confirmModal();
|
|
|
|
|
|
|
|
masthead.checkNotificationMessage(deleteSuccessMsg);
|
|
|
|
});
|
|
|
|
|
2021-09-13 09:17:00 +00:00
|
|
|
it("should add facebook social mapper", () => {
|
|
|
|
sidebarPage.goToIdentityProviders();
|
|
|
|
|
|
|
|
listingPage.goToItemDetails("facebook");
|
|
|
|
|
|
|
|
addMapperPage.goToMappersTab();
|
|
|
|
|
2021-09-30 09:26:36 +00:00
|
|
|
addMapperPage.emptyStateAddMapper();
|
2021-09-13 09:17:00 +00:00
|
|
|
|
|
|
|
addMapperPage.fillSocialMapper("facebook mapper");
|
|
|
|
|
|
|
|
addMapperPage.saveNewMapper();
|
|
|
|
|
|
|
|
masthead.checkNotificationMessage(createMapperSuccessMsg);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should add SAML mapper", () => {
|
|
|
|
sidebarPage.goToIdentityProviders();
|
|
|
|
|
|
|
|
listingPage.goToItemDetails("saml");
|
|
|
|
|
|
|
|
addMapperPage.goToMappersTab();
|
|
|
|
|
2021-09-30 09:26:36 +00:00
|
|
|
addMapperPage.emptyStateAddMapper();
|
2021-09-13 09:17:00 +00:00
|
|
|
|
|
|
|
addMapperPage.fillSAMLorOIDCMapper("SAML mapper");
|
|
|
|
|
|
|
|
masthead.checkNotificationMessage(createMapperSuccessMsg);
|
|
|
|
});
|
|
|
|
|
2021-09-30 09:26:36 +00:00
|
|
|
it("should add SAML mapper of type Username Template Importer", () => {
|
|
|
|
sidebarPage.goToIdentityProviders();
|
|
|
|
|
|
|
|
listingPage.goToItemDetails("saml");
|
|
|
|
|
|
|
|
addMapperPage.goToMappersTab();
|
|
|
|
|
|
|
|
addMapperPage.addMapper();
|
|
|
|
|
|
|
|
addMapperPage.addUsernameTemplateImporterMapper(
|
|
|
|
"SAML Username Template Importer Mapper"
|
|
|
|
);
|
|
|
|
|
|
|
|
masthead.checkNotificationMessage(createMapperSuccessMsg);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should edit Username Template Importer mapper", () => {
|
|
|
|
sidebarPage.goToIdentityProviders();
|
|
|
|
|
|
|
|
listingPage.goToItemDetails("saml");
|
|
|
|
|
|
|
|
addMapperPage.goToMappersTab();
|
|
|
|
|
|
|
|
listingPage.goToItemDetails("SAML Username Template Importer Mapper");
|
|
|
|
|
|
|
|
addMapperPage.editUsernameTemplateImporterMapper();
|
|
|
|
|
|
|
|
masthead.checkNotificationMessage(saveMapperSuccessMsg);
|
|
|
|
});
|
|
|
|
|
2021-09-22 20:27:30 +00:00
|
|
|
it("should edit facebook mapper", () => {
|
|
|
|
sidebarPage.goToIdentityProviders();
|
|
|
|
|
|
|
|
listingPage.goToItemDetails("facebook");
|
|
|
|
|
|
|
|
addMapperPage.goToMappersTab();
|
|
|
|
|
|
|
|
listingPage.goToItemDetails("facebook mapper");
|
|
|
|
|
|
|
|
addMapperPage.editSocialMapper();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should edit SAML mapper", () => {
|
|
|
|
sidebarPage.goToIdentityProviders();
|
|
|
|
|
|
|
|
listingPage.goToItemDetails("saml");
|
|
|
|
|
|
|
|
addMapperPage.goToMappersTab();
|
|
|
|
|
|
|
|
listingPage.goToItemDetails("SAML mapper");
|
|
|
|
|
|
|
|
addMapperPage.editSAMLorOIDCMapper();
|
|
|
|
|
|
|
|
masthead.checkNotificationMessage(saveMapperSuccessMsg);
|
|
|
|
});
|
|
|
|
|
2021-08-19 14:41:27 +00:00
|
|
|
it("clean up providers", () => {
|
|
|
|
const modalUtils = new ModalUtils();
|
2021-05-07 19:56:44 +00:00
|
|
|
|
2021-08-19 14:41:27 +00:00
|
|
|
sidebarPage.goToIdentityProviders();
|
|
|
|
listingPage.itemExist("bitbucket").deleteItem("bitbucket");
|
|
|
|
modalUtils.checkModalTitle(deletePrompt).confirmModal();
|
|
|
|
masthead.checkNotificationMessage(deleteSuccessMsg);
|
2021-05-07 19:56:44 +00:00
|
|
|
|
2021-08-19 14:41:27 +00:00
|
|
|
sidebarPage.goToIdentityProviders();
|
|
|
|
listingPage.itemExist("facebook").deleteItem("facebook");
|
|
|
|
modalUtils.checkModalTitle(deletePrompt).confirmModal();
|
|
|
|
masthead.checkNotificationMessage(deleteSuccessMsg);
|
|
|
|
|
|
|
|
sidebarPage.goToIdentityProviders();
|
|
|
|
listingPage.itemExist("oidc").deleteItem("oidc");
|
|
|
|
modalUtils.checkModalTitle(deletePrompt).confirmModal();
|
|
|
|
masthead.checkNotificationMessage(deleteSuccessMsg);
|
|
|
|
|
|
|
|
sidebarPage.goToIdentityProviders();
|
|
|
|
listingPage.itemExist("saml").deleteItem("saml");
|
|
|
|
modalUtils.checkModalTitle(deletePrompt).confirmModal();
|
|
|
|
masthead.checkNotificationMessage(deleteSuccessMsg);
|
|
|
|
});
|
2021-04-21 13:18:45 +00:00
|
|
|
});
|
|
|
|
});
|