discourse/test/javascripts/acceptance
Martin Brennan 0e09c5837f DEV: Try once more to make acceptance test fake timers work
In my original PR (#9647) I attempted to solve the problem of
using fake timers in acceptance tests by using the new sinon
clock.tickAsync methods. This way of doing things seems to be flawed,
however, as we are getting random spec timeouts starting with the
bookmark acceptance test where this was introduced.

I think I was going about things the wrong way. This commit introduces
a new function with callback (acceptanceUseFakeClock) that sets up the
fake timers using sinon.useFakeTimers with the shouldAdvanceTime option
set to true. This advances time at a normal rate of 20ms per tick, which
means that we are not freezing any time and existing setTimeout funcs.
should proceed as normal. Along with this the callback passed will
run clock.reset() at the end to make sure all the timers are cleaned
up correctly.

There is an optional third parameter after the callback, which is the
timezone. If the user is logged in for the acceptance test then their
timezone is used, otherwise we default to America/Denver.

Usage is (inside an acceptance test):

```
test("Name of the test", async assert => {
  // first parameter is time to start fake clock at
  await acceptanceUseFakeClock("2020-05-04T13:00:00", async () => {
    // test code goes here e.g. await visit("/url");
  });
});
```
2020-05-13 15:16:07 +10:00
..
about-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
account-created-test.js DEV: Move preload-store to discourse/lib/preload-store 2020-05-06 15:28:06 -04:00
admin-emails-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
admin-search-log-term-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
admin-search-logs-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
admin-site-settings-test.js FEATURE: Filter settings by plugin (#9692) 2020-05-10 14:07:45 +03:00
admin-site-text-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
admin-suspend-user-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
admin-user-badges-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
admin-user-emails-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
admin-user-index-test.js UX: drop the automatic_membership_retroactive column from groups model. (#9430) 2020-04-22 22:07:39 +05:30
admin-users-list-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
admin-watched-words-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
auth-complete-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
badges-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
bookmarks-test.js DEV: Try once more to make acceptance test fake timers work 2020-05-13 15:16:07 +10:00
category-banner-test.js FEATURE: add category banner for why a user cannot post (#9576) 2020-04-30 10:39:11 -07:00
category-chooser-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
category-edit-security-test.js DEV: No need for double await 2020-05-10 19:54:07 +02:00
category-edit-test.js FIX: Show category name in badge preview on edit (#9726) 2020-05-11 17:05:40 +02:00
category-hashtag-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
click-track-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
composer-actions-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
composer-attachment-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
composer-edit-conflict-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
composer-hyperlink-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
composer-onebox-test.js DEV: Remove INLINE_ONEBOX_* constants 2020-05-07 16:14:38 -04:00
composer-test.js DEV: correct bad test 2020-04-30 14:27:24 +10:00
composer-topic-links-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
composer-uncategorized-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
create-account-user-fields-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
custom-html-set-test.js DEV: Move preload-store to discourse/lib/preload-store 2020-05-06 15:28:06 -04:00
custom-html-template-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
dashboard-test.js FEATURE: allows to limit visible reports and tabs in dashboard (#9598) 2020-04-30 17:31:04 +02:00
email-notice-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
emoji-picker-test.js FIX: allows custom groups updates to be reflected without recompilation (#9421) 2020-04-14 16:43:57 +02:00
emoji-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
enforce-second-factor-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
forgot-password-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
group-card-mobile-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
group-card-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
group-index-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
group-manage-interaction-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
group-manage-logs-test.js UX: drop the automatic_membership_retroactive column from groups model. (#9430) 2020-04-22 22:07:39 +05:30
group-manage-membership-test.js UX: drop the automatic_membership_retroactive column from groups model. (#9430) 2020-04-22 22:07:39 +05:30
group-manage-profile-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
group-requests-test.js UX: drop the automatic_membership_retroactive column from groups model. (#9430) 2020-04-22 22:07:39 +05:30
group-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
groups-index-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
groups-new-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
invite-accept-test.js DEV: Move preload-store to discourse/lib/preload-store 2020-05-06 15:28:06 -04:00
invite-show-user-fields-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
jump-to-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
keyboard-shortcuts-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
login-redirect-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
login-required-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
login-with-email-and-hide-email-address-taken-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
login-with-email-and-no-social-logins-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
login-with-email-disabled-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
login-with-email-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
mobile-discovery-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
mobile-sign-in-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
mobile-users-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
modal-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
new-message-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
new-topic-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
page-publishing-test.js FEATURE: Support for publishing topics as pages (#9364) 2020-04-08 12:52:36 -04:00
password-reset-test.js DEV: Move preload-store to discourse/lib/preload-store 2020-05-06 15:28:06 -04:00
personal-message-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
plugin-keyboard-shortcut-test.js DEV: Refactor and test plugin addKeyboardShortcut (#9381) 2020-04-09 10:30:26 +10:00
plugin-outlet-connector-class-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
plugin-outlet-decorator-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
plugin-outlet-multi-template-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
plugin-outlet-single-template-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
preferences-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
raw-plugin-outlet-test.js DEV: Remove Discourse.RAW_TEMPLATES (#9630) 2020-05-05 12:15:03 -04:00
redirect-to-top-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
reports-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
review-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
search-full-test.js DEV: Remove obsolete commented out tests 2020-05-11 18:19:21 +02:00
search-mobile-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
search-test.js FIX: topic title in search contains data-topic-id (#9435) 2020-04-17 09:35:26 +10:00
share-and-invite-desktop-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
share-and-invite-mobile-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
shared-drafts-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
sign-in-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
static-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
tag-groups-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
tag-hashtag-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
tags-intersection-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
tags-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
topic-anonymous-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
topic-discovery-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
topic-edit-timer-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
topic-footer-buttons-mobile-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
topic-move-posts-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
topic-notifications-button-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
topic-test.js DEV: Add acceptance tests for bookmarks with reminders (#9592) 2020-04-30 14:58:26 +10:00
unknown-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
user-anonymous-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
user-bookmarks-test.js UX: Bookmark removal tweaks (#9635) 2020-05-05 14:56:04 +10:00
user-card-mobile-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
user-card-test.js FIX: CurrentUser now must be passed to resolveTimezone and user card local time issues (#9734) 2020-05-11 11:01:47 +10:00
user-drafts-stream-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
user-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
users-test.js Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00