Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

expect-playwright

Package Overview
Dependencies
Maintainers
2
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

expect-playwright

![Node.js CI](https://github.com/playwright-community/expect-playwright/workflows/Node.js%20CI/badge.svg) [![codecov](https://codecov.io/gh/playwright-community/expect-playwright/branch/master/graph/badge.svg?token=Eay491HC49)](https://codecov.io/gh/playw

  • 0.8.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1M
increased by9.84%
Maintainers
2
Weekly downloads
 
Created

What is expect-playwright?

The expect-playwright npm package is an assertion library for Playwright, which extends the capabilities of Jest's expect function to work seamlessly with Playwright. It allows for more expressive and readable assertions when testing web applications.

What are expect-playwright's main functionalities?

Element Visibility

This feature allows you to assert that a specific element is present in the DOM. In this example, it checks if a button with the ID 'submit' is present on the page.

await expect(page).toHaveSelector('button#submit');

Element Text

This feature allows you to assert that a specific element contains the expected text. In this example, it checks if an <h1> element contains the text 'Welcome'.

await expect(page).toHaveText('h1', 'Welcome');

Element Count

This feature allows you to assert that a specific number of elements are present in the DOM. In this example, it checks if there are exactly 5 <li> elements on the page.

await expect(page).toHaveSelectorCount('li', 5);

Element Attribute

This feature allows you to assert that a specific element has a particular attribute with the expected value. In this example, it checks if an input element with the ID 'username' has a placeholder attribute with the value 'Enter your username'.

await expect(page).toHaveAttribute('input#username', 'placeholder', 'Enter your username');

Element State

This feature allows you to assert that a specific element is in a particular state, such as enabled or disabled. In this example, it checks if a button with the ID 'submit' is enabled.

await expect(page).toBeEnabled('button#submit');

Other packages similar to expect-playwright

FAQs

Package last updated on 19 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc