Skip to content

Commit 3078be9

Browse files
lint
1 parent 6bc157e commit 3078be9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

web/libs/editor/tests/e2e/utils/async-helpers.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
* @param {Object} I - CodeceptJS I object
1515
* @param {Function} conditionFn - Function that returns true when condition is met.
16-
* Will be serialized and executed in browser context.
16+
* Will be executed in browser context.
1717
* Should be a pure function with no external dependencies.
1818
* @param {Array} args - Arguments to pass to the condition function
1919
* @param {Object} options - Configuration options
@@ -25,11 +25,11 @@
2525
const waitForCondition = (I, conditionFn, args = [], options = {}) => {
2626
const { timeout = 5000, pollInterval = 50, timeoutMessage = "Timeout waiting for condition" } = options;
2727

28+
// CodeceptJS automatically serializes functions and arguments when passing to executeScript
29+
// This follows the same pattern as existing helpers like waitTicks
2830
return I.executeScript(
29-
(conditionFnStr, args, timeout, pollInterval, timeoutMessage) => {
31+
(conditionFn, args, timeout, pollInterval, timeoutMessage) => {
3032
return new Promise((resolve, reject) => {
31-
// Reconstruct the condition function from string
32-
const conditionFn = eval(`(${conditionFnStr})`);
3333
const startTime = Date.now();
3434

3535
const checkCondition = () => {
@@ -54,7 +54,7 @@ const waitForCondition = (I, conditionFn, args = [], options = {}) => {
5454
checkCondition();
5555
});
5656
},
57-
conditionFn.toString(),
57+
conditionFn,
5858
args,
5959
timeout,
6060
pollInterval,

0 commit comments

Comments
 (0)