-
Notifications
You must be signed in to change notification settings - Fork 855
/
Copy pathicheckmatrix.js
66 lines (58 loc) · 1.88 KB
/
icheckmatrix.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import { frameworks, url_test, initSurvey, getSurveyResult, checkSurveyWithEmptyQuestion } from "../helper";
import { fixture, Selector, test } from "testcafe";
const title = "icheckmatrix";
const json = {
questions: [
{
type: "matrix",
isRequired: true,
name: "Quality",
title:
"Please indicate if you agree or disagree with the following statements",
columns: [
{ value: 1, text: "Strongly Disagree" },
{ value: 2, text: "Disagree" },
{ value: 3, text: "Neutral" },
{ value: 4, text: "Agree" },
{ value: 5, text: "Strongly Agree" }
],
rows: [
{ value: "affordable", text: "Product is affordable" },
{ value: "does what it claims", text: "Product does what it claims" },
{
value: "better than others",
text: "Product is better than other products on the market"
},
{ value: "easy to use", text: "Product is easy to use" }
]
}
]
};
frameworks.forEach(framework => {
fixture`${framework} ${title}`
.page`${url_test}customWidget/${framework}`.beforeEach(async ctx => {
await ctx.debug();
await initSurvey(framework, json);
});
test("check integrity", async t => {
// const getCount = ClientFunction(
// () => document.querySelectorAll("ins.iCheck-helper").length
// );
await t.expect(Selector("ins.iCheck-helper").count).eql(20);
});
test("choose empty", async t => {
await checkSurveyWithEmptyQuestion(t);
});
test("choose value", async t => {
let surveyResult;
await t
.click("table tr:nth-child(1) td:nth-child(3) ins")
.click("table tr:nth-child(2) td:nth-child(4) ins")
.click("input[value=Complete]");
surveyResult = await getSurveyResult();
await t.expect(surveyResult.Quality).eql({
affordable: "2",
"does what it claims": "3"
});
});
});