calendar_tour.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. /** @odoo-module **/
  2. import tour from 'web_tour.tour';
  3. const todayDate = function() {
  4. let now = new Date();
  5. let year = now.getFullYear();
  6. let month = String(now.getMonth() + 1).padStart(2, '0');
  7. let day = String(now.getDate()).padStart(2, '0');
  8. return `${month}/${day}/${year} 10:00:00`;
  9. };
  10. tour.register('calendar_appointments_hour_tour', {
  11. url: '/web',
  12. test: true,
  13. }, [
  14. tour.stepUtils.showAppsMenuItem(),
  15. {
  16. trigger: '.o_app[data-menu-xmlid="calendar.mail_menu_calendar"]',
  17. content: 'Open Calendar',
  18. run: 'click',
  19. },
  20. {
  21. trigger: '.o-calendar-button-new',
  22. content: 'Create a new event',
  23. run: 'click',
  24. },
  25. {
  26. trigger: '#name',
  27. content: 'Give a name to the new event',
  28. run: 'text TEST EVENT',
  29. },
  30. {
  31. trigger: '#start',
  32. content: 'Give a date to the new event',
  33. run: `text ${todayDate()}`,
  34. },
  35. {
  36. trigger: '.fa-cloud-upload',
  37. content: 'Save the new event',
  38. run: 'click',
  39. },
  40. {
  41. trigger: '.dropdown-item:contains("Calendar")',
  42. content: 'Go back to Calendar view',
  43. run: 'click',
  44. },
  45. {
  46. trigger: '.dropdown-toggle:contains("Week")',
  47. content: 'Click to change calendar view',
  48. run: 'click',
  49. },
  50. {
  51. trigger: '.dropdown-item:contains("Month")',
  52. content: 'Change the calendar view to Month',
  53. run: 'click',
  54. },
  55. {
  56. trigger: '.fc-day-header:contains("Monday")',
  57. content: 'Change the calendar view to week',
  58. },
  59. {
  60. trigger: '.fc-time:contains("10:00")',
  61. content: 'Check the time is properly displayed',
  62. },
  63. {
  64. trigger: '.o_event_title:contains("TEST EVENT")',
  65. content: 'Check the event title',
  66. },
  67. ]);
  68. tour.register('test_calendar_delete_tour', {
  69. test: true,
  70. },
  71. [
  72. {
  73. content: 'Select filter (everybody)',
  74. trigger: 'div[data-value="all"] input',
  75. },
  76. {
  77. content: 'Click on the event (focus + waiting)',
  78. trigger: 'a .fc-content:contains("Test Event")',
  79. async run() {
  80. $('a .fc-content:contains("Test Event")').click();
  81. await new Promise((r) => setTimeout(r, 1000));
  82. $('a .fc-content:contains("Test Event")').click();
  83. }
  84. },
  85. {
  86. content: 'Delete the event',
  87. trigger: '.o_cw_popover_delete',
  88. },
  89. {
  90. content: 'Validate the deletion',
  91. trigger:'button:contains("Ok")',
  92. async run() {
  93. $('button:contains("Ok")').click();
  94. await new Promise((r) => setTimeout(r, 1000));
  95. }
  96. },
  97. ]);
  98. tour.register('test_calendar_decline_tour', {
  99. test: true,
  100. },
  101. [
  102. {
  103. content: 'Click on the event (focus + waiting)',
  104. trigger: 'a .fc-content:contains("Test Event")',
  105. async run() {
  106. $('a .fc-content:contains("Test Event")').click();
  107. await new Promise((r) => setTimeout(r, 1000));
  108. $('a .fc-content:contains("Test Event")').click();
  109. }
  110. },
  111. {
  112. content: 'Delete the event',
  113. trigger: '.o_cw_popover_delete',
  114. },
  115. {
  116. content: 'Wait declined status',
  117. trigger: '.o_attendee_status_declined',
  118. },
  119. ]);
  120. tour.register('test_calendar_decline_with_everybody_filter_tour', {
  121. test: true,
  122. },
  123. [
  124. {
  125. content: 'Select filter (everybody)',
  126. trigger: 'div[data-value="all"] input',
  127. },
  128. {
  129. content: 'Click on the event (focus + waiting)',
  130. trigger: 'a .fc-content:contains("Test Event")',
  131. async run() {
  132. $('a .fc-content:contains("Test Event")').click();
  133. await new Promise((r) => setTimeout(r, 1000));
  134. $('a .fc-content:contains("Test Event")').click();
  135. }
  136. },
  137. {
  138. content: 'Delete the event',
  139. trigger: '.o_cw_popover_delete',
  140. },
  141. {
  142. content: 'Select filter (everybody)',
  143. trigger: 'div[data-value="all"] input',
  144. },
  145. {
  146. content: 'Wait declined status',
  147. trigger: '.o_attendee_status_declined',
  148. },
  149. ]);