Add "ByType" variant for findMessage-related testing function and rewrite consumers to always specify message class
Categories
(DevTools :: Console, task)
Tracking
(firefox102 fixed)
Tracking | Status | |
---|---|---|
firefox102 | --- | fixed |
People
(Reporter: arai, Assigned: arai)
References
Details
Attachments
(27 files)
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details |
Derived from bug 1764682
bug 1764682 is caused by findMessage
testing function returns console input, while the code should wait for console API output.
There seems to be similar situation in other tests, for the case that the test executes code from console and wait for output:
const expectedMessages = [
`Cu.reportError`, // bug 1561930
];
...
execute(hud, `Cu.reportError("Cu.reportError");`); // bug 1561930
...
await waitFor(() =>
expectedMessages.every(expectedMessage => findMessage(hud, expectedMessage))
Those tests should pass special selector to the 3rd parameter of findMessage
.
(such as ".console-api"
for console.log
, not sure for Cu.reportError
, maybe just :not(.command)
?)
Or maybe we should make the default behavior ignore the console input (".message:not(.command)"
)?
Assignee | ||
Comment 1•3 years ago
|
||
testing patch that ignores command by default
https://treeherder.mozilla.org/jobs?repo=try&group_state=expanded&revision=eed157b8cc37c6186a99e4d159a6d42e05ea8db2
there are some failure, that may be just that it's expecting command input, or perhaps some other issue.
Assignee | ||
Comment 2•3 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/150bf969aea0ec4434daccd86c52cc96f0f3c02a
The patch suggests that making the selector required parameter might be better.
or maybe provide separate function for ".message.command", ".message.result", etc
Assignee | ||
Comment 3•3 years ago
|
||
to avoid surprise by changing the function signature or parameter requirement,
maybe we could do this at the same time with bug 1669126, with single implementation across all tests, with possibly different function name.
there's already some functions in some shared-head.js, but some tests are still defining their own version.
https://searchfox.org/mozilla-central/search?q=function%20findMessage&path=
Assignee | ||
Comment 4•3 years ago
|
||
:nchevobbe, can I have your opinion here?
How do you think about making the selector parameter required?
Also, what do you think about adding new function (e.g. findMessageByClass
) instead of modifying the existing function?
What I'm thinking right now is, introducing findMessageByClass(hud, "hello", ".console-api")
and waitForMessageByClass(hud, "hello", ".error")
etc.
The caller needs to pass the "message type"-specific class name, instead of the entire query, and internally add ".message"
to generate the query.
(just to reduce the redundancy)
Those functions will be added to shared head.js file, and then replace each consumer with ByClass
variants, fixing some unexpected cases (e.g. comment #0) at the same time, and once the replacement completes, remove findMessage
functions where selector is optional,
so that new tests written from that point are required to specify class, and there's no new bug around finding/waiting for wrong message.
Comment 5•3 years ago
|
||
(In reply to Tooru Fujisawa [:arai] from comment #4)
:nchevobbe, can I have your opinion here?
How do you think about making the selector parameter required?
Also, what do you think about adding new function (e.g.findMessageByClass
) instead of modifying the existing function?What I'm thinking right now is, introducing
findMessageByClass(hud, "hello", ".console-api")
andwaitForMessageByClass(hud, "hello", ".error")
etc.
The caller needs to pass the "message type"-specific class name, instead of the entire query, and internally add".message"
to generate the query.
(just to reduce the redundancy)Those functions will be added to shared head.js file, and then replace each consumer with
ByClass
variants, fixing some unexpected cases (e.g. comment #0) at the same time, and once the replacement completes, removefindMessage
functions where selector is optional,
so that new tests written from that point are required to specify class, and there's no new bug around finding/waiting for wrong message.
I like your proposal, overall it makes sense to force passing the classname so we don't get false positive.
We might introduce type-specific finder then (e.g. findEvaluationResultMessage
, findErrorMessage
, …) if we feel like callsites are a bit harder to read.
Assignee | ||
Comment 6•3 years ago
|
||
Thank you!
I'll work on it.
Assignee | ||
Comment 7•3 years ago
|
||
Just realized ByClass
is misleading that the parameter is selector, not class name.
I'll go with ByType
Assignee | ||
Comment 8•3 years ago
|
||
I have question regarding findMessage(s)Virtualized
vs findMessage(s)
.
findMessage(s)Virtualized
seems to be used in very limited place, and most place uses findMessage(s)
.
Is it intentional, or all consumers are supposed to switch to findMessage(s)Virtualized
?
I'm wondering whether the new ByType
functions should be based on findMessage(s)Virtualized
algorithm or findMessage(s)
algorithm.
Assignee | ||
Comment 9•3 years ago
|
||
here's WIP based on findMessage(s)
, that doesn't scroll.
https://treeherder.mozilla.org/jobs?repo=try&revision=b5091293640b8fe5abf7fa1a0ec573581c6b1263
Comment 10•3 years ago
|
||
(In reply to Tooru Fujisawa [:arai] from comment #8)
I have question regarding
findMessage(s)Virtualized
vsfindMessage(s)
.
findMessage(s)Virtualized
seems to be used in very limited place, and most place usesfindMessage(s)
.
Is it intentional, or all consumers are supposed to switch tofindMessage(s)Virtualized
?
I'm wondering whether the newByType
functions should be based onfindMessage(s)Virtualized
algorithm orfindMessage(s)
algorithm.
When we added virtualization, we added the findMessageVirtualized helper to use it in tests that were failing.
Lots of test didn't have to switch to the new helpers as they don't have enough message for the virtualization to kick in
So IMO the ByType
function should be based on findMessage(s)
, but maybe we could also have findMessage(s)VirtualizedByType
at the same time (or later) ?
Assignee | ||
Comment 11•3 years ago
|
||
Assignee | ||
Comment 12•3 years ago
|
||
Depends on D147021
Assignee | ||
Comment 13•3 years ago
|
||
Depends on D147022
Assignee | ||
Comment 14•3 years ago
|
||
Depends on D147023
Assignee | ||
Comment 15•3 years ago
|
||
Depends on D147024
Assignee | ||
Comment 16•3 years ago
|
||
Depends on D147025
Assignee | ||
Comment 17•3 years ago
|
||
Depends on D147026
Assignee | ||
Comment 18•3 years ago
|
||
Depends on D147027
Assignee | ||
Comment 19•3 years ago
|
||
Depends on D147028
Assignee | ||
Comment 20•3 years ago
|
||
Depends on D147029
Assignee | ||
Comment 21•3 years ago
|
||
Depends on D147030
Assignee | ||
Comment 22•3 years ago
|
||
Depends on D147031
Assignee | ||
Comment 23•3 years ago
|
||
Depends on D147032
Assignee | ||
Comment 24•3 years ago
|
||
Depends on D147033
Assignee | ||
Comment 25•3 years ago
|
||
Depends on D147034
Assignee | ||
Comment 26•3 years ago
|
||
Depends on D147035
Assignee | ||
Comment 27•3 years ago
|
||
Depends on D147036
Assignee | ||
Comment 28•3 years ago
|
||
Depends on D147037
Assignee | ||
Comment 29•3 years ago
|
||
Depends on D147038
Assignee | ||
Comment 30•3 years ago
|
||
Depends on D147039
Assignee | ||
Comment 31•3 years ago
|
||
Depends on D147040
Assignee | ||
Comment 32•3 years ago
|
||
Depends on D147041
Assignee | ||
Comment 33•3 years ago
|
||
Depends on D147042
Assignee | ||
Comment 34•3 years ago
|
||
Depends on D147043
Assignee | ||
Comment 35•3 years ago
|
||
Depends on D147044
Assignee | ||
Comment 36•3 years ago
|
||
Depends on D147045
Assignee | ||
Comment 37•3 years ago
|
||
Depends on D147046
Comment 38•3 years ago
|
||
Comment 39•3 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/04b84879d85e
https://hg.mozilla.org/mozilla-central/rev/f35df94ea1d5
https://hg.mozilla.org/mozilla-central/rev/2a5382583807
https://hg.mozilla.org/mozilla-central/rev/2abb293b94c8
https://hg.mozilla.org/mozilla-central/rev/df95e92908e0
https://hg.mozilla.org/mozilla-central/rev/b8075ad20646
https://hg.mozilla.org/mozilla-central/rev/189891fa3067
https://hg.mozilla.org/mozilla-central/rev/e96bc7b205dc
https://hg.mozilla.org/mozilla-central/rev/15d1924a3ecf
https://hg.mozilla.org/mozilla-central/rev/6378c2ef157a
https://hg.mozilla.org/mozilla-central/rev/1082127c4df2
https://hg.mozilla.org/mozilla-central/rev/1ee9606f67eb
https://hg.mozilla.org/mozilla-central/rev/e83c3e63ca63
https://hg.mozilla.org/mozilla-central/rev/0f2347d0303f
https://hg.mozilla.org/mozilla-central/rev/2975998b65ed
https://hg.mozilla.org/mozilla-central/rev/deff7858a2d5
https://hg.mozilla.org/mozilla-central/rev/099f223528fa
https://hg.mozilla.org/mozilla-central/rev/ca07dc8f01b2
https://hg.mozilla.org/mozilla-central/rev/861d0cd7b2fa
https://hg.mozilla.org/mozilla-central/rev/ef8b0bc412cb
https://hg.mozilla.org/mozilla-central/rev/94a81659571f
https://hg.mozilla.org/mozilla-central/rev/bc6db1de8b6f
https://hg.mozilla.org/mozilla-central/rev/aef55b5eacb1
https://hg.mozilla.org/mozilla-central/rev/385713053465
https://hg.mozilla.org/mozilla-central/rev/6c41fd93e6cb
https://hg.mozilla.org/mozilla-central/rev/8a5c5a21ebe1
https://hg.mozilla.org/mozilla-central/rev/abb6eeffb44d
Description
•