-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLayoutDialog.svb
More file actions
398 lines (319 loc) · 10.9 KB
/
LayoutDialog.svb
File metadata and controls
398 lines (319 loc) · 10.9 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
'USEUNIT CommonFunction
'===============================================================================
' Function: GetLayoutRowNumber
'
' Description:
'
' Parameters:
' Object - objTable : table object in which we are search.
' String - strCreateForName : the name of the category in which you want to find item
' String - strLayoutName : name of the item you want to find
' Iteger - intColumn : number column with the name of layout
'
' Returns:
' Integer - Row Number (0 if not found)
'
'===============================================================================
Function GetLayoutRowNumber(objTable, strCreateForName, strLayoutName, intColumn)
Log.AppendFolder("Get select layout dialog row number")
intCategoryColumnNumber = 0
For i = 0 To objTable.RowCount - 1
If (objTable.Cell(i, 0).colSpan = 3) AND InStr(objTable.Cell(i, 0).contentText, strCreateForName) Then
intCategoryColumnNumber = i + 1
Exit For
Else
If i = (objTable.RowCount - 1) Then
Log.Message("Category " & strCreateForName & " not found ")
GetLayoutRowNumber = 0
Log.PopLogFolder
Exit Function
End If
End if
Next
For i = intCategoryColumnNumber To objTable.RowCount - 1
If objTable.Cell(i, 0).colSpan = 1 Then
If LCase(Trim(objTable.Cell(i, intColumn).innerText)) = LCase(strLayoutName) Then
GetLayoutRowNumber = i
Exit For
Else
If i = (objTable.RowCount - 1) Then
Log.Message("Layout " & strCreateForName & " not found ")
GetLayoutRowNumber = 0
End if
End if
End if
Next
Log.PopLogFolder
End Function
'===============================================================================
' Function: FindDialog
' Find the dialog Object
'
' Description:
' Finds the dialog Object and returns it
'
' Parameters:
' String - DialogIdStr : Pass idStr of the Dialog you want to check
'
' Returns:
' Object - Dialog object
'
'===============================================================================
Function FindDialog(DialogIdStr)
On Error Resume Next
Log.AppendFolder("Finds the Dialog Object")
Indicator.PushText("Finds the Dialog Object")
Call Aliases.browser.WaitPage("http*", 120000)
set objPage = Aliases.browser.page
'Logic to wait for the page objects to load
If aqObject.IsSupported(objPage , "contentDocument") = False Then
Log.Message("Delay for content document to load")
AQUtils.Delay 5000
End If
If aqObject.IsSupported(objPage.contentDocument, "body") = False Then
Log.Message("Delay for body to load")
AQUtils.Delay 5000
End If
If aqObject.IsSupported(objPage.contentDocument.body, "children") = False Then
Log.Message("Delay for children to load")
AQUtils.Delay 5000
End If
set objPage = Aliases.browser.page
set objDialog = HTML.FindChildMethods.FromParent_Proximity1(objPage, "idStr", DialogIdStr, 2)
If objDialog.Exists Then
Set FindDialog = objDialog
Else
Set FindDialog = objDialog
Log.Warning("Dialog is not on the screen")
End iF
'Error Handling
If Err.Number <> 0 Then
Log.Error("Error encountered: Source: " & Err.Source & " Description: " & Err.Description)
Log.Message("Error encountered: Source: " & Err.Source & " Description: " & Err.Description)
Err.Clear
End if
Indicator.PopText
Log.PopLogFolder
End Function
'===============================================================================
' Sub: SLDRowsChecking
' Checks all the rows in the list of layout.
'
' Description:
' Checks all the rows in the list of layout.
'
' Parameters:
' Object - objDialog : Dialog object
'
'===============================================================================
Sub SLDRowsChecking(objDialog)
On Error Resume Next
Log.AppendFolder("Checking all the rows in the list of layout.")
Indicator.PushText("Checking all the rows in the list of layout.")
Set TableList = HTML.FindChildMethods.FromParent_Proximity1(objDialog, "idStr", "qadLDLayoutList", 2)
Dim i, TableValues
TableValues = SLDParseTable(TableList)
Log.AppendFolder("Validation the active column of each item")
For i = 0 To UBound(TableValues)
ActiveColumnChecking(TableValues(i))
Next
Log.PopLogFolder
Indicator.PopText
Log.PopLogFolder
End sub
'===============================================================================
' Sub: ActiveColumnChecking
' Checking the absence of values and duplication "Yes".
'
' Description:
' Checking the absence of values and duplication "Yes".
'
' Parameters:
' Array - arrTBody : array of the rows in TBODY.
'
'===============================================================================
Sub ActiveColumnChecking(arrTBody)
Dim i, tempActive
checkEr = false
tempActive = "No"
For i = 1 to UBound(arrTBody, 1)
' Check for the absence of value.
If arrTBody(i, 2) <> "" Then
' Check for duplicate "Yes".
If arrTBody(i, 2) = "Yes" Then
if tempActive = "Yes" Then
checkEr = true
Exit For
Else
tempActive = "Yes"
End if
End If
Else
checkEr = true
Exit For
End If
Next
' Check for at least one Yes-active in "System".
If (arrTBody(0, 0) = "System") and (tempActive = "No") Then
checkEr = true
Log.Warning("All System layouts are inactive.")
End if
If checkEr = true Then
Log.Warning(arrTBody(0, 0) & " is FAIL")
Else
Log.Checkpoint(arrTBody(0, 0) & " is DONE")
End If
End Sub
'===============================================================================
' Function: SLDParseTable
' Parse TABLE
'
' Parameters:
' Object - objTable : TABLE object
'
' Returns:
' Array(Array(n,2), Array(n,2)... ) - array of arrays TBODY.
'===============================================================================
Function SLDParseTable(objTable)
Dim i
ReDim TableValues(objTable.tBodies.length - 1)
' Parses the TBODY elements
For i = 0 To objTable.tBodies.length - 1
TableValues(i) = SLDParseTableBody(objTable.tBodies.item(i))
Next
SLDParseTable = TableValues
End Function
'===============================================================================
' Function: SLDParseTableBody
' Parse TBODY
'
' Parameters:
' Object - objTableBody : TBODY object
'
' Returns:
' Array(n,2) - array of all the rows in TBODY object.
'===============================================================================
Function SLDParseTableBody(objTableBody)
Dim i, j, row
ReDim TBodyValues(objTableBody.rows.length - 1, 2)
' Goes through rows
For i = 0 To objTableBody.rows.length - 1
' Obtains a row
Set row = objTableBody.rows.item(i)
TBodyValues(i, 0) = Trim(row.cells.item(0).innerText)
if i > 0 Then
TBodyValues(i, 1) = Trim(row.cells.item(1).innerText)
TBodyValues(i, 2) = Trim(row.cells.item(2).innerText)
End if
Next
SLDParseTableBody = TBodyValues
End function
' '===============================================================================
' ' Sub: MARowsChecking
' ' Checks all the rows in the list of layout.
' '
' ' Description:
' ' Checks all the rows in the list of layout.
' '
' ' Parameters:
' ' Object - objDialog : Dialog object
' '
' '===============================================================================
' Sub MARowsChecking(objDialog)
' On Error Resume Next
' Log.AppendFolder("Checking all the rows in the list of layout.")
' Indicator.PushText("Checking all the rows in the list of layout.")
' Set TableList = HTML.FindChildMethods.FromParent_Proximity1(objDialog, "idStr", "qadLDLayoutList", 2)
' Dim i, arrTableValues
' arrTableValues = MAParseTable(TableList)
' Log.AppendFolder("Validation the active column of each item")
' For i = 0 To UBound(arrTableValues)
' ActiveColumnChecking(arrTableValues(i))
' Next
' Log.PopLogFolder
' Indicator.PopText
' Log.PopLogFolder
' End sub
' '===============================================================================
' ' Sub: ActiveColumnChecking
' ' Checking the absence of values and duplication "Yes".
' '
' ' Description:
' ' Checking the absence of values and duplication "Yes".
' '
' ' Parameters:
' ' Array - arrTBody : array of the rows in TBODY.
' '
' '===============================================================================
' Sub ActiveColumnChecking(arrTBody)
' Dim i, tempActive
' bolCheckEr = false
' bolTempActive = false
' For i = 1 to UBound(arrTBody, 1) - 1
' If TypeName(arrTBody(i, 0)) = "Boolean" Then
' ' Check for duplicate active layout.
' If arrTBody(i, 0) = true Then
' if bolTempActive = true Then
' bolCheckEr = true
' Exit For
' Else
' bolTempActive = true
' End if
' End If
' Else
' bolCheckEr = true
' Exit For
' End If
' Next
' ' Check for at least one Yes-active in "System".
' If (arrTBody(0, 0) = "System") and (bolTempActive = true) Then
' bolCheckEr = true
' End if
' If bolCheckEr = true Then
' Log.Warning(arrTBody(0, 0) & " is FAIL")
' Else
' Log.Checkpoint(arrTBody(0, 0) & " is DONE")
' End If
' End Sub
' '===============================================================================
' ' Function: MAParseTable
' ' Parse TABLE
' '
' ' Parameters:
' ' Object - objTable : TABLE object
' '
' ' Returns:
' ' Array(Array(n,2), Array(n,2)... ) - array of arrays TBODY.
' '===============================================================================
' Function MAParseTable(objTable)
' ReDim arrTableValues(objTable.tBodies.length - 1)
' ' Parses the TBODY elements
' For i = 0 To objTable.tBodies.length - 1
' strCatName = objTable.tBodies.item(i).rows.item(0).cells.item(0).innerText
' Log.Message(strCatName)
' arrTableValues(i) = MAParseTableBody(objTable.tBodies.item(i))
' Next
' MAParseTable = arrTableValues
' End Function
' '===============================================================================
' ' Function: MAParseTableBody
' ' Parse TBODY
' '
' ' Parameters:
' ' Object - objTableBody : TBODY object
' '
' ' Returns:
' ' Array(n,2) - array of all the rows in TBODY object.
' '===============================================================================
' Function MAParseTableBody(objTableBody)
' ReDim TBodyValues(objTableBody.rows.length - 1, 2)
' ' Goes through rows
' For i = 1 To objTableBody.rows.length - 1
' ' Obtains a row
' Set objRow = objTableBody.rows.item(i)
' TBodyValues(i, 0) = objRow.cells.item(0).firstElementChild.checked
' TBodyValues(i, 1) = Trim(objRow.cells.item(1).innerText)
' TBodyValues(i, 2) = Trim(objRow.cells.item(2).innerText)
' Next
' MAParseTableBody = TBodyValues
' End function