Commit Graph
14 Commits
Author SHA1 Message Date
Jack Franklin fc495906c3 Enforce no TS non-null bang assertions
This CL bans the TS `!` operator which is used to assert not null.

Typically when we use this we are making errors harder to track down
should the value actually end up being null. Checking it takes more work
but will give nicer errors.

Fixed: 1154182
Change-Id: I11599541c199204e4ca21c9fd81a256614d70389
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2566804
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-12-02 14:46:50 +00:00
Jan Scheffler f74777559c [e2etest] Move hosted mode server to https
This allows testing things that require secure connections
like thrid party cookies.

Change-Id: Id7f6dc672f8a2e701f2baad22fa035826a8d7b2a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2537951
Commit-Queue: Jan Scheffler <janscheffler@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-11-18 12:58:43 +00:00
Peter Marshall 467b0b1632 tests: Use mocha-extensions in e2e tests
The extensions have helpers like it.repeat() and async tracing which
make development and debugging easier. All the tests will import from
the extensions file now rather than mocha directly.

A follow-up CL will add lint checks for this.

Bug: 1101782
Change-Id: I7b1a540be1685375b06f1db5d0fda2f2879446c2
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2354104
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-08-17 07:37:56 +00:00
Johan Bay 00fc92a773 Reland^2 "eliminate initial timeout in waitForFunction"
`waitForFunction` previously always waited 100 ms before checking if
the given function is truthy. We can improve the total e2e test suite
running time by 40-50 s by eliminating this timeout. This,
unfortunately, makes some of the tests flake since they relied on this
timeout. This CL attempts to eliminate the timeout and patch the tests
that relied on it. In the cases where a test could not be patched the
timeout is inserted in the test explicitly.
Local experiments showed that this CL reduces the total runtime from
on avg. ~309 seconds to an avg. of ~264 seconds.
This amounts to a ~45 second reduction or ~15%.

This is a reland of a26e3406c7
which was a reland of 3be2087f9d

Bug: 1112692
Change-Id: I3a5156d35553415bfbac95c0251b849ed77f4767
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2354096
Commit-Queue: Johan Bay <jobay@google.com>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
2020-08-17 06:21:56 +00:00
Johan Bay 504a6f1944 Let $ return null when no element is found
This CL also changes tests to favor `waitFor` over `$` per default:
In all tests where an element is expected `$` is changed to `waitFor`.
This should be uproblematic in all the cases where an element is
expected to exist immediately, but gives a bit of leeway in case the
element is slow to emerge. Typing wise, `waitFor` never returns null
since it throws if no element is found before it times out.

Change-Id: I00b722eff34df44402d9f3bf6786432c9faf1505
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2327710
Commit-Queue: Mathias Bynens <mathias@chromium.org>
Reviewed-by: Changhao Han <changhaohan@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-08-04 14:43:13 +00:00
Johan Bay e8245718be Use custom query handlers to implement $ and $$ in test/shared/helper.ts
Change-Id: I7c2ea2e6250bea1d15caaf1d341c56b7b2448e9b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2317870
Commit-Queue: Mathias Bynens <mathias@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Changhao Han <changhaohan@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
2020-08-04 14:05:13 +00:00
Patrick Brosset 0805f4a033 Shared goToResource e2e helper to simplify tests
This introduces a new goToResource shared helper for all e2e puppeteer
tests to use.
It helps simplify a bunch of tests and other helpers in that they don't
need to replicate the `${resourcesPath}/some/file.html` part.
Because this helper also knows how to get hold of the target on its own
it also further simplifies other tests that don't need to import it
anymore.

The next step would be to create a shared helper that knows how to
navigate to panels inside the DevTools front-end as this is also
duplicated across tests.

Bug: 1091226
Change-Id: I717455a51dec30e153d796ef101eab3d42bc2da1
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2230320
Commit-Queue: Patrick Brosset <patrick.brosset@microsoft.com>
Reviewed-by: Jan Scheffler <janscheffler@chromium.org>
Reviewed-by: Jose Leal <joselea@microsoft.com>
2020-06-11 09:52:45 +00:00
Tim van der Lippe d76dbd1fe3 Add node_ts_library for Node scripts
ts_library by default uses ES modules. However, Node doesn't fully
support ES modules yet, nor do our dependencies for our e2e-tests
support them fully. Therefore, transpile to commonjs for now, if
running in Node.

DISABLE_THIRD_PARTY_CHECK=Fixes to ts_library
R=aerotwist@chromium.org,jacktfranklin@chromium.org

Bug: 1088463
Change-Id: Ie6acf886417b80eb38365f9c2377799e370634fe
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2224805
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2020-06-02 10:24:00 +00:00
Jack Franklin a1064d4e1d Sort expected files in search results e2e test
To fix e2e flakes where the ordering may differ, such as:

https://logs.chromium.org/logs/devtools-frontend/buildbucket/cr-buildbucket.appspot.com/8879147594763513568/+/steps/E2E_tests/0/stdout

Change-Id: I66ae32b5ec6adea897d104d354a31e044ce9fc8e
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2218009
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2020-05-27 14:45:46 +00:00
Tim van der Lippe 869374bcab Port shared test runner logic into separate package
The shared test runner logic was reimplementing parts of Mocha,
in particular the test logging and filtering. Moreover, it was
booting the hosted mode server and puppeteer outside of Mocha.

Mocha supports root level hooks [1]. These hooks allow us to
perform work before a test starts. Moreover, by using the
before and after hook, we can run logic before and after
all tests.

By using these hooks, we can extract the "boot the hosted mode
server and hookup puppeteer" part to these root hooks.
Additionally, we can reset the pages in the `beforeEach`, which
means that tests themselves don't have to reset the pages.

We also put the implementation code into third_party/conductor,
as we would like to reuse this logic for the Puppeteer tests.
The Puppeteer test suite now also uses Mocha and has very
similar requirements as to our DevTools tests. By extracting
from DevTools, we can look into expanding the test runner to
other usecases, but that is out of scope for now.

[1]: https://mochajs.org/#root-level-hooks

Bug: 1071369

Change-Id: Ie9f954359d9de84da564b74b6f5517dd535db008
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2150458
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-04-20 10:32:58 +00:00
Tim van der Lippe 77750704ab Rename e2e test files
This allows us to efficiently glob the files based on the
`*_test.js` pattern.

Bug: 1071369

R=aerotwist@chromium.org

Change-Id: I0ba1af79d66cc146deb2301c6d398da7cf0bcd02
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2151453
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
2020-04-16 15:47:19 +00:00
Tim van der Lippe 18ab47bc33 Typecheck all e2e tests with TypeScript
R=aerotwist@chromium.org

Bug: 1011811
Change-Id: I2045f0980a522a3fb63e1881c2b968a2170ec57f
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2112557
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-03-23 13:02:11 +00:00
Al Muthanna Athamina e8b5b9a589 Move all helper functions to one folder
This CL attempts to move all helper
functions to one folder so they can
be more easily maintained.

Change-Id: I2acb755b220240d84f3b105d210d6b7984251440
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2083315
Commit-Queue: Almothana Athamneh <almuthanna@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-03-03 09:20:28 +00:00
Paul Lewis 36122adbd3 [e2e] Migrate http/tests/devtools/search/sources-search-scope.js to e2e
Original test at https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/web_tests/http/tests/devtools/search/sources-search-scope.js;l=1;drc=77578ccb4082ae20a9326d9e673225f1189ebb63?originalUrl=https:%2F%2Fcs.chromium.org%2F

Bug: 1032561, 1046784
Change-Id: I3ba6790afedbb88ffbb0f79e8543d6d5440d9fb0
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2078234
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-02-28 12:35:48 +00:00