Commit Graph

11 Commits

Author SHA1 Message Date
Daniel Martí
fb23c1750a fix data races in table-driven parallel subtests
t.Parallel effectively fires off a goroutine, so we can't use the test
range variable directly. That can result in different subtests using the
same test case data, causing sporadic failures, or some test cases
rarely being actually tested.

This was uncovered while stress-testing the test suite for an unrelated
refactor.

While at it, one test case in TestMouseClickNode was incorrect.
contextmenu fires on a right click, so ModifierNone won't fire it. This
wasn't caught before, as this test case was almost never ran. After the
data race fix, the test case failed consistently, before being fixed.
2019-04-01 16:48:49 +01:00
Daniel Martí
d73caffcd0 make gofumpt happy
Just a stricter gofmt; see mvdan.cc/gofumpt.
2019-04-01 16:43:03 +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í
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
Daniel Martí
da4f783362 make all tests run in parallel
The subtests were almost all marked as parallel, but that's not enough.
That only makes the subtests run in parallel with other subtests within
the same tests, not with any other test.

Since none of the tests make use of globals nor require the entire
program to themselves, properly run all the tests in parallel.

Speeds up 'go test' on my 8-core laptop from an average of ~130s to an
average of ~50s. Many tests hit timeouts and have sleeps, so we want to
avoid running those sequentially whenever possible.
2019-02-21 13:56:54 +01:00
Kenneth Shaw
b0c2445e67 Splitting repositories 2017-12-28 11:17:14 +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
869aafc836 Adding script to generate domains from protocol.json and updating to latest protocol.json 2017-05-06 08:20:24 +07:00
Kenneth Shaw
bf1d5ecfbc Revising ScrollIntoView Action
- Rewrote ScrollIntoView to be consistent with other query actions
2017-02-28 08:35:00 +07:00
Randy Cahyana
f85f3777fa Fixing issue when node is offscreen and more.
- Adding ScrollIntoNode action.
- Adding isOnViewJS snippet.
- Fixing race issue in some unit tests.
2017-02-27 19:17:36 +07:00
Randy Cahyana
3a264ed3ff Adding unit test for navigation actions and few minor changes. 2017-02-23 16:39:29 +07:00