From 15d55952660dedca5097bbd45b5e4de0da5be147 Mon Sep 17 00:00:00 2001 From: Alberto Fernandez-Capel Date: Thu, 22 Sep 2022 09:45:18 +0100 Subject: [PATCH] Add some more delay To avoid flaky tests in CI. --- src/test/system/custom_element_test.js | 7 ++----- src/test/test_helpers/toolbar_helpers.js | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/test/system/custom_element_test.js b/src/test/system/custom_element_test.js index 1b379a64f..5a522f645 100644 --- a/src/test/system/custom_element_test.js +++ b/src/test/system/custom_element_test.js @@ -345,27 +345,24 @@ testGroup("Custom element API", { template: "editor_empty" }, () => { element.addEventListener("trix-blur", () => blurEventCount++) triggerEvent(element, "blur") - await nextFrame() + await delay(10) assert.equal(blurEventCount, 1) assert.equal(focusEventCount, 0) triggerEvent(element, "focus") - - await nextFrame() + await delay(10) assert.equal(blurEventCount, 1) assert.equal(focusEventCount, 1) insertImageAttachment() - await delay(20) await clickElement(element.querySelector("figure")) const textarea = element.querySelector("textarea") textarea.focus() - await nextFrame() assert.equal(document.activeElement, textarea) diff --git a/src/test/test_helpers/toolbar_helpers.js b/src/test/test_helpers/toolbar_helpers.js index fcf225447..1a6159be5 100644 --- a/src/test/test_helpers/toolbar_helpers.js +++ b/src/test/test_helpers/toolbar_helpers.js @@ -1,12 +1,12 @@ import { triggerEvent } from "./event_helpers" import { selectionChangeObserver } from "trix/observers/selection_change_observer" -import { nextFrame } from "./timing_helpers" +import { delay, nextFrame } from "./timing_helpers" export const clickToolbarButton = async (selector) => { selectionChangeObserver.update() const button = getToolbarButton(selector) triggerEvent(button, "mousedown") - await nextFrame() + await delay(5) } export const typeToolbarKeyCommand = async (selector) => {