Commit Graph

1365 Commits

Author SHA1 Message Date
Pavel Feldman
34adc28ed3
feat(pause): make page.pause public (#5288) 2021-02-03 16:01:51 -08:00
Dmitry Gozman
d8e0834562
fix(server): use setMaxListeners(0) on all internal event emitters (#5283) 2021-02-03 13:53:09 -08:00
Pavel Feldman
3d253c4e5c
feat: auto-detect expression/function in js server (#5284) 2021-02-03 13:49:25 -08:00
Dmitry Gozman
fa1cf4108b
fix(codegen): do not show recorder controls in iframes (#5282) 2021-02-03 13:42:29 -08:00
Dmitry Gozman
53ed35ef96
feat(dialogs): auto-dismiss dialogs when there are no listeners (#5269)
This makes dialogs disappear and prevents stalling.

Pros:
- No need to worry about dialogs for most users.
- Those that wait for a specific dialog still get to control it.

Cons:
- Those who use Playwright to show interactive browser will have
  to add an empty 'dialog' handler to prevent auto-dismiss.
  We do this in cli.
2021-02-03 10:34:45 -08:00
Andrey Lushnikov
cb1b64289c
devops: downloading ffmpeg during install step (#5249)
This patch starts downloading FFMPEG like we download our browsers
instead of bundling it in the NPM package.

With this patch, NPM size is reduced from 8.8MB to 1.7MB.

Consequences:
- `npx playwright` is drastically faster now
- playwright driver for language bindings is way smaller
- projects that bundle Playwright can pass Apple Notorization

Fixes #5193
2021-02-03 09:19:11 -08:00
Dmitry Gozman
4cad34509f
fix(oopifs): do not emulate focus in oopifs (#5270)
- We don't need this, since it should propagate from the main frame.
- Forcing focus in oopif immediately focuses it and blurs currently
  focused frame. This leads to undesired side effects, e.g. selects
  being closed.
2021-02-03 08:47:52 -08:00
Dmitry Gozman
1a464c732c
feat(video): switch vp8 in ffmpeg to realtime (#5260)
This switches vp8 to "realtime" mode that works fast, adapting to
the speed of incoming frames, and produces the best quality in can
given realtime constraints.

In practice, this gives 2x larger video files but no noticible quality
difference. It also eliminates huge delays for encoding the video.

Drive-by: document our ffmpeg option choices and add some links
to documentation for future use.
2021-02-02 17:14:39 -08:00
Pavel Feldman
8a8d8ea370
fix: update terminal size dynamically (#5250) 2021-02-02 14:25:51 -08:00
Dmitry Gozman
6c12f58058
feat(selectors): always make xpath relative (#5252)
This makes `/foo` and `//foo` match starting with the scope,
not the document, by turning them into `./foo` and `.//foo`.
2021-02-02 13:27:16 -08:00
Dmitry Gozman
9e09bd369d
fix(oopifs): ignore target closure when broadcasting across oopifs (#5246) 2021-02-02 10:21:42 -08:00
Dominik Deren
8c65871b25
fix(trace viewer): Bringing back the ability to display images in Network Tab in Trace Viewer. (#5232)
This fix restores the ability to display images in the Network Tab inside Trace Viewer. Previously data returned from the server was coming back as base64 encoded string, but now it is returned as a Buffer object. This required convertion to either base64 encoded string or utf8 encoded string on the frontend.

Co-authored-by: Dominik Deren <dominik.deren@live.com>
2021-02-01 22:56:53 -08:00
Andrey Lushnikov
276bbca3d1
fix: retry browser launch if it failed due to glibc error (#5247)
Fixes #5214
2021-02-01 15:23:57 -08:00
Pavel Feldman
1db5ef24a8
docs: document electron api (#5229) 2021-02-01 11:43:26 -08:00
Andrey Lushnikov
08e2b5b825
fix(installer): retry installer when hitting ETIMEDOUT as well (#5239)
Fixes #5233
2021-02-01 09:30:22 -08:00
Dmitry Gozman
a9de3d8fd2
feat(snapshots): switch MutationObserver to only observer attributes (#5220)
Everything but attributes in the light dom is manually compared during
DOM traversal, for example child nodes or scroll offset.

This way we get a bullet-proof solution that works with input values,
scroll offsets, shadow dom and anything else web comes up with.

We also restore scroll only on the document scrolling element, for
performance reasons. We should figure out the story around scrolling.

Changes stationary snapshots from ~0.5ms to ~2.5ms due to DOM traversal.
2021-01-31 19:20:20 -08:00
Pavel Feldman
bf8c30a88b
feat(ui): extract recorder sidebar into a window (#5223) 2021-01-31 16:37:13 -08:00
Pavel Feldman
975519150e
chore: centralize playwright creation, bind context listeners to instance (#5217) 2021-01-29 16:00:56 -08:00
Dmitry Gozman
7fe7d0ef32
feat(snapshots): make cssom overrides efficient (#5218)
- Intercept CSSOM modifications and recalculate overridden css text.
- When css text does not change, use "backwards reference" similar
  to node references.
- Set 'Cache-Control: no-cache' for resources that could be overridden.
2021-01-29 15:24:38 -08:00
Dmitry Gozman
69ca30834e
feat(snapshots): incremental snapshots (#5213)
- Switch from html to json ml format.
- Allow node reuse between snapshots with `[nSnapshotsBefore, nodeWithIndexM]`.
- Service worker now lazily serializes snapshot chunks into a single html.

This decreases total snapshot size on random scripts ~10x.
This also decreases snapshot collecting time on mostly static pages to ~0.3ms.

Unfortunate downside for now is that we have to intercept
`Element.prototype.attachShadow` to invalidate nodes. This
also temporary breaks scroll restoration. Needs more research.
2021-01-29 06:57:57 -08:00
Dmitry Gozman
5e934d0fbd
chore(trace viewer): split SnapshotServer (#5210)
- Move service worker under /snapshot/ instead of /.
- Fix stylesheet base uri bug, where we inherited the wrong base url.
- Introduce TraceServer and routes there, split the actual routes
  between snapshot, ui and action previews.
2021-01-28 15:09:20 -08:00
Pavel Feldman
79e00e4911
feat(ui): more recorder uis (#5208) 2021-01-28 14:25:10 -08:00
Dominik Deren
f8fbfe28fa
feat(trace viewer): Adds _debugName BrowserContextOption to let users define a name for their contexts (#5205)
This change is adding a new property on the BrowserContextOptions class called `_debugName`. This property allows defining a user-friendly name for the browser context, and currently it is being used in one place, the Trace Viewer. When user provides the new value in the following way:

```typescript
const { chromium } = require('playwright');

(async () => {
  const browser = await chromium.launch();
  const context = await browser.newContext({ _traceDir: __dirname, _debugName: 'My custom testcase name' });
  await context.close();
  await browser.close();
})();
```

The `_debugName` will be saved in the `*.trace` file for this browser context, on the `context-created` event, under the key `debugName`.

Later, when such a trace is displayed using Trace Viewer, the `debugName` will be displayed in the dropdown in the top right part of the app instead of the actual trace filename.

Fixes #5157.
2021-01-28 10:50:57 -08:00
Pavel Feldman
8d8fa4c322
chore: move trace viewer to the src/web (#5199) 2021-01-28 09:33:20 -08:00
Andrey Lushnikov
fe1302b47d
feat(installer): retry download if connection is interrupted (#5126)
Fixes #5110
2021-01-28 00:37:42 -08:00
Andrey Lushnikov
d1a2c87e88
chore: remove backward compatibility code from installer (#5168)
Installer has a code to download browsers from the old version of
playwright. This, however, is never needed, since installer only
installs browsers from its own version.
2021-01-27 22:32:25 -08:00
Dmitry Gozman
ce43e730f4
feat(traceviewer): use http server instead of interception (#5195)
This introduces an http server that serves our frontend and our snapshots. There is more work to untangle the big server into a few modules.

This change allows us:
- Maybe eventually serve the trace viewer as a web page.
- Rely on browser caches for fast snapshot rendering. This PR also adds "snapshot on hover" feature, subject to change.
2021-01-27 19:42:51 -08:00
Dmitry Gozman
e915e51ea9
chore: fix bad merge in codeGenerator.ts (#5196) 2021-01-27 17:45:27 -08:00
Dmitry Gozman
2793d14409
fix(codegen): do not forget to reset currentAction in didPerformAction (#5194) 2021-01-27 17:05:56 -08:00
Pavel Feldman
e50f11c5b1
feat(ui): more recorder uis (#5187) 2021-01-27 17:02:09 -08:00
Dmitry Gozman
321a873d8a
fix(codegen): add timeout to our actions, catch errors (#5188) 2021-01-27 15:57:28 -08:00
Pavel Feldman
ff6b2b1dd4
chore: make emulate media params be options (#5172) 2021-01-27 14:19:37 -08:00
Dmitry Gozman
527286683f
feat(codegen): prefer frame name over url when unique (#5175) 2021-01-27 13:19:36 -08:00
Dmitry Gozman
0108d2d41f
feat(snapshots): various improvements (#5152)
- Adopt "declarative shadow dom" format for shadow dom snapshots.
- Restore scroll positions.
- Render snapshot at arbitrary timestamp.
2021-01-26 15:09:17 -08:00
Dominik Deren
a3af0829ff
feat(trace viewer): Extending existing NetworkTab view (#5009)
feat(trace viewer): Extending existing NetworkTab view

Currently the network tab contains a limited amount of information on the resources that were loaded in the browser. This change proposes extending the details displayed for each resource, to include:

- HTTP method,
- Full url,
- Easily visible response content type,
- Request headers,
- Request & response bodies.

Such level of information could help quickly understand what happened in the application, when it was communicating with backend services. This can help debug tests quicker to figure out why they are failing.

This implementation still needs some clean up & tests improvement, but I wanted to propose such changes and gather your feedback before going too far.
2021-01-26 11:06:05 -08:00
Yury Semikhatsky
f3cc4dfe6d
feat(webkit): bump to 1428 (#5140) 2021-01-26 09:42:06 -08:00
Pavel Feldman
45f7d73470
chore: plumb terminal size and port language (#5149) 2021-01-25 19:01:04 -08:00
Dmitry Gozman
5033261d27
feat(trace): streaming snapshots (#5133)
- Instead of capturing snapshots on demand, we now stream them
  from each frame every 100ms.
- Certain actions can also force snapshots at particular moment using
  "checkpoints".
- Trace viewer is able to show the page snapshot at a particular
  timestamp, or using a "checkpoint" snapshot.
- Small optimization to not process stylesheets if CSSOM was not used.
  There still is a lot of room for improvement.
2021-01-25 18:44:46 -08:00
Pavel Feldman
87a3ccc49e
fix: do not return cookies with empty values (#5147) 2021-01-25 16:37:33 -08:00
Pavel Feldman
2e290be40b
chore: remove source maps in pwdebug mode (#5148) 2021-01-25 16:36:57 -08:00
Pavel Feldman
fdde9493ea
fix: don't parse potentially invalid urls in event handlers (#5090) 2021-01-25 14:49:51 -08:00
Pavel Feldman
01d6f83597
chore: introduce debug toolbar (#5145) 2021-01-25 14:49:26 -08:00
Dmitry Gozman
894abbfe28
feat(selectors): has-text pseudo-class (#5120)
This pseudo-class matches approximately when
`element.textContent.includes(textToSearchFor)`.
2021-01-25 14:19:07 -08:00
Dmitry Gozman
d78d337e29
feat(fill): make fill work when targeting elements inside the label (#5143) 2021-01-25 13:40:19 -08:00
Dmitry Gozman
beed9a79a3
feat(chromium): bump to 845618 (#5138) 2021-01-25 07:45:21 -08:00
Pavel Feldman
464fdc1800
chore: make recorder a supplement (#5131) 2021-01-24 19:21:19 -08:00
Pavel Feldman
be9bef513e
chore: move recorder to server side (#5128) 2021-01-24 08:44:11 -08:00
Joel Einbinder
3e4e511d84
feat(pause): page._pause to wait for user to click resume (#5050) 2021-01-22 18:47:02 -08:00
Andrey Lushnikov
74816e4000
fix(installer): release lock if things go south (#5125)
References #5110
2021-01-23 04:27:33 +03:00
Dmitry Gozman
3e1c72ac5f
fix(reload): do not throw when reload is racing with navigation (#5113)
When `page.reload()` is racing against the renderer-initiated
navigation, we might end up with `waitForNavigation()` being rejected
before the reload implementation is able to catch it.

To avoid that, carefully use Promise.all and await `waitForNavigation`
from the get go.

Same happens to `page.goForward()` and `page.goBack()`.
2021-01-22 15:58:53 -08:00