diff --git a/test/client/fixtures/automation/click-test.js b/test/client/fixtures/automation/click-test.js index 5be8ebaefb3..4f37c85e640 100644 --- a/test/client/fixtures/automation/click-test.js +++ b/test/client/fixtures/automation/click-test.js @@ -14,10 +14,12 @@ const cursor = testCafeAutomation.cursor; testCafeCore.preventRealEvents(); -const isSafariGreaterThan15 = browserUtils.isSafari && parseFloat(browserUtils.fullVersion) >= '15.0'; -const isMobileSafari = browserUtils.isSafari && featureDetection.isTouchDevice; -const nextTestDelay = browserUtils.isIE ? 30 : 200; -const TEST_RESULT_TIMEOUT = featureDetection.isTouchDevice ? 2500 : 500; +const IS_SAFARI_GREATER_THAN_15 = browserUtils.isSafari && parseFloat(browserUtils.fullVersion) >= '15.0'; +const IS_MOBILE_SAFARI = browserUtils.isSafari && featureDetection.isTouchDevice; +const NEXT_TEST_DELAY = IS_MOBILE_SAFARI ? 200 : 30; +const TEST_RESULT_TIMEOUT = featureDetection.isTouchDevice ? 2500 : 500; + +QUnit.config.testTimeout = 30000; $(document).ready(function () { let $el = null; @@ -76,9 +78,9 @@ $(document).ready(function () { }; const startNext = function () { - if (browserUtils.isIE || isMobileSafari) { + if (browserUtils.isIE || IS_MOBILE_SAFARI) { removeTestElements(); - window.setTimeout(start, nextTestDelay); + window.setTimeout(start, NEXT_TEST_DELAY); } else start(); @@ -1040,7 +1042,7 @@ $(document).ready(function () { // NOTE: We turn off some tests due to an issue in Safari 15. // Need to check these tests on the next Safari versions (15.3 and later). - if (!isSafariGreaterThan15) { + if (!IS_SAFARI_GREATER_THAN_15) { asyncTest('T224332 - TestCafe problem with click on links in popup menu (click on link with span inside without offset)', function () { const $box = $('
').css('width', '128px').appendTo($('body')); const $link = $('').appendTo($box); diff --git a/test/client/fixtures/automation/content-editable/api-actions-content-editable-test/index-test.js b/test/client/fixtures/automation/content-editable/api-actions-content-editable-test/index-test.js index 6b975b60469..1187445fd07 100644 --- a/test/client/fixtures/automation/content-editable/api-actions-content-editable-test/index-test.js +++ b/test/client/fixtures/automation/content-editable/api-actions-content-editable-test/index-test.js @@ -18,11 +18,13 @@ const domUtils = testCafeCore.domUtils; const textSelection = testCafeCore.textSelection; const parseKeySequence = testCafeCore.parseKeySequence; -const isMobileSafari = browserUtils.isSafari && featureDetection.isTouchDevice; -const nextTestDelay = isMobileSafari ? 200 : 30; +const IS_MOBILE_SAFARI = browserUtils.isSafari && featureDetection.isTouchDevice; +const NEXT_TEST_DELAY = IS_MOBILE_SAFARI ? 200 : 30; testCafeCore.preventRealEvents(); +QUnit.config.testTimeout = 30000; + $(document).ready(function () { // NOTE: https://github.com/DevExpress/testcafe/issues/2008 // Remove this condition when the issue will be fixed. @@ -40,8 +42,8 @@ $(document).ready(function () { let sixthElementInnerHTML = null; let seventhElementInnerHTML = null; - const startNext = function () { - window.setTimeout(start, nextTestDelay); + const startNext = function (delay) { + window.setTimeout(start, delay || NEXT_TEST_DELAY); }; const firstNotWhiteSpaceSymbolIndex = function (value) { @@ -157,7 +159,7 @@ $(document).ready(function () { ok(clicked, 'click raised'); checkSelection($parent, $el[0].childNodes[0], 10, $el[0].childNodes[0], 10); - startNext(); + startNext(IS_MOBILE_SAFARI && 700); }); }); @@ -181,7 +183,7 @@ $(document).ready(function () { ok(clicked, 'click raised'); checkSelection($parent, $parent[0].childNodes[5].childNodes[3].childNodes[0], 1, $parent[0].childNodes[5].childNodes[3].childNodes[0], 1); - startNext(); + startNext(IS_MOBILE_SAFARI && 700); }); }); diff --git a/test/client/fixtures/automation/drag-test.js b/test/client/fixtures/automation/drag-test.js index 73e7a383955..c91764f3ad3 100644 --- a/test/client/fixtures/automation/drag-test.js +++ b/test/client/fixtures/automation/drag-test.js @@ -12,8 +12,8 @@ const hammerhead = window.getTestCafeModule('hammerhead'); const browserUtils = hammerhead.utils.browser; const featureDetection = hammerhead.utils.featureDetection; -const isMobileSafari = browserUtils.isSafari && featureDetection.isTouchDevice; const TEST_RESULT_TIMEOUT = featureDetection.isTouchDevice ? 2500 : 500; +const IS_MOBILE_SAFARI = browserUtils.isSafari && featureDetection.isTouchDevice; QUnit.config.testTimeout = 30000; @@ -22,7 +22,7 @@ $(document).ready(function () { $('body').css('border', '0px'); // NOTE: prevent auto scrolling - if (browserUtils.isSafari && featureDetection.isTouchDevice) { + if (IS_MOBILE_SAFARI) { const $meta = $(''); $('head').append($meta); @@ -34,6 +34,10 @@ $(document).ready(function () { //utils const isTouchDevice = featureDetection.isTouchDevice; + const startNext = function (delay) { + window.setTimeout(start, delay); + }; + const createDraggable = function (left, top, withGloballCoord) { const $draggable = $('
') .css({ @@ -138,7 +142,7 @@ $(document).ready(function () { .run() .then(function () { ok(isInTarget(draggable, target), 'element is in the target'); - start(); + startNext(IS_MOBILE_SAFARI && 700); }); }, TEST_RESULT_TIMEOUT); }); @@ -167,7 +171,7 @@ $(document).ready(function () { // This issue is not reproduced in real devices (checked with the devices from BrowserStack). // It can be partially fixed using the minimal test speed. But in this case, the test is still unstable. // We are forced to turn off it for mobile Safari. Try to turn on it in the future. - if (!isMobileSafari) { + if (!IS_MOBILE_SAFARI) { asyncTest('overlapped during dragging', function () { window.setTimeout(function () { const draggable = createDraggable(100, 100)[0]; @@ -194,7 +198,7 @@ $(document).ready(function () { // This issue is not reproduced in real devices (checked with the devices from BrowserStack). // It can be partially fixed using the minimal test speed. But in this case, the test is still unstable. // We are forced to turn off it for mobile Safari. Try to turn on it in the future. - if (!isMobileSafari) { + if (!IS_MOBILE_SAFARI) { asyncTest('B253930 - Wrong playback of drag action on http://jqueryui.com/droppable/ in IE9', function () { const $draggable = createDraggable(10, 10, true); const center = getCenter($draggable[0]); diff --git a/test/client/fixtures/automation/regression-test.js b/test/client/fixtures/automation/regression-test.js index ad5b6c74e1b..526539eab9e 100644 --- a/test/client/fixtures/automation/regression-test.js +++ b/test/client/fixtures/automation/regression-test.js @@ -26,6 +26,8 @@ const PressAutomation = testCafeAutomation.Press; const getOffsetOptions = testCafeAutomation.getOffsetOptions; const cursor = testCafeAutomation.cursor; +const IS_MOBILE_SAFARI = browserUtils.isSafari && featureDetection.isTouchDevice; + testCafeCore.preventRealEvents(); $(document).ready(function () { @@ -141,11 +143,9 @@ $(document).ready(function () { return $draggable; }; - const startNext = function () { - if (browserUtils.isIE) { - removeTestElements(); - window.setTimeout(start, 30); - } + const startNext = function (delay) { + if (delay) + window.setTimeout(start, delay); else start(); }; @@ -495,7 +495,7 @@ $(document).ready(function () { runClickAutomation($b[0], {}, function () { ok(clickRaised); - startNext(); + startNext(IS_MOBILE_SAFARI && 500); }); });