Commit Graph
160 Commits
Author SHA1 Message Date
Alex Rudenko fd136e001e Rename DEBUG env var to DEBUG_TEST
Currently, you cannot run tests in non-debug mode
and turn on debug logging from Puppeteer that relies
on https://www.npmjs.com/package/debug.

Running `DEBUG=puppeteer.* ...` would also start the
test runner in a debug and non headless mode. This
CL renames the DEBUG variable that DevTools test runner
relies on so that debug logging is independent from the
debug mode we have for tests.

Bug: none
Change-Id: I8b8476f7c26c07eea1db29bfae74d4fb61afd42c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2963755
Reviewed-by: Simon Zünd <szuend@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jan Scheffler <janscheffler@chromium.org>
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
2021-06-16 12:47:15 +00:00
Tim van der Lippe 8b929548c0 Also add license headers for .gni files
R=jacktfranklin@chromium.org

Bug: 1213449
Change-Id: I3228629bbaa1c3824a721a93782356ec71855513
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2919951
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-05-26 16:19:23 +00:00
Tim van der Lippe 81752507db Integrate license header check in PRESUBMIT
Also fix the script to only allow absolute paths, since the presubmit
script handles absolute paths only.

R=jacktfranklin@chromium.org

Bug: 1213449
Change-Id: Id1c0c55ec1c039eadd343445645655910b06da8c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2919950
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2021-05-26 15:06:53 +00:00
Tim van der Lippe 1dc9ecb63c Add script to check license headers for BUILD.gn files
The script currently processes all BUILD.gn files in the
top level directories and automatically adds the required
license header if missing.

In a follow-up CL the script will be integrated in the
PRESUBMIT.py.

R=jacktfranklin@chromium.org

Bug: 1213449
Change-Id: Ifea17b0fd3301158c098513d0cc9d7d7c50e3fe3
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2919948
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>
2021-05-26 14:38:55 +00:00
Jan Scheffler 0f14e2b82c [Unit tests] Show html coverage results location
This cl informs developers where they can find the result when running
unittests with the html coverage report enabled.

Bug: None
Change-Id: Id6784d9070fc2ad1f1be2a1da58b0d5baf174f8a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2912102
Commit-Queue: Jan Scheffler <janscheffler@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-05-25 08:58:53 +00:00
Jan Scheffler ef7787df1a [Unit tests] Improve output for unit tests
This change replaces the 'spec' report with a 'mocha' report in karma
when the '--expanded-reporting' flag is set. If it is not set and the
tests fail, a hint is added to the console to enable the flag to get a
more verbose output of why the tests are failing.

Bug:None
Change-Id: Ia41615362332459a4d89aef0440cea0ec266157b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2912098
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Jan Scheffler <janscheffler@chromium.org>
2021-05-25 08:26:23 +00:00
Tim van der Lippe 7460028f70 Update run_test_suite to pass on coverage flag
When running `run_test_suite.js` you can now specify `--coverage`
to allow for coverage collection. This will used by the CQ
scripts to collect coverage for interactions tests.

R=jacktfranklin@chromium.org
CC=liviurau@chromium.org

Bug: 1206705
Change-Id: I555662f02efbf16165f1c8b3e47403e427d65a0a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2884241
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2021-05-11 09:29:08 +00:00
Tim van der Lippe baa6dec654 Add script to merge unit and interaction test coverage
This script can be invoked to obtain the coverage from the unit
and interaction tests and writes them to a coverage-summary.json
file that lives in `test/`. This file can then be used in favor of
karma-coverage/coverage-summary.json to upload to the Chromium
infrastructure.

As a follow-up, we should turn on coverage collection on CQ and
hook up this script after both unit and interaction tests have
completed.

R=jacktfranklin@chromium.org
CC=liviurau@chromium.org

Bug: 1206705
Change-Id: I52199940d6747ec13f208233e04dcf81a618a8fb
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2884240
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2021-05-11 09:19:48 +00:00
Tim van der Lippe e622f55864 Move component_docs to ui/components/docs
R=jacktfranklin@chromium.org

Bug: 1187573
Change-Id: I2f8225ba1b9fc9848cf497ec0235756ace0f4831
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2826290
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-04-14 15:08:31 +00:00
Jack Franklin 95126a863b [TestRunner] support --test-file-pattern as a positional arg.
Bug: chromium:1186163
Change-Id: Ib485321ba38860b9640f143f5cba008bdfa52bf6
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2794955
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Philip Pfaffe <pfaffe@chromium.org>
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
2021-03-31 12:18:13 +00:00
Jack Franklin e61c02b806 [TestRunner] Make Conductor use --chrome-features flag.
This CL fixes a bug where the test runner took the `--chrome-features`
flag but Conductor never read that value when booting up a browser
instance.

This CL updates it so it will read the value and pass it into the
relevant argument when executing `puppeteer.launch`.

I also changed the Python test suite runner to not prepend
`--enable-features`; that feels like something that Conductor should
do, not the test runner.

Bug: chromium:1186163
Change-Id: I05916d39d60bb98a606570cd82e688581dd78a40
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2790874
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
2021-03-29 11:47:41 +00:00
Jack Franklin 4b34d9c8cf Revert "[TestRunner] remove --chrome-features flag"
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>
2021-03-25 14:02:21 +00:00
Jack Franklin 7742a201a1 [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>
2021-03-24 15:26:05 +00:00
Jack Franklin 1e39e4a268 [TestRunner] allow the e2e resources path to be configurable
Bug: chromium:1186163
Change-Id: I35031bd570f88de3b884da4e57cb9de5d00e5571
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2782551
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
2021-03-24 10:58:21 +00:00
Jack Franklin fa099cbaef [TestRunner] validate file paths on input
Bug: chromium:1186163
Change-Id: If1c73edeebc1e015314ed4250ef038a816bdbcf4
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2780793
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2021-03-23 11:28:59 +00:00
Jack Franklin a3dd06a3de Add test-suite-source-dir flag to new test runner
The current tests try to figure out the root directory and then glob
for _test.ts files within there, but this breaks easily if the folder
structure isn't exactly as expected. Instead we can set this via a
flag in the test runner.

This CL only updates the interaction tests, which use the new runner.
e2e tests will be supported in time.

Bug: chromium:1186163
Change-Id: I198b67bf0081ce7334c40d7d661fb8642c2d56d0
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2772045
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2021-03-18 11:19:17 +00:00
Jack Franklin 0e199ca69f [TestRunner] set test-server-type flag
This CL adds a flag to the new test runner to provide the test-server-type.

We intelligently set it if the test suite ends with `e2e` or
`interactions`, but otherwise it's required. Unfortunately this can't
be checked as part of Yargs' API, so we check for it ourselves at run
time.

Bug: chromium:1186163
Change-Id: I6487f1a95c6c86759e1489309d4c18aec1292073
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2767266
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2021-03-18 11:04:22 +00:00
Jack Franklin aa1d0c8587 [TestRunner] add flag for configuring DevTools root page.
That. Note that this currently isn't used or set because everyone +
all our scripts still run the Python version of the test runner
script, not the new script. But this needs to be in place before we
move people over to the new script.

We provide a fallback value such that this still works and is able to
run the tests despite the test runner not providing the configuration
via an environment variable.

Bug: chromium:1186163
Change-Id: I8255e5c7f9902be845e3c33add7b1703f6e4db9d
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2766904
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
2021-03-17 15:29:47 +00:00
Jack Franklin 0dc1fef024 [TestRunner] Ensure NODE_PATH is absolute.
Forgot a call to `path.resolve`, which is required in the case that
`cwd` is a relative path.

Bug: chromium:1166669
Change-Id: Ia5af9567dde5a313174ca15945778a788e43cbd2
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2766895
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
2021-03-17 10:34:07 +00:00
Jack Franklin fe65bc6387 [TestRunner] add base-path and shared-resources flags
This CL adds two flags to the new test runner for configuring the
components server and then updates the server to detect those values.

Note that whilst this CL adds yet-another-way to configure the
components server, this is only being done for backwards compat whilst
we roll out this change to all the various places. We will remove old
options towards the end of this work.

Bug: chromium:1186163
Change-Id: I4c9b85a5745b9fe36894e3c492952938a5b8f648
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2763875
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
2021-03-16 13:59:59 +00:00
Jack Franklin 29bb6314ce [TestRunner] create new test runner that takes configuration file
This CL lands the initial new run_test_suite.js that can take its
configuration from a config JSON file, or from flags.

This new script is only used to run `npm run auto-interactionstest`
and nothing more; I want to roll it out slowly and ensure that
everyone is aware of it before removing the old Python script. I will
create a doc with all the various steps, and required documentation,
as I've taken the chance to rename some options to make them clearer.

Bug: chromium:1186163
Change-Id: I5a199f82ac7ab0f323988acacaa7aae2d64e6349
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2763866
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2021-03-16 10:35:54 +00:00
Simon Zünd 9960666c94 Use '--inspect' when DEBUG is set in run_test_suite.py
Run the Node.js instance that executes the mocha suite for e2e tests
with '--inspect' in case DEBUG is set. This allows developers to
attach DevTools to the puppeteer side of an e2e test and step through
the code manually.

R=jacktfranklin@chromium.org

Bug: None
Change-Id: I8241767eb96899790567a3379e29e58da4f68b5b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2755967
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-03-12 09:45:38 +00:00
Philip Pfaffe 0f054cf128 Fix passing TEST_PATTERNS to tests through env
Bug: none
Change-Id: I3c7849f8af94340aff360582b3880b4de9f82d17
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2751903
Commit-Queue: Philip Pfaffe <pfaffe@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Auto-Submit: Philip Pfaffe <pfaffe@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
2021-03-11 13:20:33 +00:00
Philip Pfaffe 9e8803fe5f Simplify running e2e tests selectively
Currently, a e2e tests can be run selectively using the --test-file
option of the test suite runner. This CL extends that by accepting
multiple file names or glob patterns as positional arguments.

Bug: none
Change-Id: Ie8edc254c82af1f280d1854a4cee2a3667b4629d
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2727389
Commit-Queue: Philip Pfaffe <pfaffe@chromium.org>
Reviewed-by: Liviu Rau <liviurau@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
2021-03-11 10:57:43 +00:00
Christy Chen 5e32bcbcf7 [Loc] Un-hook presubmit scripts
The Localization presubmit steps include checking Loc V1 and V2:
V1: Done with migration, safe to remove
V2:
- check unused string in UIStrings (Moved to ESLint)
- check migrated directory (Done with migration, safe to remove)
- check the shape of API calls (Done by typescript or ESLint)

Since all checks are obsolete or moved, this CL removes the presubmit step to unhook the scripts inside scripts/localization. I will follow up a CL to remove the actual scripts.
The CL that introduced this step https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1931279


Bug: 1136655
Change-Id: If203607588896693a6331de606c873458b74cd6e
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2746919
Reviewed-by: Simon Zünd <szuend@chromium.org>
Commit-Queue: Christy Chen <chrche@microsoft.com>
2021-03-11 03:32:57 +00:00
Jack Franklin 65a3a7fb32 Parameterise run_lint_check_css script
It now takes a flag to customise the CWD that it runs, and also
correctly passes all stylelint arguments through. Before any stylelint
argument that had a dash in would be passed through twice, and that
would cause stylelint to error.

Bug: 1184228
Change-Id: I21c0d9561dcd055968cf4bf9b4514b8184040b88
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2732368
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>
2021-03-03 15:27:19 +00:00
Jack Franklin d0bac676f2 Update run_test_suite to support --test-suite-path
The current test suite runner assumes the paths; you pass
--test-suite=interactions and it assumes that they live in
out/TARGET/gen/test/interactions. This CL removes that assumption by
asking people to pass --test-suite-path, which would be
out/gen/interactions.

We will remove the --test-suite flag, but for now we're keeping it
around so the bots can still run their tests. I will file a bug to ask
that the bots have their recipes updated.

Bug:1182255
Change-Id: I6d9e5d419231845047394c5f7cbd0c74ebad3a58
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2722448
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
2021-03-01 10:24:17 +00:00
Jack Franklin 8742dc884c Make component docs server paths more robust.
Bug: none
Change-Id: I18c993b6aed44afc750928def0c6f0685f947d4b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2720246
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2021-02-26 09:50:54 +00:00
Jack Franklin 03412d8a25 Make cwd and NODE_PATH absolute in test runner
This CL makes the custom node_modules_path absolute, because Node
requires it to be an absolute path, and does the same thing with the
custom `cwd` argument. Else if you pass a custom `cwd` you'll get errors
in the test suite as running `mocha --config ./foo/config.js` doesn't
work; Mocha also wants the path to be absolute.

Bug: none
Change-Id: Ib626075f4dd1c00fa2998d55fda8c212b8e853c0
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2718297
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2021-02-25 12:14:08 +00:00
Jack Franklin 8425c1bb3e Parameterise test runs
This CL adds two flags to our run_test_suite helper:

* --cwd to set the current working directory to use as a base to find
  tests
* --node_modules-path, which sets NODE_PATH to the given value. This can
  be used to aid Node in resolving require statements if node_modules
  aren't in the local node_modules folder.

Bug: none
Change-Id: I6c7f83d028d3ad689b61642aa9a5e51177c0628d
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2718296
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2021-02-25 11:29:58 +00:00
Paul Lewis 32df74a3e3 Reland "[Test] Tweaks to test runners"
This is a reland of 3124f1cbbc

Original change's description:
> [Test] Tweaks to test runners
>
> A couple of minor additions to unit test running.
>
> R=jacktfranklin@chromium.org
>
> Bug: None
> Change-Id: I06705d369bcc93802eb07aa5d15668c73c6bfa2a
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2681740
> Commit-Queue: Paul Lewis <aerotwist@chromium.org>
> Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
> Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
> Auto-Submit: Paul Lewis <aerotwist@chromium.org>

Bug: None
Change-Id: If68034b8bde178df4c8bcaeb51624f61daa08d5b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2678689
Auto-Submit: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-02-08 16:36:46 +00:00
Tim van der Lippe cc0a803840 Revert "[Test] Tweaks to test runners"
This reverts commit 3124f1cbbc.

Reason for revert: It breaks `npm run auto-unittest` with the following stacktrace:

```
Traceback (most recent call last):
  File "scripts/test/run_auto_unittests.py", line 46, in <module>
    main()
  File "scripts/test/run_auto_unittests.py", line 42, in main
    args.coverage)
  File "devtools-frontend/scripts/test/run_unittests.py", line 86, in run_unit_tests_on_ninja_build_target
    cwd)
  File "devtools-frontend/scripts/test/run_unittests.py", line 28, in run_tests
    'unittests', 'karma.conf.js')
  File ".vpython-root/7aef5f/lib/python2.7/posixpath.py", line 70, in join
    elif path == '' or path.endswith('/'):
AttributeError: 'NoneType' object has no attribute 'endswith'
```

Original change's description:
> [Test] Tweaks to test runners
>
> A couple of minor additions to unit test running.
>
> R=​jacktfranklin@chromium.org
>
> Bug: None
> Change-Id: I06705d369bcc93802eb07aa5d15668c73c6bfa2a
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2681740
> Commit-Queue: Paul Lewis <aerotwist@chromium.org>
> Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
> Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
> Auto-Submit: Paul Lewis <aerotwist@chromium.org>

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

Change-Id: I1bbd636e1316659721db634261506428b06d9f99
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: None
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2678688
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2021-02-08 15:41:46 +00:00
Paul Lewis 3124f1cbbc [Test] Tweaks to test runners
A couple of minor additions to unit test running.

R=jacktfranklin@chromium.org

Bug: None
Change-Id: I06705d369bcc93802eb07aa5d15668c73c6bfa2a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2681740
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Auto-Submit: Paul Lewis <aerotwist@chromium.org>
2021-02-08 12:20:39 +00:00
Paul Lewis 5dffe71f67 [unit test] Add flag for expanded test name info
In the typical case we run the unit tests with the `dot` reporter. This
CL allows the use of the karma-spec-reporter instead by setting the
EXPANDED_REPORTING environment variable.

Bug: 1175038
Change-Id: I6d5bf1207e8561ccf78bc83ee375952d646c66ca
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2564874
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2021-02-05 15:47:39 +00:00
Jack Franklin bc30234f61 Migrate run_lint_check_css to JS script
As part of the work to move more scripts to Node, not Python, over time,
picked this one as the starting point. I changed its API slightly to
allow more flags to be taken in, as we'll need that to do a stylelint
pass against TypeScript files, but I will do that in a subsequent CL.

I had to make quite a few changes to devtools_paths.js, but I think it's
now calculating paths correctly. It took a bit of messing to get the
equivalent of Python's path.abspath(__file__), as you'll see from the
large comment that tries to explain what's going on!

Bug: chromium:1166108, chromium:1166572
Change-Id: Ia0b19ff8956b2ede2447530be57876a88046887e
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2631113
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2021-01-18 10:30:12 +00:00
Tim van der Lippe e0596215e1 Fix permissions for test scripts
In https://crrev.com/c/2571462 we no longer invoke these scripts
with the locally installed Python version. However, on Unix systems,
this requires the scripts themselves to be executable.

Most of the scripts we have are already executable, but these specific
scripts were not and therefore the NPM run invocations would fail.

R=liviurau@chromium.org

Change-Id: I06bf6823aa12528ce85d9e25ba241c1cab80604a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2574459
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Jan Scheffler <janscheffler@chromium.org>
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Jan Scheffler <janscheffler@chromium.org>
2020-12-04 16:02:34 +00:00
Tim van der Lippe 8e12f92229 Use Python version bundled with depot_tools for all scripts
depot_tools ships a "vpython" binary that is added to the $PATH
for all Chromium engineers. This binary is versioned by depot_tools
which we roll in ourselves as part of `gclient sync`.

By using `vpython` instead of `python`, we are no longer depended
on the Python version installed locally and instead use the version
we pull in from DEPS.

R=liviurau@chromium.org

Change-Id: If49a54c24b6cf129ff843cd9ca1140a723a78afb
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2571462
Reviewed-by: Liviu Rau <liviurau@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2020-12-04 14:08:59 +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
Jack Franklin 086ccd5a7a Enable test_suite to take a configurable server type.
As part of the work to enable Puppeteer component tests, we need to
configure the test suite to run either the hosted mode server or the
component docs server. This CL updates it to take a flag, and makes some
updates to the component docs server, which now has to run either
directly or in the out/Default/gen directory depending on how it is run.

I suspect I'll make a follow up CL to always run the component server in
out/Default/gen, but for now enabling it to detect its context is the
quickest way to unblock running it in tests. The next CL will add a
component test suite that can run a basic test against the component doc
server, but I have manually verified locally that I can run tests
against that server.

Bug: 1153281
Change-Id: I55bda4edd0a983d03bfecff0446b0f3e3a008b52
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2562707
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
2020-11-27 12:00:26 +00:00
Tim van der Lippe 16534e267d Remove Python infrastructure for the Closure Compiler
R=aerotwist@chromium.org

Bug: 1011811
Change-Id: I2ae75adec9fc47eedc410b4f066342ed3fb0a136
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2560245
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2020-11-25 12:39:37 +00:00
Paul Lewis d14436f822 [unit test] Add flag for HTML report generation
R=liviurau@chromium.org

Change-Id: I5628f4754d502e67615df0b0a2fe09981d4dc52b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2545819
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Auto-Submit: Paul Lewis <aerotwist@chromium.org>
2020-11-18 13:02:38 +00:00
Peter Marshall 580bbf4bbc tests: Add final changes for parallel e2e tests
Only set the unhandled rejection handler once per process.
We run the setup and teardown multiple times per-process now.

Add clearPuppeteerState() to unset the state between runs on
a parallel test runner. This is because the port changes
between successive runs in the same process.

Remove the hasShutdown logic from mocha_hooks. Also remove the
beforeExit hook which was causing this to get called at least
twice for every process. It already gets called in the ordinary
shutdown case via the afterAll() hook. We only need to call it
in the extraordinary case which is the SIGINT case. Now that we
do the shutdown multiple times per process, we don't care if we
already shutdown on this process or not. The only issue could be
if ctrl+c is sent during the shutdown, but then we are crashing
anyway.

Right now the default # of jobs is 1, so out bots will still run
in serial mode. We want to add parallel mode as an options for
local development while we iron out any last problems with this
approach.

You can test this locally with npm run e2etests -- --jobs=8.

We make use of global setup fixtures to only run one hosted
mode server and share it between all parallel runners. Each
runner still starts its own chrome and restarts it between
files, which is a bit inefficient but still a big improvement
compared to serial mode.

Split the hosted mode server out into its own file inside
conductor as it can be dealt with entirely separately, and
its state is not per-process like the chrome state, but only
per-main-process which launches the test runner sub-processes.

Bug: 1101784
Change-Id: Ic0c9be3559708fd5403a88882b9fb93257633de9
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2288694
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
2020-11-13 15:20:27 +00:00
Tim van der Lippe 3387bd4064 Move startup files to GN
There previously were two special files that were handled
by `build_release_applications`: root.js and RuntimeInstantiator.js.
Both files are explicitly part of the startup process of DevTools
and its various entrypoints.

To remove the copying from `build_release_applications`, we have
to move these to the relevant `devtools_entrypoint`. Since a
`devtools_entrypoints` bundles all subdirectories, we can't keep
these files in `front_end/` directly. Instead, we move these files
to `startup/` to denote their special-casing in the startup process.

Next to that, we have to fix all usages of these files in the entrypoints.
For all JavaScript entrypoint files, all side-effect legacy files
that are loaded by `startup.js` (previously known as `root.js` and renamed
to prevent confusion with the `root/` module) are removed. All
"additional" legacy files that a particular entrypoint requires are
still loaded as-is.

The RuntimeInstantiator is moved to become an implementation detail
of `startup/`. Therefore, all of the usages that were previously
importing from `RuntimeInstantiator` now import via `startup.js`.

In the end, the special-casing of these files are removed and renamed
for clarity. In the future, we want to remove the complicated
entrypoints startup process, but we are not ready for that yet.
That will require additional cleanups with `resources` in `module.json`
before that change can happen.

R=aerotwist@chromium.org

Bug: 1131500
Change-Id: I198d5a62d2aab70f842c68d9b4c0871fde1587a4
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2485072
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-10-20 12:55:34 +00:00
Tim van der Lippe 3aa84724e0 Remove scripts support from module.json
This removes all references to and declarations of the scripts array
as defined in the module.json files.

R=aerotwist@chromium.org

Fixed: 1105476

Change-Id: I8edcebb5a527c235c606f79283adf5c977a47886
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2416513
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-09-22 11:44:35 +00:00
Sigurd Schneider 64e7f0648f Reland "Typecheck sdk/SourceMap.js with TypeScript"
This reverts commit dfe3e28145.

Reason for revert: Reland

Original change's description:
> Revert "Typecheck sdk/SourceMap.js with TypeScript"
> 
> This reverts commit c9118a78a3.
> 
> Reason for revert: Layout test update encovered an actual functional change: https://test-results.appspot.com/data/layout_results/linux-rel/401616/blink_web_tests%20%28retry%20shards%20with%20patch%29/layout-test-results/results.html
> 
> Original change's description:
> > Typecheck sdk/SourceMap.js with TypeScript
> > 
> > R=​sigurds@chromium.org,rreverser@google.com
> > 
> > Bug: chromium:1011811, chromium:1079233
> > Change-Id: Ied723f6d952cfe8f40b885f63d36eef6b614ed72
> > Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2215850
> > Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
> > Reviewed-by: Ingvar Stepanyan <rreverser@google.com>
> > Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
> 
> TBR=sigurds@chromium.org,tvanderlippe@chromium.org,rreverser@google.com
> 
> Change-Id: I3956a020caf198b9f69459f650248837799d72a1
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:1011811, chromium:1079233
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2230504
> Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
> Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>

TBR=sigurds@chromium.org,tvanderlippe@chromium.org,rreverser@google.com

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

Bug: chromium:1011811
Bug: chromium:1079233
Change-Id: I4f58efdfd23f97177526381655ab3834b4164bd2
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2418435
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
2020-09-19 09:13:20 +00:00
vidorteg 3e2942e2b8 Removing i18n-bundle.js generation on build time.
This PR removes the i18n-bundle.js bundle generation, instead the file
is generated beforehand and checked in so it can be consumed like any
other module.

Bug: 1127204
Change-Id: I79e8369269d0cd1885d6d9fc2346dddf3af1a5a4
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2411415
Commit-Queue: Vidal Diazleal <vidorteg@microsoft.com>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
2020-09-17 17:07:18 +00:00
Tim van der Lippe 88a5d76f5f Fix auto-unittest compile target
Since the inspector_overlay moved, we also moved the karma.conf.js.
However, `npm run auto-unittest` was not properly building the
karma configuration file, as that was moved into its parent
directory.

R=alexrudenko@chromium.org
CC=aerotwist@chromium.org

Change-Id: Ic74c01632fb28de6afe70e0d8555e79f97bbdb33
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2401017
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
2020-09-09 12:01:49 +00:00
Alex Rudenko ca9078f199 Move unittests karma config out of the frontend folder
Change-Id: I06e28e5a9afbbf7daa569a9b699c60e4554ed5a9
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2395404
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-09-09 06:02:48 +00:00
Alex Rudenko 0e8d7f4c64 Move inspector_overlay to the top level
This CL moves inspector_overlay out of the front_end folder.
Unit tests remain under the front_end for now as we need to see
how to move them (they rely on karma config and helpers).

Design doc: https://docs.google.com/document/d/1yuQoNPtH2KxSFKoz3bRrQKu9wrPUjW4hx7idzAxb_B4/edit

Bug: 1100925
Change-Id: I0da88d9aae33602572d11485a3cbb46b5e3d588f
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2395397
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Reviewed-by: Patrick Brosset <patrick.brosset@microsoft.com>
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
2020-09-08 10:38:09 +00:00
Christy Chen 23909d8cfc [Loc] Presubmit performance improvement
The current Loc presubmit are doing two checks: check_localizable_resources and check_localizability
(Details of what they are checking: https://docs.google.com/document/d/1L6TkT2-42MMQ72ZSBMFwUaq7M6mDgA2X0x8oHHKaV_U/edit#heading=h.w1no7qaa0mi0)

This CL merge two checks into one single check. check_localizability are modified into a utils file, and check_localizable_resources will also run those localizability checks when the files are visited. By doing this, we avoid the extra call to node during presubmit, and all files and nodes will only be visited once.

Also adding these fixes
https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2370103
Fix:
- Pass the fullpath for comparison.(itemPath)
- Normalize comparison between paths
- using native fs.promises instead of promisify (https://github.com/nodejs/node/pull/26581)

Bug: 1116989
Change-Id: I054040d83a65b5f798a21c040096422e287bc799
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2381320
Reviewed-by: Vidal Diazleal <vidorteg@microsoft.com>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Commit-Queue: Christy Chen <chrche@microsoft.com>
2020-09-04 05:07:07 +00:00