keycloak-scim/cypress/integration/identity_providers.spec.ts
Erik Jan de Wit 8d72f8a705
Fixing cypress tests (#586)
* upgrade cypress

* fixed delete now has dialog

* also check "unAssign"

* client type no longer required

* providers and group changes

* grp creation working

* moved create realm button ouside the dropdown

* sped up test and added cleanup

* Revert "moved create realm button ouside the dropdown"

This reverts commit e2076a5305808417de910ba8fada8e528e5c356a.

* make test re-runnable

* removed un needed navigation

* Fix misformed Cypress config for GitHub Action

* cleanup after test

* fixed cleanup

* temporary removed this test

* also remove user "new"

* try adding a wait for CI

* get different modal id

* add {force: true} to modal functions

* mv grp search last and ignore 401

* try using cy.get and disable video for testing

* add back video artifacts

Co-authored-by: mfrances <mfrances@redhat.com>
Co-authored-by: Jon Koops <jonkoops@gmail.com>
Co-authored-by: jenny-s51 <jshandel@redhat.com>
2021-05-06 07:31:40 +02:00

104 lines
3.6 KiB
TypeScript

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";
describe("Identity provider test", () => {
const loginPage = new LoginPage();
const sidebarPage = new SidebarPage();
const masthead = new Masthead();
const listingPage = new ListingPage();
const createProviderPage = new CreateProviderPage();
describe("Identity provider creation", () => {
const identityProviderName = "github";
beforeEach(function () {
keycloakBefore();
loginPage.logIn();
sidebarPage.goToIdentityProviders();
});
it("should create provider", () => {
createProviderPage.checkGitHubCardVisible().clickGitHubCard();
createProviderPage.checkAddButtonDisabled();
createProviderPage
.fill(identityProviderName)
.clickAdd()
.checkClientIdRequiredMessage(true);
createProviderPage.fill(identityProviderName, "123").clickAdd();
masthead.checkNotificationMessage(
"Identity provider successfully created"
);
//TODO temporary refresh
sidebarPage.goToAuthentication().goToIdentityProviders();
listingPage.itemExist(identityProviderName);
});
it("should delete provider", () => {
const modalUtils = new ModalUtils();
listingPage.deleteItem(identityProviderName);
modalUtils.checkModalTitle("Delete provider?").confirmModal();
masthead.checkNotificationMessage("Provider successfully deleted");
createProviderPage.checkGitHubCardVisible();
});
it("should change order of providers", () => {
const orderDialog = new OrderDialog();
const providers = ["facebook", identityProviderName, "bitbucket"];
createProviderPage
.clickCard("facebook")
.fill("facebook", "123")
.clickAdd();
listingPage.itemExist("facebook");
createProviderPage
.clickCreateDropdown()
.clickItem(identityProviderName)
.fill(identityProviderName, "123")
.clickAdd();
createProviderPage
.clickCreateDropdown()
.clickItem("bitbucket")
.fill("bitbucket", "123")
.clickAdd();
orderDialog.openDialog().checkOrder(providers);
orderDialog.moveRowTo("facebook", identityProviderName);
orderDialog.checkOrder(["facebook", "bitbucket", identityProviderName]);
orderDialog.clickSave();
masthead.checkNotificationMessage(
"Successfully changed display order of identity providers"
);
});
it("clean up providers", () => {
const modalUtils = new ModalUtils();
listingPage.deleteItem("bitbucket");
modalUtils.checkModalTitle("Delete provider?").confirmModal();
masthead.checkNotificationMessage("Provider successfully deleted");
listingPage.deleteItem("facebook");
modalUtils.checkModalTitle("Delete provider?").confirmModal();
masthead.checkNotificationMessage("Provider successfully deleted");
cy.wait(100);
listingPage.deleteItem("github");
modalUtils.checkModalTitle("Delete provider?").confirmModal();
masthead.checkNotificationMessage("Provider successfully deleted");
});
});
});