import getCurrentUrl from "../action/getCurrentUrl";
import logger from "../../reporting-helpers/logger";
import {browser, $, $$, expect} from '@wdio/globals'

export default async function (pageConfig: Record<string, string>, pageId: string): Promise<boolean> {
    const currentUrl = await getCurrentUrl();
    logger.info(`The current URL : >>> ${currentUrl}`);
    const expectedUrl = (pageId.trim().toLowerCase() === "home") ? `${browser.options.baseUrl}/` : `${browser.options.baseUrl}/${pageId}`;
    logger.info(`The expected URL : >>> ${expectedUrl}`);
    return (currentUrl === expectedUrl)
}
