This repository was archived by the owner on Aug 21, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathreport_test.js
More file actions
137 lines (131 loc) · 3.88 KB
/
report_test.js
File metadata and controls
137 lines (131 loc) · 3.88 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
Feature('Report');
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth() + 1;
var yyyy = today.getFullYear();
Before((I) => {
I.login('admin', 'password');
I.wait(5);
});
Scenario('Test for Add Report', (I) => {
let someDate = new Date();
someDate.setDate(someDate.getDate());
let dd1 = someDate.getDate();
let mm2 = someDate.getMonth();
let yy2 = someDate.getFullYear();
if (dd < 10) {
dd = '0' + dd;
}
if (dd1 < 10) {
dd1 = '0' + dd1;
}
if (mm < 10) {
mm = '0' + mm;
}
if (mm2 < 10) {
mm2 = '0' + mm2;
}
let sdate = yy2 + '-' + mm2 + '-' + dd1;
let edate = yyyy + '-' + mm + '-' + dd;
var navBar = '//*[@id="itemsinnavbar"]';
var report = '//*[@id="itemsinnavbar"]/li/a[@href="#reports"]';
var newReport = '//*[@id ="fHonRep"]';
var formClass = '//*[@class="form courseSearchResults_Bottom"]';
var date = '//*[@data-type="date"]';
var month = '//*[@data-type="month"]';
var year = '//*[@data-type="year"]';
var saveBtn = '//*[@name="save"]';
var ActReport = '//*[@id="sHonRep"]';
var dateVis = '//input[@type="date"]';
var startDt = '//*[@id="start-date"]';
var endDt = '//*[@id="end-date"]';
var reportBtn = '//*[@id="report_button"]';
var selectDt = '//*[@id="dateSelect"]';
var genRep = '//*[@id="submit"]';
var comment = '//div/table/tbody/tr[2]/td[6]/button[@id="commentButton"]';
var subBtn = '//*[@id="submitFormButton"]';
var clBtn ='//*[@id="cancelFormButton"]';
I.amOnPage('http://127.0.0.1:5981/apps/_design/bell/MyApp/index.html');
I.waitForVisible(navBar);
I.waitForEnabled(navBar);
I.click(report);
I.seeInCurrentUrl('#reports');
I.wait(5)
I.waitForVisible(newReport);
I.waitForEnabled(newReport);
I.click(newReport);
I.seeInCurrentUrl('#reports/add');
I.wait(2);
I.waitForVisible(formClass);
I.waitForEnabled(formClass);
I.fillField('title', "New Report");
I.fillField('author', "New Author");
I.selectOption(date, "22");
I.selectOption(month, "May");
I.selectOption(year, "2017");
I.waitForVisible(saveBtn);
I.waitForEnabled(saveBtn);
I.click(saveBtn);
I.seeInCurrentUrl('#report');
I.amOnPage('http://127.0.0.1:5981/apps/_design/bell/MyApp/index.html#reports');
I.waitForVisible(ActReport);
I.waitForEnabled(ActReport);
I.click(ActReport);
I.wait(10)
I.seeInCurrentUrl('http://127.0.0.1:5981/apps/_design/bell/MyApp/index.html#logreports');
I.wait(2);
I.waitForVisible(dateVis);
I.fillField(startDt, sdate);
I.fillField(endDt, edate);
I.click(reportBtn);
I.seeInCurrentUrl('http://127.0.0.1:5981/apps/_design/bell/MyApp/index.html#logreports');
I.wait(5);
I.amOnPage('http://127.0.0.1:5981/apps/_design/bell/MyApp/index.html#reports');
I.wait(2);
I.waitForVisible(comment);
I.waitForEnabled(comment);
I.click(comment);
I.executeScript(function() {
$('.redactor_ ').html('<b>This is a comment to Trend Report</b>')
});
I.click(subBtn);
I.wait(2);
I.waitForVisible(clBtn);
I.waitForEnabled(clBtn);
I.click(clBtn);
I.seeInCurrentUrl('#reports');
I.wait(5);
I.click('Trend Activity Report');
I.seeInCurrentUrl('#trendreport');
I.wait(2);
I.waitForVisible(selectDt);
I.waitForEnabled(selectDt);
I.fillField(selectDt, edate);
I.waitForVisible(genRep);
I.waitForEnabled(genRep);
I.click(genRep);
I.seeInCurrentUrl('#trendreport');
I.wait(5);
});
Scenario('Test for Delete Report', (I) => {
var navBar = '//*[@id="itemsinnavbar"]';
var report = '//*[@id="itemsinnavbar"]/li/a[@href="#reports"]';
var delet = '//*[@class="btn btn-danger destroy"]';
I.amOnPage('http://127.0.0.1:5981/apps/_design/bell/MyApp/index.html');
I.wait(3);
I.waitForVisible(navBar);
I.waitForEnabled(navBar);
I.click(report);
I.seeInCurrentUrl('#reports');
I.wait(2)
I.waitForVisible(delet);
I.waitForEnabled(delet);
I.click(delet);
I.wait(2);
I.seeInPopup("Are you sure you want to delete this report?");
I.acceptPopup();
I.wait(1);
I.seeInPopup("Successfully deleted report.");
I.acceptPopup();
I.seeInCurrentUrl('#reports');
});