Socket
Socket
Sign inDemoInstall

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 - npm Package Compare versions

Comparing version 0.6.0 to 0.7.0

config/global-setup.ts

23

global.d.ts

@@ -89,2 +89,19 @@ // copied into our codebase for autocompletion purposes from 'playwright/types/types.d.ts' so we don't depend on it.

/**
* Will check if an element's computed style property on the page determined by the selector matches the given string.
*/
toMatchComputedStyle(
selector: string,
property: string,
value: RegExp | string,
options?: PageWaitForSelectorOptions
): Promise<R>
/**
* Will check if an element's computed style property matches the given string.
*/
toMatchComputedStyle(
property: string,
value: RegExp | string,
options?: PageWaitForSelectorOptions
): Promise<R>
/**
* Will check if the element's textContent on the page determined by the selector matches the given pattern.

@@ -149,3 +166,3 @@ */

/**
* Will ensure that the element has focus.
* Will check that an element on the page determined by the selector has focus.
*/

@@ -157,2 +174,6 @@ toHaveFocus(

/**
* Will check that an element has focus.
*/
toHaveFocus(options?: PageWaitForSelectorOptions): Promise<R>
/**
* Will assert that N elements with the given selector are on the page and wait for it by default.

@@ -159,0 +180,0 @@ * If its 0 elements, then it will throw since the element can't be found.

2

package.json
{
"name": "expect-playwright",
"version": "0.6.0",
"version": "0.7.0",
"main": "lib/index.js",

@@ -5,0 +5,0 @@ "types": "./global.d.ts",

@@ -77,2 +77,4 @@ # expect-playwright

- [toHaveSelectorCount](#toHaveSelectorCount)
- [toMatchAttribute](#toMatchAttribute)
- [toMatchComputedStyle](#toMatchComputedStyle)
- [toMatchText](#toMatchText)

@@ -136,12 +138,17 @@ - [toMatchTitle](#toMatchTitle)

This function checks if the given selector has focus.
This function checks if a given element is focused.
You can do this via a selector on the whole page:
```js
await expect(page).toHaveFocus("#foobar")
// or via not, useful to only wait 1 second instead of for the default timeout by Playwright which is 30 seconds.
await expect(page).not.toHaveFocus("#foobar", {
timeout: 1 * 1000,
})
```
Or by passing a Playwright [ElementHandle]:
```javascript
const element = await page.$("#foobar")
await expect(element).toHaveFocus()
```
### toHaveSelector

@@ -169,2 +176,40 @@

### toMatchAttribute
This function checks if an element's attribute matches the provided string or regex pattern.
You can do this via a selector on the whole page:
```javascript
await expect(page).toMatchAttribute("#foo", "href", "https://playwright.dev")
await expect(page).toMatchAttribute("#foo", "href", /playwright/)
```
Or by passing a Playwright [ElementHandle]:
```javascript
const element = await page.$("#foo")
await expect(element).toMatchAttribute("href", "https://playwright.dev")
await expect(element).toMatchAttribute("href", /playwright/)
```
### toMatchComputedStyle
This function checks if an element's computed style property matches the provided string or regex pattern.
You can do this via a selector on the whole page:
```javascript
await expect(page).toMatchComputedStyle("#my-element", "color", "rgb(0, 0, 0)")
await expect(page).toMatchComputedStyle("#my-element", "color", /rgb/)
```
Or by passing a Playwright [ElementHandle]:
```javascript
const element = await page.$("#my-element")
await expect(element).toMatchComputedStyle("color", "rgb(0, 0, 0)")
await expect(element).toMatchComputedStyle("color", /rgb/)
```
### toMatchText

@@ -171,0 +216,0 @@

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