-
Notifications
You must be signed in to change notification settings - Fork 857
/
Copy pathimage.js
45 lines (41 loc) · 1.22 KB
/
image.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import { Selector, fixture, test } from "testcafe";
import { frameworks, url, initSurvey, getSurveyResult, getQuestionValue, getQuestionJson, checkSurveyWithEmptyQuestion } from "../helper";
const title = "image";
const json = {
questions: [
{
type: "image",
name: "image",
imageLink: "https://surveyjs.io/Content/Images/examples/image-picker/lion.jpg"
},
{
type: "image",
name: "video",
imageLink: "https://surveyjs.io/Content/Images/examples/image-picker/lion.avi"
},
{
type: "image",
name: "youtube",
imageLink: "https://www.youtube.com/embed/tgbNymZ7vqY"
}
]
};
frameworks.forEach(framework => {
fixture`${framework} ${title}`.page`${url}${framework}`.beforeEach(
async t => {
await initSurvey(framework, json);
}
);
function SelectorByNumber(questionNumber) {
return Selector(".sd-body .sd-row")
.nth(questionNumber)
.find(".sd-question")
.find(".sd-image");
}
test("Check image question layout", async t => {
await t
.expect(SelectorByNumber(0).child("img").exists).ok()
.expect(SelectorByNumber(1).child("video").exists).ok()
.expect(SelectorByNumber(2).child("iframe").exists).ok();
});
});