New custom identity providers tests (#3238)
This commit is contained in:
parent
8f08101d9d
commit
ea24e3b91d
9 changed files with 633 additions and 4 deletions
|
@ -8,6 +8,14 @@ import CreateProviderPage from "../support/pages/admin_console/manage/identity_p
|
|||
import ModalUtils from "../support/util/ModalUtils";
|
||||
import OrderDialog from "../support/pages/admin_console/manage/identity_providers/OrderDialog";
|
||||
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 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";
|
||||
import ProviderPaypalGeneralSettings from "../support/pages/admin_console/manage/identity_providers/social/ProviderPaypalGeneralSettings";
|
||||
import ProviderStackoverflowGeneralSettings from "../support/pages/admin_console/manage/identity_providers/social/ProviderStackoverflowGeneralSettings";
|
||||
import adminClient from "../support/util/AdminClient";
|
||||
|
||||
describe("Identity provider test", () => {
|
||||
const loginPage = new LoginPage();
|
||||
|
@ -25,13 +33,93 @@ describe("Identity provider test", () => {
|
|||
const deletePrompt = "Delete provider?";
|
||||
const deleteSuccessMsg = "Provider successfully deleted.";
|
||||
|
||||
beforeEach(() => {
|
||||
keycloakBefore();
|
||||
loginPage.logIn();
|
||||
sidebarPage.goToIdentityProviders();
|
||||
});
|
||||
|
||||
const socialLoginIdentityProvidersWithCustomFiels = {
|
||||
Facebook: new ProviderFacebookGeneralSettings(),
|
||||
Github: new ProviderGithubGeneralSettings(),
|
||||
Google: new ProviderGoogleGeneralSettings(),
|
||||
"Openshift-v3": new ProviderOpenshiftGeneralSettings(),
|
||||
"Openshift-v4": new ProviderOpenshiftGeneralSettings(),
|
||||
Paypal: new ProviderPaypalGeneralSettings(),
|
||||
Stackoverflow: new ProviderStackoverflowGeneralSettings(),
|
||||
};
|
||||
function getSocialIdpClassInstance(idpTestName: string) {
|
||||
let instance = new ProviderBaseGeneralSettingsPage();
|
||||
Object.entries(socialLoginIdentityProvidersWithCustomFiels).find(
|
||||
([key, value]) => {
|
||||
if (key === idpTestName) {
|
||||
instance = value;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
);
|
||||
return instance;
|
||||
}
|
||||
|
||||
describe("Identity provider creation", () => {
|
||||
const identityProviderName = "github";
|
||||
|
||||
beforeEach(() => {
|
||||
keycloakBefore();
|
||||
loginPage.logIn();
|
||||
sidebarPage.goToIdentityProviders();
|
||||
describe("Custom fields tests", () => {
|
||||
const socialLoginIdentityProviders = [
|
||||
{ testName: "Bitbucket", displayName: "BitBucket", alias: "bitbucket" },
|
||||
{ testName: "Facebook", displayName: "Facebook", alias: "facebook" },
|
||||
{ testName: "Github", displayName: "GitHub", alias: "github" },
|
||||
{ testName: "Gitlab", displayName: "Gitlab", alias: "gitlab" },
|
||||
{ testName: "Google", displayName: "Google", alias: "google" },
|
||||
{ testName: "Instagram", displayName: "Instagram", alias: "instagram" },
|
||||
{ testName: "Linkedin", displayName: "LinkedIn", alias: "linkedin" },
|
||||
{ testName: "Microsoft", displayName: "Microsoft", alias: "microsoft" },
|
||||
{
|
||||
testName: "Openshift-v3",
|
||||
displayName: "Openshift v3",
|
||||
alias: "openshift-v3",
|
||||
},
|
||||
{
|
||||
testName: "Openshift-v4",
|
||||
displayName: "Openshift v4",
|
||||
alias: "openshift-v4",
|
||||
},
|
||||
{ testName: "Paypal", displayName: "PayPal", alias: "paypal" },
|
||||
{
|
||||
testName: "Stackoverflow",
|
||||
displayName: "StackOverflow",
|
||||
alias: "stackoverflow",
|
||||
},
|
||||
{ testName: "Twitter", displayName: "Twitter", alias: "twitter" },
|
||||
];
|
||||
|
||||
after(async () => {
|
||||
await Promise.all(
|
||||
socialLoginIdentityProviders.map((idp) =>
|
||||
adminClient.deleteIdentityProvider(idp.alias)
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
socialLoginIdentityProviders.forEach(($idp, linkedIdpsCount) => {
|
||||
it(`should create social login provider ${$idp.testName} with custom fields`, () => {
|
||||
if (linkedIdpsCount == 0) {
|
||||
createProviderPage.clickCard($idp.alias);
|
||||
} else {
|
||||
createProviderPage.clickCreateDropdown().clickItem($idp.alias);
|
||||
}
|
||||
const instance = getSocialIdpClassInstance($idp.testName);
|
||||
instance
|
||||
.typeDisplayOrder("0")
|
||||
.clickAdd()
|
||||
.assertRequiredFieldsErrorsExist()
|
||||
.fillData($idp.testName)
|
||||
.clickAdd()
|
||||
.assertNotificationIdpCreated()
|
||||
.assertFilledDataEqual($idp.testName);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it("should create provider", () => {
|
||||
|
|
|
@ -0,0 +1,167 @@
|
|||
import PageObject from "../../components/PageObject";
|
||||
|
||||
export enum LoginFlowOption {
|
||||
none = "None",
|
||||
browser = "browser",
|
||||
directGrant = "direct grant",
|
||||
registration = "registration",
|
||||
resetCredentials = "reset credentials",
|
||||
firstBrokerLogin = "first broker login",
|
||||
dockerAuth = "docker auth",
|
||||
httpChallenge = "http challenge",
|
||||
}
|
||||
|
||||
export enum SyncModeOption {
|
||||
import = "Import",
|
||||
legacy = "Legacy",
|
||||
force = "Force",
|
||||
}
|
||||
|
||||
export default class ProviderBaseGeneralSettingsPage extends PageObject {
|
||||
private scopesInput = "#scopes";
|
||||
private storeTokensSwitch = "#storeTokens";
|
||||
private storedTokensReadable = "#storedTokensReadable";
|
||||
private acceptsPromptNoneForwardFromClientSwitch = "#acceptsPromptNone";
|
||||
private disableUserInfoSwitch = "#disableUserInfo";
|
||||
private trustEmailSwitch = "#trustEmail";
|
||||
private accountLinkingOnlySwitch = "#accountLinkingOnly";
|
||||
private hideOnLoginPageSwitch = "#hideOnLoginPage";
|
||||
private firstLoginFlowSelect = "#firstBrokerLoginFlowAlias";
|
||||
private postLoginFlowSelect = "#postBrokerLoginFlowAlias";
|
||||
private syncModeSelect = "#syncMode";
|
||||
private addBtn = "createProvider";
|
||||
|
||||
public typeScopesInput(text: string) {
|
||||
cy.get(this.scopesInput).type(text).blur();
|
||||
return this;
|
||||
}
|
||||
|
||||
public clickStoreTokensSwitch() {
|
||||
cy.get(this.storeTokensSwitch).click();
|
||||
return this;
|
||||
}
|
||||
|
||||
public clickStoredTokensReadableSwitch() {
|
||||
cy.get(this.storedTokensReadable).click();
|
||||
return this;
|
||||
}
|
||||
|
||||
public clickAcceptsPromptNoneForwardFromClientSwitch() {
|
||||
cy.get(this.acceptsPromptNoneForwardFromClientSwitch).click();
|
||||
return this;
|
||||
}
|
||||
|
||||
public clickDisableUserInfoSwitch() {
|
||||
cy.get(this.disableUserInfoSwitch).click();
|
||||
return this;
|
||||
}
|
||||
|
||||
public clickTrustEmailSwitch() {
|
||||
cy.get(this.trustEmailSwitch).click();
|
||||
return this;
|
||||
}
|
||||
|
||||
public clickAccountLinkingOnlySwitch() {
|
||||
cy.get(this.accountLinkingOnlySwitch).click();
|
||||
return this;
|
||||
}
|
||||
|
||||
public clickHideOnLoginPageSwitch() {
|
||||
cy.get(this.hideOnLoginPageSwitch).click();
|
||||
return this;
|
||||
}
|
||||
|
||||
public selectFirstLoginFlowOption(loginFlowOption: LoginFlowOption) {
|
||||
cy.get(this.firstLoginFlowSelect).click();
|
||||
super.clickSelectMenuItem(
|
||||
loginFlowOption,
|
||||
cy.get(this.firstLoginFlowSelect).parent()
|
||||
);
|
||||
return this;
|
||||
}
|
||||
|
||||
public selectPostLoginFlowOption(loginFlowOption: LoginFlowOption) {
|
||||
cy.get(this.postLoginFlowSelect).click();
|
||||
super.clickSelectMenuItem(
|
||||
loginFlowOption,
|
||||
cy.get(this.postLoginFlowSelect).parent()
|
||||
);
|
||||
return this;
|
||||
}
|
||||
|
||||
public selectSyncModeOption(syncModeOption: SyncModeOption) {
|
||||
cy.get(this.syncModeSelect).click();
|
||||
super.clickSelectMenuItem(
|
||||
syncModeOption,
|
||||
cy.get(this.syncModeSelect).parent()
|
||||
);
|
||||
return this;
|
||||
}
|
||||
|
||||
public clickAdd() {
|
||||
cy.findByTestId(this.addBtn).click();
|
||||
return this;
|
||||
}
|
||||
|
||||
public assertScopesInputEqual(text: string) {
|
||||
cy.get(this.scopesInput).should("have.text", text);
|
||||
return this;
|
||||
}
|
||||
|
||||
public assertStoreTokensSwitchTurnedOn(isOn: boolean) {
|
||||
super.assertSwitchStateOn(cy.get(this.storeTokensSwitch), isOn);
|
||||
return this;
|
||||
}
|
||||
|
||||
public assertStoredTokensReadableTurnedOn(isOn: boolean) {
|
||||
super.assertSwitchStateOn(cy.get(this.storedTokensReadable), isOn);
|
||||
return this;
|
||||
}
|
||||
|
||||
public assertAcceptsPromptNoneForwardFromClientSwitchTurnedOn(isOn: boolean) {
|
||||
super.assertSwitchStateOn(
|
||||
cy.get(this.acceptsPromptNoneForwardFromClientSwitch),
|
||||
isOn
|
||||
);
|
||||
return this;
|
||||
}
|
||||
|
||||
public assertDisableUserInfoSwitchTurnedOn(isOn: boolean) {
|
||||
super.assertSwitchStateOn(cy.get(this.disableUserInfoSwitch), isOn);
|
||||
return this;
|
||||
}
|
||||
|
||||
public assertTrustEmailSwitchTurnedOn(isOn: boolean) {
|
||||
super.assertSwitchStateOn(cy.get(this.trustEmailSwitch), isOn);
|
||||
return this;
|
||||
}
|
||||
|
||||
public assertAccountLinkingOnlySwitchTurnedOn(isOn: boolean) {
|
||||
super.assertSwitchStateOn(cy.get(this.accountLinkingOnlySwitch), isOn);
|
||||
return this;
|
||||
}
|
||||
|
||||
public assertHideOnLoginPageSwitchTurnedOn(isOn: boolean) {
|
||||
super.assertSwitchStateOn(cy.get(this.hideOnLoginPageSwitch), isOn);
|
||||
return this;
|
||||
}
|
||||
|
||||
public assertFirstLoginFlowSelectOptionEqual(
|
||||
loginFlowOption: LoginFlowOption
|
||||
) {
|
||||
cy.get(this.firstLoginFlowSelect).should("have.text", loginFlowOption);
|
||||
return this;
|
||||
}
|
||||
|
||||
public assertPostLoginFlowSelectOptionEqual(
|
||||
loginFlowOption: LoginFlowOption
|
||||
) {
|
||||
cy.get(this.postLoginFlowSelect).should("have.text", loginFlowOption);
|
||||
return this;
|
||||
}
|
||||
|
||||
public assertSyncModeSelectOptionEqual(syncModeOption: SyncModeOption) {
|
||||
cy.get(this.postLoginFlowSelect).should("have.text", syncModeOption);
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,139 @@
|
|||
import PageObject from "../../components/PageObject";
|
||||
import Masthead from "../../Masthead";
|
||||
|
||||
const masthead = new Masthead();
|
||||
|
||||
export default class ProviderBaseGeneralSettingsPage extends PageObject {
|
||||
private redirectUriGroup = ".pf-c-clipboard-copy__group";
|
||||
protected clientIdInput = "#kc-client-id";
|
||||
protected clientSecretInput = "#kc-client-secret";
|
||||
private displayOrderInput = "#kc-display-order";
|
||||
private addBtn = "createProvider";
|
||||
private cancelBtn = "cancel";
|
||||
private requiredFieldErrorMsg = ".pf-c-form__helper-text.pf-m-error";
|
||||
protected requiredFields: string[] = [
|
||||
this.clientIdInput,
|
||||
this.clientSecretInput,
|
||||
];
|
||||
protected testData = {
|
||||
ClientId: "client",
|
||||
ClientSecret: "client_secret",
|
||||
DisplayOrder: "0",
|
||||
};
|
||||
|
||||
public typeClientId(clientId: string) {
|
||||
cy.get(this.clientIdInput).type(clientId).blur();
|
||||
return this;
|
||||
}
|
||||
|
||||
public typeClientSecret(clientSecret: string) {
|
||||
cy.get(this.clientSecretInput).type(clientSecret).blur();
|
||||
return this;
|
||||
}
|
||||
|
||||
public typeDisplayOrder(displayOrder: string) {
|
||||
cy.get(this.displayOrderInput).type(displayOrder).blur();
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public clickShowPassword() {
|
||||
cy.get(this.clientSecretInput).parent().find("button").click();
|
||||
return this;
|
||||
}
|
||||
|
||||
public clickCopyToClipboard() {
|
||||
cy.get(this.redirectUriGroup).find("button").click();
|
||||
return this;
|
||||
}
|
||||
|
||||
public clickAdd() {
|
||||
cy.findByTestId(this.addBtn).click();
|
||||
return this;
|
||||
}
|
||||
|
||||
public clickCancel() {
|
||||
cy.findByTestId(this.cancelBtn).click();
|
||||
return this;
|
||||
}
|
||||
|
||||
public assertRedirectUriInputEqual(value: string) {
|
||||
cy.get(this.redirectUriGroup).find("input").should("have.value", value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public assertClientIdInputEqual(text: string) {
|
||||
cy.get(this.clientIdInput).should("have.text", text);
|
||||
return this;
|
||||
}
|
||||
|
||||
public assertClientSecretInputEqual(text: string) {
|
||||
cy.get(this.clientSecretInput).should("have.text", text);
|
||||
return this;
|
||||
}
|
||||
|
||||
public assertDisplayOrderInputEqual(text: string) {
|
||||
cy.get(this.clientSecretInput).should("have.text", text);
|
||||
return this;
|
||||
}
|
||||
|
||||
public assertNotificationIdpCreated() {
|
||||
masthead.checkNotificationMessage("Identity provider successfully created");
|
||||
return this;
|
||||
}
|
||||
|
||||
protected assertCommonRequiredFields(requiredFiels: string[]) {
|
||||
requiredFiels.forEach((elementLocator) => {
|
||||
if (elementLocator.includes("#")) {
|
||||
cy.get(elementLocator)
|
||||
.parent()
|
||||
.parent()
|
||||
.find(this.requiredFieldErrorMsg)
|
||||
.should("exist");
|
||||
} else {
|
||||
cy.findByTestId(elementLocator)
|
||||
.parent()
|
||||
.parent()
|
||||
.find(this.requiredFieldErrorMsg)
|
||||
.should("exist");
|
||||
}
|
||||
});
|
||||
return this;
|
||||
}
|
||||
|
||||
public assertRequiredFieldsErrorsExist() {
|
||||
return this.assertCommonRequiredFields(this.requiredFields);
|
||||
}
|
||||
|
||||
protected fillCommonFields(idpName: string) {
|
||||
this.typeClientId(this.testData["ClientId"] + idpName);
|
||||
this.typeClientSecret(this.testData["ClientSecret"] + idpName);
|
||||
this.typeDisplayOrder(this.testData["DisplayOrder"]);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public fillData(idpName: string) {
|
||||
this.fillCommonFields(idpName);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
protected assertCommonFilledDataEqual(idpName: string) {
|
||||
cy.get(this.clientIdInput).should(
|
||||
"have.value",
|
||||
this.testData["ClientId"] + idpName
|
||||
);
|
||||
cy.get(this.clientSecretInput).should("contain.value", "****");
|
||||
cy.get(this.displayOrderInput).should(
|
||||
"have.value",
|
||||
this.testData["DisplayOrder"]
|
||||
);
|
||||
return this;
|
||||
}
|
||||
|
||||
public assertFilledDataEqual(idpName: string) {
|
||||
this.assertCommonFilledDataEqual(idpName);
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
import ProviderBaseGeneralSettingsPage from "../ProviderBaseGeneralSettingsPage";
|
||||
|
||||
const additionalUsersProfile_input_test_value =
|
||||
"additionalUsersProfile_input_test_value";
|
||||
|
||||
export default class ProviderFacebookGeneralSettings extends ProviderBaseGeneralSettingsPage {
|
||||
private additionalUsersProfileFieldsInput = "#facebookFetchedFields";
|
||||
|
||||
public typeAdditionalUsersProfileFieldsInput(value: string) {
|
||||
cy.get(this.additionalUsersProfileFieldsInput).type(value).blur();
|
||||
return this;
|
||||
}
|
||||
|
||||
public assertAdditionalUsersProfileFieldsInputEqual(value: string) {
|
||||
cy.get(this.additionalUsersProfileFieldsInput).should("have.value", value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public fillData(idpName: string) {
|
||||
this.fillCommonFields(idpName);
|
||||
this.typeAdditionalUsersProfileFieldsInput(
|
||||
idpName + additionalUsersProfile_input_test_value
|
||||
);
|
||||
return this;
|
||||
}
|
||||
|
||||
public assertFilledDataEqual(idpName: string) {
|
||||
this.assertCommonFilledDataEqual(idpName);
|
||||
this.assertAdditionalUsersProfileFieldsInputEqual(
|
||||
idpName + additionalUsersProfile_input_test_value
|
||||
);
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
import ProviderBaseGeneralSettingsPage from "../ProviderBaseGeneralSettingsPage";
|
||||
|
||||
const base_url_input_test_value = "base_url_input_test_value";
|
||||
const api_url_input_test_value = "api_url_input_test_value";
|
||||
|
||||
export default class ProviderGithubGeneralSettings extends ProviderBaseGeneralSettingsPage {
|
||||
private baseUrlInput = "#baseUrl";
|
||||
private apiUrlInput = "#apiUrl";
|
||||
|
||||
public typeBaseUrlInput(value: string) {
|
||||
cy.get(this.baseUrlInput).type(value).blur();
|
||||
return this;
|
||||
}
|
||||
|
||||
public typeApiUrlInput(value: string) {
|
||||
cy.get(this.apiUrlInput).type(value).blur();
|
||||
return this;
|
||||
}
|
||||
|
||||
public assertBaseUrlInputInputEqual(value: string) {
|
||||
cy.get(this.baseUrlInput).should("have.value", value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public assertApiUrlInputEqual(value: string) {
|
||||
cy.get(this.apiUrlInput).should("have.value", value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public fillData(idpName: string) {
|
||||
this.fillCommonFields(idpName);
|
||||
this.typeBaseUrlInput(idpName + base_url_input_test_value);
|
||||
this.typeApiUrlInput(idpName + api_url_input_test_value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public assertFilledDataEqual(idpName: string) {
|
||||
this.assertCommonFilledDataEqual(idpName);
|
||||
this.assertBaseUrlInputInputEqual(idpName + base_url_input_test_value);
|
||||
this.assertApiUrlInputEqual(idpName + api_url_input_test_value);
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
import ProviderBaseGeneralSettingsPage from "../ProviderBaseGeneralSettingsPage";
|
||||
|
||||
const hosted_domain_input_test_value = "hosted_domain_input_test_value";
|
||||
|
||||
export default class ProviderGoogleGeneralSettings extends ProviderBaseGeneralSettingsPage {
|
||||
private hostedDomainInput = "#googleHostedDomain";
|
||||
private useUserIpParamSwitch = "#googleUserIp";
|
||||
private requestRefreshTokenSwitch = "#googleOfflineAccess";
|
||||
|
||||
public typeHostedDomainInput(value: string) {
|
||||
cy.get(this.hostedDomainInput).type(value).blur();
|
||||
return this;
|
||||
}
|
||||
|
||||
public clickUseUserIpParamSwitch() {
|
||||
cy.get(this.useUserIpParamSwitch).parent().click();
|
||||
return this;
|
||||
}
|
||||
|
||||
public clickRequestRefreshTokenSwitch() {
|
||||
cy.get(this.requestRefreshTokenSwitch).parent().click();
|
||||
return this;
|
||||
}
|
||||
|
||||
public assertHostedDomainInputEqual(value: string) {
|
||||
cy.get(this.hostedDomainInput).should("have.value", value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public assertUseUserIpParamSwitchTurnedOn(isOn: boolean) {
|
||||
super.assertSwitchStateOn(cy.get(this.useUserIpParamSwitch), isOn);
|
||||
return this;
|
||||
}
|
||||
|
||||
public assertRequestRefreshTokenSwitchTurnedOn(isOn: boolean) {
|
||||
super.assertSwitchStateOn(cy.get(this.requestRefreshTokenSwitch), isOn);
|
||||
return this;
|
||||
}
|
||||
|
||||
public fillData(idpName: string) {
|
||||
this.fillCommonFields(idpName);
|
||||
this.typeHostedDomainInput(hosted_domain_input_test_value);
|
||||
this.clickUseUserIpParamSwitch();
|
||||
this.clickRequestRefreshTokenSwitch();
|
||||
return this;
|
||||
}
|
||||
|
||||
public assertFilledDataEqual(idpName: string) {
|
||||
this.assertCommonFilledDataEqual(idpName);
|
||||
this.assertHostedDomainInputEqual(hosted_domain_input_test_value);
|
||||
this.assertSwitchStateOn(cy.get(this.useUserIpParamSwitch));
|
||||
this.assertSwitchStateOn(cy.get(this.requestRefreshTokenSwitch));
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
import ProviderBaseGeneralSettingsPage from "../ProviderBaseGeneralSettingsPage";
|
||||
|
||||
const base_url_input_test_value = "base_url_input_test_value";
|
||||
|
||||
export default class ProviderOpenshiftGeneralSettings extends ProviderBaseGeneralSettingsPage {
|
||||
private baseUrlInput = "#baseUrl";
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.requiredFields.push(this.baseUrlInput);
|
||||
}
|
||||
|
||||
public typeBaseUrlInput(value: string) {
|
||||
cy.get(this.baseUrlInput).type(value).blur();
|
||||
return this;
|
||||
}
|
||||
|
||||
public assertbaseUrlInputEqual(value: string) {
|
||||
cy.get(this.baseUrlInput).should("have.value", value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public assertRequiredFieldsErrorsExist() {
|
||||
return this.assertCommonRequiredFields(this.requiredFields);
|
||||
}
|
||||
|
||||
public fillData(idpName: string) {
|
||||
this.fillCommonFields(idpName);
|
||||
cy.get(this.baseUrlInput).type(idpName + base_url_input_test_value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public assertFilledDataEqual(idpName: string) {
|
||||
this.assertCommonFilledDataEqual(idpName);
|
||||
this.assertbaseUrlInputEqual(idpName + base_url_input_test_value);
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
import ProviderBaseGeneralSettingsPage from "../ProviderBaseGeneralSettingsPage";
|
||||
|
||||
export default class ProviderPaypalGeneralSettings extends ProviderBaseGeneralSettingsPage {
|
||||
private targetSandboxSwitch = "#paypalSandbox";
|
||||
|
||||
public clickTargetSandboxSwitch() {
|
||||
cy.get(this.targetSandboxSwitch).parent().click();
|
||||
return this;
|
||||
}
|
||||
|
||||
public assertTargetSandboxSwitchTurnedOn(isOn: boolean) {
|
||||
super.assertSwitchStateOn(cy.get(this.targetSandboxSwitch), isOn);
|
||||
return this;
|
||||
}
|
||||
|
||||
public fillData(idpName: string) {
|
||||
this.fillCommonFields(idpName);
|
||||
this.clickTargetSandboxSwitch();
|
||||
return this;
|
||||
}
|
||||
|
||||
public assertFilledDataEqual(idpName: string) {
|
||||
this.assertCommonFilledDataEqual(idpName);
|
||||
this.assertSwitchStateOn(cy.get(this.targetSandboxSwitch));
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
import ProviderBaseGeneralSettingsPage from "../ProviderBaseGeneralSettingsPage";
|
||||
|
||||
const key_input_test_value = "key_input_test_value";
|
||||
|
||||
export default class ProviderStackoverflowGeneralSettings extends ProviderBaseGeneralSettingsPage {
|
||||
private keyInput = "#stackoverflowKey";
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.requiredFields.push(this.keyInput);
|
||||
}
|
||||
|
||||
public typeKeyInput(value: string) {
|
||||
cy.get(this.keyInput).type(value).blur();
|
||||
return this;
|
||||
}
|
||||
|
||||
public assertKeyInputEqual(value: string) {
|
||||
cy.get(this.keyInput).should("have.value", value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public assertRequiredFieldsErrorsExist() {
|
||||
return this.assertCommonRequiredFields(this.requiredFields);
|
||||
}
|
||||
|
||||
public fillData(idpName: string) {
|
||||
this.fillCommonFields(idpName);
|
||||
this.typeKeyInput(idpName + key_input_test_value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public assertFilledDataEqual(idpName: string) {
|
||||
this.assertCommonFilledDataEqual(idpName);
|
||||
this.assertKeyInputEqual(idpName + key_input_test_value);
|
||||
return this;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue