{"id":344466,"date":"2023-01-25T15:02:01","date_gmt":"2023-01-25T15:02:01","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=344466"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=344466","title":{"rendered":"<span>\u041f\u0438\u0448\u0435\u043c UI \u0430\u0432\u0442\u043e \u0442\u0435\u0441\u0442\u044b \u043d\u0430 TypeScript \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Page Object, Page Factory<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h3>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c, \u043a\u0430\u043a \u043f\u0438\u0441\u0430\u0442\u044c UI \u0430\u0432\u0442\u043e\u0442\u0435\u0441\u0442\u044b \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u0432 Page Object, Page Factory \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 TypeScript. \u0423 \u043c\u0435\u043d\u044f \u0443\u0436\u0435 \u0431\u044b\u043b\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043e \u0442\u043e\u043c <a href=\"https:\/\/habr.com\/ru\/post\/708932\/\" rel=\"noopener noreferrer nofollow\">\u041a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c UI \u0430\u0432\u0442\u043e \u0442\u0435\u0441\u0442\u044b \u043d\u0430 Python<\/a>, \u0442\u0443\u0442 \u043c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440.<\/p>\n<h3>Requirements<\/h3>\n<p>\u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f UI \u0430\u0432\u0442\u043e \u0442\u0435\u0441\u0442\u043e\u0432 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c:<\/p>\n<ul>\n<li>\n<p>playwright &#8212; yarn add\u00a0playwright\/npm install playwright<\/p>\n<\/li>\n<li>\n<p>allure &#8212; yarn add allure-playwright\/npm install allure-playwright <\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0438 \u0440\u0435\u043f\u043e\u0440\u0442\u0435\u0440, \u0441\u0443\u0442\u044c \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 Page Object, Page Factory \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0445\u043e\u0436\u0435\u0439 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0435.<\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0432\u0441\u0435 \u0430\u0432\u0442\u043e\u0442\u0435\u0441\u0442\u044b \u0431\u0443\u0434\u0443\u0442 \u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f \u0447\u0435\u0440\u0435\u0437 async, await, \u0442.\u043a. \u044d\u0442\u043e \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0434\u043b\u044f playwright. \u0412 \u0434\u0440\u0443\u0433\u0438\u0445 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430\u0445 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u043d\u0430\u0447\u0435.<\/p>\n<p>\u0410\u0432\u0442\u043e \u0442\u0435\u0441\u0442\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430 \u044d\u0442\u0443 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443\u00a0<a href=\"https:\/\/playwright.dev\/\" rel=\"noopener noreferrer nofollow\">https:\/\/playwright.dev\/<\/a><\/p>\n<p>\u0422\u0435\u0441\u0442 \u043a\u0435\u0439\u0441:<\/p>\n<ol>\n<li>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 https:\/\/playwright.dev<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u043d\u0430 \u043f\u043e\u0438\u0441\u043a<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u043c\u043e\u0434\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u043a\u043d\u043e \u043f\u043e\u0438\u0441\u043a\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u043b\u043e\u0441\u044c<\/p>\n<\/li>\n<li>\n<p>\u0412\u0432\u043e\u0434\u0438\u043c \u0432 \u043f\u043e\u0438\u0441\u043a \u044f\u0437\u044b\u043a, \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u0443\u0434\u0435\u0442 python<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0438\u0437 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043f\u0435\u0440\u0432\u044b\u0439<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0441 Python \u043e\u0442\u043a\u0440\u044b\u043b\u0430\u0441\u044c<\/p>\n<\/li>\n<\/ol>\n<p>\u041e\u0442\u043c\u0435\u0447\u0443, \u0447\u0442\u043e \u043b\u043e\u043a\u0430\u0442\u043e\u0440\u044b \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u043d\u0438\u0436\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u044d\u0442\u0430\u043b\u043e\u043d\u043d\u044b\u043c\u0438, \u0430 \u0441\u0430\u0439\u0442 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f &#8212;  \u044d\u0442\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f playwright, \u043d\u0430 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u044f \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u043c\u043e\u0433\u0443 \u043f\u043e\u0432\u043b\u0438\u044f\u0442\u044c. \u0412 \u0432\u0430\u0448\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u0441\u043e\u0432\u0435\u0442\u0443\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 data-qa-id, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 React\/Vue\/Angular \u0438\u043b\u0438 \u0436\u0435 \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e.<\/p>\n<p>\u0424\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 playwright \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043b\u0438\u0448\u044c allure-report, headles, video, screenshot. \u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043f\u0440\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e playwright \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/playwright.dev\/docs\/test-configuration\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a>.<\/p>\n<p>Playwright \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0432\u0438\u0434\u0435\u043e \u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u044b + \u043a\u0440\u0435\u043f\u0438\u0442\u044c \u0438\u0445 \u043a \u043e\u0442\u0447\u0435\u0442\u0443, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c <code>video: \"on\"<\/code>, <code>screenshot: \"on\"<\/code>, \u0442\u0430\u043c \u0435\u0441\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b. \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0432\u0438\u0434\u0435\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0444\u0435\u0439\u043b\u0435\u043d\u043d\u044b\u0439 \u0442\u0435\u0441\u0442, \u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 <code>video: \"retain-on-failure<\/code>, \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0441\u043e \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u043e\u043c <code>screenshot: \"only-on-failure\"<\/code>. \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u043e\u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0438 \u0441 Selenium. \u0412 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0432\u0438\u0434\u0435\u043e \u0438 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442 \u0432 \u043e\u0442\u0447\u0435\u0442\u0435.<\/p>\n<p>playwright.config.ts<\/p>\n<pre><code class=\"typescript\">import type { PlaywrightTestConfig } from '@playwright\/test'; import { devices } from '@playwright\/test';  \/**  * Read environment variables from file.  * https:\/\/github.com\/motdotla\/dotenv  *\/ \/\/ require('dotenv').config();  \/**  * See https:\/\/playwright.dev\/docs\/test-configuration.  *\/ const config: PlaywrightTestConfig = {   testDir: '.\/tests',   \/* Maximum time one test can run for. *\/   timeout: 30 * 1000,   expect: {     \/**      * Maximum time expect() should wait for the condition to be met.      * For example in `await expect(locator).toHaveText();`      *\/     timeout: 5000   },   \/* Run tests in files in parallel *\/   fullyParallel: true,   \/* Fail the build on CI if you accidentally left test.only in the source code. *\/   forbidOnly: !!process.env.CI,   \/* Retry on CI only *\/   retries: process.env.CI ? 2 : 0,   \/* Opt out of parallel tests on CI. *\/   workers: process.env.CI ? 1 : undefined,   \/* Reporter to use. See https:\/\/playwright.dev\/docs\/test-reporters *\/   reporter: [['html'], ['allure-playwright']],   \/* Shared settings for all the projects below. See https:\/\/playwright.dev\/docs\/api\/class-testoptions. *\/   use: {     \/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). *\/     actionTimeout: 0,     \/* Base URL to use in actions like `await page.goto('\/')`. *\/     \/\/ baseURL: 'http:\/\/localhost:3000',      \/* Collect trace when retrying the failed test. See https:\/\/playwright.dev\/docs\/trace-viewer *\/     trace: 'on-first-retry',     headless: !!process.env.CI,     video: 'on',     screenshot: 'on'   },    \/* Configure projects for major browsers *\/   projects: [     {       name: 'chromium',       use: {         ...devices['Desktop Chrome']       }     }   ] };  export default config; <\/code><\/pre>\n<h3>Base Page<\/h3>\n<p>\u041f\u043e \u0441\u0443\u0442\u0438 Base Page &#8212; \u044d\u0442\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0435 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043a\u0430\u043a\u0443\u044e-\u0442\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0443\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0438\u043b\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442. \u0421\u0430\u043c\u0430 \u043f\u043e \u0441\u0435\u0431\u0435 Base Page \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0442\u0435\u0441\u0442\u0430\u0445 \u0438 \u043e\u0442 \u043d\u0435\u0435 \u043c\u044b \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u043c \u043d\u0430\u0448\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0438\u043b\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b.<\/p>\n<p>pages\\base-page.ts<\/p>\n<pre><code class=\"typescript\">import test, { Page } from '@playwright\/test'; import { Navbar } from '..\/components\/navigation\/navbar';  export class BasePage {   readonly navbar: Navbar;    constructor(public page: Page) {     this.navbar = new Navbar(page);   }    async visit(url: string): Promise&lt;void> {     await test.step(`Opening the url \"${url}\"`, async () => {       await this.page.goto(url, { waitUntil: 'networkidle' });     });   }    async reload(): Promise&lt;void> {     const currentUrl = this.page.url();      await test.step(`Reloading page with url \"${currentUrl}\"`, async () => {       await this.page.reload({ waitUntil: 'domcontentloaded' });     });   } }<\/code><\/pre>\n<p>\u0412\u043d\u0443\u0442\u0440\u0438 BasePage \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b. \u042d\u0442\u043e \u043b\u0438\u0448\u044c \u043e\u0431\u0440\u0430\u0437\u0435\u0446 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c BasePage  <\/p>\n<h2>Page Factory<\/h2>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0430\u043c\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435. \u041c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430. \u041d\u043e \u043f\u0435\u0440\u0435\u0434 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0442\u0438\u043f\u044b \u0438 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b.<\/p>\n<p>utils\\generic.ts<\/p>\n<pre><code class=\"typescript\">export const capitalizeFirstLetter = (string: string): string => string.charAt(0).toUpperCase() + string.slice(1); <\/code><\/pre>\n<p>utils\\page-factory.ts<\/p>\n<pre><code class=\"typescript\">import { LocatorContext } from '..\/types\/page-factory\/component';  export const locatorTemplateFormat = (locator: string, { ...context }: LocatorContext): string => {   let template = locator;   for (const [key, value] of Object.entries(context)) {     template = template.replace(`{${key}}`, value.toString());   }    return template; }; <\/code><\/pre>\n<p>\u041f\u043e \u0441\u0443\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>locatorTemplateFormat<\/code> \u0431\u0443\u0434\u0435\u0442 \u0431\u0440\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u043b\u043e\u043a\u0430\u0442\u043e\u0440\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>[data-qa-id=\"here-my-locator-with-index-{index}\"]<\/code> \u0438 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438 <code>context<\/code> \u0432\u043d\u0443\u0442\u0440\u044c \u0441\u0442\u0440\u043e\u043a\u0438 \u043b\u043e\u043a\u0430\u0442\u043e\u0440\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"typescript\">const locator = '[data-qa-id=\"here-my-locator-with-index-{index}\"]'; const context = {index: 5};  locatorTemplateFormat(locator, context) => '[data-qa-id=\"here-my-locator-with-index-5\"]<\/code><\/pre>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f <code>locatorTemplateFormat<\/code> \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043b\u044e\u0431\u0430\u044f, \u044f \u043b\u0438\u0448\u044c \u043f\u0440\u0438\u0432\u0435\u043b \u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u0430\u043a \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c. \u0412 \u0441\u0432\u043e\u0435\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0439 \u0444\u043e\u0440\u043c\u0430\u0442\u0435\u0440 \u0434\u043b\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u043b\u043e\u043a\u0430\u0442\u043e\u0440\u0430.<\/p>\n<p>types\\page-factory\\component.ts<\/p>\n<pre><code class=\"typescript\">import { Page } from '@playwright\/test';  export type LocatorContext = { [key: string]: string | boolean | number };  export type ComponentProps = {   page: Page;   name?: string;   locator: string; };  export type LocatorProps = { locator?: string } &amp; LocatorContext;<\/code><\/pre>\n<p>\u0411\u0430\u0437\u043e\u0432\u044b\u0439 <strong>Component<\/strong>. \u0421\u0430\u043c \u043f\u043e \u0441\u0435\u0431\u0435 Component \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0442\u0435\u0441\u0442\u0430\u0445 \u0438 \u043e\u0442 \u043d\u0435\u0433\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0438 \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0435\u0433\u043e \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u043c \u043a\u043b\u0430\u0441\u0441\u043e\u043c. <\/p>\n<p>page-factory\\component.ts<\/p>\n<pre><code class=\"typescript\">import { expect, Locator, Page, test } from '@playwright\/test'; import { ComponentProps, LocatorProps } from '..\/types\/page-factory\/component'; import { capitalizeFirstLetter } from '..\/utils\/generic'; import { locatorTemplateFormat } from '..\/utils\/page-factory';  export abstract class Component {   page: Page;   locator: string;   private name: string | undefined;    constructor({ page, locator, name }: ComponentProps) {     this.page = page;     this.locator = locator;     this.name = name;   }    getLocator(props: LocatorProps = {}): Locator {     const { locator, ...context } = props;     const withTemplate = locatorTemplateFormat(locator || this.locator, context);      return this.page.locator(withTemplate);   }    get typeOf(): string {     return 'component';   }    get typeOfUpper(): string {     return capitalizeFirstLetter(this.typeOf);   }    get componentName(): string {     if (!this.name) {       throw Error('Provide \"name\" property to use \"componentName\"');     }      return this.name;   }    private getErrorMessage(action: string): string {     return `The ${this.typeOf} with name \"${this.componentName}\" and locator ${this.locator} ${action}`;   }    async shouldBeVisible(locatorProps: LocatorProps = {}): Promise&lt;void> {     await test.step(`${this.typeOfUpper} \"${this.componentName}\" should be visible on the page`, async () => {       const locator = this.getLocator(locatorProps);       await expect(locator, { message: this.getErrorMessage('is not visible') }).toBeVisible();     });   }    async shouldHaveText(text: string, locatorProps: LocatorProps = {}): Promise&lt;void> {     await test.step(`${this.typeOfUpper} \"${this.componentName}\" should have text \"${text}\"`, async () => {       const locator = this.getLocator(locatorProps);       await expect(locator, { message: this.getErrorMessage(`does not have text \"${text}\"`) }).toContainText(text);     });   }    async click(locatorProps: LocatorProps = {}): Promise&lt;void> {     await test.step(`Clicking the ${this.typeOf} with name \"${this.componentName}\"`, async () => {       const locator = this.getLocator(locatorProps);       await locator.click();     });   } } <\/code><\/pre>\n<p>\u0412\u044b\u0448\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0430 \u043e\u0447\u0435\u043d\u044c \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f Component. \u0412 \u0441\u0432\u043e\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u043a \u043d\u0438\u043c, \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0448\u0430\u0433\u043e\u0432 test.step, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442 \u0432\u0430\u043c.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0435\u0449\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p><strong>Button<\/strong> &#8212; \u043a\u043d\u043e\u043f\u043a\u0430. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 \u0431\u0443\u0434\u0443\u0442 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043a\u043d\u043e\u043f\u043a\u0430\u043c\u0438.  <\/p>\n<p>page-factory\\button.ts<\/p>\n<pre><code class=\"typescript\">import test from '@playwright\/test'; import { LocatorProps } from '..\/types\/page-factory\/component'; import { Component } from '.\/component';  export class Button extends Component {   get typeOf(): string {     return 'button';   }    async hover(locatorProps: LocatorProps = {}): Promise&lt;void> {     await test.step(`Hovering the ${this.typeOf} with name \"${this.componentName}\"`, async () => {       const locator = this.getLocator(locatorProps);       await locator.hover();     });   }    async doubleClick(locatorProps: LocatorProps = {}) {     await test.step(`Double clicking ${this.typeOf} with name \"${this.componentName}\"`, async () => {       const locator = this.getLocator(locatorProps);       await locator.dblclick();     });   } } <\/code><\/pre>\n<p><strong>Input<\/strong> &#8212; \u043f\u043e\u043b\u0435 \u0432\u0432\u043e\u0434\u0430. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 \u0431\u0443\u0434\u0443\u0442 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0438\u043d\u043f\u0443\u0442\u0430\u043c\u0438.  <\/p>\n<p>page-factory\\input.ts<\/p>\n<pre><code class=\"typescript\">import test, { expect } from '@playwright\/test'; import { LocatorProps } from '..\/types\/page-factory\/component'; import { Component } from '.\/component';  type FillProps = { validateValue?: boolean } &amp; LocatorProps;  export class Input extends Component {   get typeOf(): string {     return 'input';   }    async fill(value: string, fillProps: FillProps = {}) {     const { validateValue, ...locatorProps } = fillProps;      await test.step(`Fill ${this.typeOf} \"${this.componentName}\" to value \"${value}\"`, async () => {       const locator = this.getLocator(locatorProps);       await locator.fill(value);        if (validateValue) {         await this.shouldHaveValue(value, locatorProps);       }     });   }    async shouldHaveValue(value: string, locatorProps: LocatorProps = {}) {     await test.step(`Checking that ${this.typeOf} \"${this.componentName}\" has a value \"${value}\"`, async () => {       const locator = this.getLocator(locatorProps);       await expect(locator).toHaveValue(value);     });   } } <\/code><\/pre>\n<p><strong>Link<\/strong> &#8212; \u0441\u0441\u044b\u043b\u043a\u0430. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 \u0431\u0443\u0434\u0443\u0442 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043e \u0441\u0441\u044b\u043b\u043a\u0430\u043c\u0438.  <\/p>\n<p>page-factory\\link.ts<\/p>\n<pre><code class=\"typescript\">import { Component } from '.\/component';  export class Link extends Component {   get typeOf(): string {     return 'link';   } } <\/code><\/pre>\n<p><strong>ListItem<\/strong> &#8212; \u043b\u044e\u0431\u043e\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441\u043f\u0438\u0441\u043a\u0430.  <\/p>\n<p>page-factory\\list-item.ts<\/p>\n<pre><code class=\"typescript\">import { Component } from '.\/component';  export class ListItem extends Component {   get typeOf(): string {     return 'list item';   } } <\/code><\/pre>\n<p><strong>Title<\/strong> &#8212; \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a. \u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e Text, \u043d\u043e \u044f \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u044e \u0440\u0430\u0437\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0441\u0435 \u0434\u043b\u044f \u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0441\u0442\u0438. Title, Text, Label, Subtitle&#8230;<\/p>\n<p>page-factory\\title.ts<\/p>\n<pre><code class=\"typescript\">import { Component } from '.\/component';  export class Title extends Component {   get typeOf(): string {     return 'title';   } } <\/code><\/pre>\n<p><strong>\u041b\u0430\u0439\u0444\u0445\u0430\u043a<\/strong>. \u0415\u0441\u043b\u0438 \u043d\u0435 \u0437\u043d\u0430\u0435\u0442\u0435 \u043a\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b, \u0442\u043e \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043b\u044f \u0434\u0438\u0437\u0430\u0439\u043d\u0430. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u0434\u0438\u0437\u0430\u0439\u043d\u0435\u0440\u044b \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 <a href=\"https:\/\/m3.material.io\/\" rel=\"noopener noreferrer nofollow\">Material Design<\/a> \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432, \u0442\u043e\u0433\u0434\u0430 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u0437\u044f\u0442\u044c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"https:\/\/m3.material.io\/components\" rel=\"noopener noreferrer nofollow\">https:\/\/m3.material.io\/components<\/a>, \u043a\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0442\u0435 \u0438\u043b\u0438 \u0438\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0432 Material Desgin \u0438 \u043f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b Page Factory. \u041d\u043e \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u0438 \u0442\u0430\u043a \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043a\u0430\u043a \u0438 \u043f\u043e\u0447\u0435\u043c\u0443 \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b, \u0442\u043e \u044d\u0442\u043e\u0442 \u043b\u0430\u0439\u0444\u0445\u0430\u043a \u043d\u0435 \u0434\u043b\u044f \u0432\u0430\u0441 \ud83d\ude42 <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u043e\u043f\u0440\u043e\u0441: &#171;\u0417\u0430\u0447\u0435\u043c \u0432\u0441\u0435 \u044d\u0442\u043e?&#187;. \u0414\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0440\u0435\u0448\u0430\u0435\u0442 \u0441\u0440\u0430\u0437\u0443 \u0442\u043e\u043d\u043d\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u0443 \u043b\u044e\u0431\u043e\u0433\u043e QA Automation, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u043e\u0442\u044c \u0440\u0430\u0437 \u043f\u0438\u0441\u0430\u043b UI \u0430\u0432\u0442\u043e \u0442\u0435\u0441\u0442\u044b.<\/p>\n<ul>\n<li>\n<p>\u0414\u0430\u0435\u0442 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435. \u0422\u043e \u0435\u0441\u0442\u044c \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u043d\u0435 \u0441 \u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u0442\u0430\u043c \u043b\u043e\u043a\u0430\u0442\u043e\u0440\u043e\u043c, \u0430 \u0441 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, Button.<\/p>\n<\/li>\n<li>\n<p>\u0423\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0432\u0441\u0435 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432. \u041e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e \u0434\u043b\u044f \u043a\u043e\u043c\u0430\u043d\u0434, \u0433\u0434\u0435 \u043d\u0430\u0434 \u0430\u0432\u0442\u043e \u0442\u0435\u0441\u0442\u0430\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0434\u0432\u0430 \u0438 \u0431\u043e\u043b\u0435\u0435 QA Automation, \u043d\u0443 \u0438\u043b\u0438 \u0435\u0441\u043b\u0438 \u0430\u0432\u0442\u043e \u0442\u0435\u0441\u0442\u044b \u043f\u0438\u0448\u0443\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0442\u043e\u0436\u0435. \u0421 \u0442\u0430\u043a\u0438\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u043c \u0443 \u0432\u0430\u0441 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043f\u043e\u0440\u043e\u0432 \u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c, \u0442\u043e \u0435\u0441\u0442\u044c \u043e\u0434\u0438\u043d QA Automation \u043c\u043e\u0436\u0435\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0430\u043a\u00a0<code>expect(locator).toBeVisible()<\/code>, \u0447\u0442\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f playwright. \u0412\u0442\u043e\u0440\u043e\u0439 QA Automation \u043c\u043e\u0436\u0435\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0430\u043a\u00a0<code>expect(await locator.isVisible()).toBeTruthy()<\/code>, \u0447\u0442\u043e \u0442\u043e\u0436\u0435 <strong>\u043f\u043e \u0441\u0443\u0442\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e<\/strong>, \u043d\u043e \u043a\u043e\u0441\u0442\u044b\u043b\u044c\u043d\u043e. \u041d\u0430 \u044d\u0442\u043e\u0439 \u043e\u0441\u043d\u043e\u0432\u0435 \u043c\u043e\u0433\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0442\u044c \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u043f\u043e\u0440\u044b \u0438\u043b\u0438 \u0435\u0449\u0435 \u0445\u0443\u0436\u0435: \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u0438\u0448\u0435\u0442 \u0442\u0430\u043a, \u043a\u0430\u043a \u043e\u043d \u0445\u043e\u0447\u0435\u0442. \u041f\u043e \u0438\u0442\u043e\u0433\u0443 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u0434\u043d\u0438 \u0438 \u0442\u0435 \u0436\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u0438\u0448\u0443\u0442\u0441\u044f \u043f\u043e \u0440\u0430\u0437\u043d\u043e\u043c\u0443. \u0421 \u0434\u0430\u043d\u043d\u044b\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u043c \u043c\u044b \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c, \u043a\u0430\u043a \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0438 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u043e\u0431 \u044d\u0442\u043e\u043c, \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e.<\/p>\n<\/li>\n<li>\n<p>\u0414\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0448\u0430\u0433\u0438 \u0434\u043b\u044f \u043e\u0442\u0447\u0435\u0442\u0430. \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b test.step \u0438\u0437 playwright, \u043d\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u044d\u0442\u043e \u043d\u0435 \u0432\u0430\u0436\u043d\u043e, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0439 \u0440\u0435\u043f\u043e\u0440\u0442\u0435\u0440. \u041f\u0440\u0438 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0448\u0430\u0433\u0438, \u043e\u043d\u0438 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, name, typeOf. \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0445 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u043f\u043e\u0434 \u0432\u0430\u0448\u0438 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f. \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c typeOf \u0438 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0441 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0448\u0430\u0433\u0430\u043c\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043b\u043e\u043a\u0430\u0442\u043e\u0440\u044b &#8212; \u044d\u0442\u043e \u0432\u0435\u0447\u043d\u0430\u044f \u0431\u043e\u043b\u044c, \u043d\u043e \u043d\u0435 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u043c. \u041c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043b\u043e\u043a\u0430\u0442\u043e\u0440\u0430 \u0434\u043e \u0431\u0435\u0437\u043e\u0431\u0440\u0430\u0437\u0438\u044f \u043f\u0440\u043e\u0441\u0442. \u041c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c\u00a0<code>LocatorProps<\/code>\u00a0\u0432 \u043a\u0430\u0436\u0434\u044b\u0439 \u043c\u0435\u0442\u043e\u0434, \u0434\u0430\u043b\u0435\u0435 \u0432\u0441\u0435 \u044d\u0442\u043e \u0438\u0434\u0435\u0442 \u0432 \u0441\u0430\u043c \u043b\u043e\u043a\u0430\u0442\u043e\u0440 \u0447\u0435\u0440\u0435\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f\u00a0<code>locatorTemplateFormat<\/code>. \u0422\u043e \u0435\u0441\u0442\u044c \u044d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430\u043c \u043b\u043e\u043a\u0430\u0442\u043e\u0440\u044b\u00a0<code>span#some-element-id-{userId}<\/code>, \u0434\u0430\u043b\u0435\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c\u00a0<code>userId<\/code>\u0447\u0435\u0440\u0435\u0437\u00a0<code>LocatorProps<\/code>\u00a0\u00a0\u043f\u0440\u044f\u043c\u043e \u0432 \u043b\u043e\u043a\u0430\u0442\u043e\u0440, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043a <code>this.myUserInput.fill('Hello World', { userId })<\/code> \u041c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043f\u0440\u043e\u0441\u0442, \u043d\u043e \u043e\u043d \u0438\u0437\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0430\u0441 \u043e\u0442 \u043b\u043e\u043a\u0430\u0442\u043e\u0440\u043e\u0432 \u0432 \u043c\u0435\u0442\u043e\u0434\u0430\u0445, \u043e\u0442 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u043b\u0438 \u0435\u0449\u0435 \u0445\u0443\u0436\u0435 \u0445\u0430\u0440\u0434\u043a\u043e\u0434\u0430 \u043b\u043e\u043a\u0430\u0442\u043e\u0440\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b, \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0443 \u0432\u0430\u0441 \u0432 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0435 \u0435\u0441\u0442\u044c \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0445\u0438\u0442\u0440\u044b\u0439 \u0430\u0432\u0442\u043e\u043a\u043e\u043c\u043f\u043b\u0438\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0443\u0436\u043d\u043e \u043a\u0430\u043a-\u0442\u043e \u0445\u0438\u0442\u0440\u043e \u043a\u043b\u0438\u043a\u0430\u0442\u044c, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u0435\u0447\u0430\u0442\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0443. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u00a0<code>MyCustomAutocomplete<\/code>, \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043e\u0442\u00a0<code>Input<\/code>\u00a0\u0438 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u00a0<code>fill<\/code>. \u0414\u0430\u043b\u0435\u0435 \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043e \u0432\u0441\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0431\u0435\u0437 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043b\u043e\u0433\u0438\u043a\u0438 \u0432\u0432\u043e\u0434\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043d\u0430\u0434 \u0430\u0432\u0442\u043e\u0442\u0435\u0441\u0442\u0430\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441\u0440\u0430\u0437\u0443 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e QA Automation \u043a\u043e\u043c\u0430\u043d\u0434, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0434\u043d\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u0442 \u0430\u0434\u043c\u0438\u043d\u043a\u0443, \u0434\u0440\u0443\u0433\u0430\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u0442 \u0441\u0430\u0439\u0442, \u0442\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u0432\u0435\u0441\u044c Page Factory \u0432\u043d\u0443\u0442\u0440\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0448\u0438\u0442\u044c \u043d\u0430 pypi \u0438\u043b\u0438 \u043d\u0430 \u0441\u0432\u043e\u0439 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0439 nexus \u0441\u0435\u0440\u0432\u0435\u0440. \u0414\u0430\u043b\u0435\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u0441\u0435 QA Automation \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u043e\u0431\u0449\u0438\u0439 \u0435\u043d\u0442\u0440\u0438 \u043f\u043e\u0438\u043d\u0442 \u0434\u043b\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f UI \u0430\u0432\u0442\u043e \u0442\u0435\u0441\u0442\u043e\u0432, \u043e\u0431\u0449\u0438\u0435 \u0448\u0430\u0433\u0438 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p>Last but not least. \u041f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u043c\u043d\u043e\u044e \u043f\u043e\u0434\u0445\u043e\u0434 Page Factory \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439, \u0430 \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u043e \u0434\u043b\u044f \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c. \u0425\u0443\u0436\u0435, \u043a\u043e\u0433\u0434\u0430 \u0432 \u043a\u043e\u0434\u0435 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u0442\u0441\u044f &#171;\u043c\u0430\u0433\u0438\u044f&#187; \u0438 \u044d\u0442\u0430 &#171;\u043c\u0430\u0433\u0438\u044f&#187; \u043f\u043e\u043d\u044f\u0442\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u043c\u0443, \u043a\u0442\u043e \u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043b. \u0412 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0432\u044b\u0448\u0435 \u0442\u0430 &#171;\u043c\u0430\u0433\u0438\u044f&#187; \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442, \u0432\u0441\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e \u0438 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u041e\u041e\u041f.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 Page Factory, \u043d\u043e \u044d\u0442\u043e \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0440\u0430\u0431\u043e\u0447\u0435\u0435 \u0438 \u0430\u0434\u0435\u043a\u0432\u0430\u0442\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0432\u044b\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u041f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0435 \u043c\u043d\u043e\u044e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e \u0437\u0430\u043a\u0440\u044b\u0442\u044c \u0432\u0441\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u043c\u0438.<\/p>\n<p>\u0414\u043b\u044f \u043c\u0435\u043d\u044f \u0433\u043b\u0430\u0432\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u0432\u0435 \u0437\u0430\u0434\u0430\u0447\u0438:<\/p>\n<ul>\n<li>\n<p>\u0424\u043e\u043a\u0443\u0441 \u043d\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0431\u0438\u0437\u043d\u0435\u0441 \u043b\u043e\u0433\u0438\u043a\u0438, \u0431\u0435\u0437 \u0432\u0435\u0447\u043d\u044b\u0445 \u0433\u043e\u043b\u043e\u0432\u043e\u043b\u043e\u043c\u043e\u043a \u0441 \u043a\u043e\u0434\u043e\u043c;<\/p>\n<\/li>\n<li>\n<p>\u041a\u0440\u0430\u0441\u0438\u0432\u044b\u0439 \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0439 \u043e\u0442\u0447\u0435\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e \u043c\u043e\u0433\u0443\u0442 \u0447\u0438\u0442\u0430\u0442\u044c Manual QA, \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u044b \u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438.<\/p>\n<\/li>\n<\/ul>\n<h3>Pages<\/h3>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u043f\u0438\u0448\u0435\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f, \u0443\u0436\u0435 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Page Factory.<\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 playwright\u00a0<a href=\"https:\/\/playwright.dev\/python\/docs\/languages\" rel=\"noopener noreferrer nofollow\">https:\/\/playwright.dev<\/a><\/p>\n<p>pages\\playwright-home-page.ts<\/p>\n<pre><code class=\"typescript\">import { BasePage } from '.\/base-page';  export class PlaywrightHomePage extends BasePage {} <\/code><\/pre>\n<p>\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0441 \u044f\u0437\u044b\u043a\u0430\u043c\u0438\u00a0<a href=\"https:\/\/playwright.dev\/python\/docs\/languages\" rel=\"noopener noreferrer nofollow\">https:\/\/playwright.dev\/python\/docs\/languages<\/a>  <\/p>\n<p>pages\\playwright-languages-page.ts<\/p>\n<pre><code class=\"typescript\">import { Page } from '@playwright\/test'; import { Title } from '..\/page-factory\/title'; import { capitalizeFirstLetter } from '..\/utils\/generic'; import { BasePage } from '.\/base-page';  export class PlaywrightLanguagesPage extends BasePage {   private readonly languageTitle: Title;    constructor(public page: Page) {     super(page);      this.languageTitle = new Title({ page, locator: 'h2#{language}', name: 'Language title' });   }    async languagePresent(language: string): Promise&lt;void> {     await this.languageTitle.shouldBeVisible({ language });     await this.languageTitle.shouldHaveText(capitalizeFirstLetter(language), { language });   } } <\/code><\/pre>\n<h3>Components<\/h3>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u043f\u0438\u0448\u0435\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043c \u0431\u0443\u0434\u0443\u0442 \u043d\u0443\u0436\u043d\u044b.<\/p>\n<h4>Navbar<\/h4>\n<p>components\\navigation\\navbar.ts<\/p>\n<pre><code class=\"typescript\">import { Page } from '@playwright\/test'; import { Button } from '..\/..\/page-factory\/button'; import { Link } from '..\/..\/page-factory\/link'; import { SearchModal } from '..\/modals\/search-modal';  export class Navbar {   readonly searchModal: SearchModal;    private readonly apiLink: Link;   private readonly docsLink: Link;   private readonly searchButton: Button;    constructor(public page: Page) {     this.searchModal = new SearchModal(page);      this.apiLink = new Link({ page, locator: \"\/\/a[text()='API']\", name: 'API' });     this.docsLink = new Link({ page, locator: \"\/\/a[text()='Docs']\", name: 'Docs' });     this.searchButton = new Button({ page, locator: 'button.DocSearch-Button', name: 'Search' });   }    async visitDocs(): Promise&lt;void> {     await this.docsLink.click();   }    async visitApi(): Promise&lt;void> {     await this.apiLink.click();   }    async openSearch(): Promise&lt;void> {     await this.searchButton.shouldBeVisible();      await this.searchButton.hover();     await this.searchButton.click();      await this.searchModal.modalIsOpened();   } } <\/code><\/pre>\n<h4>SearchModal <\/h4>\n<p>components\\modals\\search-modal.ts<\/p>\n<pre><code class=\"typescript\">import { Page } from '@playwright\/test'; import { Input } from '..\/..\/page-factory\/input'; import { ListItem } from '..\/..\/page-factory\/list-item'; import { Title } from '..\/..\/page-factory\/title';  type FindResult = {   keyword: string;   resultNumber: number; };  export class SearchModal {   private readonly emptyResultsTitle: Title;   private readonly searchInput: Input;   private readonly searchResult: ListItem;    constructor(public page: Page) {     this.emptyResultsTitle = new Title({ page, locator: 'p.DocSearch-Help', name: 'Empty results' });     this.searchInput = new Input({ page, locator: '#docsearch-input', name: 'Search docs' });     this.searchResult = new ListItem({ page, locator: '#docsearch-item-{resultNumber}', name: 'Result item' });   }    async modalIsOpened(): Promise&lt;void> {     await this.searchInput.shouldBeVisible();     await this.emptyResultsTitle.shouldBeVisible();   }    async findResult({ keyword, resultNumber }: FindResult) {     await this.searchInput.fill(keyword, { validateValue: true });     await this.searchResult.click({ resultNumber });   } } <\/code><\/pre>\n<p><strong>\u041b\u0430\u0439\u0444\u0445\u0430\u043a.<\/strong> \u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u0443\u0442\u0430\u0435\u0442\u0435\u0441\u044c \u0438 \u043d\u0435 \u0437\u043d\u0430\u0435\u0442\u0435, \u043a\u0430\u043a \u043d\u0430\u0437\u0432\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442, \u0442\u043e \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0432\u043d\u0443\u0442\u0440\u0438 React\/Vue\/Angular frontend \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0414\u0430, \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u0430\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c, \u043d\u043e \u0435\u0441\u043b\u0438 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0443\u043f \u043a frontend \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e, \u0442\u043e \u0441\u043e\u0432\u0435\u0442\u0443\u044e \u0431\u0440\u0430\u0442\u044c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u0438\u043c\u0435\u043d\u043d\u043e \u043e\u0442 \u0442\u0443\u0434\u0430. \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0442\u043e\u0447\u043d\u043e \u043b\u0443\u0447\u0448\u0435 \u0437\u043d\u0430\u044e\u0442 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 frontend \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0447\u0435\u043c \u043b\u044e\u0431\u043e\u0439 QA Engineer, + \u0432\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u043b\u0435\u0433\u0447\u0435 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0438 \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044e. \u0412 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 c <a href=\"https:\/\/playwright.dev\/\" rel=\"noopener noreferrer nofollow\">https:\/\/playwright.dev\/<\/a> \u043c\u044b \u043d\u0435 \u0438\u043c\u0435\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043a\u043e\u0434\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u043f\u043e \u0441\u043c\u044b\u0441\u043b\u0443.<\/p>\n<h3>Testing<\/h3>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0442\u0435\u0441\u0442\u0430. \u0422\u0443\u0442 \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u0442\u0435\u0441\u0442 \u0441\u043e\u0431\u0435\u0440\u0435\u043c, \u043a\u0430\u043a \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440, \u043d\u043e \u043f\u0435\u0440\u0435\u0434 \u044d\u0442\u0438\u043c \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0444\u0438\u043a\u0441\u0442\u0443\u0440\u044b.<\/p>\n<p><strong>\u041b\u0430\u0439\u0444\u0445\u0430\u043a.<\/strong> \u041d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0443 \u0432\u0430\u0441 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0432\u043b\u0438\u044f\u044e\u0442 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043a\u0438\u0435, \u043a\u0430\u043a \u0448\u0440\u0438\u0444\u0442\u044b (woff,woff2), \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 (png, jpg, jpeg), \u0438\u043a\u043e\u043d\u043a\u0438 (ico, svg), \u043c\u0443\u0437\u044b\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b (mp3), \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0444\u0440\u043e\u043d\u0442 \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0441 \u0431\u044d\u043a\u0430, \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c, \u044d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0441\u0438\u043b\u044c\u043d\u043e \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0432\u0430\u0448\u0438 \u0442\u0435\u0441\u0442\u044b, \u043f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u0435 \u0432\u0441\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c, \u043a \u044d\u0442\u043e\u043c\u0443 \u0442\u043e\u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u044c\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0438\u043b\u0438 \u043f\u043e\u0441\u043e\u0432\u0435\u0442\u0443\u0439\u0442\u0435\u0441\u044c \u0441 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0442\u044c main.js\/index.js\/app.js \u0438\u043b\u0438 \u0447\u0430\u043d\u043a\u0438 \u0442\u043e\u0447\u043d\u043e \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \ud83d\ude42  \u041c\u044b \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u043c \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 c \u043f\u043e\u043c\u043e\u0449\u044c\u044e playwright:<\/p>\n<p>utils\\mocks\\static-mock.ts<\/p>\n<pre><code class=\"typescript\">import { Page } from '@playwright\/test';  export const mockStaticRecourses = async (page: Page): Promise&lt;void> => {   await page.route('**\/*.{ico,png,jpg,mp3,woff,woff2}', (route) => route.abort()); };<\/code><\/pre>\n<p>fixtures\\context-pages.ts<\/p>\n<pre><code class=\"typescript\">import { Fixtures, Page } from '@playwright\/test'; import { BaseFixture } from '..\/types\/playwright'; import { mockStaticRecourses } from '..\/utils\/mocks\/static-mock';  export type ContextPagesFixture = {   contextPage: Page; };  export const contextPagesFixture: Fixtures&lt;ContextPagesFixture, BaseFixture> = {   contextPage: async ({ page }, use) => {     await mockStaticRecourses(page);      await use(page);   } };<\/code><\/pre>\n<p>fixtures\\playwright-pages.ts<\/p>\n<pre><code class=\"typescript\">import { Fixtures } from '@playwright\/test'; import { PlaywrightHomePage } from '..\/pages\/playwright-home-page'; import { PlaywrightLanguagesPage } from '..\/pages\/playwright-languages-page'; import { ContextPagesFixture } from '.\/context-pages';  export type PlaywrightPagesFixture = {   playwrightHomePage: PlaywrightHomePage;   playwrightLanguagesPage: PlaywrightLanguagesPage; };  export const playwrightPagesFixture: Fixtures&lt;PlaywrightPagesFixture, ContextPagesFixture> = {   playwrightHomePage: async ({ contextPage }, use) => {     const playwrightHomePage = new PlaywrightHomePage(contextPage);      await use(playwrightHomePage);   },   playwrightLanguagesPage: async ({ contextPage }, use) => {     const playwrightLanguagesPage = new PlaywrightLanguagesPage(contextPage);      await use(playwrightLanguagesPage);   } }; <\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0434\u0435\u043b\u0430\u0435\u043c extend \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e test \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0438\u0437 playwright \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043d\u0435\u0433\u043e \u0441\u0432\u043e\u0438 \u0444\u0438\u043a\u0441\u0442\u0443\u0440\u044b<\/p>\n<p>tests\\tests.ts<\/p>\n<pre><code class=\"typescript\">import { test as base } from '@playwright\/test'; import { ContextPagesFixture, contextPagesFixture } from '..\/fixtures\/context-pages'; import { PlaywrightPagesFixture, playwrightPagesFixture } from '..\/fixtures\/playwright-pages'; import { combineFixtures } from '..\/utils\/fixtures';  export const searchTest = base.extend&lt;ContextPagesFixture, PlaywrightPagesFixture>(   combineFixtures(contextPagesFixture, playwrightPagesFixture) ); <\/code><\/pre>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 <code>combineFixtures<\/code> &#8212; \u044d\u0442\u043e \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u043c \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0444\u0438\u043a\u0441\u0442\u0443\u0440 \u0432 \u043e\u0434\u0438\u043d. \u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0438 \u0431\u0435\u0437 \u043d\u0435\u0433\u043e, \u043d\u043e \u043c\u043d\u0435 \u0442\u0430\u043a \u0443\u0434\u043e\u0431\u043d\u0435\u0435:<\/p>\n<p>utils\\fixtures.ts<\/p>\n<pre><code class=\"typescript\">import { Fixtures } from '@playwright\/test';  export const combineFixtures = (...args: Fixtures[]): Fixtures =>   args.reduce((acc, fixture) => ({ ...acc, ...fixture }), {}); <\/code><\/pre>\n<p>tests\\test-search.spec.ts<\/p>\n<pre><code class=\"typescript\">import { BASE_URL } from '..\/settings'; import { searchTest as test } from '.\/tests';  test.beforeEach(async ({ playwrightHomePage }) => {   await playwrightHomePage.visit(BASE_URL); });  test('Testing search on playwright documentation page', async ({ playwrightHomePage, playwrightLanguagesPage }) => {   await playwrightHomePage.navbar.openSearch();   await playwrightHomePage.navbar.searchModal.findResult({ keyword: 'python', resultNumber: 0 });    await playwrightLanguagesPage.languagePresent('python'); }); <\/code><\/pre>\n<p>\u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 Page Object, Page Factory, \u043a\u0430\u043a \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432\u044b\u0448\u0435, \u0442\u0435\u0441\u0442\u044b \u043f\u0438\u0448\u0443\u0442\u0441\u044f \u043b\u0435\u0433\u043a\u043e \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u043e. \u0418, \u0441\u0430\u043c\u043e\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0435, \u044d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u0444\u043e\u043a\u0443\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0431\u0438\u0437\u043d\u0435\u0441 \u043b\u043e\u0433\u0438\u043a\u0438 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430, \u0430 \u043d\u0435 \u043d\u0430 \u0435\u0440\u0443\u043d\u0434\u0435 \u043f\u043e \u0442\u0438\u043f\u0443, \u043a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c test.step, \u043a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0438\u043b\u0438 \u043a\u0430\u043a \u043c\u043d\u0435 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0432 \u043b\u043e\u043a\u0430\u0442\u043e\u0440.  <\/p>\n<h2>Report<\/h2>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0442\u0435\u0441\u0442\u044b \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043e\u0442\u0447\u0435\u0442:<\/p>\n<pre><code class=\"bash\">npx playwright test<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043e\u0442\u0447\u0435\u0442:<\/p>\n<pre><code class=\"bash\">allure serve<\/code><\/pre>\n<p>\u041b\u0438\u0431\u043e \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043e\u0442\u0447\u0435\u0442 \u0438 \u0432 \u043f\u0430\u043f\u043a\u0435 allure-reports \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0444\u0430\u0439\u043b index.html:<\/p>\n<pre><code>allure generate<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/bb8\/394\/e4c\/bb8394e4cfaef53af120d4c02e83c84c.png\" alt=\"Allure report\" title=\"Allure report\" width=\"1898\" height=\"931\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/bb8\/394\/e4c\/bb8394e4cfaef53af120d4c02e83c84c.png\"\/><figcaption>Allure report<\/figcaption><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ed7\/0b0\/dcb\/ed70b0dcb52430a266e990a3443bb69b.png\" alt=\"Allure report video\" title=\"Allure report video\" width=\"1901\" height=\"934\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ed7\/0b0\/dcb\/ed70b0dcb52430a266e990a3443bb69b.png\"\/><figcaption>Allure report video<\/figcaption><\/figure>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u044b\u0439 \u043e\u0442\u0447\u0435\u0442, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0432\u0441\u044f \u043d\u0443\u0436\u043d\u0430\u044f \u043d\u0430\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f.<\/p>\n<p><a href=\"https:\/\/nikita-filonov.github.io\/playwright_typescript\/\" rel=\"noopener noreferrer nofollow\">\u041f\u043e\u043b\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u043e\u0442\u0447\u0435\u0442\u0430 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0442\u0443\u0442<\/a>.<\/p>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0412\u0435\u0441\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u00a0<a href=\"https:\/\/github.com\/Nikita-Filonov\/playwright_typescript\" rel=\"noopener noreferrer nofollow\">\u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d \u043d\u0430 \u043c\u043e\u0435\u043c github<\/a>.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/712084\/\"> https:\/\/habr.com\/ru\/post\/712084\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h3>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c, \u043a\u0430\u043a \u043f\u0438\u0441\u0430\u0442\u044c UI \u0430\u0432\u0442\u043e\u0442\u0435\u0441\u0442\u044b \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u0432 Page Object, Page Factory \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 TypeScript. \u0423 \u043c\u0435\u043d\u044f \u0443\u0436\u0435 \u0431\u044b\u043b\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043e \u0442\u043e\u043c <a href=\"https:\/\/habr.com\/ru\/post\/708932\/\" rel=\"noopener noreferrer nofollow\">\u041a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c UI \u0430\u0432\u0442\u043e \u0442\u0435\u0441\u0442\u044b \u043d\u0430 Python<\/a>, \u0442\u0443\u0442 \u043c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440.<\/p>\n<h3>Requirements<\/h3>\n<p>\u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f UI \u0430\u0432\u0442\u043e \u0442\u0435\u0441\u0442\u043e\u0432 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c:<\/p>\n<ul>\n<li>\n<p>playwright &#8212; yarn add\u00a0playwright\/npm install playwright<\/p>\n<\/li>\n<li>\n<p>allure &#8212; yarn add allure-playwright\/npm install allure-playwright <\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0438 \u0440\u0435\u043f\u043e\u0440\u0442\u0435\u0440, \u0441\u0443\u0442\u044c \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 Page Object, Page Factory \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0445\u043e\u0436\u0435\u0439 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0435.<\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0432\u0441\u0435 \u0430\u0432\u0442\u043e\u0442\u0435\u0441\u0442\u044b \u0431\u0443\u0434\u0443\u0442 \u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f \u0447\u0435\u0440\u0435\u0437 async, await, \u0442.\u043a. \u044d\u0442\u043e \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0434\u043b\u044f playwright. \u0412 \u0434\u0440\u0443\u0433\u0438\u0445 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430\u0445 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u043d\u0430\u0447\u0435.<\/p>\n<p>\u0410\u0432\u0442\u043e \u0442\u0435\u0441\u0442\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430 \u044d\u0442\u0443 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443\u00a0<a href=\"https:\/\/playwright.dev\/\" rel=\"noopener noreferrer nofollow\">https:\/\/playwright.dev\/<\/a><\/p>\n<p>\u0422\u0435\u0441\u0442 \u043a\u0435\u0439\u0441:<\/p>\n<ol>\n<li>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 https:\/\/playwright.dev<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u043d\u0430 \u043f\u043e\u0438\u0441\u043a<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u043c\u043e\u0434\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u043a\u043d\u043e \u043f\u043e\u0438\u0441\u043a\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u043b\u043e\u0441\u044c<\/p>\n<\/li>\n<li>\n<p>\u0412\u0432\u043e\u0434\u0438\u043c \u0432 \u043f\u043e\u0438\u0441\u043a \u044f\u0437\u044b\u043a, \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u0443\u0434\u0435\u0442 python<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0438\u0437 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043f\u0435\u0440\u0432\u044b\u0439<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0441 Python \u043e\u0442\u043a\u0440\u044b\u043b\u0430\u0441\u044c<\/p>\n<\/li>\n<\/ol>\n<p>\u041e\u0442\u043c\u0435\u0447\u0443, \u0447\u0442\u043e \u043b\u043e\u043a\u0430\u0442\u043e\u0440\u044b \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u043d\u0438\u0436\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u044d\u0442\u0430\u043b\u043e\u043d\u043d\u044b\u043c\u0438, \u0430 \u0441\u0430\u0439\u0442 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f &#8212;  \u044d\u0442\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f playwright, \u043d\u0430 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u044f \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u043c\u043e\u0433\u0443 \u043f\u043e\u0432\u043b\u0438\u044f\u0442\u044c. \u0412 \u0432\u0430\u0448\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u0441\u043e\u0432\u0435\u0442\u0443\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 data-qa-id, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 React\/Vue\/Angular \u0438\u043b\u0438 \u0436\u0435 \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e.<\/p>\n<p>\u0424\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 playwright \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043b\u0438\u0448\u044c allure-report, headles, video, screenshot. \u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043f\u0440\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e playwright \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/playwright.dev\/docs\/test-configuration\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a>.<\/p>\n<p>Playwright \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0432\u0438\u0434\u0435\u043e \u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u044b + \u043a\u0440\u0435\u043f\u0438\u0442\u044c \u0438\u0445 \u043a \u043e\u0442\u0447\u0435\u0442\u0443, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c <code>video: \"on\"<\/code>, <code>screenshot: \"on\"<\/code>, \u0442\u0430\u043c \u0435\u0441\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b. \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0432\u0438\u0434\u0435\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0444\u0435\u0439\u043b\u0435\u043d\u043d\u044b\u0439 \u0442\u0435\u0441\u0442, \u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 <code>video: \"retain-on-failure<\/code>, \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0441\u043e \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u043e\u043c <code>screenshot: \"only-on-failure\"<\/code>. \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u043e\u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0438 \u0441 Selenium. \u0412 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0432\u0438\u0434\u0435\u043e \u0438 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442 \u0432 \u043e\u0442\u0447\u0435\u0442\u0435.<\/p>\n<p>playwright.config.ts<\/p>\n<pre><code class=\"typescript\">import type { PlaywrightTestConfig } from '@playwright\/test'; import { devices } from '@playwright\/test';  \/**  * Read environment variables from file.  * https:\/\/github.com\/motdotla\/dotenv  *\/ \/\/ require('dotenv').config();  \/**  * See https:\/\/playwright.dev\/docs\/test-configuration.  *\/ const config: PlaywrightTestConfig = {   testDir: '.\/tests',   \/* Maximum time one test can run for. *\/   timeout: 30 * 1000,   expect: {     \/**      * Maximum time expect() should wait for the condition to be met.      * For example in `await expect(locator).toHaveText();`      *\/     timeout: 5000   },   \/* Run tests in files in parallel *\/   fullyParallel: true,   \/* Fail the build on CI if you accidentally left test.only in the source code. *\/   forbidOnly: !!process.env.CI,   \/* Retry on CI only *\/   retries: process.env.CI ? 2 : 0,   \/* Opt out of parallel tests on CI. *\/   workers: process.env.CI ? 1 : undefined,   \/* Reporter to use. See https:\/\/playwright.dev\/docs\/test-reporters *\/   reporter: [['html'], ['allure-playwright']],   \/* Shared settings for all the projects below. See https:\/\/playwright.dev\/docs\/api\/class-testoptions. *\/   use: {     \/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). *\/     actionTimeout: 0,     \/* Base URL to use in actions like `await page.goto('\/')`. *\/     \/\/ baseURL: 'http:\/\/localhost:3000',      \/* Collect trace when retrying the failed test. See https:\/\/playwright.dev\/docs\/trace-viewer *\/     trace: 'on-first-retry',     headless: !!process.env.CI,     video: 'on',     screenshot: 'on'   },    \/* Configure projects for major browsers *\/   projects: [     {       name: 'chromium',       use: {         ...devices['Desktop Chrome']       }     }   ] };  export default config; <\/code><\/pre>\n<h3>Base Page<\/h3>\n<p>\u041f\u043e \u0441\u0443\u0442\u0438 Base Page &#8212; \u044d\u0442\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0435 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043a\u0430\u043a\u0443\u044e-\u0442\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0443\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0438\u043b\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442. \u0421\u0430\u043c\u0430 \u043f\u043e \u0441\u0435\u0431\u0435 Base Page \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0442\u0435\u0441\u0442\u0430\u0445 \u0438 \u043e\u0442 \u043d\u0435\u0435 \u043c\u044b \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u043c \u043d\u0430\u0448\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0438\u043b\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b.<\/p>\n<p>pages\\base-page.ts<\/p>\n<pre><code class=\"typescript\">import test, { Page } from '@playwright\/test'; import { Navbar } from '..\/components\/navigation\/navbar';  export class BasePage {   readonly navbar: Navbar;    constructor(public page: Page) {     this.navbar = new Navbar(page);   }    async visit(url: string): Promise&lt;void> {     await test.step(`Opening the url \"${url}\"`, async () => {       await this.page.goto(url, { waitUntil: 'networkidle' });     });   }    async reload(): Promise&lt;void> {     const currentUrl = this.page.url();      await test.step(`Reloading page with url \"${currentUrl}\"`, async () => {       await this.page.reload({ waitUntil: 'domcontentloaded' });     });   } }<\/code><\/pre>\n<p>\u0412\u043d\u0443\u0442\u0440\u0438 BasePage \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b. \u042d\u0442\u043e \u043b\u0438\u0448\u044c \u043e\u0431\u0440\u0430\u0437\u0435\u0446 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c BasePage  <\/p>\n<h2>Page Factory<\/h2>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0430\u043c\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435. \u041c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430. \u041d\u043e \u043f\u0435\u0440\u0435\u0434 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0442\u0438\u043f\u044b \u0438 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b.<\/p>\n<p>utils\\generic.ts<\/p>\n<pre><code class=\"typescript\">export const capitalizeFirstLetter = (string: string): string => string.charAt(0).toUpperCase() + string.slice(1); <\/code><\/pre>\n<p>utils\\page-factory.ts<\/p>\n<pre><code class=\"typescript\">import { LocatorContext } from '..\/types\/page-factory\/component';  export const locatorTemplateFormat = (locator: string, { ...context }: LocatorContext): string => {   let template = locator;   for (const [key, value] of Object.entries(context)) {     template = template.replace(`{${key}}`, value.toString());   }    return template; }; <\/code><\/pre>\n<p>\u041f\u043e \u0441\u0443\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>locatorTemplateFormat<\/code> \u0431\u0443\u0434\u0435\u0442 \u0431\u0440\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u043b\u043e\u043a\u0430\u0442\u043e\u0440\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>[data-qa-id=\"here-my-locator-with-index-{index}\"]<\/code> \u0438 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438 <code>context<\/code> \u0432\u043d\u0443\u0442\u0440\u044c \u0441\u0442\u0440\u043e\u043a\u0438 \u043b\u043e\u043a\u0430\u0442\u043e\u0440\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"typescript\">const locator = '[data-qa-id=\"here-my-locator-with-index-{index}\"]'; const context = {index: 5};  locatorTemplateFormat(locator, context) => '[data-qa-id=\"here-my-locator-with-index-5\"]<\/code><\/pre>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f <code>locatorTemplateFormat<\/code> \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043b\u044e\u0431\u0430\u044f, \u044f \u043b\u0438\u0448\u044c \u043f\u0440\u0438\u0432\u0435\u043b \u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u0430\u043a \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c. \u0412 \u0441\u0432\u043e\u0435\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0439 \u0444\u043e\u0440\u043c\u0430\u0442\u0435\u0440 \u0434\u043b\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u043b\u043e\u043a\u0430\u0442\u043e\u0440\u0430.<\/p>\n<p>types\\page-factory\\component.ts<\/p>\n<pre><code class=\"typescript\">import { Page } from '@playwright\/test';  export type LocatorContext = { [key: string]: string | boolean | number };  export type ComponentProps = {   page: Page;   name?: string;   locator: string; };  export type LocatorProps = { locator?: string } &amp; LocatorContext;<\/code><\/pre>\n<p>\u0411\u0430\u0437\u043e\u0432\u044b\u0439 <strong>Component<\/strong>. \u0421\u0430\u043c \u043f\u043e \u0441\u0435\u0431\u0435 Component \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0442\u0435\u0441\u0442\u0430\u0445 \u0438 \u043e\u0442 \u043d\u0435\u0433\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0438 \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0435\u0433\u043e \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u043c \u043a\u043b\u0430\u0441\u0441\u043e\u043c. <\/p>\n<p>page-factory\\component.ts<\/p>\n<pre><code class=\"typescript\">import { expect, Locator, Page, test } from '@playwright\/test'; import { ComponentProps, LocatorProps } from '..\/types\/page-factory\/component'; import { capitalizeFirstLetter } from '..\/utils\/generic'; import { locatorTemplateFormat } from '..\/utils\/page-factory';  export abstract class Component {   page: Page;   locator: string;   private name: string | undefined;    constructor({ page, locator, name }: ComponentProps) {     this.page = page;     this.locator = locator;     this.name = name;   }    getLocator(props: LocatorProps = {}): Locator {     const { locator, ...context } = props;     const withTemplate = locatorTemplateFormat(locator || this.locator, context);      return this.page.locator(withTemplate);   }    get typeOf(): string {     return 'component';   }    get typeOfUpper(): string {     return capitalizeFirstLetter(this.typeOf);   }    get componentName(): string {     if (!this.name) {       throw Error('Provide \"name\" property to use \"componentName\"');     }      return this.name;   }    private getErrorMessage(action: string): string {     return `The ${this.typeOf} with name \"${this.componentName}\" and locator ${this.locator} ${action}`;   }    async shouldBeVisible(locatorProps: LocatorProps = {}): Promise&lt;void> {     await test.step(`${this.typeOfUpper} \"${this.componentName}\" should be visible on the page`, async () => {       const locator = this.getLocator(locatorProps);       await expect(locator, { message: this.getErrorMessage('is not visible') }).toBeVisible();     });   }    async shouldHaveText(text: string, locatorProps: LocatorProps = {}): Promise&lt;void> {     await test.step(`${this.typeOfUpper} \"${this.componentName}\" should have text \"${text}\"`, async () => {       const locator = this.getLocator(locatorProps);       await expect(locator, { message: this.getErrorMessage(`does not have text \"${text}\"`) }).toContainText(text);     });   }    async click(locatorProps: LocatorProps = {}): Promise&lt;void> {     await test.step(`Clicking the ${this.typeOf} with name \"${this.componentName}\"`, async () => {       const locator = this.getLocator(locatorProps);       await locator.click();     });   } } <\/code><\/pre>\n<p>\u0412\u044b\u0448\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0430 \u043e\u0447\u0435\u043d\u044c \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f Component. \u0412 \u0441\u0432\u043e\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u043a \u043d\u0438\u043c, \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0448\u0430\u0433\u043e\u0432 test.step, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442 \u0432\u0430\u043c.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0435\u0449\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p><strong>Button<\/strong> &#8212; \u043a\u043d\u043e\u043f\u043a\u0430. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 \u0431\u0443\u0434\u0443\u0442 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043a\u043d\u043e\u043f\u043a\u0430\u043c\u0438.  <\/p>\n<p>page-factory\\button.ts<\/p>\n<pre><code class=\"typescript\">import test from '@playwright\/test'; import { LocatorProps } from '..\/types\/page-factory\/component'; import { Component } from '.\/component';  export class Button extends Component {   get typeOf(): string {     return 'button';   }    async hover(locatorProps: LocatorProps = {}): Promise&lt;void> {     await test.step(`Hovering the ${this.typeOf} with name \"${this.componentName}\"`, async () => {       const locator = this.getLocator(locatorProps);       await locator.hover();     });   }    async doubleClick(locatorProps: LocatorProps = {}) {     await test.step(`Double clicking ${this.typeOf} with name \"${this.componentName}\"`, async () => {       const locator = this.getLocator(locatorProps);       await locator.dblclick();     });   } } <\/code><\/pre>\n<p><strong>Input<\/strong> &#8212; \u043f\u043e\u043b\u0435 \u0432\u0432\u043e\u0434\u0430. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 \u0431\u0443\u0434\u0443\u0442 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0438\u043d\u043f\u0443\u0442\u0430\u043c\u0438.  <\/p>\n<p>page-factory\\input.ts<\/p>\n<pre><code class=\"typescript\">import test, { expect } from '@playwright\/test'; import {<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-344466","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/344466","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=344466"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/344466\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=344466"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=344466"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=344466"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}