-
Notifications
You must be signed in to change notification settings - Fork 7
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 #17 from Progi1984/178x
Support for 1.7.8 : Module Manager (Uninstalled modules) & Classic Order Confirmation
- Loading branch information
Showing
10 changed files
with
171 additions
and
7 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
9 changes: 9 additions & 0 deletions
9
src/interfaces/BO/modules/moduleManager/uninstalledModules.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,9 @@ | ||
import {BOBasePagePageInterface} from '@interfaces/BO'; | ||
import type {Page} from '@playwright/test'; | ||
|
||
export interface ModuleManagerUninstalledModulesPageInterface extends BOBasePagePageInterface { | ||
readonly installMessageSuccessful: (moduleTag: string) => string; | ||
|
||
goToTabUninstalledModules(page: Page): Promise<void>; | ||
installModule(page: Page, moduleTag: string): Promise<string|null>; | ||
} |
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,16 @@ | ||
import type {ModuleManagerUninstalledModulesPageInterface} from '@interfaces/BO/modules/moduleManager/uninstalledModules'; | ||
import testContext from '@utils/testContext'; | ||
import semver from 'semver'; | ||
|
||
const psVersion = testContext.getPSVersion(); | ||
|
||
/* eslint-disable global-require, @typescript-eslint/no-var-requires */ | ||
function requirePage(): ModuleManagerUninstalledModulesPageInterface { | ||
if (semver.gte(psVersion, '8.0.0')) { | ||
return require('@versions/mock/pages/BO/modules/moduleManager/uninstalledModules'); | ||
} | ||
return require('@versions/1.7.8/pages/BO/modules/moduleManager/uninstalledModules'); | ||
} | ||
/* eslint-enable global-require, @typescript-eslint/no-var-requires */ | ||
|
||
export default requirePage(); |
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
57 changes: 57 additions & 0 deletions
57
src/versions/1.7.8/pages/BO/modules/moduleManager/uninstalledModules.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,57 @@ | ||
import {ModuleManagerUninstalledModulesPageInterface} from '@interfaces/BO/modules/moduleManager/uninstalledModules'; | ||
import BOBasePage from '@pages/BO/BOBasePage'; | ||
import {Page} from '@playwright/test'; | ||
|
||
/** | ||
* Module catalog page, contains selectors and functions for the page | ||
* @class | ||
* @extends BOBasePage | ||
*/ | ||
class UninstalledModules extends BOBasePage implements ModuleManagerUninstalledModulesPageInterface { | ||
public readonly installMessageSuccessful: (moduleTag: string) => string; | ||
|
||
private readonly subTabUninstalledModules: string; | ||
|
||
private readonly installModuleButton: (moduleName: string) => string; | ||
|
||
/** | ||
* @constructs | ||
* Setting up titles and selectors to use on module catalog page | ||
*/ | ||
constructor() { | ||
super(); | ||
|
||
this.installMessageSuccessful = (moduleTag: string) => `Install action on module ${moduleTag} succeeded.`; | ||
|
||
// Selectors | ||
this.subTabUninstalledModules = '#subtab-AdminPsMboUninstalledModules'; | ||
this.installModuleButton = (moduleTag: string) => `div[data-tech-name="${moduleTag}"] button.module_action_menu_install`; | ||
} | ||
|
||
/* | ||
Methods | ||
*/ | ||
/** | ||
* Go to the "Uninstalled modules" tab | ||
* @param {Page} page | ||
* @returns {Promise<void>} | ||
*/ | ||
async goToTabUninstalledModules(page: Page): Promise<void> { | ||
await this.waitForSelectorAndClick(page, this.subTabUninstalledModules); | ||
await this.waitForVisibleSelector(page, `${this.subTabUninstalledModules}.active`, 2000); | ||
} | ||
|
||
/** | ||
* Install the module and return the growl message | ||
* @param {Page} page | ||
* @param {string} moduleTag | ||
* @returns {Promise<string|null>} | ||
*/ | ||
async installModule(page: Page, moduleTag: string): Promise<string|null> { | ||
await page.locator(this.installModuleButton(moduleTag)).click(); | ||
|
||
return this.getGrowlMessageContent(page); | ||
} | ||
} | ||
|
||
module.exports = new UninstalledModules(); |
23 changes: 23 additions & 0 deletions
23
src/versions/1.7.8/pages/FO/classic/checkout/orderConfirmation.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,23 @@ | ||
// Import pages | ||
import type {FoCheckoutOrderConfirmationPageInterface} from '@interfaces/FO/checkout/orderConfirmation'; | ||
import {OrderConfirmationPage} from '@versions/develop/pages/FO/classic/checkout/orderConfirmation'; | ||
|
||
/** | ||
* Order confirmation page, contains functions that can be used on the page | ||
* @class | ||
* @extends OrderConfirmationPage | ||
*/ | ||
class OrderConfirmation extends OrderConfirmationPage implements FoCheckoutOrderConfirmationPageInterface { | ||
/** | ||
* @constructs | ||
* Setting up texts and selectors to use on order confirmation page | ||
*/ | ||
constructor(theme: string = 'classic') { | ||
super(theme); | ||
|
||
// Selectors | ||
this.orderReferenceValue = `${this.orderDetailsTable} ul li:nth-child(1)`; | ||
} | ||
} | ||
|
||
module.exports = new OrderConfirmation(); |
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
42 changes: 42 additions & 0 deletions
42
src/versions/mock/pages/BO/modules/moduleManager/uninstalledModules.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,42 @@ | ||
import {ModuleManagerUninstalledModulesPageInterface} from '@interfaces/BO/modules/moduleManager/uninstalledModules'; | ||
import BOBasePage from '@pages/BO/BOBasePage'; | ||
|
||
/** | ||
* Mock Page for unsupported version | ||
* @class | ||
* @extends BOBasePage | ||
*/ | ||
class UninstalledModules extends BOBasePage implements ModuleManagerUninstalledModulesPageInterface { | ||
public readonly installMessageSuccessful: (moduleTag: string) => string; | ||
|
||
/** | ||
* @constructs | ||
* Setting up titles and selectors to use on module catalog page | ||
*/ | ||
constructor() { | ||
super(); | ||
|
||
this.installMessageSuccessful = () => ''; | ||
} | ||
|
||
/* | ||
Methods | ||
*/ | ||
/** | ||
* Go to the "Uninstalled modules" tab | ||
* @returns {Promise<void>} | ||
*/ | ||
async goToTabUninstalledModules(): Promise<void> { | ||
// do nothing. | ||
} | ||
|
||
/** | ||
* Install the module and return the growl message | ||
* @returns {Promise<string|null>} | ||
*/ | ||
async installModule(): Promise<string|null> { | ||
return ''; | ||
} | ||
} | ||
|
||
module.exports = new UninstalledModules(); |