Commit graph

1540 commits

Author SHA1 Message Date
Pavel Feldman d3eff50386
feat(java): implement codegen (#5692) 2021-03-03 14:32:09 -08:00
Dmitry Gozman d87522f2e6
fix(text selector): revert quoted match to match by text nodes only (#5690) 2021-03-03 10:51:10 -08:00
Dmitry Gozman e4d33f56f4
fix(click): do not retarget from label to control when clicking (#5683)
And in other carefully considered cases.
2021-03-02 17:29:03 -08:00
Dmitry Gozman ff243f1af5
fix(addInitScript): make it work on new pages without navigations (#5675) 2021-03-02 16:03:48 -08:00
Andrey Lushnikov 850e3c5aa3
test: add debugging output for downloads tests (#5673) 2021-03-01 17:52:45 -08:00
Pavel Feldman b253ee80c0
chore(snapshot): brush up, start adding tests (#5646) 2021-03-01 12:20:04 -08:00
Pavel Feldman eb980207fc
test: add a test for 2 cdp sessions against the browser (#5655) 2021-03-01 11:05:02 -08:00
Pavel Feldman aeb2b2f605
feat(inspector): wire snapshots to inspector (#5628) 2021-02-26 14:16:32 -08:00
Pavel Feldman 992f808210
chore(snapshot): implement in-memory snapshot (#5624) 2021-02-25 13:09:26 -08:00
Dmitry Gozman 0102e080f6
fix(text selector): make quoted selector match by text nodes (#5603)
This change turns quoted match to be case-sensitive (as before),
but not strictly full-string for the whole element's text.

This is a fix for a case where element contains text nodes and child elements:
```html
<div>text1<span>child node</span>text2</div>
```
We now match this div by `text="text1"` and `text="text2"`.
2021-02-24 16:32:38 -08:00
Pavel Feldman 8906ba332c
chore: spell overridden (#5605) 2021-02-24 15:11:34 -08:00
Pavel Feldman f71bf9a42a
chore: move trace viewer into server (#5597) 2021-02-24 13:39:51 -08:00
Darío Kondratiuk b07dba8075
test: improve test names (#5511)
We have a few tests with duplicated names and some describes with bad names
2021-02-24 13:28:22 -08:00
Max Schmitt 070cfdcdb8
fix(inspector): skip stack trace playwright/src lines only under tests (#5594) 2021-02-24 11:34:48 -08:00
Pavel Feldman 48c237b3cf
chore: move trace to server (#5565) 2021-02-23 22:08:14 -08:00
Joel Einbinder 841264c94d
fix(test): disable failing drag and drop test on mac and windows (#5575) 2021-02-23 20:28:39 -08:00
Dmitry Gozman 1dc7fb1f3f
test: add more tests for Set-Cookie in fulfill (#5570) 2021-02-23 19:14:37 -08:00
Joel Einbinder e3cd52d0df
test(drag): enable drag tests everywhere but chromium (#5553) 2021-02-23 17:03:28 -08:00
Joel Einbinder dc3fd3f6b3
test(drag): test for dropEffect (#5559) 2021-02-23 16:25:06 -08:00
Joel Einbinder 8ef6cb731e
feat(codegen): use the name attribute for more elements (#5376) 2021-02-23 16:24:45 -08:00
Joel Einbinder 74ae013d58
test(webkit); enable test to scroll twice (#5550) 2021-02-22 15:18:15 -08:00
Dmitry Gozman b42c3690d3
fix(codegen): replace html lib with createElement (#5531)
We are not using html that much, since most of our UI moved
to the Recorder App. Getting rid of `innerHTML` assignment
fixes the TrustedTypes issue.
2021-02-22 11:38:49 -08:00
Andrey Lushnikov 6e61cde06e
test: add test to make sure that 'download' attr is respected (#5538)
References #5537
Fixes #5396
2021-02-22 09:02:50 -08:00
Pavel Feldman 6ec77dca9d
fix(inspector): fix the wait for event error rendering (#5517) 2021-02-20 14:36:19 -08:00
Pavel Feldman 600f731a67
feat(inspector): render api names from metainfo (#5530) 2021-02-19 18:12:33 -08:00
Andrey Lushnikov 57c7a703ca
test: mark test as "fixme" on chromium (#5524)
References #5523
2021-02-19 13:50:34 -08:00
Zev Isert cbcc609fa1
fix: return non-secure cookies with HTTPS URLs (#5507)
Cookies have a "Secure" attribute which tells the browsers
that a given cookie should only be sent via HTTPS. In it's
absense "Secure" is falsy and these cookies should be sent
with both HTTP and HTTPS requests. Playwright now returns
only the "Non-Secure" cookies for HTTP URLs, and both
"Secure" and "Non-Secure" cookies for HTTPS URLs.

Fixes #5504
2021-02-19 11:50:59 -08:00
Andrey Lushnikov a9c91b0703
test: fix test sanitization (#5515)
This was regressed in https://github.com/microsoft/playwright/pull/5502

Three pause tests are broken: https://devops.aslushnikov.com/flakiness2.html#timestamp=1613756319661
2021-02-19 10:54:05 -08:00
Pavel Feldman bb2b29631a
feat(inspector): pause on page/context close (#5319) 2021-02-19 09:33:24 -08:00
Joel Einbinder a9faa9c941
test(webkit): add new scrolling tests to ensure correct webkit behavior (#5496) 2021-02-18 13:29:56 -08:00
Pavel Feldman 15833ee039
feat(inspector): render params and durations in log (#5489) 2021-02-17 22:10:13 -08:00
Pavel Feldman 3248c2449c
feat(inspector): collapse completed items (#5484) 2021-02-17 17:28:02 -08:00
Dmitry Gozman dc51536bca
feat(waitForResponse): print regex pattern when waiting for request/response (#5485) 2021-02-17 15:11:23 -08:00
Pavel Feldman b2227c1bcf
feat(inspector): allow selecting file (#5483) 2021-02-17 14:05:41 -08:00
Pavel Feldman 30e68f6d1f
chore: simplify code generation (#5466) 2021-02-16 18:13:26 -08:00
Andrey Lushnikov b6bd7c0d6a
feat(chromium): roll Chromium to r851527 (#5434)
Fixes #5197
2021-02-16 14:21:47 -08:00
Andrey Lushnikov 6b40d75d03
fix: allow setting input files for detached <input> elements (#5467)
Fixes #5403
2021-02-16 10:22:46 -08:00
Andrey Lushnikov d0352cfb71
feat(firefox): roll Firefox to r1230 (#5473)
References #4987
2021-02-16 09:23:02 -08:00
Pavel Feldman 0c7da44465
test(inspector): add some tests (#5461) 2021-02-15 08:32:13 -08:00
Dmitry Gozman 1f3449c7da
fix(download): do not stall BrowserContext.close waiting for downloads (#5424)
We might not ever get the "download finished" event when closing the context:
- in Chromium, for any ongoing download;
- in all browsers, for failed downloads.

This should not prevent closing the context. Instead of waiting for the
download and then deleting it, we force delete it immediately and reject
any promises waiting for the download completion.
2021-02-14 16:46:26 -08:00
Pavel Feldman 8b9a2afd3d
feat(inspector): render errors (#5459) 2021-02-13 22:13:51 -08:00
Pavel Feldman 0782b25272
test: fix recorder downloads test (#5454) 2021-02-12 20:26:22 -08:00
Pavel Feldman 3c877374c7
feat: add replay log (#5452) 2021-02-12 18:53:46 -08:00
Pavel Feldman aef052aecc
chore: pause on input in pwdebug mode (#5427) 2021-02-12 10:11:30 -08:00
Dmitry Gozman 3e7b8e3d74
test: add basic end-to-end driver test (#5426)
- Introduce internal "out of process" start()/stop() mode.
- This mode is used both in regular tests and installation tests.
- Emulate basic driver installation, browser download and running.
2021-02-12 09:05:32 -08:00
Pavel Feldman 449adfd3ae
chore(recorder): move recording output into the gui app (#5425) 2021-02-11 17:46:54 -08:00
Dmitry Gozman 99f8e1cf63
docs: document Android and friends (#5415)
These are experimental, currently available through `_android`.
2021-02-11 10:31:57 -08:00
Joel Einbinder d8f637c239
chore(typescript): enable esModuleInterop (#5409) 2021-02-11 06:36:15 -08:00
Pavel Feldman 6576bd8b31
chore: move before/after action instrumentation into dispatcher (#5416) 2021-02-10 21:55:46 -08:00
Joel Einbinder fa8e898c3c
fix(test): missing test coverage for browserType.connectOverCDP (#5408) 2021-02-10 16:22:18 -08:00
Joel Einbinder dca70abbd3
feat(chromium): connect to a browser over cdp (#5207) 2021-02-10 14:00:02 -08:00
Yury Semikhatsky a8ebe4d888
fix(screencast): support viewport with odd dimensions (#5399) 2021-02-10 13:37:27 -08:00
Dmitry Gozman b4b14eab69
chore: refactor actionability checks (#5368) 2021-02-10 12:36:26 -08:00
Andrey Lushnikov d21d24486c
test: mark failing test as fixme (#5397)
The test has been failing since recently:
http://flaky.aslushnikov.com#commits=20&timestamp=1612958811899&filter_spec=popups+2
2021-02-10 09:04:08 -08:00
Dmitry Gozman 78ab2955f3
fix(isVisible): do not wait for the selector to be resolved (#5393) 2021-02-10 07:12:43 -08:00
Pavel Feldman 2e01fbdbec
chore: introduce instrumentation api (#5385) 2021-02-09 14:44:48 -08:00
Andrey Lushnikov 1efcf442fb
test: disable test on all bigsur (#5375)
Certain GitHub Macs got accidentally updated from 11.0 to 11.2,
which broke this test check.
2021-02-09 08:33:56 -08:00
Dmitry Gozman 0871a9cfd9
feat(codegen): improve selector generation (#5364)
- Snap to buttons, inputs, selects, etc.
- Try `<label>` selector in addition to the element.
- Use parent selectors when needed.
- Remove xpath fallback as it should be covered with css.
2021-02-08 21:53:17 -08:00
Andrey Lushnikov d499cf08d1
refactor: remove browserPaths in favor of Registry class (#5318)
This patch introduces a new Registry class that incapsulates
all logic regarding browsers and their paths.

Fixes #5278
2021-02-08 16:02:49 -08:00
Pavel Feldman b32be4b3d4
chore: expose electron types (#5362) 2021-02-08 14:39:05 -08:00
Dmitry Gozman 6d56a110ca
feat(proxy): throw when socks proxy is used with auth (#5358) 2021-02-08 12:07:45 -08:00
Yury Semikhatsky bb0af314ba
fix(video): set default size to fit into 800x800 (#5333) 2021-02-08 10:59:48 -08:00
Pavel Feldman c0610ccef4
feat(recorder): remove recorder overlay toolbar (#5334) 2021-02-05 14:24:27 -08:00
Dmitry Gozman de30ee0aa8
fix(oopifs): account for various races between processes (#5320)
Consider the following situation (one among many possible).
- FrameA has an oopif child FrameB;
- FrameA navigates to same-process origin (e.g. about:blank);
- at the same time, FrameC is attached to the FrameB in the
  FrameB's process.

In this case, we get `frameNavigated` event for FrameA, immediately
followed by `frameAttached` event for FrameC. Since we detach all
FrameA's child frames on navigation, including the oopif FrameB,
there is no parent frame for FrameC to attach to.

In general, multiple processes coming from oopif may send their
events in wildly different order, and their view about the frame
tree may not always correspond to the "up to date" frame tree as
seen from the main frame's process. We try to keep our frame tree
aligned with what main process thinks, and ignore events that
reference frames absent in this tree.

Drive-by: handle filechooser exceptions because of async processing.
2021-02-05 11:30:44 -08:00
Dmitry Gozman 0cbb2c14e6
feat(text selector): match text in child nodes (#5293)
This changes `text=` and `:text()` selectors to match the element when:
- it's combined text content matches the text;
- combined text content of any immediate child does not match the text.

This allows the following markup to match "Some bold and italics text":
`<div>Some <b>bold</b> and <i>italics</i> text</div>`.

For the reference, "combined text content" is almost equal to `element.textContent`,
but with some changes like using value of `<input type=button>` or ignoring `<head>`.

This also includes some caching optimizations, meaningful in complex matches
that involve multiple calls to the text engine.

Performance changes (measured on large page with ~25000 elements):
- `:has-text()` - 14% faster.
- `text=` - 50% faster.
- `:text()` - 0-35% slower.
- `:text-matches()` - 28% slower.
2021-02-04 17:44:55 -08:00
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
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 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
Pavel Feldman 1db5ef24a8
docs: document electron api (#5229) 2021-02-01 11:43:26 -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
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
Andrey Lushnikov 06f679b160
devops: mark another tracing test as fixme (#5201)
It was failing since a3af0829ff
2021-01-28 00:38:36 -08:00
Andrey Lushnikov 2a71165ed1
chore: disable failing tracing test (#5170)
The test constantly fails.
2021-01-27 22:31:46 -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 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 527286683f
feat(codegen): prefer frame name over url when unique (#5175) 2021-01-27 13:19:36 -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
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 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 b7fd0cd14c
test: disable trace test that always fails (#5124) 2021-01-23 04:27:16 +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
Andrey Lushnikov 8e7fc06839
chore: migrate to Folio 0.3.17 (#5115)
Folio 0.3.17 doesn't differentiate between expected and unexpected
flakiness, thus no longer supporting the "flaky" annotation.

Flaky specs are reported after run, but flaky specs do not render
test run as failed. We'll track flakiness separately via a dashboard.
2021-01-23 02:22:40 +03:00
Yury Semikhatsky a4eb121399
fix: add parameter to close/crash/disconnected etc events (#5098) 2021-01-22 09:58:31 -08:00
Dmitry Gozman 018727db8e
test: add a test for focused input screenshot (#5060)
Fails in various configurations.
2021-01-22 06:51:59 -08:00
Dmitry Gozman a9b75365eb
feat(logs): add wrapApiCall for logging to many api methods (#5093)
Some methods (quite a few!) were missing the wrapper that produces the log.
2021-01-22 06:49:59 -08:00
Dmitry Gozman 7a4b94e66c
feat(selectors): nth-match selector (#5081)
Introduces :nth-match(ul > li, 3) css extension, with one-based index.
2021-01-21 16:39:49 -08:00
Pavel Feldman 4b5c876bbf
chore: allow opening empty trace viewer (#5080) 2021-01-20 19:16:23 -08:00