Tests for realm setting tabs (#3564)
This commit is contained in:
parent
034b640042
commit
9748397661
4 changed files with 60 additions and 4 deletions
|
@ -233,6 +233,12 @@ describe("Realm settings events tab tests", () => {
|
|||
realmSettingsPage.deleteProvider("test_aes-generated");
|
||||
});
|
||||
|
||||
it("list keys", () => {
|
||||
sidebarPage.goToRealmSettings();
|
||||
cy.findByTestId("rs-keys-tab").click();
|
||||
realmSettingsPage.checkKeyPublic();
|
||||
});
|
||||
|
||||
it("add locale", () => {
|
||||
sidebarPage.goToRealmSettings();
|
||||
|
||||
|
@ -258,6 +264,8 @@ describe("Realm settings events tab tests", () => {
|
|||
masthead.checkNotificationMessage(
|
||||
"Success! The message bundle has been added."
|
||||
);
|
||||
realmSettingsPage.setDefaultLocale("dansk");
|
||||
cy.findByTestId("localization-tab-save").click();
|
||||
});
|
||||
|
||||
it("Realm header settings", () => {
|
||||
|
|
|
@ -81,6 +81,21 @@ describe("Realm settings tabs tests", () => {
|
|||
const msg: string = "Error! Failed to send email.";
|
||||
sidebarPage.goToRealmSettings();
|
||||
cy.findByTestId("rs-email-tab").click();
|
||||
//required fields not filled in or not filled properly
|
||||
realmSettingsPage.addSenderEmail("not a valid email");
|
||||
realmSettingsPage.fillFromDisplayName("displayName");
|
||||
realmSettingsPage.fillReplyToEmail("replyTo@email.com");
|
||||
realmSettingsPage.fillPort("10");
|
||||
cy.findByTestId("email-tab-save").click();
|
||||
cy.get("#kc-display-name-helper").contains("You must enter a valid email.");
|
||||
cy.get("#kc-host-helper").contains("Required field");
|
||||
//revert
|
||||
cy.wait(100);
|
||||
cy.findByTestId("email-tab-revert").click();
|
||||
cy.findByTestId("sender-email-address").should("be.empty");
|
||||
cy.findByTestId("from-display-name").should("be.empty");
|
||||
cy.get("#kc-port").should("be.empty");
|
||||
|
||||
realmSettingsPage.addSenderEmail("example@example.com");
|
||||
realmSettingsPage.toggleCheck(realmSettingsPage.enableSslCheck);
|
||||
realmSettingsPage.toggleCheck(realmSettingsPage.enableStartTlsCheck);
|
||||
|
@ -89,10 +104,12 @@ describe("Realm settings tabs tests", () => {
|
|||
cy.findByTestId(realmSettingsPage.testConnectionButton).click();
|
||||
cy.wait("@load");
|
||||
|
||||
//ln109-113 cause the tests to fail locally, but is needed for the test to pass on the dashboard.
|
||||
realmSettingsPage.fillEmailField(
|
||||
"example" + (Math.random() + 1).toString(36).substring(7) + "@example.com"
|
||||
);
|
||||
cy.findByTestId(realmSettingsPage.modalTestConnectionButton).click();
|
||||
|
||||
masthead.checkNotificationMessage(msg, true);
|
||||
});
|
||||
|
||||
|
|
|
@ -54,8 +54,8 @@ export default class RealmSettingsPage extends CommonPage {
|
|||
loginActionTimeoutSelectMenuList =
|
||||
"#kc-login-action-timeout-select-menu > div > ul";
|
||||
|
||||
selectDefaultLocale = "select-default-locale";
|
||||
defaultLocaleList = "select-default-locale > div > ul";
|
||||
selectDefaultLocale = "#kc-default-locale";
|
||||
defaultLocaleList = "select-default-locale";
|
||||
supportedLocalesTypeahead =
|
||||
"#kc-l-supported-locales-select-multi-typeahead-typeahead";
|
||||
supportedLocalesToggle = "#kc-l-supported-locales";
|
||||
|
@ -229,6 +229,13 @@ export default class RealmSettingsPage extends CommonPage {
|
|||
private realmDisplayName = "#kc-display-name";
|
||||
private frontEndURL = "#kc-frontend-url";
|
||||
private requireSSL = "#kc-require-ssl";
|
||||
private fromDisplayName = "from-display-name";
|
||||
private replyToEmail = "#kc-reply-to";
|
||||
private port = "#kc-port";
|
||||
|
||||
private keysList = ".kc-keys-list > tbody > tr > td";
|
||||
private publicKeyBtn =
|
||||
".kc-keys-list > tbody > tr > td > .button-wrapper > button";
|
||||
private realmSettingsEventsTab = new RealmSettingsEventsTab();
|
||||
|
||||
private realmName?: string;
|
||||
|
@ -304,6 +311,18 @@ export default class RealmSettingsPage extends CommonPage {
|
|||
cy.get(this.realmDisplayName).clear().type(displayName);
|
||||
}
|
||||
|
||||
fillFromDisplayName(displayName: string) {
|
||||
cy.findByTestId(this.fromDisplayName).clear().type(displayName);
|
||||
}
|
||||
|
||||
fillReplyToEmail(email: string) {
|
||||
cy.get(this.replyToEmail).clear().type(email);
|
||||
}
|
||||
|
||||
fillPort(port: string) {
|
||||
cy.get(this.port).clear().type(port);
|
||||
}
|
||||
|
||||
fillFrontendURL(url: string) {
|
||||
cy.get(this.frontEndURL).clear().type(url);
|
||||
}
|
||||
|
@ -322,7 +341,7 @@ export default class RealmSettingsPage extends CommonPage {
|
|||
|
||||
setDefaultLocale(locale: string) {
|
||||
cy.get(this.selectDefaultLocale).click();
|
||||
cy.get(this.defaultLocaleList).contains(locale).click();
|
||||
cy.findByTestId(this.defaultLocaleList).contains(locale).click();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -366,6 +385,14 @@ export default class RealmSettingsPage extends CommonPage {
|
|||
return this;
|
||||
}
|
||||
|
||||
checkKeyPublic() {
|
||||
cy.get(this.publicKeyBtn).contains("Public key").click();
|
||||
this.modalUtils().checkModalTitle("Public key").confirmModal();
|
||||
|
||||
cy.get(this.publicKeyBtn).contains("Certificate").click();
|
||||
this.modalUtils().checkModalTitle("Certificate").confirmModal();
|
||||
}
|
||||
|
||||
switchToActiveFilter() {
|
||||
cy.get(this.filterSelectMenu).first().click();
|
||||
cy.findByTestId(this.activeKeysOption).click();
|
||||
|
|
|
@ -405,7 +405,11 @@ export const RealmSettingsEmailTab = ({
|
|||
>
|
||||
{t("common:testConnection")}
|
||||
</Button>
|
||||
<Button variant="link" onClick={reset}>
|
||||
<Button
|
||||
variant="link"
|
||||
onClick={reset}
|
||||
data-testid="email-tab-revert"
|
||||
>
|
||||
{t("common:revert")}
|
||||
</Button>
|
||||
</ActionGroup>
|
||||
|
|
Loading…
Reference in a new issue