-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #124 from Progi1984/modKeycloakConnectorDemoBoMain
`modKeycloakConnectorDemoBoMain` : Added new page
- Loading branch information
Showing
4 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
53 changes: 53 additions & 0 deletions
53
src/versions/develop/pages/BO/modules/keycloakConnectorDemo/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |