This CL is a preparatory refactoring. In the future, we want to load
DevTools from a different origin than `localhost` to increase
isolation between test runs (e.g. no shared window.localStorage).
To get there, we have to change how the extension tests load the
actual extension code. The extension must be served from the same
origin as the DevTools frontend. Currently this CL is a no-op, as
both resources and the DevTools frontend are served from 'localhost'.
R=pfaffe@chromium.org
Bug: 1297458
Change-Id: Iedee09d8cdd992f64132add78537428e9e4ab7ae
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3466036
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
This CL fixes a long-standing disabled l10n test. Initially we didn't
have a 'language' setting so we had to use the emulation feature
to simulate setting `navigator.language`. Finally, this is not how
we solved l10n for DevTools.
This CL adds a new helper that allows setting settings via the
Host API and uses it to make sure that the pseudo local is loaded
and applied correctly.
R=alexrudenko@chromium.org
Bug: 1163928
Change-Id: I1873ed38c9c6ef95ae87b281292e210363764211
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3466035
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
This is extracted from https://crrev.com/c/3330076/36
This is to fix interactions test failure like
```
1) shows cookies even when navigating to an unreachable page (crbug.com/1047348)
(node:3756728) Warning: Accessing non-existent property 'AsyncScope' of module exports inside circular dependency
at emitCircularRequireWarning (node:internal/modules/cjs/loader:707:11)
at Object.get (node:internal/modules/cjs/loader:721:5)
at waitFor (/usr/local/google/home/tikuta/devtools/devtools-frontend/test/shared/helper.ts:228:67)
at getElementPosition (/usr/local/google/home/tikuta/devtools/devtools-frontend/test/shared/helper.ts:57:21)
at click (/usr/local/google/home/tikuta/devtools/devtools-frontend/test/shared/helper.ts:104:13)
at navigateToApplicationTab (/usr/local/google/home/tikuta/devtools/devtools-frontend/test/e2e/helpers/application-helpers.ts:11:9)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at Context.<anonymous> (/usr/local/google/home/tikuta/devtools/devtools-frontend/test/e2e/application/cookies_test.ts:29:5)
```
when we use esbuild.
Bug: 1278663
Change-Id: I9e3ab2d19c4daa56c87e3f77ac917a13d32a7c24
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3394445
Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Tim Van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Tim Van der Lippe <tvanderlippe@chromium.org>
The click event only fires for elements that receive both a mousedown
and a mouseup event. Since DataGrid elements in the Network panel get
replaced every time a message is received on WebSockets, the click
event doesn't get fired if you click before a message and release after
the message. To fix this we'll listen for the mousedown event instead.
This has the added benefit that the request panel becomes visible
sooner, making it feel more responsive.
Fixed: 1222382
Change-Id: Ia44c47a90b4822530081caf63aec682e9f32186c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3293092
Reviewed-by: Simon Zünd <szuend@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
This change is required to prevent a test timing out when we await the
coordinator being done when actually that work is already done.
Previously the helper would add a listener for the `rendererqueueempty`
event but if the work had been completed by then, the event would never
fire and the test would time out.
Now we expose globally a function to return the count of pending events
and the interaction/e2e test helper will check if that returns `0`, and
if so, resolve, before then adding the event listener.
This means a test that waits for work where that work has actually
already happened will now correctly resolve and continue, whereas before
it would time out indefinitely.
Bug: none
Change-Id: I43243bcc9002c9e97f476a66ed3f42c7313f7fcd
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3198872
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
`assertNotNull()` of `undefined` does not cause the test to fail,
whereas `assertNotNullOrUndefined()` does.
Because of import restrictions, platform.js's
`assertNotNullOrUndefined()` is copied to helper.ts.
Bug: 1072335
Change-Id: Iaa56492c2f58f735cb93b434f6a73c65cdb740c5
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3057046
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Commit-Queue: Wolfgang Beyer <wolfi@chromium.org>
When an e2e test times out, running promises aren't aborted. Instead,
any errors that are thrown are silently swallowed. When not being
careful, in-flight promises can still mess up state, or even never
detect timeouts. waitForFunction is especially vulnerable to this,
because it's running an infinite loop inside the test process. This CL
extends AsyncScopes to carry a flag when a timeout was triggered, which
allows waitForFunction to bail.
Bug: none
Change-Id: I30ebcc45419c4000a1b2a25096ca1211bf2400a0
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2978374
Auto-Submit: Philip Pfaffe <pfaffe@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
Commit-Queue: Philip Pfaffe <pfaffe@chromium.org>
Previously, if inline CSS had a sourcemap attached, we'd assume that the
sourcemap maps HTML document locations instead of locations relative
to the start of the CSS style tag. This CL adds logic that checks for
inline CSS whether the sourcemap maps the origin location (0,0), and if
so, uses locations relative to the style tag to index the sourcemap.
This preserves the previous behavior for non-inline CSS, and for inline
CSS if the sourcemap doesn't map the origin coordinates.
Bug: chromium:787792
Change-Id: I92c107dc652cc377371dceb8c523d4788f2532bc
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2859907
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
To make it easier to import from a helper without relying on Node
resolution. This CL only adds the export; if I update all imports to
use it we get a circular dep of:
test/shared:shared =>
test/conductor:implementation =>
test/shared:shared
So I will do some thinking about the best way to break that chain in a
follow-up CL (logged crbug.com/1193946).
Bug:1192498
Change-Id: Ia4d85be76a8018c41d9697e0cb9eda8ca556164e
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2792584
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
This reverts commit 7742a201a1.
Reason for revert: We do have a use case for this flag that we missed, so we need it. Will follow-up with a CL to fix the fact that the test frontend infra doesn't use it currently.
Original change's description:
> [TestRunner] remove --chrome-features flag
>
> The scripts (both the old Python one and the new JS one) took
> `--chrome-features` as a flag, which was then set as
> `process.env.CHROME_FEATURES`, however searching the codebase for
> `CHROME_FEATURES` revealed that whilst we set this value, we never
> read it. Therefore this CL removes it entirely, my logic being that if
> someone needed this flag to work, we would have found this bug a long
> time ago.
>
> We can reintroduce should we find a usecase for it in the future.
>
> Bug: chromium:1186163
> Change-Id: I11d900df4aaad232fd64b9edca2aac12c94fc988
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2782555
> Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
> Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
> Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
Bug: chromium:1186163
Change-Id: I336a4a14a3e720f3b0626d78148038ceab9a8774
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2786942
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
The scripts (both the old Python one and the new JS one) took
`--chrome-features` as a flag, which was then set as
`process.env.CHROME_FEATURES`, however searching the codebase for
`CHROME_FEATURES` revealed that whilst we set this value, we never
read it. Therefore this CL removes it entirely, my logic being that if
someone needed this flag to work, we would have found this bug a long
time ago.
We can reintroduce should we find a usecase for it in the future.
Bug: chromium:1186163
Change-Id: I11d900df4aaad232fd64b9edca2aac12c94fc988
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2782555
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
Note that the actual reporting is blocked on infra changes
(more specifically our bots need to migrate to LUIC realms), before
ResultsDB is available on our bots.
Nonetheless, this change can already land. As per official guidance
no runtime flags etc should be used, but only whether the LUCI_CONTEXT
environment variable is available.
R=tvanderlippe@chromium.org
Bug: chromium:1186570
Change-Id: I2974f8b3b68f4c42c8d4ae9309ebf7ca8f58ccb4
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2748084
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
This CL configures custom host resolver rules for the Chromium binary
that puppeteer is using to run e2e test.
With host resolver rules, all resources can now be loaded via
arbitrary '.test' domains while still being served from localhost.
E.g. an e2e test might navigate to 'devtools.test/foo.html' while
also including an iframe with Url 'bar.test/iframe.html', with both
files being served from localhost.
This unlocks testing for a whole class of features that was
previoulsy impossible to test.
This CL also adds a new helper 'goToResourceWithCustomHost', that
supplements the existing 'goToResource' with a modifiable host part.
R=aerotwist@chromium.org, sigurds@chromium.org
Bug: chromium:1177676
Change-Id: I1f51aa8419619e11352989457b24cc56cfc78e52
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2692148
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
When tests fail, debugging the failure includes isolating the test
before opening it in debug mode or adding diagnostics to it. With the
current test output, opening the file is surprisingly tedious, since
there is no direct way to map test log output to the tests on the
filesystem. One has to grep the test directory for test names first.
This CL wraps Mocha's describe function to automatically include the
test filename into the test title in a format that can be copy-pasted
into the test runner's --test-file argument.
Bug: none
Change-Id: I172bd14f5026ec0041b933c64bcdcccf58536fb9
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2681741
Commit-Queue: Philip Pfaffe <pfaffe@chromium.org>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
Auto-Submit: Philip Pfaffe <pfaffe@chromium.org>
This CL adds the logic to trigger contrast checks on DevTools
startup or on page load events. The check is only triggered if
the corresponding experiment (contrastIssues) is enabled.
Deduplication of the reported issues happens in the IssueManager
on the frontend since the same issue might be reported twice
if there are multiple documents on the target page.
Bug: chromium:1155460
Change-Id: Ib0d5115c527ceb9da9d2ed2dfa48cfdca6f82f60
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2573360
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>