github provider details testing (#3371)

This commit is contained in:
Dominik Kawka 2022-09-26 18:21:38 +01:00 committed by GitHub
parent bff01af327
commit ebf8a6c91c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 115 additions and 13 deletions

View file

@ -10,6 +10,7 @@ import OrderDialog from "../support/pages/admin_console/manage/identity_provider
import AddMapperPage from "../support/pages/admin_console/manage/identity_providers/AddMapperPage";
import ProviderFacebookGeneralSettings from "../support/pages/admin_console/manage/identity_providers/social/ProviderFacebookGeneralSettings";
import ProviderBaseGeneralSettingsPage from "../support/pages/admin_console/manage/identity_providers/ProviderBaseGeneralSettingsPage";
import ProviderBaseAdvancedSettingsPage from "../support/pages/admin_console/manage/identity_providers/ProviderBaseAdvancedSettingsPage";
import ProviderGithubGeneralSettings from "../support/pages/admin_console/manage/identity_providers/social/ProviderGithubGeneralSettings";
import ProviderGoogleGeneralSettings from "../support/pages/admin_console/manage/identity_providers/social/ProviderGoogleGeneralSettings";
import ProviderOpenshiftGeneralSettings from "../support/pages/admin_console/manage/identity_providers/social/ProviderOpenshiftGeneralSettings";
@ -279,4 +280,99 @@ describe("Identity provider test", () => {
masthead.checkNotificationMessage(deleteSuccessMsg, true);
});
});
describe("should check provider details", () => {
const identityProviderName = "github";
const githubSettings = new ProviderGithubGeneralSettings();
const advancedSettings = new ProviderBaseAdvancedSettingsPage();
it("creating github provider", () => {
createProviderPage.checkGitHubCardVisible().clickGitHubCard();
createProviderPage.checkAddButtonDisabled();
createProviderPage
.fill(identityProviderName)
.clickAdd()
.checkClientIdRequiredMessage(true);
createProviderPage.fill(identityProviderName, "123").clickAdd();
masthead.checkNotificationMessage(createSuccessMsg, true);
sidebarPage.goToIdentityProviders();
listingPage.itemExist(identityProviderName);
});
it("should check general settings", () => {
sidebarPage.goToIdentityProviders();
listingPage.goToItemDetails("github");
githubSettings.fillData("github");
cy.findByTestId("save").click();
});
it("should check input switches and inputs", () => {
sidebarPage.goToIdentityProviders();
listingPage.goToItemDetails("github");
advancedSettings.typeScopesInput("openid");
//advancedSettings.assertScopesInputEqual("openid"); //this line doesn't work
advancedSettings.assertStoreTokensSwitchTurnedOn(false);
advancedSettings.assertAcceptsPromptNoneForwardFromClientSwitchTurnedOn(
false
);
advancedSettings.assertDisableUserInfoSwitchTurnedOn(false);
advancedSettings.assertTrustEmailSwitchTurnedOn(false);
advancedSettings.assertAccountLinkingOnlySwitchTurnedOn(false);
advancedSettings.assertHideOnLoginPageSwitchTurnedOn(false);
advancedSettings.clickStoreTokensSwitch();
advancedSettings.clickAcceptsPromptNoneForwardFromClientSwitch();
advancedSettings.clickDisableUserInfoSwitch();
advancedSettings.clickTrustEmailSwitch();
advancedSettings.clickAccountLinkingOnlySwitch();
advancedSettings.clickHideOnLoginPageSwitch();
advancedSettings.assertStoreTokensSwitchTurnedOn(true);
advancedSettings.assertAcceptsPromptNoneForwardFromClientSwitchTurnedOn(
true
);
advancedSettings.assertDisableUserInfoSwitchTurnedOn(true);
advancedSettings.assertTrustEmailSwitchTurnedOn(true);
advancedSettings.assertAccountLinkingOnlySwitchTurnedOn(true);
advancedSettings.assertHideOnLoginPageSwitchTurnedOn(true);
cy.findByTestId("save").click();
});
it("should revert and save options", () => {
sidebarPage.goToIdentityProviders();
listingPage.goToItemDetails("github");
cy.findByTestId("jump-link-advanced-settings").click();
advancedSettings.assertStoreTokensSwitchTurnedOn(true);
advancedSettings.assertAcceptsPromptNoneForwardFromClientSwitchTurnedOn(
true
);
advancedSettings.clickStoreTokensSwitch();
advancedSettings.clickAcceptsPromptNoneForwardFromClientSwitch();
advancedSettings.assertStoreTokensSwitchTurnedOn(false);
advancedSettings.assertAcceptsPromptNoneForwardFromClientSwitchTurnedOn(
false
);
cy.findByTestId("revert").click();
advancedSettings.assertStoreTokensSwitchTurnedOn(true);
advancedSettings.assertAcceptsPromptNoneForwardFromClientSwitchTurnedOn(
true
);
});
it("should delete providers", () => {
const modalUtils = new ModalUtils();
sidebarPage.goToIdentityProviders();
listingPage.itemExist("github").deleteItem("github");
modalUtils.checkModalTitle(deletePrompt).confirmModal();
masthead.checkNotificationMessage(deleteSuccessMsg, true);
});
});
});

View file

@ -37,37 +37,37 @@ export default class ProviderBaseGeneralSettingsPage extends PageObject {
}
public clickStoreTokensSwitch() {
cy.get(this.storeTokensSwitch).click();
cy.get(this.storeTokensSwitch).parent().click();
return this;
}
public clickStoredTokensReadableSwitch() {
cy.get(this.storedTokensReadable).click();
cy.get(this.storedTokensReadable).parent().click();
return this;
}
public clickAcceptsPromptNoneForwardFromClientSwitch() {
cy.get(this.acceptsPromptNoneForwardFromClientSwitch).click();
cy.get(this.acceptsPromptNoneForwardFromClientSwitch).parent().click();
return this;
}
public clickDisableUserInfoSwitch() {
cy.get(this.disableUserInfoSwitch).click();
cy.get(this.disableUserInfoSwitch).parent().click();
return this;
}
public clickTrustEmailSwitch() {
cy.get(this.trustEmailSwitch).click();
cy.get(this.trustEmailSwitch).parent().click();
return this;
}
public clickAccountLinkingOnlySwitch() {
cy.get(this.accountLinkingOnlySwitch).click();
cy.get(this.accountLinkingOnlySwitch).parent().click();
return this;
}
public clickHideOnLoginPageSwitch() {
cy.get(this.hideOnLoginPageSwitch).click();
cy.get(this.hideOnLoginPageSwitch).parent().click();
return this;
}
@ -104,7 +104,7 @@ export default class ProviderBaseGeneralSettingsPage extends PageObject {
}
public assertScopesInputEqual(text: string) {
cy.get(this.scopesInput).should("have.text", text);
cy.get(this.scopesInput).should("have.text", text).parent();
return this;
}
@ -114,25 +114,28 @@ export default class ProviderBaseGeneralSettingsPage extends PageObject {
}
public assertStoredTokensReadableTurnedOn(isOn: boolean) {
super.assertSwitchStateOn(cy.get(this.storedTokensReadable), isOn);
super.assertSwitchStateOn(cy.get(this.storedTokensReadable).parent(), isOn);
return this;
}
public assertAcceptsPromptNoneForwardFromClientSwitchTurnedOn(isOn: boolean) {
super.assertSwitchStateOn(
cy.get(this.acceptsPromptNoneForwardFromClientSwitch),
cy.get(this.acceptsPromptNoneForwardFromClientSwitch).parent(),
isOn
);
return this;
}
public assertDisableUserInfoSwitchTurnedOn(isOn: boolean) {
super.assertSwitchStateOn(cy.get(this.disableUserInfoSwitch), isOn);
super.assertSwitchStateOn(
cy.get(this.disableUserInfoSwitch).parent(),
isOn
);
return this;
}
public assertTrustEmailSwitchTurnedOn(isOn: boolean) {
super.assertSwitchStateOn(cy.get(this.trustEmailSwitch), isOn);
super.assertSwitchStateOn(cy.get(this.trustEmailSwitch).parent(), isOn);
return this;
}
@ -142,7 +145,10 @@ export default class ProviderBaseGeneralSettingsPage extends PageObject {
}
public assertHideOnLoginPageSwitchTurnedOn(isOn: boolean) {
super.assertSwitchStateOn(cy.get(this.hideOnLoginPageSwitch), isOn);
super.assertSwitchStateOn(
cy.get(this.hideOnLoginPageSwitch).parent(),
isOn
);
return this;
}