Open
Bug 1423868
Opened 7 years ago
Updated 2 years ago
An example of typical Network panel test
Categories
(DevTools :: Netmonitor, enhancement, P3)
DevTools
Netmonitor
Tracking
(Not tracked)
NEW
People
(Reporter: Honza, Unassigned)
References
Details
It would be great to have an example of typical Network panel test showing concepts that are often repeated. This should help us to produce new clean & stable tests in the future). The example should show: 1) How to initialize Network monitor panel 2) How to trigger an HTTP request and wait till all (payload) data are fetched from the backend. 3) How to wait till the UI is properly updated (also happens asynchronously) 4) How to assert simple UI value. Honza
Reporter | ||
Updated•7 years ago
|
Priority: -- → P1
Updated•7 years ago
|
Assignee: nobody → poirot.alex
Comment 1•7 years ago
|
||
Take browser_net_headers_sorted.js for example, https://hg.mozilla.org/try/diff/58e23ac4f349/devtools/client/netmonitor/test/browser_net_headers_sorted.js#l1.31 After fetching requestHeaders & responseHeaders lazily, it's inevitable to add an extra wait code (waitUntil or waitForDOM) for ensuring every check is right. This trick is similar to what we use like onResponseContent [1] or waitForDOM to wait the component rendering state. P.S. The waitForNetworkEvents of this test is in wrong order, so I moved it prior to tab.linkedBrowser.reload() to make it more solid. Please ignore the change of waitForNetworkEvents() in this case. [1] https://searchfox.org/mozilla-central/source/devtools/client/netmonitor/test/browser_net_content-type.js#274
Comment 2•7 years ago
|
||
Another one is browser_net_filter-01.js https://hg.mozilla.org/try/diff/58e23ac4f349/devtools/client/netmonitor/test/browser_net_filter-01.js#l1.21 Filter request list needs to know requestHeaders & responseHeaders, both of them now are fetching lazily when filtering XHR & WS [1]. Therefore, while user clicks on filter buttons [2], we start fetching requestHeaders & responseHeaders via requestData [2]. It means RECEIVED_REQUEST_HEADERS & RECEIVED_RESPONSE_HEADERS events will be emitted under this condition. Both events will not appear in waitForNetworkEvents() calls. [1] https://searchfox.org/mozilla-central/source/devtools/client/netmonitor/src/utils/filter-predicates.js#36,64 [2] https://hg.mozilla.org/try/diff/58e23ac4f349/devtools/client/netmonitor/src/components/RequestListItem.js#l1.71
Comment 3•7 years ago
|
||
Alex, you can use above two examples to extend what you want to do. Let's figure out how to improve our test env.
Flags: needinfo?(poirot.alex)
Updated•6 years ago
|
Flags: needinfo?(poirot.alex)
Updated•6 years ago
|
Product: Firefox → DevTools
Reporter | ||
Comment 4•6 years ago
|
||
@Alex: are you planning to work on this? Or, should we move it to the Backlog (P3)? Honza
Flags: needinfo?(poirot.alex)
Comment 5•6 years ago
|
||
TBH, I don't have the cycles to work on this right now. I'm currently cleaning up many tests and I think there is more trivial cleanups to do first over the whole codebase.
Assignee: poirot.alex → nobody
Flags: needinfo?(poirot.alex)
Priority: P1 → P3
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•