mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Fix a flakey test (#20241)
The `Composer - current time` test would sometimes fail due to a 1-second difference. We don't really need per-second fidelity here, the key thing this needs to test is that the shortcut works and adds today's date. I have updated the test to reflect that.
This commit is contained in:
parent
47abe61994
commit
827df072a6
@ -1372,6 +1372,7 @@ acceptance("Composer - current time", function (needs) {
|
|||||||
await fillIn(".d-editor-input", "and the time now is: ");
|
await fillIn(".d-editor-input", "and the time now is: ");
|
||||||
|
|
||||||
const mac = /Mac|iPod|iPhone|iPad/.test(navigator.platform);
|
const mac = /Mac|iPod|iPhone|iPad/.test(navigator.platform);
|
||||||
|
const date = moment().format("YYYY-MM-DD");
|
||||||
|
|
||||||
await triggerKeyEvent(".d-editor-input", "keydown", ".", {
|
await triggerKeyEvent(".d-editor-input", "keydown", ".", {
|
||||||
shiftKey: true,
|
shiftKey: true,
|
||||||
@ -1379,12 +1380,10 @@ acceptance("Composer - current time", function (needs) {
|
|||||||
metaKey: mac,
|
metaKey: mac,
|
||||||
});
|
});
|
||||||
|
|
||||||
const time = moment().format("HH:mm:ss");
|
const inputValue = query("#reply-control .d-editor-input").value.trim();
|
||||||
const date = moment().format("YYYY-MM-DD");
|
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.ok(
|
||||||
query("#reply-control .d-editor-input").value.trim(),
|
inputValue.startsWith(`and the time now is: [date=${date}`),
|
||||||
`and the time now is: [date=${date} time=${time} timezone="Australia/Brisbane"]`,
|
|
||||||
"it adds the current date"
|
"it adds the current date"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user