Commit Graph

18 Commits

Author SHA1 Message Date
Daniel Martí
f742f327a7 speed up the screenshot tests, and test the images
Using a smaller viewport speeds up both tests, and lets us know what
dimensions to expect in TestCaptureScreenshot.

For TestScreenshot, we can know what dimensions to expect in advance, as
we have the images in testdata.

'go test -run Screenshot' goes from ~0.9s to ~0.5s on my machine.

Finally, don't run ExampleTitle as part of 'go test', as it's slow.
2019-04-01 12:18:16 +01:00
Daniel Martí
da4ac414ed get rid of all sleeps in tests
The navigate sleeps can be replaced by appropriate wait actions.

Some other tests don't need any sleeps at all. This might be because
work is done synchronously now; I haven't been able to get test flakes
after hundreds of test runs with flags like -parallel=32 -count=200.
2019-04-01 12:18:16 +01:00
Daniel Martí
7c1a9fbf3e get rid of all exceptions
We hadn't noticed a few uncaught exceptions being received from the
browser, because the events were ignored. Start printing them via the
error logger.

The ones we were getting were caused by testAllocate running Navigate
actions when the path argument was empty. Navigating to "testdata/"
causes JS exceptions, as it's not a valid page.

Instead, leave the new target pointing at a blank document.
2019-04-01 12:18:16 +01:00
Daniel Martí
92bfcc3c8d collapse a few Navigate actions in the tests 2019-04-01 12:18:16 +01:00
Daniel Martí
3d3bf22ccc start the chromedp v2 refactor
First, we want all of the functionality in a single package; this means
collapsing whatever is useful into the root chromedp package.

The runner package is being replaced by the Allocator interface, with a
default implementation which starts browser processes.

The client package doesn't really have a place in the new design. The
context, allocator, and browser types will handle the connection with
each browser.

Finally, the new API is context-based, hence the addition of context.go.
The tests have been modified to build and run against the new API.
2019-04-01 12:17:28 +01:00
Kenneth Shaw
f683cfc4c1 Minor code cleanup 2018-03-27 04:31:09 +07:00
Kenneth Shaw
b0c2445e67 Splitting repositories 2017-12-28 11:17:14 +07:00
Kenneth Shaw
1e295eddfb Updating to latest protocol.json (clarifying timestamp behavior)
* Disabled AddOnLoadScript/RemoveOnLoadScript
* Updated chromedp-gen fixups for latest timestamp declarations
* Updated to latest protocol.json definitions
2017-07-09 08:40:29 +07:00
Kenneth Shaw
fa3cf26d37 Minor changes to unit tests in attempt to fix issues with travis 2017-06-18 09:32:12 +07:00
Kenneth Shaw
22e287750a Fixing misspelling issues 2017-03-02 09:53:47 +07:00
Randy Cahyana
3a264ed3ff Adding unit test for navigation actions and few minor changes. 2017-02-23 16:39:29 +07:00
Randy Cahyana
a4cd7f9783 Removing external url on navigation and query actions. 2017-02-22 19:55:45 +07:00
Kenneth Shaw
6ce1f2fdfb Reenabling TestStop
- Added contrib/grab-headless_shell.sh to grab latest headless_shell
- Changed travis config to use contrib/grab-headless_shell.sh
- Reenabled TestStop since Page.stopLoading is now available with latest
  available headless_shell
2017-02-22 07:58:30 +07:00
Kenneth Shaw
d15303bae6 Skipping TestStop unit test (Page.stopLoading not available) 2017-02-21 15:06:28 +07:00
Kenneth Shaw
bb2a503425 Standardizing NavigateBack and NavigateForward API 2017-02-21 11:25:36 +07:00
Randy Cahyana
1988de618d Adding unit test for navigation actions. 2017-02-21 09:08:18 +07:00
Kenneth Shaw
dc17e7f8cd Parallelizing unit tests 2017-02-18 13:12:21 +07:00
Randy Cahyana
0db7a9ee72 Increasing unit test coverage on query.go 2017-02-18 10:50:33 +07:00