Commit graph

553 commits

Author SHA1 Message Date
Pavel Feldman 78bd29d558
fix(click): work around input alignment on chromium (#1282) 2020-03-07 08:19:31 -08:00
Pavel Feldman 3c35d7b058
api(waitFor): click(waitFor) -> click(force) (#1275) 2020-03-06 16:24:21 -08:00
Andrey Lushnikov 578880cb8b test: mark test as slow 2020-03-06 15:55:04 -08:00
Andrey Lushnikov e604acd5fa test: disable flaky test on WebKit 2020-03-06 15:24:26 -08:00
Yury Semikhatsky 8211287a23
fix(session): use isolated root session for client page sessions (#1271) 2020-03-06 15:11:03 -08:00
Pavel Feldman 3fa000f5f4
api(waitForSelector): bring it back (#1272) 2020-03-06 15:02:42 -08:00
Pavel Feldman 119df5a985
feat(nowait): allow waitUntil:nowait for actions (#1264) 2020-03-06 14:32:15 -08:00
Andrey Lushnikov c494944b46
api(popups): move Page.authenticate to BrowserContext.setHTTPCredentials (#1267)
Drive-by: fixes #720 since it rolls past r1037. 

Co-authored-by: Dmitry Gozman <dgozman@gmail.com>
2020-03-06 13:50:42 -08:00
Andrey Lushnikov ca6faf2e4c chore: properly mark failint tests 2020-03-06 13:34:29 -08:00
Andrey Lushnikov cf820b5269 test: mark failing tests on WebKit 2020-03-06 12:24:21 -08:00
Andrey Lushnikov 8cc7d43a83 tests: disable failing test on chromium 2020-03-06 11:45:13 -08:00
Pavel Feldman 677ebf882f test: mark "clicking anchor should await navigation" as failing on chromium 2020-03-06 10:54:34 -08:00
Pavel Feldman f3734c3e86 test: mark "should await navigating specified target" as failing on chromium 2020-03-06 10:44:44 -08:00
Pavel Feldman 328805747f test(webkit): disable failing wk test 2020-03-06 10:20:15 -08:00
Pavel Feldman a802b00880 test: oops - fdescribe 2020-03-06 09:42:13 -08:00
Pavel Feldman 49c1161e00
api(press): bump .press to the page/frame level (#1262) 2020-03-06 09:38:08 -08:00
Pavel Feldman 2724157c22
feat(waitUntil): allow waiting for navigation from clicks, etc (#1255) 2020-03-06 08:24:32 -08:00
Dmitry Gozman 1d770af804
api: waitForElement accepts waitFor: attached|detached|visible|hidden (#1244)
This includes rename waitForSelector -> waitForElement and removes $wait.
2020-03-05 17:45:41 -08:00
Yury Semikhatsky 9bc6dcea1d
feat(api): introduce BrowserContext.waitForEvent (#1252) 2020-03-05 17:22:57 -08:00
Dmitry Gozman e5f82af47c
api(popups): emit PageEvent immediately, and resolve page() once initialized (#1229)
This way we do not miss any popups, even immediately closed ones.
2020-03-05 15:18:27 -08:00
Pavel Feldman c734b4b715
feat(click): start wire auto-waiting click in firefox (#1233) 2020-03-05 14:47:04 -08:00
Yury Semikhatsky e770d706a1
fix(chromium): do not create default page and context in headless (#1247) 2020-03-05 14:46:12 -08:00
Dmitry Gozman cd8714d573
tests: skip failing waitForNavigation test in Chromium (#1248) 2020-03-05 13:28:45 -08:00
Yury Semikhatsky 665888d579
feat(popups): auto-attach to all pages in Chromium (#1226) 2020-03-05 10:45:32 -08:00
Yury Semikhatsky aabdac8380
api: remove Page.setCacheEnabled (#1231) 2020-03-05 10:09:04 -08:00
Pavel Feldman 11f68bac54
feat(cr, wk): make clicks, input and evaluate await scheduled navigations (#1200) 2020-03-04 19:15:01 -08:00
Dmitry Gozman 7f9df9488e
api(popups): move Page.setOfflineMode -> BrowserContext.setOffline (#1223) 2020-03-04 17:58:12 -08:00
Dmitry Gozman 5ee744cd26
api(page.frame): allow looking up frames by name (#1228) 2020-03-04 17:53:39 -08:00
Pavel Feldman 5ff660de15
feat(navigation): waitForNavigation/goto should not wait until response finished (#1225) 2020-03-04 15:59:26 -08:00
Yury Semikhatsky 771793f418
test(context): test that context.close() works for empty context (#1205) 2020-03-03 23:04:08 -08:00
Dmitry Gozman f4e9b5079d
api: declare not supporting isMobile on Firefox (#1207) 2020-03-03 17:28:31 -08:00
Dmitry Gozman 33f3e5724b
test: skip flaky 'Page.goto extraHttpHeaders should be pushed to provisional page' (#1203) 2020-03-03 17:26:58 -08:00
Joel Einbinder fcfe887c57
feat(select): don't accept undefined as a value (#1202)
`page.select` accepting an `undefined` value is a legacy of when `page.select` took `...values`. This matches the way the method is documented in the API.
2020-03-03 16:59:41 -08:00
Yury Semikhatsky 4556513c2a
chore(test): test cleanup (#1198) 2020-03-03 16:58:37 -08:00
Dmitry Gozman 6c6cdc033b
api(popup): introduce BrowserContext.exposeFunction (#1176) 2020-03-03 16:46:06 -08:00
Dmitry Gozman 1b863c2300
fix(screenshots): simplify implementation, allow fullPage + clip, add tests (#1194) 2020-03-03 16:09:32 -08:00
Dmitry Gozman 2ec9e6daa2
test: cleanup some test files (#1195) 2020-03-03 15:02:06 -08:00
Yury Semikhatsky 4a9a155838
test: enable page opener test on WebKit (#1193) 2020-03-03 14:11:17 -08:00
Yury Semikhatsky 31e26a2208
fix(api): fire BrowserContext.Page event in WebKit and Firefox (#1186) 2020-03-02 18:32:56 -08:00
Dmitry Gozman 342a2cf5cc
fix(selectors): continue matching after first fail for combined selectors (#1185) 2020-03-02 15:47:50 -08:00
Pavel 342e79c5b4 test: mark some tests as skipped (3) 2020-03-02 15:13:15 -08:00
Pavel 2f98b5e26a test: mark some tests as skipped (2) 2020-03-02 15:08:15 -08:00
Pavel ba06fb2f0d test: mark some tests as skipped 2020-03-02 14:57:54 -08:00
Dmitry Gozman 1186998bd8
fix(click): wait for element to be displayed before scrolling into view (#1182)
Otherwise, we may get an error during scrollIntoViewIfNeeded protocol call.
2020-03-02 14:26:38 -08:00
Yury Semikhatsky a57978a5f0
api(chromium): remove Target from public API (#1163) 2020-03-02 13:58:22 -08:00
Pavel Feldman 5bd6e4970b
test: it.skip skips and it.fail expects to fail now (#1178) 2020-03-02 13:47:08 -08:00
Dmitry Gozman ac2f04f10f
api(selectors): pass selector name when registering, allow file path (#1162) 2020-02-28 15:34:07 -08:00
Dmitry Gozman 7843c29d32
feat(selectors): auto-detect each selector part (#1160) 2020-02-28 14:41:32 -08:00
Dmitry Gozman 82a4ede6dc
chore: roll Chromium to 745253 (#1156) 2020-02-28 09:02:26 -08:00
aesyondu 041b8c6e01
chore: fix typo on sepcified -> specified (#1153) 2020-02-27 17:44:19 -08:00
Dmitry Gozman 823bf389a7
api: evaluateOnNewDocument -> addInitScript (#1152)
Also adds more options to specify the script.
2020-02-27 17:42:14 -08:00
Joel Einbinder 857ffd8ea9
fix: text selector should be case insensitive without quotes (#1151) 2020-02-27 16:52:30 -08:00
Dmitry Gozman 7682865d73
feat(popups): add BrowserContext.evaluateOnNewDocument (#1136) 2020-02-27 16:18:33 -08:00
Pavel Feldman dc161df063
fix(launch): throw upon page argument when non-persistent (#1144) 2020-02-27 14:09:24 -08:00
Yury Semikhatsky 9d6aa967f3
chore(workers): align worker lifecycle evens with other APIs (#1147) 2020-02-27 14:02:48 -08:00
Yury Semikhatsky 6b6a671754
fix(webkit): pass popup tests (#1138) 2020-02-27 08:43:01 -08:00
Andrey Lushnikov 22c28b6615
test(firefox): support loading of file URLs (#1132)
Fixes #822
2020-02-26 15:02:59 -08:00
Pavel 5cfe68d878 test: uncomment webkit fix 2020-02-26 14:16:14 -08:00
Dmitry Gozman 672f3f9960
feat(popups): introduce BrowserContext.setDefaultHTTPHeaders (#1116) 2020-02-26 12:42:20 -08:00
Yury Semikhatsky 4f69930fbe
fix(chromium): make locale overrides work (#1108) 2020-02-26 11:01:46 -08:00
Dmitry Gozman ba29470cc1
fix(api): rename relativePoint to offset, remove unused parameters from input (#1092) 2020-02-24 21:12:02 -08:00
aesyondu fdfec8eb2a
fix(platform) instanceof bug between execution contexts of RegExp object (#1048)
First encountered at jest-playwright repo:
https://github.com/mmarkelov/jest-playwright/issues/38

Solution based on:
https://stackoverflow.com/questions/4339288/typeof-for-regexp#comment4724685_4339350
2020-02-24 18:32:17 -08:00
Joel Einbinder a6c3735b9d
test: add failing drag and drop test (#1095)
The test file comes from mdn: https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/setData

References #1094
2020-02-24 18:25:47 -08:00
Dmitry Gozman 6acc439450
feat(api): move targets from CRBrowser to CRBrowserContext (#1089)
This makes them work for default context.
2020-02-24 14:35:51 -08:00
Dmitry Gozman 3677818202
fix(api): browser.serviceWorker -> target.serviceWorker (#1076) 2020-02-24 08:31:58 -08:00
Dmitry Gozman 1f8508d1ed
feat(waitFor): update various waitFor options to be a single boolean (#1066) 2020-02-22 09:16:28 -05:00
Andrey Lushnikov 88e310942b
test: fix test on Firefox Linux (#1079) 2020-02-21 13:21:45 -08:00
Andrey Lushnikov f305d6594e chore: remove focused test 2020-02-21 13:12:57 -08:00
Andrey Lushnikov 66362a5687 chore: update appveyour config 2020-02-21 13:09:36 -08:00
Andrey Lushnikov 0ded511d0b
feat(testrunner): better matchers (#1077)
This patch re-implements matching and reporting for test runner.
Among other improvements:
- test failures now show a short snippet from test
- test failures now explicitly say what received and what was expected
- `expect.toBe()` now does text diff when gets strings as input
- `expect.toEqual` now does object diff
2020-02-20 22:55:39 -08:00
Andrey Lushnikov 05a1e1c641
test: remove newContext and newPage test helpers (#1070)
All tests should clean up their contexts themselves.
2020-02-20 15:15:48 -08:00
Dmitry Gozman 40164298a8
api: remove ElementHandle.visibleRatio (#1069) 2020-02-19 16:08:25 -08:00
Joel Einbinder 568c6cbb54
test(navigation): fix flaky networkidle tests (#1058)
The network idle tests were waiting for requests to appear on the server, but not for playwright to be notified of the request via protocol. They also assumed performance.now would match up with setTimeout times.
2020-02-19 14:26:02 -08:00
Dmitry Gozman 84ee297c4b
test: add a test for bounding box on partially visible element (#1011) 2020-02-19 16:08:29 -06:00
Andrey Lushnikov 4be48a6b1b chore: disable DEBUGP on bots 2020-02-19 14:07:36 -08:00
Dmitry Gozman 33824aa1d7
feat(click): waitForInteractable option, defaults to true (#934) (#1052) 2020-02-19 09:34:57 -08:00
Dmitry Gozman 1805acd5d5
test: update animation click test (#1053) 2020-02-18 14:30:56 -08:00
Pavel Feldman 1ee657823e
feat(viewport): update defaults to 1280x720, fix Firefox (#1038) 2020-02-18 09:16:32 -08:00
Pavel Feldman f2b2d72693
fix(input): emit change events upon page.setInputFiles (#1028) 2020-02-18 09:15:47 -08:00
Pavel Feldman e65897844f
test: add screenshot test that fails on Chromium (#1039) 2020-02-15 16:34:27 -08:00
Darío Kondratiuk cfeaecb3d2
test(keyboard): Remove duplicated test (#1031) 2020-02-15 14:58:07 -08:00
Joel Einbinder 3656403f2d
fix(keyboard): Add mac editing commands for NumpadEnter (#1026)
This should fix NumpadEnter on webkit for mac.
2020-02-14 18:37:02 -08:00
Joel Einbinder 21acb369db
fix(keyboard): correctly press enter on firefox (#1023) 2020-02-14 17:42:08 -08:00
Andrey Lushnikov 5695ade926
test: add failing test for Firefox (#1019)
References #1009
2020-02-14 17:02:22 -08:00
Dmitry Gozman dbb45d443a
Revert "feat(click): waitForInteractable option, defaults to true (#934)" (#1013)
Reason: new tests are flaky on all bots.
2020-02-14 13:05:23 -08:00
Dmitry Gozman 9413351d3f
feat(click): waitForInteractable option, defaults to true (#934) 2020-02-14 11:55:34 -08:00
Dmitry Gozman 1eabd182e9
test(firefox): unskip passing url hash test (#998) 2020-02-13 18:22:14 -08:00
Pavel Feldman 4d7e531520
fix(webkit): wait for the pipe ready on windows (#997) 2020-02-13 17:46:40 -08:00
Pavel Feldman cd4e9da807
feat(coverage): export raw v8 coverage (#976)
Fixes #955
2020-02-13 17:39:14 -08:00
Andrey Lushnikov 7ec3bf4d94 test: fix locale tests on mac 2020-02-13 17:03:35 -08:00
Andrey Lushnikov b181b34e2e test: attempt to normalize locale tests 2020-02-13 15:32:39 -08:00
Pavel Feldman b96d985d12
test: fix locale expectations on non-Mac (#994) 2020-02-13 15:12:54 -08:00
Dmitry Gozman 25022e4685
feat(api): introduce default timeouts on BrowserContext (#992) 2020-02-13 14:18:18 -08:00
Andrey Lushnikov f8f818f676 Revert "Revert "feat: do not wait for first page in non-persistent mode (#939)""
Apparently a good fix is coming: https://github.com/microsoft/playwright/pull/993/
Pavel want to re-revert.
2020-02-13 13:54:01 -08:00
Andrey Lushnikov 71892b4aaa Revert "feat: do not wait for first page in non-persistent mode (#939)"
This reverts commit a567123596.

Reason for revert: WK-Win fails to start if we start talking over the
pipe too early.
2020-02-13 13:44:58 -08:00
Pavel Feldman c15534ff01
fix(locale): document locale parameter (#990) 2020-02-13 13:37:59 -08:00
Dmitry Gozman cb63021b2f
test: add test for navigator.userAgent in popups (#985) 2020-02-13 13:23:29 -08:00
Andrey Lushnikov 05f8d001f8
test: fix service worker test (#988)
Do the following to ensure SW is active and serves requests:
- in ServiceWorker, claim all clients once activated
- in page, await activation promise instead of a registration
2020-02-13 13:21:19 -08:00
Dmitry Gozman 2e0d89e25c
fix(firefox): roll to 1029 and unskip passing tests (#984) 2020-02-13 13:19:25 -08:00
Joel Einbinder d790b4c280
fix(test): default DEBUGP to false (#989) 2020-02-13 13:18:19 -08:00
Pavel Feldman 8ed88c910a
feat(webkit): introduce BrowserContext({language}) (#972) 2020-02-13 12:24:17 -08:00
Pavel Feldman 53fa62910a
fix(chromium): emit focus events in headful (#982)
Fixes #979
2020-02-13 11:29:13 -08:00
Dmitry Gozman a567123596
feat: do not wait for first page in non-persistent mode (#939) 2020-02-13 10:51:17 -08:00
Joel Einbinder d367a2ed3a
chore(tests): log protocol messages when a test fails on the bots (#963)
Similarly to how we handle stdio, this captures all protocol messages and logs them when a test fails. Great for when debugging tests in parallel or for bot failures!

Currently I made `DEBUGP=true` turn this on locally, and turned it on always for the CI. Open to 
suggestions for a better environment variable. I would turn it on by default always, like the stdio logging, but it adds an enormous amount of noise to our error messages.
2020-02-12 22:35:06 -08:00
Pavel Feldman 8abf35c8e4
feat(webkit): roll webkit to 1148 (#971) 2020-02-12 21:25:17 -08:00
Andrey Lushnikov d735de5347
feat: do not let users pass userDataDir to browserType.launch() (#974)
We now have a separate method for this - `browserType.launchPersistent`.
This will probably save our users quite some time.
2020-02-12 19:32:23 -08:00
Pavel Feldman 012bf671b8
feat(webkit): emulate timezone on webkit (#968) 2020-02-12 17:02:59 -08:00
Dmitry Gozman fbce2908ad
test: unskip passing Firefox tests (#966) 2020-02-12 16:27:45 -08:00
Andrey Lushnikov bfaf191c98
test: add missing tests (#965)
Chromium tests on Linux now call all our API methods and events at least once!
2020-02-12 16:13:48 -08:00
Dmitry Gozman 1d84f38e5e
fix(input): ensure input works as expected with page scale (#962) 2020-02-12 16:13:21 -08:00
Andrey Lushnikov 7ce49c2835
chore: remove WebSocket implementation (#961)
WebSocket implementation currently is very incomplete, lacking
support in WebKit-Win and Firefox.
2020-02-12 15:29:06 -08:00
Dmitry Gozman 5f24205922
test: add a test for interception + service worker (#951) 2020-02-12 13:02:27 -08:00
Pavel Feldman c8c4356d7c
test: add setInputFiles input event test (#944) 2020-02-11 20:18:41 -08:00
Pavel Feldman d05feec740
feat(active): emulate active state on webkit (#941) 2020-02-11 19:10:57 -08:00
Dmitry Gozman da30847c83
feat(firefox): apply emulation to all pages in the browser context (#931) 2020-02-11 18:52:01 -08:00
Dmitry Gozman f25a27a0a4
test: add a test for bounding box with page scale (#935)
Does not work on WebKit, because it uses device-independent pixels instead of css pixels for content quads.
2020-02-11 17:04:49 -08:00
Pavel Feldman 20e2bac857 test: fix flaky page event test 2020-02-11 15:19:43 -08:00
Pavel Feldman 53237009ad
feat($wait): make $wait a shortcut for waitForSelector (#932) 2020-02-11 14:51:09 -08:00
Joel Einbinder 6105d8a26a
fix(tests): fix test that was leaking a context (#933) 2020-02-11 14:15:30 -08:00
Pavel Feldman aae5fca237
feat(api): make browser.newPage own the created context (#930) 2020-02-11 12:06:58 -08:00
Dmitry Gozman c69dccf7c1
feat(click): use browser-provided scrollIntoViewIfNeeded (#893) 2020-02-11 10:30:09 -08:00
Pavel Feldman 72b9cf010e
feat(context): introduce BrowserContext close event (#918) 2020-02-11 10:27:19 -08:00
Meir Blachman 5fee93ae96
test: fix expect in jshandle spec (#927) 2020-02-11 09:26:23 -08:00
Joel Einbinder 251ad38824
fix(navigations): remove LifecycleWatcher, fix flakes (#882) 2020-02-10 18:35:47 -08:00
Joel Einbinder c03e8b7946
chore(tests): add types for tests (#915)
I enabled vscode autocomplete in our test files. Typechecking had too many errors to enable, but it caught some real bugs that I will fix in a follow up.

This patch contains:
* `test/types.d.ts` - d.ts file for our test runner.
* `test/tsconfig.json` - typescript project for our tests.
* JSDoc header in all specs to mark the describe as a TestSuite
* Drive-by fix of a launcher test that was using `if` instead of `it`
* Some drive-by fixes of unimpactful typos in tests.
2020-02-10 13:20:13 -08:00
Andrey Lushnikov 4fcc63f2e1 chore: remove usages of mime module from infrastructure
Follow-up to 4d84e35096
2020-02-10 11:26:08 -08:00
Pavel Feldman 84f5700294
feat(api): rename browserContext() to context() in the apis, remove url from newPage (#906) 2020-02-10 10:41:45 -08:00
Pavel Feldman 4d84e35096
fix(upload): detect mime type from file extension (#911) 2020-02-10 10:08:51 -08:00
Pavel Feldman 79b7a8491e
fix(screenshot): be careful w/ default viewport, extract common logic (#913)
Fixes #887.
2020-02-10 09:15:15 -08:00
Pavel Feldman 36344dee27
tests: consistently use platform constants (#899) 2020-02-07 14:44:05 -08:00
Pavel Feldman fe2431e34b
feat(webkit): roll webkit to r1137 (#884) 2020-02-06 21:06:55 -08:00
Dmitry Gozman fee83b17c9
fix(api): page.viewport -> page.viewportSize (#878)
We now only allow to resize the page, leaving isMobile and deviceScaleFactor as browser context options.
2020-02-06 19:02:55 -08:00
Dmitry Gozman c33a12d8f0
feat(firefox): ensure that new pages get browser context userAgent option (#872) 2020-02-06 19:01:03 -08:00
Pavel Feldman 99d06892c5
tests: explicitly close contexts for browser.newPage (#875) 2020-02-06 15:18:07 -08:00
Pavel Feldman a547aa7984
feat(connect): allow multiple webkit connections over web socket (#863) 2020-02-06 12:41:43 -08:00
Andrey Lushnikov f49d63ff0c test: remove fdescribe 2020-02-06 12:20:29 -08:00
Pavel Feldman 5152540f47
test(cookies): add more isolation tests (#869) 2020-02-06 09:24:10 -08:00
Dmitry Gozman 6318ba6e4a
feat(frame): introduce frame.frameElement (#856)
Fixes #839.
2020-02-05 17:20:23 -08:00
Pavel Feldman 55b6fe241e
feat(launch): introduce client, server & persistent launch modes (3) (#854) 2020-02-05 16:36:36 -08:00
Andrey Lushnikov a4c40fff82
test: make sure page.fill actually clears an input (#851) 2020-02-05 16:07:25 -08:00
Pavel Feldman a2ab645e63
feat(launch): introduce client, server & persistent launch modes (2) (#840) 2020-02-05 12:41:55 -08:00
Pavel Feldman 0518625dcc
feat(launch): introduce client, server & persistent launch modes (1) (#838) 2020-02-04 19:41:38 -08:00
Pavel Feldman bdf8e39786
feat(goto): assume http:// for localhost navigations (#825) 2020-02-04 19:39:52 -08:00
Dmitry Gozman 8f1df5e1e8
fix(chromium): pause workers on start to not miss any events (#832) 2020-02-04 19:36:46 -08:00
Dmitry Gozman 4b761f4485
test: expect current behavior for cross-frame js handles (#833) 2020-02-04 19:34:54 -08:00
Pavel Feldman e3e2da3186
feat(check): introduce page.check/uncheck (#826) 2020-02-04 14:39:10 -08:00
Pavel Feldman 05d4746eb5
feat(selectors): temporarily remove zs engine (#824) 2020-02-03 16:14:37 -08:00
Pavel Feldman 1059e22f9e
fix(fill): make fill work for input[type=number] (#819) 2020-02-03 15:50:45 -08:00
Andrey Lushnikov b82bc5fbd4
feat: treat selectors with leading '(//' as xpath (#821)
This starts treating the following selectors as xpath:
- `page.$('//div')`
- `page.$('(//div)[1]')`
- `page.$('((((//div))))[1]')`

(and generally, any number of leading openting parenthesis)

Fixes #817
2020-02-03 14:52:18 -08:00
Pavel Feldman 8028fb052a
feat(route): migrate from request interception w/ events to page.route (#809) 2020-02-03 14:23:24 -08:00