<commit_before>import { Ability, Duration, f, LogicError, UsesAbilities } from '@serenity-js/core';

import { Key } from '../../input';
import { Cookie, CookieData, Locator, ModalDialog, Page, PageElement, Selector } from '../models';
import { BrowserCapabilities } from './BrowserCapabilities';

export abstract class BrowseTheWeb<Native_Element_Type = any, Native_Root_Element_Type = unknown> implements Ability {
    /**
     * @desc
     *  Used to access the Actor's ability to {@link BrowseTheWeb}
     *  from within the {@link @serenity-js/core/lib/screenplay~Interaction} classes,
     *  such as {@link Click}.
     *
     * @param {@serenity-js/core/lib/screenplay/actor~UsesAbilities} actor
     * @return {BrowseTheWeb}
     */
    static as<NET = any, NRET = unknown>(actor: UsesAbilities): BrowseTheWeb<NET, NRET> {
        return actor.abilityTo(BrowseTheWeb) as BrowseTheWeb<NET, NRET>;
    }

    constructor(
        protected locators: Map<
        new (...args: unknown[]) => Selector,
        (selector: Selector) =>
        Locator<Native_Element_Type, Native_Root_Element_Type>
        >
    ) {
    }

    abstract navigateTo(destination: string): Promise<void>;

    abstract navigateBack(): Promise<void>;

    abstract navigateForward(): Promise<void>;

    abstract reloadPage(): Promise<void>;

    abstract waitFor(duration: Duration): Promise<void>;

    abstract waitUntil(condition: () => boolean | Promise<boolean>, timeout: Duration): Promise<void>;

    locate(selector: Selector): Locator<Native_Element_Type, Native_Root_Element_Type> {
        for (const [ type, locatorFactory ] of this.locators) {
            if (selector instanceof type) {
                return locatorFactory(selector);
            }
        }

        throw new LogicError(f `${ selector } is not supported by ${ this.constructor.name }`);
    }
<commit_msg>fix(web): made the constructor of BrowseTheWeb protected, since it's an abstract class<commit_after>import { Ability, Duration, f, LogicError, UsesAbilities } from '@serenity-js/core';

import { Key } from '../../input';
import { Cookie, CookieData, Locator, ModalDialog, Page, PageElement, Selector } from '../models';
import { BrowserCapabilities } from './BrowserCapabilities';

export abstract class BrowseTheWeb<Native_Element_Type = any, Native_Root_Element_Type = unknown> implements Ability {
    /**
     * @desc
     *  Used to access the Actor's ability to {@link BrowseTheWeb}
     *  from within the {@link @serenity-js/core/lib/screenplay~Interaction} classes,
     *  such as {@link Click}.
     *
     * @param {@serenity-js/core/lib/screenplay/actor~UsesAbilities} actor
     * @return {BrowseTheWeb}
     */
    static as<NET = any, NRET = unknown>(actor: UsesAbilities): BrowseTheWeb<NET, NRET> {
        return actor.abilityTo(BrowseTheWeb) as BrowseTheWeb<NET, NRET>;
    }

    protected constructor(
        protected locators: Map<
            new (...args: unknown[]) => Selector,
            (selector: Selector) => Locator<Native_Element_Type, Native_Root_Element_Type>
        >
    ) {
    }

    abstract navigateTo(destination: string): Promise<void>;

    abstract navigateBack(): Promise<void>;

    abstract navigateForward(): Promise<void>;

    abstract reloadPage(): Promise<void>;

    abstract waitFor(duration: Duration): Promise<void>;

    abstract waitUntil(condition: () => boolean | Promise<boolean>, timeout: Duration): Promise<void>;

    locate(selector: Selector): Locator<Native_Element_Type, Native_Root_Element_Type> {
        for (const [ type, locatorFactory ] of this.locators) {
            if (selector instanceof type) {
                return locatorFactory(selector);
            }
        }

        throw new LogicError(f `${ selector } is not supported by ${ this.constructor.name }`);
    }

{'fraction_non_alphanumeric': 0.12098249281421479, 'fraction_numerical': 0.0, 'mean_word_length': 3.354948805460751, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6884347', 'n_tokens_mistral': 1120, 'n_tokens_neox': 1084, 'n_words': 280}