From 2e6cfb46e5c54ebbf31cdfc29e0bcc21749a23b4 Mon Sep 17 00:00:00 2001 From: Andrew Telnov Date: Mon, 16 Oct 2023 10:57:56 +0300 Subject: [PATCH] Rename settings, and fix functional tests #7153 --- src/settings.ts | 2 +- src/survey.ts | 2 +- testCafe/survey/autoNextPage.js | 17 ++++++++++++----- tests/ko/survey_kotests.ts | 2 +- tests/surveyShowPreviewTests.ts | 2 +- tests/surveyquestiontests.ts | 6 +++--- tests/surveytests.ts | 2 +- 7 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/settings.ts b/src/settings.ts index 23345aa653..3699df546e 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -546,7 +546,7 @@ export var settings = { notifications: { lifetime: 2000 }, - nextPageAutomaticDelay: 300, + autoAdvanceDelay: 300, /** * Specifies the direction in which to lay out Checkbox and Radiogroup items. This setting affects the resulting UI when items are arranged in [more than one column](https://surveyjs.io/form-library/documentation/api-reference/checkbox-question-model#colCount). * diff --git a/src/survey.ts b/src/survey.ts index fa4c8496b8..0eaa063ac8 100644 --- a/src/survey.ts +++ b/src/survey.ts @@ -6344,7 +6344,7 @@ export class SurveyModel extends SurveyElementCore } } }; - surveyTimerFunctions.safeTimeOut(goNextPage, settings.nextPageAutomaticDelay); + surveyTimerFunctions.safeTimeOut(goNextPage, settings.autoAdvanceDelay); } /** * Returns a comment value from a question with a specified `name`. diff --git a/testCafe/survey/autoNextPage.js b/testCafe/survey/autoNextPage.js index cce1df310a..39b2403f87 100644 --- a/testCafe/survey/autoNextPage.js +++ b/testCafe/survey/autoNextPage.js @@ -101,11 +101,14 @@ frameworks.forEach(framework => { ); let surveyResult; assert.notEqual(await getProgressTextPosition(1), -1); - await t.click("input[type=radio]"); + await t.click("input[type=radio]") + .wait(500); assert.notEqual(await getProgressTextPosition(2), -1); - await t.click("input[type=radio]"); + await t.click("input[type=radio]") + .wait(500); assert.notEqual(await getProgressTextPosition(3), -1); - await t.click("input[type=radio]"); + await t.click("input[type=radio]") + .wait(500); surveyResult = await getSurveyResult(); await t.expect(surveyResult).eql({ civilwar: "1750-1800", @@ -154,8 +157,11 @@ frameworks.forEach(framework => { await t .click("input[name=\"sq_100_A\"][value=\"1\"]") + .wait(500) .click("input[name=\"sq_100_B\"][value=\"2\"]") - .click("input[name=\"sq_100_C\"][value=\"3\"]"); + .wait(500) + .click("input[name=\"sq_100_C\"][value=\"3\"]") + .wait(500); surveyResult = await getSurveyResult(); assert.deepEqual(surveyResult.q1, { A: 1, B: 2, C: 3 }); @@ -187,7 +193,8 @@ frameworks.forEach(framework => { let surveyResult; const label3 = Selector("label").withText("3"); await t - .click(label3); + .click(label3) + .wait(500); surveyResult = await getSurveyResult(); assert.equal(surveyResult.q1, 3); diff --git a/tests/ko/survey_kotests.ts b/tests/ko/survey_kotests.ts index 14dab93777..f3d4009798 100644 --- a/tests/ko/survey_kotests.ts +++ b/tests/ko/survey_kotests.ts @@ -28,7 +28,7 @@ import { settings } from "../../src/settings"; export default QUnit.module("koTests"); -settings.nextPageAutomaticDelay = 0; +settings.autoAdvanceDelay = 0; QUnit.test("koOtherVisible for one choice items", function (assert) { var survey = new Survey(); diff --git a/tests/surveyShowPreviewTests.ts b/tests/surveyShowPreviewTests.ts index 316d134faf..7c032bd554 100644 --- a/tests/surveyShowPreviewTests.ts +++ b/tests/surveyShowPreviewTests.ts @@ -6,7 +6,7 @@ import { settings } from "../src/settings"; export default QUnit.module("SurveyShowPreviewTests"); -settings.nextPageAutomaticDelay = 0; +settings.autoAdvanceDelay = 0; QUnit.test("Complete and Preview button visibility", function(assert) { var survey = new SurveyModel({ elements: [{ type: "text", name: "q1" }] }); diff --git a/tests/surveyquestiontests.ts b/tests/surveyquestiontests.ts index 23af51b093..0695f77cd0 100644 --- a/tests/surveyquestiontests.ts +++ b/tests/surveyquestiontests.ts @@ -42,7 +42,7 @@ import { surveyTimerFunctions } from "../src/surveytimer"; export default QUnit.module("Survey_Questions"); -settings.nextPageAutomaticDelay = 0; +settings.autoAdvanceDelay = 0; class QuestionMatrixRandomModel extends QuestionMatrixModel { constructor(name: string) { @@ -831,7 +831,7 @@ QUnit.test("Multiple Text Question: support goNextPageAutomatic", function ( ); }); QUnit.test("Use timer to go next page", function (assert) { - settings.nextPageAutomaticDelay = 250; + settings.autoAdvanceDelay = 250; const json = { pages: [ { @@ -870,7 +870,7 @@ QUnit.test("Use timer to go next page", function (assert) { assert.equal(survey.currentPageNo, 1, "Go to the second page"); assert.equal(checkDelay, 250, "setTimeout function is called"); surveyTimerFunctions.safeTimeOut = prevFunc; - settings.nextPageAutomaticDelay = 0; + settings.autoAdvanceDelay = 0; }); QUnit.test("Radiogroup Question: support goNextPageAutomatic + hasOther", function (assert) { var json = { diff --git a/tests/surveytests.ts b/tests/surveytests.ts index ab84edf211..2c38f229ef 100644 --- a/tests/surveytests.ts +++ b/tests/surveytests.ts @@ -66,7 +66,7 @@ import { StylesManager } from "../src/stylesmanager"; export default QUnit.module("Survey"); -settings.nextPageAutomaticDelay = 0; +settings.autoAdvanceDelay = 0; QUnit.test("set data property", function (assert) { var survey = new SurveyModel();