国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

? ? ????? JS ???? ???: ? UI ??? ??? ?????? ???? ??

???: ? UI ??? ??? ?????? ???? ??

Dec 26, 2024 pm 05:57 PM

PlayWright? Microsoft?? ??? ? UI ??? ??? ????????.

??? ????? ???? ??? ???, ??? ??, ??? ???? ??? ??? ?????? ???? ?? ??? ???.

Playwright: A Comprehensive Overview of Web UI Automation Testing Framework

?? ???? ??:

  • ?? ??, ??? ??? ?? ??? ??? ? ?? ??? ?? ????? ????? ???? ? ?? ??????.
  • ???? ???? ????? ?? ????? ????? ???? ???? ? ??? ???? ??? ??? Shadow DOM ??? ?????.
  • PlayWright? ? ???? ?? ???? ????? ?????. ???? ????? ??? ??? ???? ???? ????? ??? ?? ?? ?? ?? ??? ??? ?????. ??? ???? ????? ???? ?? ? ????? ??? ????.
  • ?? ??, ??? ???, ???? ??
  • ?? ??? ?????.

PlayWright ? ??? ? Cypress

?? ?? ??? ??? ? UI ??? ??? ?????? ?????? ?? ?? ???? 10? ? Selenium, ?? ?? ?? Cypress, ??? ??? ???? PlayWright? ?????. ??? ??? ??? ?? ??? ????? ??? ?????

Feature PlayWright Selenium Cypress
Supported Languages JavaScript, Java, C#, Python JavaScript, Java, C#, Python, Ruby JavaScript/TypeScript
Supported Browsers Chrome, Edge, Firefox, Safari Chrome, Edge, Firefox, Safari, IE Chrome, Edge, Firefox, Safari
Testing Framework Frameworks for supported languages Frameworks for supported languages Frameworks for supported languages
Usability Easy to use and configure Complex setup with a learning curve Easy to use and configure
Code Complexity Simple Moderate Simple
DOM Manipulation Simple Moderate Simple
Community Maturity Improving gradually Highly mature Fairly mature
Headless Mode Support Yes Yes Yes
Concurrency Support Supported Supported Depends on CI/CD tools
iframe Support Supported Supported Supported via plugins
Driver Not required Requires a browser-specific driver Not required
Multi-Tab Operations Supported Not supported Supported
Drag and Drop Supported Supported Supported
Built-in Reporting Yes No Yes
Cross-Origin Support Supported Supported Supported
Built-in Debugging Yes No Yes
Automatic Wait Yes No Yes
Built-in Screenshot/Video Yes No video recording Yes

?? ??:

  • ?? ??: PlayWright ? Selenium? Java, C# ? Python? ????? JavaScript/TypeScript? ???? ?? ??? ????? ???? ?? ??? ????.
  • ??? ??: PlayWright? Selenium? ?? Google? ?? ??? ????? ???? Chromium ?? ????? ?????. Firefox? ?? ????? ?? ??? ????? ??? JavaScript ??? ?????. Selenium? ?? ????? ????? PlayWright? ?? ?? ?????. ?? Cypress? JavaScript? ???? ????? ?????.
  • ???? ??: Selenium? Internet Explorer? ????? IE? ????? ???? ???? ?? ?????.
  • ?? ???: ? ?? ????? ?? ?? ??? ????. ??? PlayWright? Cypress? Selenium? ?? ??? ?????? ? ??? ??????.

????

PlayWright? ?? ??? ????? Node.js? ?? ?????. Python ?? Java ??? ????? ??? ???? PlayWright? ??? ?? Node.js ????? ?????? ?? Node.js ??? ?????. ??? ? ?????? JavaScript/TypeScript? ??? ?????.

?? ? ??

  1. Node.js? ???? ??? ?????.
  2. npm ?? Yarn? ???? PlayWright ????? ??????.
   # Using npm
   npm init playwright@latest

   # Using yarn
   yarn create playwright
  1. ??? ????.
    • TypeScript ?? JavaScript? ?????(???: TypeScript).
    • ??? ???? ??? ?????.
    • PlayWright ?? ???? ?? ??? ?????(???: True).

???? ????? ???? PlayWright?? Chromium, Firefox ? WebKit? ??????? ??? ?? ?? ? ????. ? ????? PlayWright ??? ?????? ?? ? ? ?? ?? ??? ?????.

???? ??

??? ? ???? ???? ?? ???:

playwright.config.ts    # PlayWright configuration file
package.json            # Node.js configuration file
package-lock.json       # Node.js dependency lock file
tests/                  # Your test directory
  example.spec.ts       # Template test case
tests-examples/         # Example tests directory
  demo-todo-app.spec.ts # Example test case

?? ??? ?? ??:

npx playwright test

???? ???? ???? ???? ???? ??? ??? ?? ?????.

Running 6 tests using 6 workers

  6 passed (10s)

To open the last HTML report run:

  npx playwright show-report

?? ?? ??

example.spec.ts ??? ??? ??? ????.

import { test, expect } from '@playwright/test';

test('has title', async ({ page }) => {
  await page.goto('https://playwright.dev/');
  await expect(page).toHaveTitle(/Playwright/);
});

test('get started link', async ({ page }) => {
  await page.goto('https://playwright.dev/');
  await page.getByRole('link', { name: 'Get started' }).click();
  await expect(page).toHaveURL(/.*intro/);
});
  • ? ?? ???: ??? ??? "???"? ???? ??? ?????.
  • ? ?? ???: "????" ??? ???? URL? ?????.

? ??? ???? ??? ?????.

  • ??? ??(?: '?? ??').
  • ??? ??? ???? ??

?? ??? ??? ????.

  • page.goto: URL? ?????.
  • Expect(page).toHaveTitle: ??? ??? ?????.
  • page.getByRole: ???? ??? ????.
  • ??: ??? ??? ??? ??? ?????.

????? ??? ??

??? ???? ?????:

  • ?? ??? ??:
   # Using npm
   npm init playwright@latest

   # Using yarn
   yarn create playwright
  • ?? ??? ?? ??:
playwright.config.ts    # PlayWright configuration file
package.json            # Node.js configuration file
package-lock.json       # Node.js dependency lock file
tests/                  # Your test directory
  example.spec.ts       # Template test case
tests-examples/         # Example tests directory
  demo-todo-app.spec.ts # Example test case
  • ??? ?? ???:
npx playwright test

?? ??

Codegen ??? ???? ????? ?????.

Running 6 tests using 6 workers

  6 passed (10s)

To open the last HTML report run:

  npx playwright show-report

??? ??? ??? ??? ? ????. ??: ???? ???? ?? ??? ??? ???? ?? ?? ????.


?? ??? ???

?? ? ??

? ????? ??? ??? ?????? ?? ? ?? ???? ??? ??? ?????. ?? ??? ???? ??? ???? ??? ?? ??? ???? ??? ?? ????. ??? ???? ???? ???? ?? ???? ???? ???? ???? ??? ???? ??? ???? ????. ?? ?? ??? ?? ?? ??? ?????. ?? ????? ??? ?? ???? ?? ??? ???? ??? ??? ????? Selenium? findElement ???? ????.

??? ??

?? ,