diff --git a/src/index.ts b/src/index.ts index ff2a9cdd..cea05c13 100644 --- a/src/index.ts +++ b/src/index.ts @@ -269,6 +269,7 @@ export {default as foHummingbirdSearchResultsPage} from '@pages/FO/hummingbird/s // Export Modules export {default as modBlockwishlistBoMain} from '@pages/BO/modules/blockwishlist'; export {default as modBlockwishlistBoStatistics} from '@pages/BO/modules/blockwishlist/statistics'; +export {default as modKeycloakConnectorDemoBoMain} from '@pages/BO/modules/keycloakConnectorDemo'; export {default as modPsEmailSubscriptionBoMain} from '@pages/BO/modules/ps_emailsubscription'; export {default as modPsFacetedsearchBoMain} from '@pages/BO/modules/ps_facetedsearch'; export {default as modPsFacetedsearchBoFilterTemplate} from '@pages/BO/modules/ps_facetedsearch/filterTemplate'; diff --git a/src/interfaces/BO/modules/keycloakConnectorDemo/index.ts b/src/interfaces/BO/modules/keycloakConnectorDemo/index.ts new file mode 100644 index 00000000..1a346385 --- /dev/null +++ b/src/interfaces/BO/modules/keycloakConnectorDemo/index.ts @@ -0,0 +1,8 @@ +import {type ModuleConfigurationPageInterface} from '@interfaces/BO/modules/moduleConfiguration'; +import {type Page} from '@playwright/test'; + +export interface ModuleKeycloakConnectorDemoPageInterface extends ModuleConfigurationPageInterface { + readonly pageTitle: string; + + setKeycloakEndpoint(page: Page, keycloakRealmUrl: string, allowedIssuers: string[]): Promise; +} diff --git a/src/pages/BO/modules/keycloakConnectorDemo/index.ts b/src/pages/BO/modules/keycloakConnectorDemo/index.ts new file mode 100644 index 00000000..34ccb290 --- /dev/null +++ b/src/pages/BO/modules/keycloakConnectorDemo/index.ts @@ -0,0 +1,9 @@ +import type {ModuleKeycloakConnectorDemoPageInterface} from '@interfaces/BO/modules/keycloakConnectorDemo'; + +/* eslint-disable global-require */ +function requirePage(): ModuleKeycloakConnectorDemoPageInterface { + return require('@versions/develop/pages/BO/modules/keycloakConnectorDemo'); +} +/* eslint-enable global-require */ + +export default requirePage(); diff --git a/src/versions/develop/pages/BO/modules/keycloakConnectorDemo/index.ts b/src/versions/develop/pages/BO/modules/keycloakConnectorDemo/index.ts new file mode 100644 index 00000000..8f1a4aba --- /dev/null +++ b/src/versions/develop/pages/BO/modules/keycloakConnectorDemo/index.ts @@ -0,0 +1,53 @@ +import {type ModuleKeycloakConnectorDemoPageInterface} from '@interfaces/BO/modules/keycloakConnectorDemo'; +import ModuleConfiguration from '@pages/BO/modules/moduleConfiguration'; +import {type Page} from '@playwright/test'; + +/** + * Module configuration page for module : ps_email_subscription, contains selectors and functions for the page + * @class + * @extends ModuleConfiguration + */ +class KeycloakConnectorDemoPage extends ModuleConfiguration implements ModuleKeycloakConnectorDemoPageInterface { + public readonly pageTitle: string; + + private readonly formKeycloakEndpoint: string; + + private readonly formKeycloakAllowedIssuers: string; + + private readonly formKeycloakButtonSubmit: string; + + /** + * @constructs + * Setting up titles and selectors to use on ps email subscription page + */ + constructor() { + super(); + + this.pageTitle = `Keycloak connector • ${global.INSTALL.SHOP_NAME}`; + + // Form selectors + this.formKeycloakEndpoint = '#form_KEYCLOAK_REALM_ENDPOINT'; + this.formKeycloakAllowedIssuers = '#form_KEYCLOAK_ALLOWED_ISSUERS'; + this.formKeycloakButtonSubmit = 'form.form-horizontal .card-footer button'; + } + + /* Methods */ + + /** + * Set the Keycloak Realm Endpoint + * @param page {Page} Browser tab + * @param keycloakRealmUrl {string} + * @param allowedIssuers {string[]} + * @returns {Promise} + */ + async setKeycloakEndpoint(page: Page, keycloakRealmUrl: string, allowedIssuers: string[]): Promise { + await page.locator(this.formKeycloakEndpoint).fill(keycloakRealmUrl); + await page.locator(this.formKeycloakAllowedIssuers).fill(allowedIssuers.join(' ')); + + await this.clickAndWaitForLoadState(page, this.formKeycloakButtonSubmit); + + return this.getAlertSuccessBlockParagraphContent(page); + } +} + +module.exports = new KeycloakConnectorDemoPage();