From 95292224fcbce4da41160824f0abea8248a47d0e Mon Sep 17 00:00:00 2001 From: Wattachai Kanawitoon <117723407+wattachai-lseg@users.noreply.github.com> Date: Thu, 3 Oct 2024 09:39:20 +0700 Subject: [PATCH 1/5] test: wait for additional frame --- packages/elements/src/overlay/__test__/mocks/helper.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/elements/src/overlay/__test__/mocks/helper.js b/packages/elements/src/overlay/__test__/mocks/helper.js index c8674ced98..9931354f4d 100644 --- a/packages/elements/src/overlay/__test__/mocks/helper.js +++ b/packages/elements/src/overlay/__test__/mocks/helper.js @@ -3,8 +3,7 @@ import { elementUpdated, fixture, isIE, nextFrame } from '@refinitiv-ui/test-hel export const openedUpdated = async (element) => { await elementUpdated(element); - await nextFrame(); - await nextFrame(); + await nextFrame(2); }; export const fireKeydownEvent = (element, key, shiftKey = false) => { let event; @@ -106,8 +105,7 @@ export const createPositionTargetFixture = async ( await elementUpdated(elements.panel); - await nextFrame(); - await nextFrame(); + await nextFrame(3); } return elements; From d3366d40098b2654f0f82d039b4544f816e8049f Mon Sep 17 00:00:00 2001 From: Wattachai Kanawitoon <117723407+wattachai-lseg@users.noreply.github.com> Date: Thu, 3 Oct 2024 10:14:51 +0700 Subject: [PATCH 2/5] test: add timeout to rule out timing issue --- packages/elements/src/overlay/__test__/mocks/helper.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/elements/src/overlay/__test__/mocks/helper.js b/packages/elements/src/overlay/__test__/mocks/helper.js index 9931354f4d..c258cd6206 100644 --- a/packages/elements/src/overlay/__test__/mocks/helper.js +++ b/packages/elements/src/overlay/__test__/mocks/helper.js @@ -1,4 +1,4 @@ -import { elementUpdated, fixture, isIE, nextFrame } from '@refinitiv-ui/test-helpers'; +import { aTimeout, elementUpdated, fixture, isIE, nextFrame } from '@refinitiv-ui/test-helpers'; export const openedUpdated = async (element) => { await elementUpdated(element); @@ -105,7 +105,8 @@ export const createPositionTargetFixture = async ( await elementUpdated(elements.panel); - await nextFrame(3); + await nextFrame(2); + await aTimeout(500); } return elements; From 53f51565a15ecff1d4d3ddd028a52f6f59cb3594 Mon Sep 17 00:00:00 2001 From: Wattachai Kanawitoon <117723407+wattachai-lseg@users.noreply.github.com> Date: Mon, 2 Dec 2024 13:28:22 +0700 Subject: [PATCH 3/5] test(overlay): revert back test debugging --- packages/elements/src/overlay/__test__/mocks/helper.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/elements/src/overlay/__test__/mocks/helper.js b/packages/elements/src/overlay/__test__/mocks/helper.js index c258cd6206..8a799bfee9 100644 --- a/packages/elements/src/overlay/__test__/mocks/helper.js +++ b/packages/elements/src/overlay/__test__/mocks/helper.js @@ -1,4 +1,4 @@ -import { aTimeout, elementUpdated, fixture, isIE, nextFrame } from '@refinitiv-ui/test-helpers'; +import { elementUpdated, fixture, isIE, nextFrame } from '@refinitiv-ui/test-helpers'; export const openedUpdated = async (element) => { await elementUpdated(element); @@ -106,7 +106,6 @@ export const createPositionTargetFixture = async ( await elementUpdated(elements.panel); await nextFrame(2); - await aTimeout(500); } return elements; From 77c0ddb8f327a3cacf7113b6c54f31bba3d867d8 Mon Sep 17 00:00:00 2001 From: Wattachai Kanawitoon <117723407+wattachai-lseg@users.noreply.github.com> Date: Mon, 2 Dec 2024 13:28:42 +0700 Subject: [PATCH 4/5] test: use Chrome headless instead of headless shell --- karma.config.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/karma.config.js b/karma.config.js index af376f5928..2c083960ca 100644 --- a/karma.config.js +++ b/karma.config.js @@ -161,8 +161,14 @@ if (!argv.watch) { flags: ['-headless'] }, chrome: { - base: 'ChromeHeadless', - flags: ['--no-sandbox', '--disable-setuid-sandbox', '--disable-translate', '--disable-extensions'] + base: 'Chrome', + flags: [ + '--headless', + '--no-sandbox', + '--disable-setuid-sandbox', + '--disable-translate', + '--disable-extensions' + ] }, ie: { base: 'IE', From c5233701ff51cd979bfbee70c9a682a0500bc006 Mon Sep 17 00:00:00 2001 From: Wattachai Kanawitoon <117723407+wattachai-lseg@users.noreply.github.com> Date: Mon, 2 Dec 2024 13:44:17 +0700 Subject: [PATCH 5/5] test: use headless=new flag with Chrome --- karma.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/karma.config.js b/karma.config.js index 2c083960ca..c11bde7d11 100644 --- a/karma.config.js +++ b/karma.config.js @@ -163,7 +163,7 @@ if (!argv.watch) { chrome: { base: 'Chrome', flags: [ - '--headless', + '--headless=new', '--no-sandbox', '--disable-setuid-sandbox', '--disable-translate',