Skip to content

Commit

Permalink
Work for #5551 - Implement TOC navigation - fixed f-test and skipped …
Browse files Browse the repository at this point in the history
…one vr-test for Vue
  • Loading branch information
tsv2013 committed Feb 27, 2023
1 parent a3cfa5d commit 438c622
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 60 deletions.
9 changes: 7 additions & 2 deletions testCafe/survey/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,19 @@ frameworks.forEach(framework => {
});

test("show top progress bar", async t => {
const questionElements = Selector(".sv_container > .sv-components-column > div");
let progressSelector = ".sv_container > div:nth-child(2)";
if(framework === "vue") { // TODO: reanimate Vue after Vue3 supported
progressSelector = ".sv_container > .sv-components-column > div";
}

const progressElement = Selector(progressSelector);
await t.expect(progressbar.exists).notOk();

await show_top_progress_bar();
await t
.expect(progressbar.visible).ok()
.expect(progressbar.textContent).contains("Page 1 of 3")
.expect(questionElements.classNames).contains("sv_progress");
.expect(progressElement.classNames).contains("sv_progress");
});

test("show bottom progress bar", async t => {
Expand Down
119 changes: 61 additions & 58 deletions visualRegressionTests/tests/defaultV2/survey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -507,65 +507,68 @@ frameworks.forEach(framework => {
});
});
test("Check survey progress bar freezes on top", async (t) => {
await wrapVisualTest(t, async (t, comparer) => {
await t.resizeWindow(1500, 720);
const json = {
"title": "American History",
"showProgressBar": "top",
"pages": [
{
"elements": [
{
"type": "radiogroup",
"name": "civilwar",
"title": "When was the American Civil War?",
"choices": [
"1796-1803",
"1810-1814",
"1861-1865",
"1939-1945"
],
"correctAnswer": "1861-1865"
},
{
"type": "radiogroup",
"name": "libertyordeath",
"title": "Whose quote is this: \"Give me liberty, or give me death\"?",
"choices": [
"John Hancock",
"James Madison",
"Patrick Henry",
"Samuel Adams"
],
"correctAnswer": "Patrick Henry"
},
{
"type": "radiogroup",
"name": "magnacarta",
"title": "What is Magna Carta?",
"choices": [
"The foundation of the British parliamentary system",
"The Great Seal of the monarchs of England",
"The French Declaration of the Rights of Man",
"The charter signed by the Pilgrims on the Mayflower"
],
"correctAnswer": "The foundation of the British parliamentary system"
}
]
if(framework in ["knockout", "react", "angular"]) { // TODO: reanimate Vue after Vue3 supported
await wrapVisualTest(t, async (t, comparer) => {
await t.resizeWindow(1500, 720);
const json = {
"title": "American History",
"showProgressBar": "top",
"pages": [
{
"elements": [
{
"type": "radiogroup",
"name": "civilwar",
"title": "When was the American Civil War?",
"choices": [
"1796-1803",
"1810-1814",
"1861-1865",
"1939-1945"
],
"correctAnswer": "1861-1865"
},
{
"type": "radiogroup",
"name": "libertyordeath",
"title": "Whose quote is this: \"Give me liberty, or give me death\"?",
"choices": [
"John Hancock",
"James Madison",
"Patrick Henry",
"Samuel Adams"
],
"correctAnswer": "Patrick Henry"
},
{
"type": "radiogroup",
"name": "magnacarta",
"title": "What is Magna Carta?",
"choices": [
"The foundation of the British parliamentary system",
"The Great Seal of the monarchs of England",
"The French Declaration of the Rights of Man",
"The charter signed by the Pilgrims on the Mayflower"
],
"correctAnswer": "The foundation of the British parliamentary system"
}
]
}
]
};
await initSurvey(framework, json);
await ClientFunction(() => {
const surveyElement = document.getElementById("surveyElement");
if(surveyElement) {
surveyElement.style.height = "90vh";
surveyElement.style.overflowY = "auto";
document.querySelector("[data-name='libertyordeath']")?.scrollIntoView(true);
}
]
};
await initSurvey(framework, json);
await ClientFunction(() => {
const surveyElement = document.getElementById("surveyElement");
if(surveyElement) {
surveyElement.style.height = "90vh";
surveyElement.style.overflowY = "auto";
document.querySelector("[data-name='libertyordeath']")?.scrollIntoView(true);
}
})();
await takeElementScreenshot("survey-progress-top-freeze.png", Selector("body"), t, comparer);
});
})();
//t.debug();
await takeElementScreenshot("survey-progress-top-freeze.png", Selector("body"), t, comparer);
});
}
});

const notifierJson = {
Expand Down

0 comments on commit 438c622

Please sign in to comment.