Skip to content

Commit

Permalink
Merge pull request #124 from Progi1984/modKeycloakConnectorDemoBoMain
Browse files Browse the repository at this point in the history
`modKeycloakConnectorDemoBoMain` : Added new page
  • Loading branch information
Progi1984 authored Sep 5, 2024
2 parents e22e15e + 474b108 commit a72aef0
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
8 changes: 8 additions & 0 deletions src/interfaces/BO/modules/keycloakConnectorDemo/index.ts
Original file line number Diff line number Diff line change
@@ -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<string>;
}
9 changes: 9 additions & 0 deletions src/pages/BO/modules/keycloakConnectorDemo/index.ts
Original file line number Diff line number Diff line change
@@ -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();
Original file line number Diff line number Diff line change
@@ -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<number>}
*/
async setKeycloakEndpoint(page: Page, keycloakRealmUrl: string, allowedIssuers: string[]): Promise<string> {
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();

0 comments on commit a72aef0

Please sign in to comment.