browser_canvas-frontend-img-thumbnails-01.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* Any copyright is dedicated to the Public Domain.
  2. http://creativecommons.org/publicdomain/zero/1.0/ */
  3. /**
  4. * Tests if thumbnails are properly displayed in the UI.
  5. */
  6. function* ifTestingSupported() {
  7. let { target, panel } = yield initCanvasDebuggerFrontend(SIMPLE_CANVAS_URL);
  8. let { window, $, $all, EVENTS, SnapshotsListView } = panel.panelWin;
  9. yield reload(target);
  10. let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
  11. let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
  12. let thumbnailsDisplayed = once(window, EVENTS.THUMBNAILS_DISPLAYED);
  13. SnapshotsListView._onRecordButtonClick();
  14. yield promise.all([recordingFinished, callListPopulated, thumbnailsDisplayed]);
  15. is($all(".filmstrip-thumbnail").length, 4,
  16. "There should be 4 thumbnails displayed in the UI.");
  17. let firstThumbnail = $(".filmstrip-thumbnail[index='0']");
  18. ok(firstThumbnail,
  19. "The first thumbnail element should be for the function call at index 0.");
  20. is(firstThumbnail.width, 50,
  21. "The first thumbnail's width is correct.");
  22. is(firstThumbnail.height, 50,
  23. "The first thumbnail's height is correct.");
  24. is(firstThumbnail.getAttribute("flipped"), "false",
  25. "The first thumbnail should not be flipped vertically.");
  26. let secondThumbnail = $(".filmstrip-thumbnail[index='2']");
  27. ok(secondThumbnail,
  28. "The second thumbnail element should be for the function call at index 2.");
  29. is(secondThumbnail.width, 50,
  30. "The second thumbnail's width is correct.");
  31. is(secondThumbnail.height, 50,
  32. "The second thumbnail's height is correct.");
  33. is(secondThumbnail.getAttribute("flipped"), "false",
  34. "The second thumbnail should not be flipped vertically.");
  35. let thirdThumbnail = $(".filmstrip-thumbnail[index='4']");
  36. ok(thirdThumbnail,
  37. "The third thumbnail element should be for the function call at index 4.");
  38. is(thirdThumbnail.width, 50,
  39. "The third thumbnail's width is correct.");
  40. is(thirdThumbnail.height, 50,
  41. "The third thumbnail's height is correct.");
  42. is(thirdThumbnail.getAttribute("flipped"), "false",
  43. "The third thumbnail should not be flipped vertically.");
  44. let fourthThumbnail = $(".filmstrip-thumbnail[index='6']");
  45. ok(fourthThumbnail,
  46. "The fourth thumbnail element should be for the function call at index 6.");
  47. is(fourthThumbnail.width, 50,
  48. "The fourth thumbnail's width is correct.");
  49. is(fourthThumbnail.height, 50,
  50. "The fourth thumbnail's height is correct.");
  51. is(fourthThumbnail.getAttribute("flipped"), "false",
  52. "The fourth thumbnail should not be flipped vertically.");
  53. yield teardown(panel);
  54. finish();
  55. }