From d28dac53e055e5917402ccde1edbaac95f8c9244 Mon Sep 17 00:00:00 2001 From: Ilya Maroz <37909603+ilyamore88@users.noreply.github.com> Date: Thu, 29 Aug 2024 00:16:59 +0100 Subject: [PATCH] feat(playwright): make fields private --- .../tests/fixtures/PlaygroundPage.ts | 18 +++++++++--------- packages/playground/tsconfig.playwright.json | 1 + 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/packages/playground/tests/fixtures/PlaygroundPage.ts b/packages/playground/tests/fixtures/PlaygroundPage.ts index f579a78e..44e95378 100644 --- a/packages/playground/tests/fixtures/PlaygroundPage.ts +++ b/packages/playground/tests/fixtures/PlaygroundPage.ts @@ -4,9 +4,9 @@ import type { Locator, Page } from '@playwright/test'; * Playground page fixture to help access the page elements */ export class PlaygroundPage { - private readonly inputLocator: Locator; - private readonly textareaLocator: Locator; - private readonly contenteditableLocator: Locator; + readonly #input: Locator; + readonly #textarea: Locator; + readonly #contenteditable: Locator; /** * Sets locators for input, textarea and contenteditable elements @@ -14,9 +14,9 @@ export class PlaygroundPage { * @param page - Playwright page object */ constructor(public readonly page: Page) { - this.inputLocator = page.locator('input'); - this.textareaLocator = page.locator('textarea'); - this.contenteditableLocator = page.locator('[contenteditable]').first(); // hack to get the first contenteditable element + this.#input = page.locator('input'); + this.#textarea = page.locator('textarea'); + this.#contenteditable = page.locator('[contenteditable]').first(); // hack to get the first contenteditable element } /** @@ -30,20 +30,20 @@ export class PlaygroundPage { * Returns the native input locator */ public get input(): Locator { - return this.inputLocator; + return this.#input; } /** * Returns the textarea locator */ public get textarea(): Locator { - return this.textareaLocator; + return this.#textarea; } /** * Returns the contenteditable locator */ public get contenteditable(): Locator { - return this.contenteditableLocator; + return this.#contenteditable; } } diff --git a/packages/playground/tsconfig.playwright.json b/packages/playground/tsconfig.playwright.json index db25ade2..69fd1ad1 100644 --- a/packages/playground/tsconfig.playwright.json +++ b/packages/playground/tsconfig.playwright.json @@ -1,4 +1,5 @@ { + "extends": "./tsconfig.json", "compilerOptions": { "strict": true, },