Commit Graph

878 Commits

Author SHA1 Message Date
Joel Einbinder
040c6a6a41
chore(jest): run tests with jest (#2754)
Experimentally run `npx jest` to run our tests with jest.
2020-07-08 11:13:18 -07:00
Joel Einbinder
8611ee8df7
chore(testrunner): typescript test files (#2751)
This lets our spec files be .ts instead of just .js. The typescript files will be checked against the public types. Tests are compiled with babel just in time before running them, emulating the jest experience. TypeScript tests are also linted with eslint.

I converted keyboard.spec.js as the first demo. I'll follow up converting some more more tests.
2020-07-08 00:20:36 -07:00
Dmitry Gozman
0c80c22716
feat(rpc): plumb CDPSession (#2862) 2020-07-07 18:47:00 -07:00
Dmitry Gozman
2a86ead0ac
chore: replace FrameTask with internal events on Frame (#2856)
We now use a few helper.waitForEvent calls to wait for internal
events kNavigationEvent and kLifecycleEvent. With these events,
we should be able to replicate logic over rpc.
2020-07-07 15:22:05 -07:00
Dmitry Gozman
35cb20d5ad
test: unflake recorder tests (#2808)
We ensure that recorder is installed in the main frame before running the test.
2020-07-07 14:11:59 -07:00
Dmitry Gozman
ac2185a9d9
test: update http credentials tests (#2806) 2020-07-06 11:28:07 -07:00
Andrey Lushnikov
7f60c4df62
feat(webkit): roll webkit to r1301 (#2827)
References #2700
2020-07-02 18:51:03 -07:00
Andrey Lushnikov
05b019f1ba
reland: testrunner: make environment a simple class (#2812)
This re-lands PR https://github.com/microsoft/playwright/pull/2769

It was reverted before in https://github.com/microsoft/playwright/pull/2790
because it was breaking the new CHANNEL bot.
2020-07-02 11:05:38 -07:00
Yury Semikhatsky
6329cbbbf8
chore: remove dead code from test (#2819) 2020-07-02 10:42:46 -07:00
Andrey Lushnikov
756d537324
feat(webkit): roll WebKit to r1298 (#2813) 2020-07-02 09:50:16 -07:00
Joel Einbinder
cb0c037e17
test(chromium): enable selectall test on mac (#2788) 2020-07-02 01:57:30 -07:00
Andrey Lushnikov
f9f3aeb0fe
test: add failing test for context menus that prevent browser close (#2811)
References #2700
2020-07-02 00:45:02 -07:00
Dmitry Gozman
19abc9bd9f
fix(dialogs): let click timeout, log information about dialogs (#2781)
We should not stall selector actions because of dialogs
and properly timeout instead. For this, we should not await
the handle.dispose() call because it will never happen
while dialog is shown.

Also, log information about dialogs to make it easier to debug.
2020-07-01 22:10:37 -07:00
Dmitry Gozman
0d16b16e91
fix(firefox): unskip worker error test (#2805) 2020-07-01 22:07:53 -07:00
Dmitry Gozman
e12e2451e4
test: disable flaky test on chromium mac (#2807) 2020-07-01 22:01:44 -07:00
Dmitry Gozman
9d6eaadba7
fix(navigation): ensure that goBack/goForward work with file urls (#2792) 2020-07-01 19:17:27 -07:00
Pavel Feldman
d484e04a08
test(route): add another route test (#2800) 2020-07-01 18:31:08 -07:00
Dmitry Gozman
e8e45e8450
feat(dom): migrate innerText, innerHTML and getAttribute to tasks (#2782)
This ensures synchronous access to avoid element recycling.
2020-07-01 16:10:53 -07:00
Pavel Feldman
c25fc4956d
chore(rpc): scope client-side handles (#2796) 2020-07-01 13:55:29 -07:00
Pavel Feldman
e467ea57e7
revert: testrunner: make environment a simple class (#2769) (#2790) 2020-07-01 10:56:19 -07:00
Joel Einbinder
e480ec3f59
feat(chromium): roll to r782078 (#2714)
Highlights:
- [Remove support for (prefers-color-scheme: no-preference).
](ed6b36f0b4)
- [DevTools: Add commands option to Input.dispatchKeyEvent
](3d3ee67f69)

#1067
2020-07-01 07:26:08 -07:00
Pavel Feldman
95538e73e7
chore(rpc): move classes around, fix tests, respect dispatcher scopes (#2784) 2020-06-30 22:21:17 -07:00
Pavel Feldman
87516cb3a3
chore(rpc): make dispatcher creation and lookup explicit (#2783) 2020-06-30 21:30:39 -07:00
Andrey Lushnikov
1605cb453c
testrunner: make environment a simple class (#2769)
This patch:
- makes environment a simple class with optional methods `beforeEach`, `afterEach`, `beforeAll`, `afterAll`, `globalSetup` and `globalTeardown`
- removes capability to have multiple hooks of the same name inside suite
- removes default environment for test. (`dit` now adds a `TraceTestEnvironment` to the test)
- extracts all environments that we use in our tests in `//test/environments.js`

Downsides:
- we no longer know hook locations for the environments. This, however, should not be a big deal since stack traces (if any) will still point into it.
- this also regresses hook locations for suites for simplicity. We can get them back, but it shouldn't be pressing since we now have only one hook of each kind in every suite.
2020-06-30 16:51:03 -07:00
Pavel Feldman
e29f7b9f58
chore(rpc): support workers, file chooser, browser server (#2766) 2020-06-30 10:55:11 -07:00
Pavel Feldman
5bb018e0e5
chore(rpc): attribute calles to page, ignore USES_HOOKS (#2764) 2020-06-29 18:58:09 -07:00
Dmitry Gozman
38236b4f29
fix(close): ensure close() can be called twice (#2744)
... without any exceptions.
2020-06-29 16:26:32 -07:00
Dmitry Gozman
1fa9d30992
fix(evaluate): awaitPromise when Promise is overwritten (#2759)
Firefox and WebKit require native promises to provide awaitPromise
functionality. When the Promise is overwritten, all evaluations
in the main world produce wrong Promise, so we wrap with async
function to get a native promise instead.
2020-06-29 16:25:52 -07:00
Dmitry Gozman
18f9b4a219
test: add failing test for navigation corner cases (#2746) 2020-06-29 10:39:03 -07:00
Pavel Feldman
e920fde9f7
chore(rpc): bootstrap demo for rpc (#2741) 2020-06-27 11:32:27 -07:00
Pavel Feldman
db12ddebb3
chore(rpc): clear the page test spec (#2736) 2020-06-26 21:22:03 -07:00
Dmitry Gozman
b54303a386
fix(textContent): make page.textContent(selector) atomic (#2717)
We now query selector and take textContent synchronously. This
avoids any issues with async processing: node being recycled,
detached, etc.

More methods will follow with the same atomic pattern.

Drive-by: fixed selector engine names being sometimes case-sensitive
and sometimes not.
2020-06-26 16:32:42 -07:00
Dmitry Gozman
43f70ab978
test: add more failing tests with react recycle (#2731) 2020-06-26 16:31:51 -07:00
Pavel Feldman
02f7501725
chore(rpc): strongly-type the initializer, remove __init__ phase (#2729) 2020-06-26 12:28:27 -07:00
Pavel Feldman
18d6140d3e
chore(rpc): support routes and bindings (#2725) 2020-06-26 11:51:47 -07:00
Dmitry Gozman
064a0a1154
fix(webkit): do not swallow errors when returning by value (#2723)
We currently return undefined whenever we had an error trying
return the evaluation result by error. The most common error
is "execution context destroyed".

This produces very unexpected undefined from methods that do not
ever expect undefined. Instead, we should throw because we were
not able to return the result.
2020-06-26 09:50:57 -07:00
Dmitry Gozman
ab6a6c9b82
chore: run most actions through page._runAbortableTask (#2721)
This introduces a single place for future snapshots.
2020-06-25 16:57:21 -07:00
Pavel Feldman
bab6833232
chore: introduce the experimental rpc implementation (#2720) 2020-06-25 16:05:36 -07:00
Dmitry Gozman
807dc1f324
fix(crash): improve documentation for crash, reject waitForEvent (#2694) 2020-06-25 09:53:56 -07:00
Dmitry Gozman
39ce35e154
fix(errors): strict error handling around element operations (#2567)
- Gave all possible dom errors distinct names, and throw them on the node side.
- Separated errors into FatalDOMError and RetargetableDOMError.
  Fatal errors are unrecoverable. Retargetable errors
  could be resolved by requerying the selector.
- This exposed a number of unhandled 'notconnected' cases.
- Added helper functions to handle errors and ensure TypeScript catches
  unhandled ones.
2020-06-24 15:12:17 -07:00
Dmitry Gozman
355305d31d
feat(screenshot): accept timeout, migrate to Progress, wait for visible (#2679)
Element screenshot now waits for the element to become visible and
throws on detach.

Both screenshot methods accept a timeout and capture logs using Progress.
Also, carefully handling exceptions and restoring the viewport.
2020-06-24 10:16:54 -07:00
Dmitry Gozman
d0a6e1a64e
fix(dom): make selectText and scrollIntoViewIfNeeded wait for visible (#2628)
All other methods wait for the element to be visible, so we should make
them behave similarly.
2020-06-23 13:02:31 -07:00
Joel Einbinder
9000ccb3b2
fix(click): don't timeout when innerWidth is modified (#2669)
We were evaluating `innerWidth` in the main context, where it could be modified.
2020-06-22 14:03:31 -07:00
Pavel Feldman
eac7dab8b7
fix(cors): allow intercepting cors requests on chromium (#2643) 2020-06-19 17:14:32 -07:00
Yury Semikhatsky
2251f9bedb
feat(webkit): bump to 1290 (#2652) 2020-06-19 16:35:14 -07:00
Dmitry Gozman
53f7f4e4e7
test: add redirect+extraHTTPHeaders test (#2637) 2020-06-18 18:06:10 -07:00
Dmitry Gozman
d0336ea5c2
fix(network): disallow intercepting redirects (#2617)
WebKit and Firefox are only able to continue redirects.
Firefox is faking it on the backend, so you can't even stall it.

Instead, we just do not fire routes for redirects on all browsers,
to avoid surprises.
2020-06-18 17:15:47 -07:00
Joel Einbinder
b88fabab13
test: add another test for browserContext.addInitScript (#2285) 2020-06-18 12:27:48 -07:00
Dmitry Gozman
971bd88922
fix(chromium): do not bring page to front before screenshot (#2614) 2020-06-18 10:52:08 -07:00
Dmitry Gozman
f581e84829
fix(css selector): handle missing spaces between [] and > (#2612) 2020-06-17 23:20:12 -07:00