Giter VIP home page Giter VIP logo

playwrightautomation's Introduction

PlaywrightAutomation

Inside that directory, you can run several commands:

Runs the end-to-end tests: npx playwright test

Run tests in headed browsers: npx playwright test --headed

Starts the interactive UI mode: npx playwright test --ui

Runs the tests only on Desktop Chrome: npx playwright test --project=chromium

Runs the tests in a specific file.: npx playwright test example

Runs the tests in debug mode: npx playwright test --debug

Auto-generate tests with Codegen: npx playwright codegen

Runs the tests with specific workers number

npx playwright test exercise-learnings --workers 4

If you set workers to 1. It will become serial instead of the paralel running, one after another.

npx playwright test exercise-learnings --workers 1

We suggest that you begin by typing:

npx playwright test

Install Extension

Playwright Test for VSCode

Playwright Test Snippets

Playwright Runner

Playwright Trace Viewer for VSCode

Debug

  • Debug in Console

DEBUG=pw:api basic_test_command

DEBUG=pw:api npx playwright test home.spec.ts -g "Open\s+About\s+Page\s+and\s+verify\s+title$" image

  • Debug with Trace Viewer
  1. Open the playwright.cnfig.ts file
  2. Use the "trace: 'on'," command instead of "trace: 'on-first-retry',"
  3. Run a test with the "Execute Playwright Tests" extension trace on what will work for each particular test Also, it will open the report automatically and you will find a Trace section below. image
  • Debug with Inspector

It will open a playwright inspector and you can debug it by clicking the next step button. So it gives an opportunity to watch lines step by step

PWDEBUG=1 basic_test_command

PWDEBUG=1 npx playwright test assertions.spec.ts -g "Avoid\s+running\s+further\s+if\s+there\s+were\s+soft\s+assertion\s+failures$"

image
  • Debug with Record Put await page.pause(); to your code and debug with inspector

image

Use faker for random data

https://fakerjs.dev/guide/ https://fakerjs.dev/api/

npm install @faker-js/faker --save-dev

For Example: visit the "secondChallenge.spec.ts" test file

Reporters

  1. List Reporter

npx playwright test exercise-learnings/secondChallenge.spec.ts --reporter=list

  1. Line Reporter

npx playwright test exercise-learnings/secondChallenge.spec.ts --reporter=line

  1. html Reporter

npx playwright test exercise-learnings/secondChallenge.spec.ts --reporter=html

  1. Dot Reporter

npx playwright test exercise-learnings/secondChallenge.spec.ts --reporter=dot

  1. json Reporter

npx playwright test exercise-learnings/secondChallenge.spec.ts --reporter=json

  1. Allure Reporter

npm i -D @playwright/test allure-playwright

npm i -D allure-commandline

npx allure generate allure-results --clean && npx allure open

ESlint Implementation

npm install eslint --save-dev

npm i eslint-plugin-playwright --save-dev

npm i @typescript-eslint/eslint-plugin @typescript-eslint/parser --save-dev

Then install VS Code ESLint extension

Create .eslintrc ( /../../PlaywrightAutomation/.eslintrc ) file

npx eslint exercise-learnings/ will show all warnings and errors in my code

NOTE

You can use https://trace.playwright.dev/ for opening trace.zip as a readable report

playwrightautomation's People

Contributors

avsaryagmur avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.