Commit Graph

24 Commits

Author SHA1 Message Date
Dmitry Gozman
6a65a43e9a
chore: use consistent asLocator() in all logs (#18586)
References #18524.
2022-11-04 15:19:16 -07:00
Pavel Feldman
739b64a09a
chore: render typed locators in the recorder (#18162) 2022-10-18 16:39:58 -07:00
Ross Wollman
8d639ae50e
chore: revert toHaveAttribute type sig and overloads (#17406)
Relates #16517.

Revert "docs(python): add missing NotToHaveAttribute overloads (#17371)"

This reverts commit 2e1ea29614.

Revert "docs(release-notes): add 1.26 release notes for language ports
(#17345)"

This reverts commit 4b8a85e69d.

Revert "test: unflake "should support boolean attribute with options"
(#17024)"

This reverts commit 1dc05bd4c6.

Revert "fix: support toHaveAttribute(name, options) (#16941)"

This reverts commit f30ac1d678.

Revert "feat: expect(locator).toHaveAttribute to assert attribute
presence (#16767)"

This reverts commit 622c73cc1e.
2022-09-16 11:17:35 -07:00
Dmitry Gozman
bca13bc35a
feat(assertions): support toBeVisible({ visible }) (#17207) 2022-09-09 08:33:23 -07:00
Dmitry Gozman
f0c5810609
feat(assertions): support toBeEditable({ editable }) (#17065) 2022-09-06 12:50:45 -07:00
Dmitry Gozman
306ab34aa3
feat(assertions): support toBeEnabled({ enabled }) (#17058) 2022-09-06 11:40:34 -07:00
Yury Semikhatsky
f30ac1d678
fix: support toHaveAttribute(name, options) (#16941) 2022-08-30 17:53:00 -07:00
Dmitry Gozman
7acbd052e4
test: migrate some expect() tests to be more readable (#16394)
This moves some expect() matchers tests from test runner tests to page tests,
because these are implemented through a library call anyway.

Makes tests more readbable, faster and easier to test specific details.
2022-08-10 15:10:25 -07:00
Max Schmitt
98ea418124
fix(expect): expect.not types (#15487) 2022-07-11 18:31:53 +02:00
Dmitry Gozman
85b86e19b8
feat(expect): ensure it works in global setup (#13896) 2022-05-03 21:53:15 +01:00
Dmitry Gozman
1e1df6395f
chore: generate expect types (#13439) 2022-04-11 10:42:19 -07:00
Dmitry Gozman
4bb563b015
fix(expect): proper return types (#13334)
A few changes:
- `Matchers<R, T>` now carries both return and argument type.
- Based on the argument type, we apply playwright-specific Page/Locator matchers.
- Return type is usually void, unless wrapped with `expect.resolves`,
  `expect.rejects` or `expect.poll()`.
- To preserve compatibility with any extended types in the wild,
  argument type is optional.
2022-04-05 16:11:11 -07:00
Ross Wollman
12abae7f31
feat(test-runner): friendly expect errors for typos (#13229)
If you typo'd an `expect` property, you got a cryptic error message:

```
Uncaught TypeError: Cannot create proxy with a non-object as target or handler
```

Now we get this nice friendly message:

```
  1) a.spec.ts:6:9 › explodes ======================================================================

    Error: expect: Property 'toBeLessThen' not found.

    Did you mean 'toBeLessThan'?

    See https://playwright.dev/docs/test-assertions for available options and documentation.

      5 |         const { test } = pwt;
      6 |         test('explodes', () => {
    > 7 |           expect.soft(1).toBeLessThen();
        |           ^
      8 |         });
      9 |

```

Fixes #13218
2022-04-01 13:38:22 -07:00
Andrey Lushnikov
cfe92e1608
feat(test-runner): implement expect.poll (#12815)
This patch implements `expect.poll()` method that polls given
predicate until a given synchronous predicate completes.

Usage:

```js
// wait until page gets 3 frames.
await expect.poll(() => page.frames().length, {
  timeout: 1000,
  message: 'custom error message',
}).toBe(3);
```

Fixes #10235
2022-03-18 16:31:26 -07:00
Max Schmitt
e231db1810
chore: restore expect.any()/expect.anything() (#12820) 2022-03-16 21:34:41 +01:00
Andrey Lushnikov
2336692e8a
feat: support clarification message for expect (#11735)
The clarification message is displayed in the HTML report as the name of the step:

![image](https://user-images.githubusercontent.com/746130/151852652-48194140-5ea4-439d-afee-12583a8caf71.png)

It is also shown in terminal output:

![image](https://user-images.githubusercontent.com/746130/151852666-5c956ef1-6e94-4bc2-8e55-b58688dfc7e0.png)

Fixes #7816
2022-01-31 17:14:59 -08:00
Joel Einbinder
7a02c52144
feat(test-runner): specific playwright types for expect (#10670) 2021-12-13 13:42:36 -05:00
Max Schmitt
4a96a75fe8
test(test-runner): add test for hiding conditional expect matchers (#10703) 2021-12-03 14:55:16 -08:00
Max Schmitt
cd22072685
chore: enable object-curly-spacing in ESLint (#9168) 2021-09-27 18:58:08 +02:00
Joel Einbinder
0cf9cf0829
fix(test-runner): set expand: false for expect. (#7722) 2021-07-19 11:59:53 -05:00
Max Schmitt
a3a9ccad6f
fix(test-runner): do not require esModuleInterop=true (#7100) 2021-06-14 21:58:10 +02:00
Dmitry Gozman
8c13f679b7
fix(test runner): remove folio/jest namespaces in expect matchers (#6930) 2021-06-07 08:02:01 -07:00
Dmitry Gozman
46a0213769
chore: remove internal uses of "folio" (#6931)
Replaced by "pwt" or "playwright test".
2021-06-06 22:07:07 -07:00
Dmitry Gozman
f745bf1fbc
chore: bring in folio source (#6923)
- Source now lives at `src/test`.
- Former folio tests live at `tests/playwright-test`.
- We use `src/test/internal.ts` that exposes base test without
  Playwright fixtures for most tests (to avoid modifications for now).
- Test types live in `types/testFoo.d.ts`.
- Stable test runner is installed to `tests/config/test-runner` during `npm install`.
- All deps including test-only are now listed in `package.json`.
  Non-test deps must also be listed in `build_package.js` to get included.
2021-06-06 17:09:53 -07:00