Skip to content

Commit

Permalink
#6717 - v-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksey Novikov committed Aug 16, 2023
1 parent f30fa59 commit fa6a36c
Show file tree
Hide file tree
Showing 9 changed files with 242 additions and 121 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
363 changes: 242 additions & 121 deletions visualRegressionTests/tests/defaultV2/matrix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,126 +86,247 @@ frameworks.forEach(framework => {
});
});

// test("Matrix single-select in panel", async (t) => {
// await wrapVisualTest(t, async (t, comparer) => {
// await t.resizeWindow(1200, 1200);
// await initSurvey(framework, {
// "pages": [
// {
// "name": "page1",
// "elements": [
// {
// "type": "panel",
// "name": "panel1",
// "elements": [
// {
// "type": "matrix",
// "name": "q1",
// "title": "Question",
// "alternateRows": true,
// "columns": [
// {
// "value": "Column 1",
// "text": "Title"
// },
// {
// "value": "Column 2",
// "text": "Title"
// },
// {
// "value": "Column 3",
// "text": "Title"
// },
// {
// "value": "Column 4",
// "text": "Title"
// },
// {
// "value": "Column 5",
// "text": "Title"
// }
// ],
// "rows": [
// {
// "value": "Row 1",
// "text": "Title"
// },
// {
// "value": "Row 2",
// "text": "Title"
// },
// {
// "value": "Row 3",
// "text": "Title"
// }
// ]
// },
// {
// "type": "matrix",
// "name": "q2",
// "title": "Question",
// "alternateRows": true,
// "columns": [
// {
// "value": "Column 1",
// "text": "Title"
// },
// {
// "value": "Column 2",
// "text": "Title"
// },
// {
// "value": "Column 3",
// "text": "Title"
// },
// {
// "value": "Column 4",
// "text": "Title"
// },
// {
// "value": "Column 5",
// "text": "Title"
// }
// ],
// "rows": [
// {
// "value": "Row 1",
// "text": "Title"
// },
// {
// "value": "Row 2",
// "text": "Title"
// },
// {
// "value": "Row 3",
// "text": "Title"
// }
// ]
// }
// ],
// "title": "Question"
// }
// ]
// }
// ],
// "showQuestionNumbers": "off",
// "widthMode": "static",
// "width": "1136"
// });

// const questionRoot = Selector(".sd-row");
// await takeElementScreenshot("question-matrix-single-select-in-panel.png", questionRoot, t, comparer);

// await ClientFunction(() => { window["survey"].getAllQuestions().map(q => q.showHeader = false); })();
// await takeElementScreenshot("question-matrix-single-select-in-panel-no-header.png", questionRoot, t, comparer);

// await ClientFunction(() => { window["survey"].getAllQuestions().map(q => q.titleLocation = "hidden"); })();
// await takeElementScreenshot("question-matrix-single-select-in-panel-no-header-no-title.png", questionRoot, t, comparer);

// await ClientFunction(() => { window["survey"]..getAllQuestions().map(q => q.showHeader = true); })();
// await takeElementScreenshot("question-matrix-single-select-in-panel-no-title.png", questionRoot, t, comparer);
// });
// });
test("Matrix single-select in panel", async (t) => {
await wrapVisualTest(t, async (t, comparer) => {
await t.resizeWindow(1200, 1200);
await initSurvey(framework, {
"pages": [
{
"name": "page1",
"elements": [
{
"type": "panel",
"name": "panel1",
"elements": [
{
"type": "matrix",
"name": "q1",
"title": "Question",
"alternateRows": true,
"columns": [
{
"value": "Column 1",
"text": "Title"
},
{
"value": "Column 2",
"text": "Title"
},
{
"value": "Column 3",
"text": "Title"
},
{
"value": "Column 4",
"text": "Title"
},
{
"value": "Column 5",
"text": "Title"
}
],
"rows": [
{
"value": "Row 1",
"text": "Title"
},
{
"value": "Row 2",
"text": "Title"
},
{
"value": "Row 3",
"text": "Title"
}
]
},
{
"type": "matrix",
"name": "q2",
"title": "Question",
"alternateRows": true,
"columns": [
{
"value": "Column 1",
"text": "Title"
},
{
"value": "Column 2",
"text": "Title"
},
{
"value": "Column 3",
"text": "Title"
},
{
"value": "Column 4",
"text": "Title"
},
{
"value": "Column 5",
"text": "Title"
}
],
"rows": [
{
"value": "Row 1",
"text": "Title"
},
{
"value": "Row 2",
"text": "Title"
},
{
"value": "Row 3",
"text": "Title"
}
]
}
],
"title": "Question"
}
]
}
],
"showQuestionNumbers": "off",
"widthMode": "static",
"width": "1136"
});

const questionRoot = Selector(".sd-row");
await takeElementScreenshot("question-matrix-single-select-in-panel.png", questionRoot, t, comparer);

await ClientFunction(() => { window["survey"].getAllQuestions().map(q => q.showHeader = false); })();
await takeElementScreenshot("question-matrix-single-select-in-panel-no-header.png", questionRoot, t, comparer);

await ClientFunction(() => { window["survey"].getAllQuestions().map(q => q.titleLocation = "hidden"); })();
await takeElementScreenshot("question-matrix-single-select-in-panel-no-header-no-title.png", questionRoot, t, comparer);

await ClientFunction(() => { window["survey"].getAllQuestions().map(q => q.showHeader = true); })();
await takeElementScreenshot("question-matrix-single-select-in-panel-no-title.png", questionRoot, t, comparer);
});
});

test("Matrix multi-select in panel", async (t) => {
await wrapVisualTest(t, async (t, comparer) => {
await t.resizeWindow(1200, 1200);
await initSurvey(framework, {
"pages": [
{
"name": "page1",
"elements": [
{
"type": "panel",
"name": "panel1",
"elements": [
{
"type": "matrixdropdown",
"name": "q1",
"title": "Question",
"cellType": "text",
"columns": [
{
"name": "Column 1",
"title": "Title"
},
{
"name": "Column 2",
"title": "Title"
},
{
"name": "Column 3",
"title": "Title"
},
{
"name": "Column 4",
"title": "Title"
},
{
"name": "Column 5",
"title": "Title"
}
],
"rows": [
{
"value": "Row 1",
"text": "Title"
},
{
"value": "Row 2",
"text": "Title"
},
{
"value": "Row 3",
"text": "Title"
}
]
},
{
"type": "matrixdropdown",
"name": "q2",
"title": "Question",
"cellType": "text",
"columns": [
{
"name": "Column 1",
"title": "Title"
},
{
"name": "Column 2",
"title": "Title"
},
{
"name": "Column 3",
"title": "Title"
},
{
"name": "Column 4",
"title": "Title"
},
{
"name": "Column 5",
"title": "Title"
}
],
"rows": [
{
"value": "Row 1",
"text": "Title"
},
{
"value": "Row 2",
"text": "Title"
},
{
"value": "Row 3",
"text": "Title"
}
]
}
],
"title": "Question"
}
]
}
],
"showQuestionNumbers": "off",
"widthMode": "static",
"width": "1136"
});

const questionRoot = Selector(".sd-row");
await takeElementScreenshot("question-matrix-multi-select-in-panel.png", questionRoot, t, comparer);

await ClientFunction(() => { window["survey"].getAllQuestions().map(q => q.showHeader = false); })();
await takeElementScreenshot("question-matrix-multi-select-in-panel-no-header.png", questionRoot, t, comparer);

await ClientFunction(() => { window["survey"].getAllQuestions().map(q => q.titleLocation = "hidden"); })();
await takeElementScreenshot("question-matrix-multi-select-in-panel-no-header-no-title.png", questionRoot, t, comparer);

await ClientFunction(() => { window["survey"].getAllQuestions().map(q => q.showHeader = true); })();
await takeElementScreenshot("question-matrix-multi-select-in-panel-no-title.png", questionRoot, t, comparer);
});
});

test("Matrix multi-select", async (t) => {
await wrapVisualTest(t, async (t, comparer) => {
Expand Down Expand Up @@ -635,7 +756,7 @@ frameworks.forEach(framework => {
await resetFocusToBody();
await takeElementScreenshot("question-matrix-alternate-rows-invalid-value.png", rowElement, t, comparer);

await ClientFunction(()=>{
await ClientFunction(() => {
(window as any).survey.getAllQuestions()[0].value = { "Row 1": "Column 1" };
document.body.focus();
})();
Expand Down

0 comments on commit fa6a36c

Please sign in to comment.