Commit Graph
92 Commits
Author SHA1 Message Date
Alex Rudenko c9f76ea16b Capture page screenshot on e2e timeout errors
This CL adds capturing of the target page and the frontend screenshots
when a timeout occurs. The screenshots are printed to stderr as data URLs
and can be opened in a web browser directly.

Also-By: pfaffe@chromium.org
Change-Id: I58f731bd0a8d71565e1160699e1003b08361f073
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2571124
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
2020-12-03 14:39:33 +00:00
Jack Franklin 3b3a782f3a Enable interaction tests
This CL introduces the infrastructure and first test for what we're calling
"Interaction tests". These are tests that can be used to test component
behaviour that cannot be tested via Karma unit tests but don't require an e2e
test either.

The best example here is complex user interactions: clicking and dragging a
mouse, or doing multiple tabs to navigate through the UI.

Note that the one interaction test added here for theme_colors isn't the best
example of a complex test, but it's a test that's good enough for now whilst we
get everything set up on infrastructure and make sure it runs without flaking.

Bug: 1153281
Change-Id: Ifb37639a557c459974f703b8954ae68a93d5d368
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2566808
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-12-03 10:44:22 +00:00
Tim van der Lippe 75c2c9cff5 Disable @typescript-eslint/no-unused-vars
The newest version of @typescript-eslint errors on declare globals.
While this is usually good to point out, we have legitimate usages
of these statements. Based on the discussion in
https://github.com/typescript-eslint/typescript-eslint/issues/2519
it seems unlikely this will be fixed anytime soon. Therefore, let's
disable these specific lines to unblock our upgrade of the linter.

R=jacktfranklin@chromium.org

Change-Id: Iee6339428eef0d5496783850a9026fed00942bcb
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2566807
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
2020-12-01 13:18:25 +00:00
Philip Pfaffe 7426b000e3 [wasm debug] Fix propagating debug evaluate errors in language plugins
When debug evaluation hits exceptions in wasm debugging, the
LanguagePluginManager incorrectly propagated those errors, causing weird
warnings in the wrong places or warnings that are missing altogether.
This CL hooks up the plugin manager with the existing error reporting
mechanisms and includes a test to make sure the errors show up.

Drive-by: In the watch window, when evaluation failed, we previously
swallowed the actual exception. That's probably because most of the time
that exception is a reference error because variables aren't valid in
the current scope. This CL adds a tooltip that shows the exception.


Bug: chromium:1137514, chromium:1153315
Change-Id: Ia1ec81ce95598adf7abab8c4e31c3310e3669fb7
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2565376
Commit-Queue: Philip Pfaffe <pfaffe@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Auto-Submit: Philip Pfaffe <pfaffe@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
2020-11-30 16:34:10 +00:00
Jack Franklin 8d634c2cdf Update all enums to be const enums
We will land a rule soon that enforces const enums in the codebase. This
updates any non-const enums to be const enums and updates the tests
accordingly.

R=andoli@chromium.org

Bug: 1130536
Change-Id: I2221a948a88ec7328e7abc2b33f044d14aef73fb
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2562853
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Andres Olivares <andoli@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
2020-11-30 15:23:42 +00:00
Jack Franklin aba88003dc [ESLint] enforce enum members are explicitly initialized
As per the DevTools style guide; this was a rule enforced previously by
the component bridges.

Bug: 1130536
Change-Id: I281f2d355a78dedd0433b7967f7b26e2e71c8791
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2562348
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-11-26 17:03:13 +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 1319aa78f5 [tests] Don't print steps except for error cases
console.log() output is not buffered during parallel testing so it's
hard to associate the step() logging output with the test that
actually caused it. If we want to log stuff like this, we should find
a way to redirect it to the test reporter properly so that it gets
buffered per-test-file and printed all at once, like the describe/
it output is.

The step output probably isn't needed anymore as we have the AsyncScope
output which gives the source-mapped file name + line number in the
test output if there is an await failure, which is even more useful
than the step output.

If people find cases where we do really need this we can add it back,
the step function still exists for now.

Bug: 1101784
Change-Id: Ia90b6532ce348b189ee7c5f2e3ed482f074a6561
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2534207
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Almothana Athamneh <almuthanna@chromium.org>
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
2020-11-13 09:03:52 +00:00
Peter Marshall 6ab6932111 [tests] Re-export mocha functions properly in mocha-extensions
Directly re-exporting functions using the ES modules syntax is clearer.

There is also a bug in parallel mode where describe.skip does not work
in some circumstances, and this fixes it.

Bug: 1101784
Change-Id: Ia0f94f53d0846253c46f47234eefdde4ce212ec8
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2532243
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
2020-11-11 14:47:19 +00:00
Johan Bay f04b99c38e Remove redundant aria labels and update tests
crrev.com/c/2039270 introduced a redundant aria-label on every context
submenu for testing purposes. Now that Puppeteer supports querying the
AOM for computed name and role, we can use that instead and remove the
labels.

Change-Id: I883cd99ab5f289e5f50907336f4638bbcea57df4
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2516341
Commit-Queue: Johan Bay <jobay@google.com>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
2020-11-04 12:50:58 +00:00
Jack Lynch d529e88005 Reland "Settings: Add e2e tests for shortcuts tab"
This reverts commit f3b391e525.

Reason for revert: Some strings are different on mac, creating a reland to investigate a fix

Original change's description:
> Revert "Settings: Add e2e tests for shortcuts tab"
>
> This reverts commit 137f0a1b84.
>
> Reason for revert: Consistently fails on Mac Bot, first failure:
> https://logs.chromium.org/logs/devtools-frontend/buildbucket/cr-buildbucket.appspot.com/8864995173425920000/+/steps/E2E_tests/0/stdout
>
> Original change's description:
> > Settings: Add e2e tests for shortcuts tab
> >
> > This CL adds several end to end tests for the shortcuts settings tab,
> > including the keyboard shortcut editor.
> >
> > Bug: 174309
> > Change-Id: I293f233f9afde298cb618fbdbb6c9b147b895daf
> > Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2504790
> > Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
> > Reviewed-by: Patrick Brosset <patrick.brosset@microsoft.com>
> > Commit-Queue: Jack Lynch <jalyn@microsoft.com>
>
> TBR=jalyn@microsoft.com,tvanderlippe@chromium.org,patrick.brosset@microsoft.com
>
> # Not skipping CQ checks because original CL landed > 1 day ago.
>
> Bug: 174309
> Change-Id: Ie5ee124b3ad760dead6745e33591eb7578b69e88
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2512225
> Reviewed-by: Simon Zünd <szuend@chromium.org>
> Commit-Queue: Simon Zünd <szuend@chromium.org>

TBR=szuend@chromium.org,jalyn@microsoft.com,tvanderlippe@chromium.org,patrick.brosset@microsoft.com

# Not skipping CQ checks because this is a reland.

Bug: 174309
Change-Id: I8382dfab7a3e3a3dfaaa36e834d67636b33a6b9c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2512850
Reviewed-by: Jack Lynch <jalyn@microsoft.com>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Reviewed-by: Patrick Brosset <patrick.brosset@microsoft.com>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Jack Lynch <jalyn@microsoft.com>
2020-11-03 19:22:47 +00:00
Johan Bay b01fc265f3 Add optional handler argument to $, $$, and waitFor
This allows us to clean up the `textContent`-related helpers a bit,
and makes it easier to use the new `aria` handler in test scripts.

Change-Id: Ifb4b5a88109223b09034ca4ed1f40e54c6e76310
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2512236
Commit-Queue: Johan Bay <jobay@google.com>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
2020-11-03 07:59:16 +00:00
Johan Bay 5a41e47b6f Use Puppeteer's built-in pierce/ handler
Puppeteer now ships with a built-in handler for piercing shadow dom.
We can therefore get rid of our custom query handler that serves the same
purpose.

Change-Id: Id481f2c083e34e9e9976df72a8a7950290f6e923
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2512234
Commit-Queue: Johan Bay <jobay@google.com>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
2020-11-02 14:14:10 +00:00
Simon Zünd f3b391e525 Revert "Settings: Add e2e tests for shortcuts tab"
This reverts commit 137f0a1b84.

Reason for revert: Consistently fails on Mac Bot, first failure:
https://logs.chromium.org/logs/devtools-frontend/buildbucket/cr-buildbucket.appspot.com/8864995173425920000/+/steps/E2E_tests/0/stdout

Original change's description:
> Settings: Add e2e tests for shortcuts tab
>
> This CL adds several end to end tests for the shortcuts settings tab,
> including the keyboard shortcut editor.
>
> Bug: 174309
> Change-Id: I293f233f9afde298cb618fbdbb6c9b147b895daf
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2504790
> Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
> Reviewed-by: Patrick Brosset <patrick.brosset@microsoft.com>
> Commit-Queue: Jack Lynch <jalyn@microsoft.com>

TBR=jalyn@microsoft.com,tvanderlippe@chromium.org,patrick.brosset@microsoft.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 174309
Change-Id: Ie5ee124b3ad760dead6745e33591eb7578b69e88
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2512225
Reviewed-by: Simon Zünd <szuend@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
2020-11-02 07:37:30 +00:00
Jack Lynch 137f0a1b84 Settings: Add e2e tests for shortcuts tab
This CL adds several end to end tests for the shortcuts settings tab,
including the keyboard shortcut editor.

Bug: 174309
Change-Id: I293f233f9afde298cb618fbdbb6c9b147b895daf
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2504790
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Patrick Brosset <patrick.brosset@microsoft.com>
Commit-Queue: Jack Lynch <jalyn@microsoft.com>
2020-10-30 17:26:39 +00:00
Philip Pfaffe 1e8f608def Add a DebuggerPaused DOM event and some tooling to await it in tests
I will use it to get rid of a timeout() in the sources panel tests, but
that will be a followup CL to simplify reverting it if necessary.

Change-Id: I4362135e1dac306d67f29474d1d6aea4ef0f1102
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2498224
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
2020-10-28 10:29:44 +00:00
Jesus David Garcia Gomez 9103d0e4fc Fix enum sending telemetry for issues panel opened resource.
This CL fix the event fired for the histogram IssuesPanelResourceOpened.

Bug: 1135327
Change-Id: Ifea9e0ed53aeda0a4017ecc17d9e82d745e62e88
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2451470
Commit-Queue: Jesus David Garcia Gomez <jegarc@microsoft.com>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Patrick Brosset <patrick.brosset@microsoft.com>
2020-10-12 23:07:28 +00:00
Tim van der Lippe e9b8e99658 Add component hooks to conductor
These will be used in the tests for the style component. We are checking
these helpers/infra in before landing the component, to figure out how
to hook up the tests. I expect the `component_hooks.ts` to be refactored
away, but kept it now for ease of debugging/plumbing.

Bug:1126047
Change-Id: Ia01e16e66b22c353016313636f20f7d0745aac9e
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2406162
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-09-23 08:35:24 +00:00
Jack Franklin b811a7fcc0 Make it.repeat also do it.only
If you want to run a test multiple times, it's a safe assumption that
you don't care about the rest of the test suite while you're doing that.
So by default when someone uses it.repeat we should also isolate it with
it.only.

Change-Id: I71abba82c1c87a595924b4c12a1ed7af312b4bcf
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2406161
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
2020-09-14 16:03:59 +00:00
Jack Franklin f56bc382ec Migrate devtools-active-dom-objects heap layout test
Bug:  1110817
Change-Id: I38bb4d748f5f70388b7b0808090498929462928a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2406156
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
2020-09-11 14:24:44 +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
Peter Marshall 4cafd236c0 tests: Add an it.repeat() helper
it.repeat() is helpful for fixing flaky tests.

Along with repeat, we also have the async tracing which is very helpful
for debugging tests that timeout due to hanging async operations. We
want to make all of these helpers available by default.

This CL introduces a new file mocha-extensions and adds both of these
customizations to the default mocha operations and then re-exports them.

In the future, all tests will import from mocha-extensions instead to
get these extensions by default. We will add lint rules to ensure that
callers don't import from mocha directly and miss out on these.

Bug: 1101782
Change-Id: I15dbb71493e60064288bfc050ac3f818a5c6821f
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2339319
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
2020-08-14 09:10:47 +00:00
Simon Zünd f3cd1098d0 Revert "Reland "eliminate initial timeout in waitForFunction""
This reverts commit a26e3406c7.

Reason for revert: Still causes flakes on the Mac bot.
Example: https://ci.chromium.org/p/devtools-frontend/builders/ci/Stand-alone%20Mac/475

Original change's description:
> Reland "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. 5:05 minutes to an avg. of 4:19 minutes.
> This amounts to a ~46 s reduction or ~15%.
> This is a reland of 3be2087f9d
> 
> Bug: 1112692
> Change-Id: Id92542de85920f95bb922d1b62ddfb63b83a055a
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2346366
> Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
> Reviewed-by: Changhao Han <changhaohan@chromium.org>
> Reviewed-by: Mathias Bynens <mathias@chromium.org>
> Commit-Queue: Johan Bay <jobay@google.com>

TBR=mathias@chromium.org,changhaohan@chromium.org,jacktfranklin@chromium.org,jobay@google.com

Change-Id: I607b04d929ec32dd518d3b6c472747a9e2e687b3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1112692
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2352727
Reviewed-by: Simon Zünd <szuend@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
2020-08-13 08:49:02 +00:00
Johan Bay a26e3406c7 Reland "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. 5:05 minutes to an avg. of 4:19 minutes.
This amounts to a ~46 s reduction or ~15%.
This is a reland of 3be2087f9d

Bug: 1112692
Change-Id: Id92542de85920f95bb922d1b62ddfb63b83a055a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2346366
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Changhao Han <changhaohan@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Commit-Queue: Johan Bay <jobay@google.com>
2020-08-13 08:09:10 +00:00
Maksim Sadym 4d2e095852 e2e tests for Idle Emulation
Blocked by
https://bugs.chromium.org/p/chromium/issues/detail?id=1113202

Bug: 1090802
Change-Id: Icebb86770dcde77bc267470cc26426b2439f9164
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2335279
Commit-Queue: Maksim Sadym <sadym@chromium.org>
Reviewed-by: Changhao Han <changhaohan@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
2020-08-06 09:24:37 +00:00
Sigurd Schneider d12b93955a Revert "Eliminate initial timeout in waitForFunction"
This reverts commit 3be2087f9d.

Reason for revert: Causes a lot of flakes on the devtools waterfall,
see commit 3be2087f (this CL) and the following CLs.

This is a difficult change, because discovering all test that needs
fixing is difficult. Please do land-revert-reland cycles until we've
fixed all tests. Analyzing the redness referenced above will reveal
more tests that needs fixing.

Original change's description:
> Eliminate initial timeout in waitForFunction
>
> Bug: 1112692
> Change-Id: I28bc29b0f5c2af55d3cf54614fe4d6641b64dd76
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2336716
> Reviewed-by: Mathias Bynens <mathias@chromium.org>
> Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
> Reviewed-by: Changhao Han <changhaohan@chromium.org>
> Commit-Queue: Changhao Han <changhaohan@chromium.org>
> Commit-Queue: Mathias Bynens <mathias@chromium.org>

TBR=mathias@chromium.org,changhaohan@chromium.org,jacktfranklin@chromium.org,jobay@google.com

Change-Id: Id7dd3cf313cf4a74e758c28aed5400517bc5f2a6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1112692
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2339526
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
2020-08-06 08:24:49 +00:00
Johan Bay 3be2087f9d Eliminate initial timeout in waitForFunction
Bug: 1112692
Change-Id: I28bc29b0f5c2af55d3cf54614fe4d6641b64dd76
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2336716
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Changhao Han <changhaohan@chromium.org>
Commit-Queue: Changhao Han <changhaohan@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
2020-08-05 17:24:16 +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
Philip Pfaffe 6d143ae8af [e2e] Introduce AsyncScope and remove timeout settings in test helpers
AsyncScope objects allow tracking of the current stack trace during
chains of calls to test helpers. Recording stack traces allows us to
report pending helpers when a mocha timeout occurs.

The CL also introduces an AsyncTrace help that tests use to opt into
stack tracing. Wrapping the mocha it() call is necessary to hook into the
processing of the timeout. I export the AsyncTrace helper for clarity,
but we can also wrap mocha's it() directly into our own it() wrapper to
provide a drop-in replacement. AsyncTrace's it() allows configuring the
mocha timeout locally per test. We can chose to not do that and configure
it globally, or alternatively define standard timeouts for 'fast',
'regular', or 'slow' tests.

Change-Id: I9542cdfdd78a1868a9f0fa56b8d112bd549e6f34
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2328845
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
Commit-Queue: Philip Pfaffe <pfaffe@chromium.org>
2020-08-03 13:49:07 +00:00
Paul Lewis 839037fe83 [TypeScript] disallow explicit any
This CL explicitly disallows use of the `any` keyword via eslint. This
is to make sure we don't accidentally miss typing info. This CL also
adds eslint-ignore statements for existing uses of any (mostly in tests)
as well as fixing a few cases where the types were simple enough to add
quickly.

R=jacktfranklin@chromium.org

Change-Id: Ia913a30d63c1ae3d969785af332a8dde512cc275
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2308544
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
2020-07-21 14:31:32 +00:00
Peter Marshall c059be1548 tests: Always specify a timeout for waitFor/Function
If we use a local timeout rather than letting this timeout the whole
mocha process, we get a way better error message which includes
info about the selector/function/whatever we care about, and the
step name. Without this we just get the test file name and nothing
else.

Change-Id: Ia2882fb123a6f2b582c0dd19f3f01135b496161a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2292276
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
2020-07-20 10:26:19 +00:00
Peter Marshall c16cedd67c tests: Don't hardcode the hosted mode server port number
(...in more than one place).

Lots of tests relied on the hosted mode server using port 8090 which
is not going to be the case once we have the parallel mocha runner
working.

Add the port number to puppeteer-state and have tests use it by
going through test/shared/helper.ts.

The port number is set at runtime rather than being a module-time
constant, so some users of the port needed to be changed to get it
after the root hooks ran instead. Future users should follow this
pattern and get the port in a before() block or during the test
itself. Or just use helpers that treat the port properly already
e.g. goToResource.

We don't send this port number to the hosted mode server yet,
so we still have this hardcoded in two places. A fix is coming in
a future CL.

Bug: 1101784
Change-Id: Ib0a7aa7a25db58d06624a1cdee6fa630cdfbe362
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2284828
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-07-07 15:43:22 +00:00
Eric Leese 66342552ce Add helpers for debugging and snippet tests
Changes include:
 - Test server handles URLs with escaping better.
 - Logging from DevTools frontend now logged by the test.
 - Helper to turn on CDP logging - for debugging only.
 - click helper improved to allow specifying maximum distance from
   left, for when an element extends far beyond its containing
   element.
 - New pressKey helper that makes keyboard shortcuts easy.
 - Helpers to modify and save a source pane and to get the text of
   the line of code where we are stopped.

Bug: 1094436
Change-Id: I389eaa680bb0771a45104f470647f67b4fa5d1d9
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2282811
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Eric Leese <leese@chromium.org>
2020-07-07 13:45:42 +00:00
Jose Leal Chapa 50e7bb5309 DevTools personalization - Make Security tab closeable
To be careful of not introducing breaking changes the closeable tabs work will be staggered in different CLs.
Each CL will target one single panel and will include new e2e tests that will validate:
- the panel is open by default
- the panel exists under More tools
- Closing the tab doesn't crash the devtools
- Reopening devtools persist the newly closed tab

Gif: https://imgur.com/a/LXM0ndg

Explainer:
https://docs.google.com/document/d/1TC1FxzSgRIaXmChpjL05T7sZuduRos3IDPDG5vCS1Oc/edit?usp=sharing

Overall layout personalization explainer:
https://docs.google.com/document/d/1oYBh3QeucgEV-n8BYDU_J-2wcLA4Kg1yku4jDDMcsro/edit?usp=sharing

Bug: 1074732
Change-Id: Idf4ef206c5a8b10fa73c2369394ec1ff09976e97
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2167137
Commit-Queue: Jose Leal <joselea@microsoft.com>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Brandon Goddard <brgoddar@microsoft.com>
Reviewed-by: Jack Lynch <jalyn@microsoft.com>
Reviewed-by: Robert Paveza <Rob.Paveza@microsoft.com>
2020-06-19 17:34:41 +00:00
Songtao Xia 67f65da531 [e2e] Tests for dual screen emulation.
Test the experimental feature of dual screen emulation.

Test the dual screen span mode exists for a dual screen device but
not for a non-dual-screen device.

Change-Id: I72b0cb4e77bb58305f112b32fd7b040436ec42c9
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2225335
Commit-Queue: Songtao Xia <soxia@microsoft.com>
Reviewed-by: John Emau <John.Emau@microsoft.com>
Reviewed-by: Jose Leal <joselea@microsoft.com>
2020-06-11 18:13:05 +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 421827d590 Add ninja template for copying to the gen folder
We are doing this so often and the syntax for the `outputs` arg
is difficult to remember, I figured it is better to extract out
a template. This should make it easier to copy-paste from other
BUILD.gn files as well.

R=aerotwist@chromium.org,jacktfranklin@chromium.org

Bug: 1088463
Change-Id: Ic78ee5082ee5eae4e07f7ceeb21842f54dcbaf56
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2224807
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-06-02 10:38:50 +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
Almothana Athamneh f55afd74b6 Convert Layout test for long trace trimming
This CL attempts to convert the Layout test
that tests the truncation of long messages
to a Mocha test that follows the new guidlines.

Converted Layout test can be found here: https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/web_tests/http/tests/devtools/console/console-trim-long-traces.js

Change-Id: Ie75f69c04c562a7572c232474eaaaf049bb30f1a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2218007
Commit-Queue: Almothana Athamneh <almuthanna@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-05-28 13:51:10 +00:00
Jose Leal Chapa dd4d881300 End to end tests: Add cross tool integration tests
Bug: 1079076
Change-Id: I588fd64e5d724c1203db7b072ffc01739962941a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2186850
Reviewed-by: Robert Paveza <Rob.Paveza@microsoft.com>
Commit-Queue: Jose Leal <joselea@microsoft.com>
2020-05-21 19:13:31 +00:00
Al Muthanna Athamina 889cecf7f4 Add the Step function with an example
This CL attempts to add the step function
which should help with documenting the E2E
tests with the session-storage_test an example.

Change-Id: Ib993c060c74199e85a362b67395933636ea0a1b9
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2159517
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Almothana Athamneh <almuthanna@chromium.org>
2020-04-22 15:00:19 +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
Paul Lewis 7108574e87 [e2e] Fails tests on in-page errors
Change-Id: Iba880410eab9d154d0d236b70eb7895963e252ed
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2130793
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Auto-Submit: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-04-01 13:09:09 +00:00
Ted Meyer 7e5ebf014b Adds End2End test for the Media tab.
I had to add support for running the tests with chromium
--enable-features flags. This isn't on by default though, I'll leave
that up to you to turn on. The tests just exit early if the flag isn't
present.

Change-Id: I132ca71796d8f069a6fba0342f10f2f2b18c7b62
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2125249
Commit-Queue: Ted Meyer <tmathmeyer@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-03-31 16:29:03 +00:00
Tim van der Lippe 0ccd8de267 Fix logging of page errors in e2e-test
This will now properly show up the errors if they are thrown in
an e2e-test:

Page Error in Frontend
Error: Error: Error from sdk-legacy.js
    at http://localhost:8090/front_end/sdk/sdk-legacy.js:249:7
Page Error in Frontend
Error: Error: Error from sdk-legacy.js
    at http://localhost:8090/front_end/sdk/sdk-legacy.js:249:7
Worker (17606): /Users/tvanderlippe/Projects/devtools/devtools-frontend/test/e2e/elements/sidebar-event-listeners-remove.js

R=aerotwist@chromium.org

Change-Id: Ia171bdffc4fb28591b40277c33861ce392516d09
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2124489
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-03-30 11:33:52 +00:00
Paul Lewis ca9a03f92f [e2e] Adds various helpers; tidies up env vars
Change-Id: I0babf1394d62f37628c8812f9b593b40d03a30da
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2124491
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-03-27 17:39:36 +00:00
Jack Franklin 60f529d224 Expand event listener e2e tests
This CL adds a test for listing properties of a custom event.

Bug: 1044632
Change-Id: Ibf08173ba878d68b3877399cd0e21794a9581ff2
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2122142
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-03-27 14:10:31 +00:00
Paul Lewis 417c5c06b2 [e2e] Adds support for logs and errors
This CL adds support for piping through stderr from the workers, and
adds an extra helper for logging messages from the worker to the master
process.

Change-Id: I39c31e8150456df12635f951fc6015a0bbe59960
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2123479
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Auto-Submit: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-03-27 12:19:31 +00:00
Paul Lewis 7234471130 [e2e] Adds support for setting a timeout
This CL allows the setting of a TIMEOUT env variable to control test
timeout values.

Includes a drive-by fix on only outputting actual and expected values
when they are set.

Bug: 1062614
Change-Id: Idf444778a8a7292052a489a758b57bd2cfac81f9
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2123470
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
2020-03-27 12:18:01 +00:00