browser_wa_automation-view-01.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* Any copyright is dedicated to the Public Domain.
  2. http://creativecommons.org/publicdomain/zero/1.0/ */
  3. /**
  4. * Tests that automation view shows the correct view depending on if events
  5. * or params exist.
  6. */
  7. add_task(function* () {
  8. let { target, panel } = yield initWebAudioEditor(AUTOMATION_URL);
  9. let { panelWin } = panel;
  10. let { gFront, $, $$, EVENTS } = panelWin;
  11. let started = once(gFront, "start-context");
  12. let events = Promise.all([
  13. get3(gFront, "create-node"),
  14. waitForGraphRendered(panelWin, 3, 2)
  15. ]);
  16. reload(target);
  17. let [actors] = yield events;
  18. let nodeIds = actors.map(actor => actor.actorID);
  19. let $tabbox = $("#web-audio-editor-tabs");
  20. // Oscillator node
  21. click(panelWin, findGraphNode(panelWin, nodeIds[1]));
  22. yield waitForInspectorRender(panelWin, EVENTS);
  23. $tabbox.selectedIndex = 1;
  24. ok(isVisible($("#automation-graph-container")), "graph container should be visible");
  25. ok(isVisible($("#automation-content")), "automation content should be visible");
  26. ok(!isVisible($("#automation-no-events")), "no-events panel should not be visible");
  27. ok(!isVisible($("#automation-empty")), "empty panel should not be visible");
  28. // Gain node
  29. click(panelWin, findGraphNode(panelWin, nodeIds[2]));
  30. yield waitForInspectorRender(panelWin, EVENTS);
  31. $tabbox.selectedIndex = 1;
  32. ok(!isVisible($("#automation-graph-container")), "graph container should not be visible");
  33. ok(isVisible($("#automation-content")), "automation content should be visible");
  34. ok(isVisible($("#automation-no-events")), "no-events panel should be visible");
  35. ok(!isVisible($("#automation-empty")), "empty panel should not be visible");
  36. // destination node
  37. click(panelWin, findGraphNode(panelWin, nodeIds[0]));
  38. yield waitForInspectorRender(panelWin, EVENTS);
  39. $tabbox.selectedIndex = 1;
  40. ok(!isVisible($("#automation-graph-container")), "graph container should not be visible");
  41. ok(!isVisible($("#automation-content")), "automation content should not be visible");
  42. ok(!isVisible($("#automation-no-events")), "no-events panel should not be visible");
  43. ok(isVisible($("#automation-empty")), "empty panel should be visible");
  44. yield teardown(target);
  45. });