Commit Graph

340 Commits

Author SHA1 Message Date
Andrey Lushnikov
fc94f98247
feat(Targets): expose browser target (#2036)
This patch exposes "browser" target to the list of targets.
2018-02-15 13:24:24 -08:00
Andrey Lushnikov
e8a085ccfb
feat(appMode): support pipes for appMode (#2032)
This patch starts using pipes as a transport to
the browser instance instead of websocket.
2018-02-14 17:51:29 -08:00
Andrey Lushnikov
43c0feb2f2
fix(Network): fulfill security details for response redirects (#2025)
This patch:
- starts fulfilling security details for redirect responses
- changes `response.securityDetails()` to return null if the response
  is served over non-secure connection
2018-02-14 16:08:20 -08:00
Andrey Lushnikov
ee5ec3e630
test: await browser closing in tests (#2022) 2018-02-13 14:39:13 -08:00
Andrey Lushnikov
ae22ef30b3
feat(ExecutionContext): introduce ExecutionContext.frame() (#1972)
This patch introduces ExecutionContext.frame() that returns Frame
associated with this Execution Context.

This allows to associate console messages with the originating frame,
if any.
2018-02-13 14:02:44 -08:00
Tomáš Trnka
856c431914 feat(Network): introduce response.securityDetails() method (#1880)
This patch:
- introduces `SecurityDetails` class that exposes a set of fields that describe properties of secure connection
- introduces method `response.securityDetails()` that returns an instance of `SecurityDetails` object.
2018-02-13 11:26:18 -08:00
JoelEinbinder
700244a29a test: dont race against the mutation observer (#2016) 2018-02-13 11:00:38 -08:00
JoelEinbinder
1b6ee37137 fix(test): merge _pressedKeys test into the .repeat test (#2017) 2018-02-13 10:59:29 -08:00
travch
f3ba436239 Fix: Remove key codes from _pressedKeys Set after keyboard.up() is called (#1928)
keyboard.down() and keyboard.up() both use the _pressedKeys Set, however keyboard.down() adds and searches for the key code, whereas keyboard.up() attempts to delete based on the key rather than the key code.

Fixes #1901
2018-02-12 17:25:38 -08:00
Drew Diamantoukos
b275e66594 chore: Spelling and Markdown Consistency (#1998)
- Adding missing language tags to markdown code blocks.
- Fixed various spelling mistakes my IDE complained to me about.
2018-02-08 22:59:46 -05:00
Andrew Collins
ac1b9a0eb0 feat(Page): add setCacheEnabled(enabled) to Page object (#1609)
This change adds in the `Page.setCacheEnabled(enabled)` method to toggle ignoring cache for each request.

Fixes #1556.
2018-02-08 00:58:48 -05:00
Andrey Lushnikov
a363a733b7
feat: Introduce BrowserFetcher class (#1983)
This patch introduces `BrowserFetcher` class that manages
downloaded versions of products.

This patch:
- shapes Downloader API to be minimal yet usable for our needs. This
  includes removing such methods as `Downloader.supportedPlatforms` and
  `Downloader.defaultRevision`.
- makes most of the fs-related methods in Downloader async. The only
  exception is the `Downloader.revisionInfo`: it has stay sync due to the
  `pptr.executablePath()` method being sync.
- updates `install.js` and `utils/check_availability.js` to use new API
- finally, renames `Downloader` into `BrowserFetcher`

Fixes #1748.
2018-02-07 12:31:53 -05:00
Andrey Lushnikov
18c975509f
test: create tmp folder in os.tmp() folder (#1982) 2018-02-06 16:44:46 -05:00
Andrey Lushnikov
ecc3adc279
feat(Response): add Response.fromCache / Response.fromServiceWorker (#1971)
This patch:
- introduces `test/assets/cached` folder and teaches server to cache
  all the assets from the folder
- introduces `test/assets/serviceworkers` folder that stores all the
  service workers and makes them register with unique URL prefix
- introduces `Response.fromCache()` and `Response.fromServiceWorker()`
  methods

Fixes #1551.
2018-02-05 17:59:07 -05:00
Alix Axel
bc6902623a fix: allow timeouts of be 0 (#1964)
This patch fixes timeouts for `puppeteer.launch` and `page.waitForFunction`
to be `0`.

Fixes #1960 .
2018-02-05 17:42:54 -05:00
Andrey Lushnikov
cfb728b09b
feat(Chromium): roll to r533271 (#1938)
This roll includes:
- https://crrev.com/530961 DevTools: fix Referer header handling in
  net interceptor

References #469.
2018-01-31 16:02:56 -08:00
Yaniv Efraim
189deb84c0 feat(Frame): add Frame.evaluateHandle (#1885)
This patch adds Frame.evaluateHandle method. The method is a shortcut
for frame.executionContext().evaluateHandle.

Fixes #1051
2018-01-24 21:16:01 -08:00
Alix Axel
5175d8e692 fix(Page): fix Page.select() behavior to be on par with docs (#1886)
This PR fixes lost functionality that is no longer on-par with the documentation for `Page.select`, namely:

> `...values` <...string> Values of options to select. If the `<select>` has the `multiple` attribute, all values are considered, **otherwise only the first one is taken into account**.

I've also added an accompanying test for this use case.
2018-01-24 21:12:27 -08:00
Ram Dobson
cb684ebbc4 feat(Page): introduce Page.waitForXPath (#1767)
This patch:
- introduces `page.waitForXPath` method
- introduces `frame.waitForXPath` method
- amends `page.waitFor` to treat strings that start with `//` as xpath queries.

Fixes #1757.
2018-01-22 15:16:20 -08:00
Ian Hunter
59f6d42610 feat: add Page.Events.DOMContentLoaded (#1730)
Fixes #1580
2018-01-16 23:22:44 -08:00
yujiosaka
c866c175f8 fix: page.goto should support pages with self requests (#1391) (#1781)
This patch fixes `page.goto` for websites that re-request document URL with javascript.

Fixes #1391.
2018-01-12 00:16:36 -08:00
Andrey Lushnikov
5368051610
feat: expose raw devtools protocol connection (#1770)
feat: expose raw devtools protocol connection

This patch introduces `target.createCDPSession` method that
allows directly communicating with the target over the
Chrome DevTools Protocol.

Fixes #31.
2018-01-10 19:33:22 -08:00
Radu Aron
ec8e40f1cb feat(Page): Add global navigation timeout setting (#1728)
This patch introduces `page.setDefaultNavigationTimeout` method to override the 
default 30 seconds navigation timeout.

Fixes #1514
2018-01-10 13:04:01 -08:00
yujiosaka
c29822d663 feat: Attribute network requests to frames (#1646)
This patch introduces `request.frame()` method that returns the frame that
initiated request.

Fixes #1579
2018-01-09 18:47:21 -08:00
yujiosaka
5843f6f775 fix: setRequestInterception and setExtraHTTPHeaders not working together (#1734)
This patch starts lowering header keys while generating request hashes.

Fixes #1729.
2018-01-09 16:52:28 -08:00
JoelEinbinder
972f44d328 fix: avoid calling jsonValue from waitFor (#1746)
If the success value of `waitForFunction` was not serializable, checking whether it was truthy with `.jsonValue()` might fail. Now I check whether it was truthy inside the page.

Fixes #1737.
2018-01-08 14:14:41 -08:00
yujiosaka
8e9c54a789 feat: introduce browser.userAgent() (#1716)
The patch introduces browser.userAgent() method to retrieve
default browser user agent.

Fixes #1706.
2018-01-05 10:14:30 -08:00
JoelEinbinder
05b1aca21e feat: support JSHandles for page.waitFor* calls (#1712)
This patch:
- teaches page.waitFor* methods to accept JSHandles
- starts returning JSHandles from page.waitFor* calls. 

BREAKING CHANGE: this patch starts allocating `JSHandle`/`ElementHandle` instances for every call to `page.waitFor*` functions. These handles should be disposed manually to avoid memory consumption.

Fixes #1703, fixes #1654, fixes #1724.
2018-01-04 14:49:13 -08:00
JoelEinbinder
ed3fc47069 test: don't show max listeners warning when running tests in parallel (#1722) 2018-01-04 12:08:35 -08:00
JoelEinbinder
e7eacd443f test: scrub port from coverage golden files (#1723) 2018-01-04 11:47:30 -08:00
Andrey Lushnikov
f0b11ad22e
test: verify serialization of "undefined" fields (#1721)
Fixes #1510.
2018-01-04 11:30:29 -08:00
Andrey Lushnikov
24354a4879
feat: implement CSS Coverage (#1714)
This patch adds two new methods to the `page.coverage` namespace:
- `page.coverage.startCSSCoverage()` - to initiate css coverage
- `page.coverage.stopCSSCoverage()` - to stop css coverage

The coverage format is consistent with the JavaScript coverage.
2018-01-03 18:21:40 -08:00
JoelEinbinder
f183664d0f feat: rename page.xpath into page.$x, return an array of elements (#1713)
Fixes #1705.
2018-01-03 15:37:08 -08:00
Andrey Lushnikov
d062381978
feat: Implement JavaScript Coverage (#1673)
This patch introduces a new `page.coverage` namespace with two methods:
- `page.coverage.startJSCoverage` to initiate JavaScript coverage
  recording
- `page.coverage.stopJSCoverage` to stop JavaScript coverage and get
  results
2018-01-02 19:53:53 -08:00
Andrey Lushnikov
05f4f943f0
test: add server/run.js that runs assets locally (#1687) 2017-12-28 15:51:41 -08:00
Andrey Lushnikov
508a78d99b
test: prohibit focused tests/suites on bots (#1686) 2017-12-28 15:41:57 -08:00
JoelEinbinder
d82402a987 test: add dblclick input test (#1675) 2017-12-28 11:34:03 -08:00
Andrey Lushnikov
02720e4f22
test: do not leave dangling listener on shared browser object (#1674)
This resulted in quite a few failures on travis.
2017-12-27 19:38:33 -07:00
Andrey Lushnikov
fc2fc0de5d
test: run chrome with --disable-dev-shm-usage (#1633)
This might speedup tests on CI.
2017-12-21 16:29:00 -08:00
JoelEinbinder
8a40cd5eef feat(Launcher): allow the default arguments to be overridden (#1623)
This patch:
- adds `puppeteer.defaultArgs()` method to get default arguments that are used to launch chrome
- adds `ignoreDefaultArgs` option to `puppeteer.launch` to avoid using default puppeteer arguments

Fixes #872
2017-12-19 17:51:21 -08:00
Andrey Lushnikov
671d464a98
test: await all navigations in tests (#1629) 2017-12-19 16:28:39 -08:00
JoelEinbinder
60ba8c3af9 feat: add page.xpath (#1620)
This patch adds xpath support with the following methods:
- page.xpath
- frame.xpath
- elementHandle.xpath

Fixes #537
2017-12-19 16:23:45 -08:00
Andrey Lushnikov
b73737302a
fix: convert all getters to methods (#1621)
The patch converts all the getters in the codebase into the methods.
For example, the `request.url` getter becomes the `request.url()`
method.

This is done in order to unify the API and make it more predictable.
The general rule for all further changes would be:
- there are no getters/fields exposed in the api
- the only exceptions are "namespaces", e.g. `page.keyboard`

Fixes #280.

BREAKING CHANGE:
This patch ditches getters and replaces them with methods throughout
the API. The following methods were added instead of the fields:
- dialog.type()
- consoleMessage.args()
- consoleMessage.text()
- consoleMessage.type()
- request.headers()
- request.method()
- request.postData()
- request.resourceType()
- request.url()
- response.headers()
- response.ok()
- response.status()
- response.url()
2017-12-18 17:05:57 -08:00
David Dios
10f3b92304 test: Fix broken Tracing unit tests (#1613)
This patch fixes broken Tracing tests which are failing since the `state.parallel` -> `state.parallelIndex` modification of #1531
2017-12-18 10:49:01 -08:00
Jih-Chi Lee
18d5cfa269 fix(Cookies): disallow setting cookies in 'about:blank' page (#1567)
This patch asserts that no cookies are set on `about:blank` and `data:` urls.

References #1411
2017-12-16 01:17:20 -08:00
Andrey Lushnikov
be438c59c1
chore(testrunner): support first-class test debugging (#1606)
This patch teaches testrunner to override both timeout and
parallel execution option if there's attached inspector.
2017-12-15 14:25:06 -08:00
Andrey Lushnikov
a5db6d412c
test: migrate test.js to support concurrent test execution (#1531)
This patch migrates tests so that they can be run concurrently.

- By default, tests still run in one thread.
- To run tests in 4 parallel threads, run node test/test.js -j 4 or npm run unit -- -j 4
- Environment variable PPTR_PARALLEL_TESTS could be set to override default parallelization

Every test gets passed in a state. State is set up in the beforeAll and beforeEach callbacks,
and should be teared down in the afterAll and afterEach callbacks.

By default, state has a parallelIndex variable initialized that defines the thread index that runs the execution.
2017-12-12 13:34:21 -08:00
Andrey Lushnikov
4eaf52fa1d
feat(Browser): introduce browser.process() variable (#1581)
This patch adds a `browser.process()` getter to expose the child process
with running browser.

Fixes #1539.
2017-12-11 12:11:12 -08:00
JoelEinbinder
a164524c72 feat(Connection): nicer stack traces on protocol errors (#1383)
This rewrites protocol errors to have the stack trace of the call site.
2017-12-08 19:05:46 -08:00
Andrey Lushnikov
391d1abaa7
chore: generalize node6 transpilation (#1560)
This patch unifies node6 transpilation:
- instead of generating multiple top-level directories, prefixed with
  `node6-`, all transpiled code gets placed under single `node6/` folder
- transpilation doesn't change require paths of transpiled modules any
  more
2017-12-08 15:14:28 -08:00