From 82e9d33bcb59f84d458d7000da9174a9aae1f3cf Mon Sep 17 00:00:00 2001 From: EggSaled <88363052+EggSaled@users.noreply.github.com> Date: Thu, 5 Oct 2023 04:08:41 -0700 Subject: [PATCH] docs: moved imports section (#51819) --- docs/how-to-add-playwright-tests.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/how-to-add-playwright-tests.md b/docs/how-to-add-playwright-tests.md index 695d5d07f2a..afe98655337 100644 --- a/docs/how-to-add-playwright-tests.md +++ b/docs/how-to-add-playwright-tests.md @@ -24,9 +24,19 @@ To learn how to write Playwright tests, or 'specs', please see Playwright's offi This section will explain in detail about best practices for writing and documenting E2E tests based on Playwright documentation and our community code-style. +### - Imports + +Always start with necessary imports at the beginning of the file. + +For example: + +```ts +import { test, expect, type Page } from '@playwright/test'; +``` + ### - Identifying a DOM element -Playwright comes with [multiple built-in locators](https://playwright.dev/docs/locators#quick-guide), but we recommend priritizing the following locators: +Playwright comes with [multiple built-in locators](https://playwright.dev/docs/locators#quick-guide), but we recommend prioritizing the following locators: - `getByRole` for querying semantic elements, whose role is important and allows assistive technology to perceive the page correctly. - `getByText` for querying non-semantic elements such as `div`, `span`, or `p`. @@ -54,16 +64,6 @@ For example: await expect(page.getByTestId('landing-page-figure')).toBeVisible(); ``` -### - Imports - -Always start with necessary imports at the beginning of the file. - -For example: - -```ts -import { test, expect, type Page } from '@playwright/test'; -``` - ### - Constants Define any constant elements, data sets, or configurations used throughout your tests for easy reference.