Commit graph

872 commits

Author SHA1 Message Date
Pavel Feldman a08a41f6c9
chore: render annotations in html report (#10774) 2021-12-07 18:35:06 -08:00
Pavel Feldman feb4c62da1
fix(html): html reporter fixes (#10770) 2021-12-07 16:47:47 -08:00
Mateusz Burzyński 55fb53ef82
test(keyboard): add tests for click events being dispatched when Space/Enter gets pressed while focus is on a button (#10748) 2021-12-07 14:48:27 -08:00
Pavel Feldman c9220801e7
feat(cli): add locator methods to the cli api (#10746) 2021-12-07 12:32:11 -08:00
Andrey Lushnikov a89fe3ec5c
fix: support shadow DOM with Vue and React selectors (#10742)
There were two issues:
- we did not find VDom roots inside shadow DOM
- we incorrectly relied on DOM's `contain` method to determine if
  VDom's rendered node belongs to requested scope.

Fixes #10123
2021-12-07 11:23:37 -08:00
Dmitry Gozman ec74fa6a76
feat(fill): support color and range input types (#10736) 2021-12-06 15:43:10 -08:00
Dmitry Gozman 516360be5f
fix(waitForEvent): include timeout value in the timeout message (#10738) 2021-12-06 15:42:57 -08:00
Pavel Feldman 7765131a14
feat(acceptDownload): revert acceptDownload (#10709) 2021-12-06 09:25:24 -08:00
Pavel Feldman 518d67add5
feat(test.info): expose information on the currently running test (#10708) 2021-12-06 09:25:11 -08:00
Max Schmitt 4a96a75fe8
test(test-runner): add test for hiding conditional expect matchers (#10703) 2021-12-03 14:55:16 -08:00
Pavel Feldman aef0444ff5
fix(focus): make sure strictness is respected (#10685) 2021-12-03 10:22:50 -08:00
Pavel Feldman f583f1604c
feat(locator.withText): allow narrowing locators to those with text (#10688) 2021-12-03 09:27:06 -08:00
Yury Semikhatsky 8afd0b7d6a
feat(tracing): trace context APIRequest calls (#10684) 2021-12-02 15:53:47 -08:00
Pavel Feldman 5bde171657
fix(chromium): disable AutoExpandDetailsElement as it breaks the web (#10679) 2021-12-02 13:04:15 -08:00
Dmitry Gozman de6af16744
test: add reporter test with grep (#10678) 2021-12-02 11:07:45 -08:00
Pavel Feldman 31e0a63fcd
feat(toBeChecked): allow passing checked: false (#10665) 2021-12-02 10:31:26 -08:00
Pavel Feldman 2ac9c08d0c
feat(inputValue): allow on labels, retarget (#10666) 2021-12-02 10:31:06 -08:00
Dmitry Gozman 15b92e3f62
test: disable flaky test on wk/ff (#10662)
This is a Chromium-specific test, skip it on wk/ff.
2021-12-02 07:44:13 -08:00
Dmitry Gozman 045cf1a56e
test: add a test for clicking on material ui select (#10652) 2021-12-01 15:14:28 -08:00
Dmitry Gozman 6e00af3b2e
fix(click): revert layout shift logic (#10653) 2021-12-01 12:54:20 -08:00
Pavel Feldman 127dacf5d4
fix(toHaveText): normalize zero width white space (#10623) 2021-12-01 09:21:21 -08:00
Yury Semikhatsky d66b7aab3b
feat(expext): toBeOK for APIResponse (#10596) 2021-11-30 18:12:19 -08:00
Dmitry Gozman 729da65eba
fix(test runner): allow multiple missing snapshots per test (#10621)
Instead of failing right away, continue test execution but mark
the test as failed.
2021-11-30 17:50:19 -08:00
Pavel Feldman 11cbdcf58a
fix(tracing): fix tracing + debugger test (#10619) 2021-11-30 17:32:29 -08:00
Henric Trotzig 1bfc473bc8
chore(chromium): Capture off-screen content without resizing viewport (#10606) 2021-11-30 14:11:15 -08:00
Max Schmitt e7f1fd5c56
chore: escape CSS selectors in codegen correctly (#10608) 2021-11-30 21:13:41 +01:00
github-actions[bot] c9881a28f1
feat(firefox): roll to r1307 (#10605)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Max Schmitt <max@schmitt.mx>
2021-11-30 14:26:26 +01:00
Max Schmitt 90e7a45211
test: add test for time/timeLog/timeEnd formatting (#10586) 2021-11-29 17:18:20 -08:00
Pavel Feldman 3997671ab7
fix(selectors): do not hide selector errors (#10595) 2021-11-29 17:13:24 -08:00
Max Schmitt e6ef3e3680
test: add console.info/debug tests (#10577) 2021-11-29 22:20:46 +01:00
Joel Einbinder 15053d9b3b
fix(test-runner): apply default options to all browserTypes (#10507) 2021-11-29 12:21:15 -05:00
Max Schmitt 63abf0950b
test: using custom baseURL with webServer (#10539) 2021-11-29 17:41:26 +01:00
Joel Einbinder 20c0facfb9
fix(test runner): dont mangle test names with multiple dashes (#10447) 2021-11-24 19:36:38 -05:00
Pavel Feldman 5d19f16601
feat(esm): introduce experimental PW_EXPERIMENTAL_TS_ESM option (#10519) 2021-11-24 14:17:01 -08:00
Pavel Feldman 7eb3f76f49
feat(esm): allow running tests in type module projects (#10503) 2021-11-24 12:42:48 -08:00
Pavel Feldman 206a877cea
fix(trace-viewer): multiple iframe and UX fixes (#10486) 2021-11-23 11:36:18 -08:00
Ross Wollman 854f321532
feat(api): add explicit async testInfo.attach (#10121)
feat(api): add explicit async testInfo.attach

We add an explicit async API for attaching file paths (and Buffers) to
tests that can be awaited to help users ensure they are attaching files
that actually exist at both the time of the invocation and later when
reporters (like the HTML Reporter) run and package up test artifacts.

This is intended to help surface attachment issues as soon as possible
so you aren't silently left with a missing attachment
minutes/days/months later when you go to debug a suddenly breaking test
expecting an attachment to be there.

NB: The current implemntation incurs an extra file copy compared to
manipulating the raw attachments array. If users encounter performance
issues because of this, we can consider an option parameter that uses
rename under the hood instead of copy. However, that would need to be
used with care if the file were to be accessed later in the test.
2021-11-23 09:30:53 -08:00
Joel Einbinder 9c1ff08186
test(chromium): ensure that arguments can be passed with spaces (#10057) 2021-11-23 02:59:56 -05:00
Joel Einbinder 0878548238
test(wheel): add test for scrolling while emulating mobile (#10224) 2021-11-23 02:59:32 -05:00
Joel Einbinder 6d3bb458f9
fix(firefox): round down mouse coordinates (#10483) 2021-11-23 02:55:32 -05:00
Joel Einbinder d70e37de80
feat: locator.dragTo (#10287) 2021-11-22 20:27:26 +01:00
Joel Einbinder 06ab3c0fda
feat: consider fieldset and aria-disabled when checking if an element is enabled (#9927)
Co-authored-by: Max Schmitt <max@schmitt.mx>
2021-11-22 20:25:06 +01:00
Dmitry Gozman 0302e759df
feat(test runner): allow top-level test.fixme similar to test.skip (#10250)
```js
test.fixme('my test name', () => {});
```
2021-11-19 11:40:40 -08:00
github-actions[bot] e76edef3e2
feat(webkit): roll to r1579 (#10409)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Max Schmitt <max@schmitt.mx>
2021-11-19 11:11:27 +01:00
Pavel Feldman b302152789
chore(zones): prepare to remove wrapApiCall, introduce zones (#10427) 2021-11-18 22:30:09 -08:00
Dmitry Gozman d9f849fb14
feat(test runner): replace declare/define with "options" (#10293)
1. Fixtures defined in test.extend() can now have `{ option: true }` configuration that makes them overridable in the config. Options support all other properties of fixtures - value/function, scope, auto.
```
const test = base.extend<MyOptions>({
  foo: ['default', { option: true }],
});
```

2. test.declare() and project.define are removed.

3. project.use applies overrides to default option values and nothing else. Any test.extend() and test.use() calls take priority over config options.

Required user changes: if someone used to define fixture options with test.extend(), overriding them in config will stop working. The solution is to add `{ option: true }`.

```
// Old code
export const test = base.extend<{ myOption: number, myFixture: number }>({
  myOption: 123,
  myFixture: ({ myOption }, use) => use(2 * myOption),
});

// New code
export const test = base.extend<{ myOption: number, myFixture: number }>({
  myOption: [123, { option: true }],
  myFixture: ({ myOption }, use) => use(2 * myOption),
});
```
2021-11-18 15:45:52 -08:00
Dmitry Gozman c470080aec
test: move grid tests to installation-tests (#10418)
- Determine the actual chrome version.
- Download chromedriver.
- Run tests.
2021-11-18 15:32:09 -08:00
Dmitry Gozman 8f43f4c98f
feat(serial): better errors from beforeAll (#10419)
When beforeAll hook times out or fails with an exception, we now
close the context and show a nice error.
2021-11-18 14:36:55 -08:00
Dmitry Gozman 04dc935265
test: do not print output from child processes in skipped tests (#10422) 2021-11-18 14:35:51 -08:00
github-actions[bot] 24cc266de0
feat(chromium): roll to r941965 (#10372)
Co-authored-by: Max Schmitt <max@schmitt.mx>
2021-11-18 18:46:44 +01:00
Dmitry Gozman bd93fc499f
fix(html reporter): show missing attachments as warnings (#10400) 2021-11-17 18:03:13 -08:00
Dmitry Gozman ce2c0c59a7
feat(expect): show expect timeout in the error message (#10388)
Makes it easier to understand that expect does indeed have a separate timeout.

```
    Error: expect(received).toHaveCount(expected) // deep equality

    Expected: 0
    Received: 1

    Call log:
      - expect.toHaveCount with timeout 500ms
      - waiting for selector "span"
      -   selector resolved to 1 element
      -   unexpected value "1"
      -   selector resolved to 1 element
      -   unexpected value "1"
      -   selector resolved to 1 element
      -   unexpected value "1"
```
2021-11-17 17:28:30 -08:00
Andrey Lushnikov dc89738233
test: bump expect timeout (#10384)
This should make trace viewer tests less flaky.

References #10383
2021-11-17 11:56:24 -08:00
Yury Semikhatsky 08a7470b0a
fix: API response to string (#10364) 2021-11-16 15:42:35 -08:00
Yury Semikhatsky c5cb73003f
docs: OR for css and xpath selectors (#10285) 2021-11-15 13:54:12 -08:00
Dmitry Gozman 638ebd6dd6
fix(test runner): do not validate fixtures in tests/hooks that are never run (#10328) 2021-11-15 13:17:26 -08:00
Pavel Feldman 1c9c0dc2e6
feat(webkit): roll to r1578 (#10323) 2021-11-15 08:43:51 -08:00
Andrey Lushnikov faf9d901c1
chore: fix test to work on Windows with auto.crlf = false (#10296) 2021-11-13 00:29:51 -08:00
Dmitry Gozman 6a46711347
fix(chromium): race between loadingFailed and requestPaused (#10289) 2021-11-12 19:06:53 -08:00
Dmitry Gozman 4bb123d4b7
fix(test runner): route more errors to reporter (#10263)
For example, top-level errors in files or global setup issues.
2021-11-12 06:47:41 -08:00
Andrey Lushnikov 80da0f7b69
test: test gardening (#10258) 2021-11-12 00:00:13 -08:00
Dmitry Gozman 7eec66d0f9
chore(test runner): route runner errors through Reporter.onError (#10257) 2021-11-11 16:48:08 -08:00
Dmitry Gozman f38f611478
chore: add npm run lint-tests (#10252) 2021-11-11 13:27:50 -08:00
Dmitry Gozman 4c93417e8a
fix(github reporter): handle global onError (#10256) 2021-11-11 13:25:38 -08:00
Yury Semikhatsky fbb3c88f3c
fix(fetch): smarter JSON.stringify for application/json requests (#10245) 2021-11-11 11:12:24 -08:00
Max Schmitt 3a64da7a54
fix: do not show taskkill.exe output (#10244) 2021-11-11 18:32:22 +01:00
Max Schmitt ac629afd46
chore: fix API name capitalisation with APIRequestContext (#10240) 2021-11-11 08:46:17 -08:00
Dmitry Gozman 9622704a8a
fix(test runner): update TestInfo.duration before running afterEach hooks (#10228) 2021-11-10 16:02:27 -08:00
Dmitry Gozman 9ec3e7cd52
fix(click): account for detached elements and iframe overlays (#10206) 2021-11-10 12:14:06 -08:00
Pavel Feldman 03fee2f593
feat(trace-viewer): add metainfo tab (#10205) 2021-11-09 22:13:51 -08:00
Pavel Feldman 0d0f1690cd
fix(trace-viewer): do not rely upon request mode, it is inconsistent (#10198) 2021-11-09 15:12:37 -08:00
Dmitry Gozman 75efeb1e08
fix: resolve ip using grid/api/testsession endpoint (#10196)
For Selenium 4, we use se:cdp ws proxy, pointing it to the hub url.
For Selenium 3, we use grid api to try and get the target node ip.
2021-11-09 14:41:13 -08:00
Pavel Feldman 4e90eb9406
api(frame-locator): allow nth, first, last (#10195) 2021-11-09 14:14:20 -08:00
Max Schmitt d25b0f70bc
chore: api testing test nits (#10180) 2021-11-09 14:11:42 -08:00
Andrey Lushnikov cce359ea83
test: fix fixture teardown (#10174) 2021-11-09 11:12:18 -08:00
github-actions[bot] 5b604acedb
feat(chromium): roll to r939194 (#10165)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Andrey Lushnikov <aslushnikov@gmail.com>
2021-11-08 20:05:39 -08:00
Pavel Feldman 806b5706a5
fix(trace-viewer): redirect, time and missing snapshot bugfixes (#10055) 2021-11-08 18:03:10 -08:00
Pavel Feldman 7b64161a37
feat(test-runner): allow specifying fine-grained trace options (#10147) 2021-11-08 15:39:58 -08:00
Dmitry Gozman 3cc839e013
fix(route): catch all Route methods when page closes (#10140)
This fixes a common scenario where you setup a route,
and the page closes (e.g. test ends) while we are aborting/continuing
some requests that are not instrumental to the test itself.
2021-11-08 15:13:15 -08:00
Joel Einbinder 0cad0de3e3
fix(test runner): better error message when importing typescript from esmodule (#10061) 2021-11-08 16:25:40 -05:00
Dmitry Gozman 0a104bc500
docs: clarify that slow tests are about files (#10134) 2021-11-08 12:54:18 -08:00
Pavel Feldman 4553d76fce
api(frame-locator): introduce frame locators (#10102) 2021-11-08 09:58:24 -08:00
Andrey Lushnikov 51a7567907
codegen: use import instead of require for codegen tests (#10104) 2021-11-05 19:01:54 -07:00
Dmitry Gozman 61ff52704c
feat(input): perform hit target check during input (#9546)
This replaces previous `checkHitTarget` heuristic that took place before the action
with a new `setupHitTargetInterceptor` that works during the action:
- Before the action we set up capturing listeners on the window.
- During the action we ensure that event target is the element we expect to interact with.
- After the action we clear the listeners.

This should catch the "layout shift" issues where things move
between action point calculation and the actual action.

Possible issues:
- **Risk:** `{ trial: true }` might dispatch move events like `mousemove` or `pointerout`,
because we do actually move the mouse but prevent all other events.
- **Timing**: The timing of "hit target check" has moved, so this may affect different web pages
in different ways, for example expose more races. In this case, we should retry the click as before.
- **No risk**: There is still a possibility of mis-targeting with iframes shifting around,
because we only intercept in the target frame. This behavior does not change.

There is an opt-out environment variable PLAYWRIGHT_NO_LAYOUT_SHIFT_CHECK that reverts to previous behavior.
2021-11-05 17:31:28 -07:00
Yury Semikhatsky 15a8b29961
test: goto finishes on window.stop() (#10070) 2021-11-05 16:51:22 -07:00
Pavel Feldman f3fd3ebc37
chore(frame-selector): add more tests, use frame logic in element handle (#10097) 2021-11-05 16:36:01 -07:00
Andrey Lushnikov fd2bbe0c1a
tests: disable video tests on Firefox + Tracing (#10096) 2021-11-05 15:15:46 -07:00
Max Schmitt 9dbf225afc
test: fix connectOverCDP with proxy on Windows (#10092) 2021-11-05 19:49:39 +01:00
Pavel Feldman f19864890f
feat(iframe): make iframe selectors work w/ element handles (#10063) 2021-11-05 11:06:04 -07:00
Max Schmitt 84d2ee3929
chore: fix connectOverCDP on Windows when proxy is used (#10080) 2021-11-05 17:38:13 +01:00
Dmitry Gozman 3c1aaa5338
fix(trace): do not call tracing.stopChunk() twice (#10054) 2021-11-04 21:08:42 -07:00
Yury Semikhatsky 83657a1df4
test: skip interception tests in electron (#10056) 2021-11-04 13:36:04 -07:00
Pavel Feldman 78e99249a3
feat(frame-selector): intial implementation (#10018) 2021-11-04 13:28:35 -07:00
github-actions[bot] 9b4d9460eb
feat(chromium): roll to r936784 (#9986) 2021-11-04 12:35:31 -07:00
Dmitry Gozman 2cfc997614
test: detach frame while clicking race (#10029) 2021-11-03 19:41:31 -07:00
Andrey Lushnikov 1a577ac344
chore: introduce docker integration dogfood (#9998)
This patch:
- rolls stable-test-runner to Nov 2, 2021 tip-of-tree
- introduces a new npm script, `npm run vtest`, to run Visual Regression
  Tests for our HTML reporter
2021-11-03 15:26:18 -07:00
Yury Semikhatsky bce9a8187d
fix(fetch): post data for delete request (#10019) 2021-11-03 13:26:15 -07:00
Dmitry Gozman 3120f81629
fix(reporters): move Running X tests using Y workers to reporters (#10014) 2021-11-03 11:17:23 -07:00
Dmitry Gozman c373986ca0
fix(evaluate): reject all context operations when frame detaches (#9987) 2021-11-03 10:44:50 -07:00
Dmitry Gozman 9cebe60831
feat(reporters): augment non-stdio reporters with dot/line (#10003) 2021-11-03 08:25:16 -07:00