Open Bug 1309497 Opened 8 years ago Updated 2 years ago

Generating network event stub for enzyme unit testing

Categories

(DevTools :: Netmonitor, defect, P4)

defect

Tracking

(firefox52 affected)

Tracking Status
firefox52 --- affected

People

(Reporter: rickychien, Unassigned)

References

(Blocks 3 open bugs)

Details

(Whiteboard: [netmonitor-reserve])

Follow-up for bug 1309496. Most of the enzyme unit testing for netmonitor needs to receive networkEvent and netoworkEventUpdate packets from actor.

Unit testing must depend on these event stubs to verify rendering result.
Blocks: 1309498
Flags: qe-verify?
Whiteboard: [netmonitor]
Ricky, how the Webconsole does this? Do you have any pointers to the code base so, we can look and get some inspiration?

Honza
Flags: needinfo?(rchien)
This is test-only, no QA needed.

Honza
Flags: qe-verify? → qe-verify-
I know it's tricky so far we run mochitest by ./mach test <a mochitest file> [1] to generate a stub file [2].

The idea is to capture any events you want while running mochitest and save these events to somewhere, so the enzyme test cases are able to import them and get the stub packet by given key [3].


[1] https://dxr.mozilla.org/mozilla-central/source/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/browser_webconsole_update_stubs_network_event.js
[2] https://dxr.mozilla.org/mozilla-central/source/devtools/client/webconsole/new-console-output/test/fixtures/stubs/networkEvent.js
[3] https://dxr.mozilla.org/mozilla-central/source//devtools/client/webconsole/new-console-output/test/components/network-event-message.test.js#25
Flags: needinfo?(rchien)
Priority: -- → P2
Blocks: 1310153
Priority: P2 → P3
Whiteboard: [netmonitor] → [netmonitor-reserve]
Priority: P3 → P4
Product: Firefox → DevTools
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.