Skip to content

Commit

Permalink
try to fix title location test blinking (#6979)
Browse files Browse the repository at this point in the history
* try to fix title location test blinking

* moved f-test to v-test
  • Loading branch information
novikov82 committed Sep 22, 2023
1 parent 8077326 commit 6d5ce94
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 50 deletions.
50 changes: 0 additions & 50 deletions testCafe/survey/questionsInOneLine.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,54 +73,4 @@ frameworks.forEach((framework) => {
assert(await isCountRight());
});

test("change title location", async (t) => {
const isInputAboveHeader = ClientFunction(() => {
const h5 = document.querySelector(
"div[data-name='city'] h5:first-of-type"
);
const input = document.querySelector("div[data-name='city'] input");
return h5.getBoundingClientRect().top > input.getBoundingClientRect().top;
});

const isHeaderAboveInput = ClientFunction(() => {
const h5 = document.querySelector(
"div[data-name='city'] h5:first-of-type"
);
const input = document.querySelector("div[data-name='city'] input");
return h5.getBoundingClientRect().top < input.getBoundingClientRect().top;
});

assert(await isInputAboveHeader());

await changeTitleLocation("top");

assert(await isHeaderAboveInput());
});

test("change title location left", async (t) => {
const isInputAboveHeader = ClientFunction(() => {
var h5 = document.querySelectorAll(
"div[data-name='city'] h5:first-of-type"
)[0];
var input = document.querySelector("div[data-name='city'] input");
return (
h5.getBoundingClientRect().left === input.getBoundingClientRect().left
);
});

const isHeaderToTheLeftOfInput = ClientFunction(() => {
var h5 = document.querySelectorAll(
"div[data-name='city'] h5:first-of-type"
)[0],
input = document.querySelector("div[data-name='city'] input");
return (
h5.getBoundingClientRect().left < input.getBoundingClientRect().left
);
});

assert(await isInputAboveHeader());
await changeTitleLocation("left");

assert(await isHeaderToTheLeftOfInput());
});
});
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions visualRegressionTests/tests/defaultV2/question.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,43 @@ frameworks.forEach(framework => {
});
});

test("Check questions in one row", async (t) => {
await wrapVisualTest(t, async (t, comparer) => {

await t.resizeWindow(1920, 1080);
await initSurvey(framework, {
questions: [
{
type: "text",
name: "question_with_num",
title: "Personal information"
},
{
type: "text",
name: "question_with_num",
startWithNewLine: false,
title: "Contact information"
},
]
},);
const rowSelector = Selector(".sd-row");
await resetFocusToBody();
await takeElementScreenshot("multiple-row.png", rowSelector, t, comparer);

await ClientFunction(() => {
window["survey"].questionTitleLocation = "bottom";
window["survey"].render();
})();
await takeElementScreenshot("multiple-row-title-bottom.png", rowSelector, t, comparer);

await ClientFunction(() => {
window["survey"].questionTitleLocation = "left";
window["survey"].render();
})();
await takeElementScreenshot("multiple-row-title-left.png", rowSelector, t, comparer);
});
});

test("Check questions in one row with different default heights", async (t) => {
await wrapVisualTest(t, async (t, comparer) => {

Expand Down

0 comments on commit 6d5ce94

Please sign in to comment.