Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable boDashboardPage in the Core #28

Merged
merged 1 commit into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions src/interfaces/BO/dashboard/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,47 @@
import {BOBasePagePageInterface} from '@interfaces/BO';
import {type Page} from '@playwright/test';

export interface DashboardPageInterface extends BOBasePagePageInterface {
readonly pageTitle: string;

clickOnAbandonedCartsLink(page: Page): Promise<void>;
clickOnActiveShoppingCartsLink(page: Page): Promise<void>;
clickOnConfigureLink(page: Page): Promise<boolean>;
clickOnConfigureProductsAndSalesLink(page: Page): Promise<boolean>;
clickOnDetailsButtonOfRecentOrdersTable(page: Page, row?: number): Promise<void>;
clickOnNewCustomersLink(page: Page): Promise<void>;
clickOnNewMessagesLink(page: Page): Promise<void>;
clickOnNewSubscriptionsLink(page: Page): Promise<void>;
clickOnOrdersLink(page: Page): Promise<void>;
clickOnOutOfStockProductsLink(page: Page): Promise<void>;
clickOnProductReviewsLink(page: Page): Promise<void>;
clickOnReturnExchangeLink(page: Page): Promise<void>;
clickOnTotalSubscribersLink(page: Page): Promise<void>;
clickOnVisitsLink(page: Page): Promise<void>;
closeHelpCard(page: Page): Promise<boolean>;
getBestSellersTabTitle(page: Page): Promise<string>;
getHelpDocumentTitle(page: Page): Promise<string>;
getMostViewedTabTitle(page: Page): Promise<string>;
getNumberOfAbandonedCarts(page: Page): Promise<number>;
getNumberOfActiveShoppingCarts(page: Page): Promise<number>;
getNumberOfNewCustomers(page: Page): Promise<number>;
getNumberOfNewMessages(page: Page): Promise<number>;
getNumberOfNewSubscriptions(page: Page): Promise<number>;
getNumberOfOrders(page: Page): Promise<number>;
getNumberOfProductReviews(page: Page): Promise<number>;
getNumberOfReturnExchange(page: Page): Promise<number>;
getNumberOfTotalSubscribers(page: Page): Promise<number>;
getNumberOfVisits(page: Page): Promise<number>;
getOutOfStockProducts(page: Page): Promise<number>;
getRecentOrdersTitle(page: Page): Promise<string>;
getSalesScore(page: Page): Promise<number>;
getTopSearchersTabTitle(page: Page): Promise<string>;
goToBestSellersTab(page: Page): Promise<void>;
goToMostViewedTab(page: Page): Promise<void>;
goToTopSearchersTab(page: Page): Promise<void>;
isBestSellersTableVisible(page: Page): Promise<boolean>;
isMostViewedTableVisible(page: Page): Promise<boolean>;
isTopSearchersTableVisible(page: Page): Promise<boolean>;
openHelpCard(page: Page): Promise<boolean>;
setDemoMode(page: Page, toEnable: boolean): Promise<void>;
}
24 changes: 23 additions & 1 deletion src/interfaces/BO/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ export interface BOBasePagePageInterface extends CommonPageInterface {

readonly themeAndLogoParentLink: string;

readonly themeAndLogoLink: string

readonly emailThemeLink: string;

readonly pagesLink: string;
Expand Down Expand Up @@ -126,16 +128,36 @@ export interface BOBasePagePageInterface extends CommonPageInterface {

readonly logsLink: string;

readonly authorizationServerLink: string;
readonly adminAPILink: string;

readonly featureFlagLink: string;

readonly securityLink: string;

readonly multistoreLink: string;
readonly menuTree: { parent: string; children: string[] }[];

clickOnNotification(page: Page, tabName: string, row?: number): Promise<void>;
clickOnNotificationsLink(page: Page): Promise<boolean>;
clickOnNotificationsTab(page: Page, tabName: string): Promise<void>;
clickSubMenu(page: Page, parentSelector: string): Promise<void>;
closeSfToolBar(page: Frame | Page): Promise<void>;
getAllNotificationsNumber(page: Page): Promise<number>;
getNotificationsNumberInTab(page: Page, tabName: string): Promise<number>;
goToMyProfile(page: Page): Promise<void>;
goToSubMenu(page: Page, parentSelector: string, linkSelector: string): Promise<void>;
isMobileMenuVisible(page: Page): Promise<boolean>;
isNavbarVisible(page: Page): Promise<boolean>;
isSidebarCollapsed(page: Page): Promise<boolean>;
isSubMenuActive(page: Page, linkSelector: string): Promise<boolean>;
isSubmenuVisible(page: Page, parentSelector: string, linkSelector: string): Promise<boolean>;
logoutBO(page: Page): Promise<void>;
navigateToPageWithInvalidToken(page: Page, url: string, continueToPage?: boolean): Promise<void>;
quickAccessToPage(page: Page, linkName: string): Promise<void>;
quickAccessToPageNewWindow(page: Page, linkName: string): Promise<Page>;
quickAccessToPageWithFrame(page: Page, linkName: string): Promise<void>;
resize(page: Page, mobileSize: boolean): Promise<void>;
search(page: Page, query: string): Promise<void>;
setSidebarCollapsed(page: Page, isCollapsed: boolean): Promise<void>;
viewMyShop(page: Page): Promise<Page>;
}
2 changes: 2 additions & 0 deletions src/interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ export interface CommonPageInterface {
getPageTitle(page: Page): Promise<string>;
goTo(page: Page, url: string): Promise<void>;
goToFo(page: Page): Promise<void>;
reloadPage(page: Page): Promise<void>;
resize(page: Page, mobileSize: boolean): Promise<void>;
}
14 changes: 9 additions & 5 deletions src/pages/BO/BOBasePage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Import pages
import {type BOBasePagePageInterface} from '@interfaces/BO';
import CommonPage from '@pages/commonPage';

import {Frame, Page} from '@playwright/test';
Expand All @@ -11,7 +12,7 @@ import semver from 'semver';
* @class
* @extends CommonPage
*/
export default class BOBasePage extends CommonPage {
export default class BOBasePage extends CommonPage implements BOBasePagePageInterface {
public successfulCreationMessage: string;

public successfulUpdateMessage: string;
Expand Down Expand Up @@ -136,6 +137,8 @@ export default class BOBasePage extends CommonPage {

public readonly themeAndLogoParentLink: string;

public readonly themeAndLogoLink: string;

public readonly emailThemeLink: string;

public readonly pagesLink: string;
Expand Down Expand Up @@ -204,7 +207,7 @@ export default class BOBasePage extends CommonPage {

public readonly logsLink: string;

public readonly authorizationServerLink: string;
public readonly adminAPILink: string;

public readonly featureFlagLink: string;

Expand Down Expand Up @@ -403,6 +406,7 @@ export default class BOBasePage extends CommonPage {
this.designParentLink = '#subtab-AdminParentThemes';
// Theme & Logo
this.themeAndLogoParentLink = '#subtab-AdminThemesParent';
this.themeAndLogoLink = '#subtab-AdminThemes';
// Email theme
this.emailThemeLink = '#subtab-AdminParentMailTheme';
// Pages
Expand Down Expand Up @@ -475,7 +479,7 @@ export default class BOBasePage extends CommonPage {
// Logs
this.logsLink = '#subtab-AdminLogs';
// Authorization Server
this.authorizationServerLink = '#subtab-AdminAuthorizationServer';
this.adminAPILink = '#subtab-AdminAdminAPI';
// New & Experimental Features
this.featureFlagLink = '#subtab-AdminFeatureFlag';
// Security
Expand Down Expand Up @@ -612,8 +616,8 @@ export default class BOBasePage extends CommonPage {
this.helpDocumentURL = `${this.rightSidebar} div.quicknav-scroller._fullspace object`;

// Invalid token block
this.invalidTokenContinueLink = 'a.btn-continue';
this.invalidTokenCancelLink = 'a.btn-cancel';
this.invalidTokenContinueLink = '#security-compromised-page #csrf-white-container div a:nth-child(1)';
this.invalidTokenCancelLink = '#security-compromised-page #csrf-white-container div a:nth-child(2)';
}

/*
Expand Down
6 changes: 3 additions & 3 deletions src/versions/develop/pages/BO/dashboard/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,14 @@ class Dashboard extends BOBasePage implements DashboardPageInterface {
this.dashboardLiveSection = '#dash_live span.data_label';
this.onlineVisitorLink = `${this.dashboardLiveSection} a[href*='controller=AdminStats']`;
this.onlineVisitorsNumber = '#online_visitor';
this.activeShoppingCartsLink = `${this.dashboardLiveSection} a[href*='controller=AdminCarts']`;
this.activeShoppingCartsLink = `${this.dashboardLiveSection} a[href*='sell/orders/carts/?']`;
this.activeShoppingCartNumber = '#active_shopping_cart';
this.dashboardPendingSection = '#dash_pending span.data_label';
this.dashboardOrdersLink = `${this.dashboardPendingSection} a[href*='sell/orders']`;
this.dashboardOrdersLink = `${this.dashboardPendingSection} a[href*='sell/orders/?']`;
this.ordersNumber = '#pending_orders';
this.returnExchangeLink = `${this.dashboardPendingSection} a[href*='controller=AdminReturn']`;
this.returnExchangeNumber = '#return_exchanges';
this.abandonedCartsLink = `${this.dashboardPendingSection} a[href*='controller=AdminCarts']`;
this.abandonedCartsLink = `${this.dashboardPendingSection} a[href*='sell/orders/carts/?']`;
this.abandonedCartsNumber = '#abandoned_cart';
this.outOfStockProductsLink = `${this.dashboardPendingSection} a[href*='catalog/monitoring']`;
this.outOfStockProductsNumber = '#products_out_of_stock';
Expand Down
Loading