@servicenow/sdk-build-plugins 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/dist/AttachmentPlugin.d.ts +253 -0
  2. package/dist/AttachmentPlugin.js +216 -0
  3. package/dist/AttachmentPlugin.js.map +1 -0
  4. package/dist/BusinessRulePlugin.d.ts +56 -0
  5. package/dist/BusinessRulePlugin.js +171 -0
  6. package/dist/BusinessRulePlugin.js.map +1 -0
  7. package/dist/CrossScopePrivilegePlugin.d.ts +22 -0
  8. package/dist/CrossScopePrivilegePlugin.js +42 -0
  9. package/dist/CrossScopePrivilegePlugin.js.map +1 -0
  10. package/dist/DefaultPlugin.d.ts +71 -0
  11. package/dist/DefaultPlugin.js +238 -0
  12. package/dist/DefaultPlugin.js.map +1 -0
  13. package/dist/IdPlugin.d.ts +17 -0
  14. package/dist/IdPlugin.js +45 -0
  15. package/dist/IdPlugin.js.map +1 -0
  16. package/dist/ListPlugin.d.ts +91 -0
  17. package/dist/ListPlugin.js +398 -0
  18. package/dist/ListPlugin.js.map +1 -0
  19. package/dist/PropertyPlugin.d.ts +122 -0
  20. package/dist/PropertyPlugin.js +165 -0
  21. package/dist/PropertyPlugin.js.map +1 -0
  22. package/dist/ScriptTemplatePlugin.d.ts +31 -0
  23. package/dist/ScriptTemplatePlugin.js +208 -0
  24. package/dist/ScriptTemplatePlugin.js.map +1 -0
  25. package/dist/UserPreferencePlugin.d.ts +16 -0
  26. package/dist/UserPreferencePlugin.js +30 -0
  27. package/dist/UserPreferencePlugin.js.map +1 -0
  28. package/dist/aclAndRole/AclPlugin.d.ts +117 -0
  29. package/dist/aclAndRole/AclPlugin.js +285 -0
  30. package/dist/aclAndRole/AclPlugin.js.map +1 -0
  31. package/dist/aclAndRole/RolePlugin.d.ts +58 -0
  32. package/dist/aclAndRole/RolePlugin.js +152 -0
  33. package/dist/aclAndRole/RolePlugin.js.map +1 -0
  34. package/dist/aclAndRole/Util.d.ts +3 -0
  35. package/dist/aclAndRole/Util.js +106 -0
  36. package/dist/aclAndRole/Util.js.map +1 -0
  37. package/dist/app/ApplicationMenuPlugin.d.ts +32 -0
  38. package/dist/app/ApplicationMenuPlugin.js +106 -0
  39. package/dist/app/ApplicationMenuPlugin.js.map +1 -0
  40. package/dist/atf/ATFComposer.d.ts +492 -0
  41. package/dist/atf/ATFComposer.js +2717 -0
  42. package/dist/atf/ATFComposer.js.map +1 -0
  43. package/dist/atf/TestPlugin.d.ts +31 -0
  44. package/dist/atf/TestPlugin.js +95 -0
  45. package/dist/atf/TestPlugin.js.map +1 -0
  46. package/dist/atf/index.d.ts +1 -0
  47. package/dist/atf/index.js +9 -0
  48. package/dist/atf/index.js.map +1 -0
  49. package/dist/db/ColumnPlugins.d.ts +278 -0
  50. package/dist/db/ColumnPlugins.js +112 -0
  51. package/dist/db/ColumnPlugins.js.map +1 -0
  52. package/dist/db/RecordPlugin.d.ts +208 -0
  53. package/dist/db/RecordPlugin.js +287 -0
  54. package/dist/db/RecordPlugin.js.map +1 -0
  55. package/dist/db/TablePlugin.d.ts +742 -0
  56. package/dist/db/TablePlugin.js +1249 -0
  57. package/dist/db/TablePlugin.js.map +1 -0
  58. package/dist/db/index.d.ts +3 -0
  59. package/dist/db/index.js +27 -0
  60. package/dist/db/index.js.map +1 -0
  61. package/dist/index.d.ts +16 -0
  62. package/dist/index.js +51 -0
  63. package/dist/index.js.map +1 -0
  64. package/dist/scriptedRESTAPI/RESTDeserializationUtils.d.ts +12 -0
  65. package/dist/scriptedRESTAPI/RESTDeserializationUtils.js +371 -0
  66. package/dist/scriptedRESTAPI/RESTDeserializationUtils.js.map +1 -0
  67. package/dist/scriptedRESTAPI/RESTSerializationUtils.d.ts +15 -0
  68. package/dist/scriptedRESTAPI/RESTSerializationUtils.js +177 -0
  69. package/dist/scriptedRESTAPI/RESTSerializationUtils.js.map +1 -0
  70. package/dist/scriptedRESTAPI/RestApiPlugin.d.ts +144 -0
  71. package/dist/scriptedRESTAPI/RestApiPlugin.js +318 -0
  72. package/dist/scriptedRESTAPI/RestApiPlugin.js.map +1 -0
  73. package/dist/scriptedRESTAPI/RestSchemaUtils.d.ts +190 -0
  74. package/dist/scriptedRESTAPI/RestSchemaUtils.js +53 -0
  75. package/dist/scriptedRESTAPI/RestSchemaUtils.js.map +1 -0
  76. package/dist/scriptedRESTAPI/RestUtils.d.ts +75 -0
  77. package/dist/scriptedRESTAPI/RestUtils.js +469 -0
  78. package/dist/scriptedRESTAPI/RestUtils.js.map +1 -0
  79. package/dist/scripts/ClientScriptPlugin.d.ts +43 -0
  80. package/dist/scripts/ClientScriptPlugin.js +190 -0
  81. package/dist/scripts/ClientScriptPlugin.js.map +1 -0
  82. package/dist/scripts/scriptUtils.d.ts +15 -0
  83. package/dist/scripts/scriptUtils.js +83 -0
  84. package/dist/scripts/scriptUtils.js.map +1 -0
  85. package/dist/uxf/ExperiencePlugin.d.ts +22 -0
  86. package/dist/uxf/ExperiencePlugin.js +55 -0
  87. package/dist/uxf/ExperiencePlugin.js.map +1 -0
  88. package/dist/uxf/RoutesPlugin.d.ts +22 -0
  89. package/dist/uxf/RoutesPlugin.js +176 -0
  90. package/dist/uxf/RoutesPlugin.js.map +1 -0
  91. package/dist/uxf/UxfFormulaParser/cleanUxValue.d.ts +4 -0
  92. package/dist/uxf/UxfFormulaParser/cleanUxValue.js +65 -0
  93. package/dist/uxf/UxfFormulaParser/cleanUxValue.js.map +1 -0
  94. package/dist/uxf/UxfFormulaParser/grammerParser/api.d.ts +189 -0
  95. package/dist/uxf/UxfFormulaParser/grammerParser/api.js +158 -0
  96. package/dist/uxf/UxfFormulaParser/grammerParser/api.js.map +1 -0
  97. package/dist/uxf/UxfFormulaParser/grammerParser/clientTransformMap.d.ts +13 -0
  98. package/dist/uxf/UxfFormulaParser/grammerParser/clientTransformMap.js +604 -0
  99. package/dist/uxf/UxfFormulaParser/grammerParser/clientTransformMap.js.map +1 -0
  100. package/dist/uxf/UxfFormulaParser/grammerParser/grammarParser.d.ts +12 -0
  101. package/dist/uxf/UxfFormulaParser/grammerParser/grammarParser.js +551 -0
  102. package/dist/uxf/UxfFormulaParser/grammerParser/grammarParser.js.map +1 -0
  103. package/dist/uxf/UxfFormulaParser/grammerParser/spanHelpers.d.ts +31 -0
  104. package/dist/uxf/UxfFormulaParser/grammerParser/spanHelpers.js +64 -0
  105. package/dist/uxf/UxfFormulaParser/grammerParser/spanHelpers.js.map +1 -0
  106. package/dist/uxf/UxfFormulaParser/index.d.ts +3 -0
  107. package/dist/uxf/UxfFormulaParser/index.js +11 -0
  108. package/dist/uxf/UxfFormulaParser/index.js.map +1 -0
  109. package/dist/uxf/UxfFormulaParser/parser.d.ts +8 -0
  110. package/dist/uxf/UxfFormulaParser/parser.js +87 -0
  111. package/dist/uxf/UxfFormulaParser/parser.js.map +1 -0
  112. package/dist/uxf/UxfFormulaParser/utils/getErrorMsg.d.ts +8 -0
  113. package/dist/uxf/UxfFormulaParser/utils/getErrorMsg.js +17 -0
  114. package/dist/uxf/UxfFormulaParser/utils/getErrorMsg.js.map +1 -0
  115. package/dist/uxf/constants.d.ts +2 -0
  116. package/dist/uxf/constants.js +8 -0
  117. package/dist/uxf/constants.js.map +1 -0
  118. package/dist/uxf/index.d.ts +2 -0
  119. package/dist/uxf/index.js +11 -0
  120. package/dist/uxf/index.js.map +1 -0
  121. package/dist/uxf/tectonicIdGenerator.d.ts +12 -0
  122. package/dist/uxf/tectonicIdGenerator.js +102 -0
  123. package/dist/uxf/tectonicIdGenerator.js.map +1 -0
  124. package/license +9 -0
  125. package/package.json +42 -0
  126. package/src/AttachmentPlugin.ts +262 -0
  127. package/src/BusinessRulePlugin.ts +251 -0
  128. package/src/CrossScopePrivilegePlugin.ts +54 -0
  129. package/src/DefaultPlugin.ts +272 -0
  130. package/src/IdPlugin.ts +47 -0
  131. package/src/ListPlugin.ts +497 -0
  132. package/src/PropertyPlugin.ts +218 -0
  133. package/src/ScriptTemplatePlugin.ts +223 -0
  134. package/src/UserPreferencePlugin.ts +36 -0
  135. package/src/aclAndRole/AclPlugin.ts +410 -0
  136. package/src/aclAndRole/RolePlugin.ts +225 -0
  137. package/src/aclAndRole/Util.ts +104 -0
  138. package/src/app/ApplicationMenuPlugin.ts +158 -0
  139. package/src/atf/ATFComposer.ts +3356 -0
  140. package/src/atf/TestPlugin.ts +119 -0
  141. package/src/atf/index.ts +1 -0
  142. package/src/db/ColumnPlugins.ts +117 -0
  143. package/src/db/RecordPlugin.ts +391 -0
  144. package/src/db/TablePlugin.ts +1581 -0
  145. package/src/db/index.ts +3 -0
  146. package/src/index.ts +16 -0
  147. package/src/scriptedRESTAPI/RESTDeserializationUtils.ts +410 -0
  148. package/src/scriptedRESTAPI/RESTSerializationUtils.ts +227 -0
  149. package/src/scriptedRESTAPI/RestApiPlugin.ts +438 -0
  150. package/src/scriptedRESTAPI/RestSchemaUtils.ts +72 -0
  151. package/src/scriptedRESTAPI/RestUtils.ts +507 -0
  152. package/src/scripts/ClientScriptPlugin.ts +251 -0
  153. package/src/scripts/scriptUtils.ts +81 -0
  154. package/src/uxf/ExperiencePlugin.ts +64 -0
  155. package/src/uxf/RoutesPlugin.ts +215 -0
  156. package/src/uxf/UxfFormulaParser/cleanUxValue.ts +73 -0
  157. package/src/uxf/UxfFormulaParser/grammerParser/api.js +166 -0
  158. package/src/uxf/UxfFormulaParser/grammerParser/clientTransformMap.js +606 -0
  159. package/src/uxf/UxfFormulaParser/grammerParser/grammarParser.js +551 -0
  160. package/src/uxf/UxfFormulaParser/grammerParser/spanHelpers.js +65 -0
  161. package/src/uxf/UxfFormulaParser/index.ts +4 -0
  162. package/src/uxf/UxfFormulaParser/parser.ts +64 -0
  163. package/src/uxf/UxfFormulaParser/utils/getErrorMsg.ts +13 -0
  164. package/src/uxf/constants.ts +4 -0
  165. package/src/uxf/index.ts +2 -0
  166. package/src/uxf/tectonicIdGenerator.ts +81 -0
@@ -0,0 +1,3356 @@
1
+ import { Data, Record, TableName } from '@servicenow/sdk-core/runtime/db'
2
+ import type { Role } from '@servicenow/sdk-core/runtime/app'
3
+ import { StepConfig, Variables } from '@servicenow/sdk-core/runtime/tables'
4
+ import { Context, InputObject } from '@servicenow/sdk-build-core'
5
+ import * as atf from '@servicenow/sdk-core/runtime/atf'
6
+
7
+ export function getRecordIdIfRecord(value: any, context: Context): string {
8
+ if (isRecord(value)) {
9
+ return getRecordId(value, context)
10
+ } else if (isRole(value)) {
11
+ return getRoleId(value, context)
12
+ }
13
+ return value
14
+ }
15
+
16
+ export function getRoleId(record: Role, context: Context): string {
17
+ return context.keys.registerExplicitId('sys_user_role', record.$id)
18
+ }
19
+
20
+ export function getRecordId<T extends TableName>(record: Record<T>, context: Context): string {
21
+ if ('sys_id' in record.data && record.data['sys_id']) {
22
+ return record.data['sys_id'] as string
23
+ }
24
+
25
+ return context.keys.registerExplicitId(record.table, typeof record.$id === 'object' ? record.$id.id : record.$id)
26
+ }
27
+
28
+ export function isRecord(value: any): value is Record {
29
+ return typeof value === 'object' && '$id' in value && 'table' in value
30
+ }
31
+
32
+ export function isRole(value: any): value is Role {
33
+ return typeof value === 'object' && '$id' in value && 'name' in value
34
+ }
35
+
36
+ /**
37
+ * These functions will return record lists instead of the return type property specified in the interface. Hence the explicit any return
38
+ *
39
+ */
40
+ export class ATF implements atf.FlatATF {
41
+ public test: Record<'sys_atf_test'>
42
+ /**
43
+ * Do not modify directly. Let TestPlugin handle incrementing the value
44
+ */
45
+ private order: number
46
+ /**
47
+ * Do not manipulate directly in step functions. Instead create helper creation functions that increment this value
48
+ *
49
+ * Modified in the following locations:
50
+ * ```typescript
51
+ * function createStepRecord
52
+ * function _createGemRecords
53
+ * function _createVariableValueRecord
54
+ * ```
55
+ */
56
+ public _records: {
57
+ [stepRecord: string]: Record[]
58
+ }
59
+
60
+ /**
61
+ * Used to access previously created steps based on index. Do not manipulate directly unless you are sure of what you are doing
62
+ *
63
+ * Modified in the following locations:
64
+ * ```typescript
65
+ * createStepRecord
66
+ * ```
67
+ */
68
+ public stepRecords: Record<'sys_atf_step'>[]
69
+ private context: Context
70
+
71
+ constructor(
72
+ inputObject: InputObject & { name: string; description: string; active: boolean; failOnServerError: boolean },
73
+ context: Context
74
+ ) {
75
+ this.context = context
76
+ this.test = Record({
77
+ $id: inputObject.$id,
78
+ table: 'sys_atf_test',
79
+ data: {
80
+ name: inputObject.name,
81
+ active: inputObject.active,
82
+ description: inputObject.description,
83
+ fail_on_server_error: inputObject.failOnServerError,
84
+ },
85
+ })
86
+ this._records = {}
87
+ this.order = 1
88
+ this.stepRecords = []
89
+ }
90
+
91
+ /**
92
+ * DO NOT CALL DIRECTLY
93
+ * Unless you know what you are doing do not handle setting the order number. It is handled by TestPlugin
94
+ */
95
+ public incrementOrder() {
96
+ this.order++
97
+ }
98
+
99
+ private parseValue(value: any) {
100
+ // Simple object types should be trivial to parse
101
+ if (typeof value !== 'object') {
102
+ return value
103
+ }
104
+
105
+ // Dont iterate on entities, assume whatever extractor they are using is doing its job
106
+ if (typeof value?.asRecord !== 'undefined') {
107
+ return value
108
+ }
109
+
110
+ // If the value is a gem value we should replace the gem object with a string in place
111
+ if (this.isGem(value)) {
112
+ const refRecord: Record<'sys_atf_step'> | undefined = this.stepRecords[value.__references]
113
+ if (!refRecord) {
114
+ throw new Error('Cannot find referenced record')
115
+ }
116
+
117
+ const stepID = getRecordId(refRecord, this.context)
118
+ value = `{{step['${stepID}'].${value.__value}}}`
119
+ return value
120
+ }
121
+
122
+ // Template strings can contain gem values so iterate over them to replace gem values, records, etc, if necessary, but most entries should be string
123
+ if (this.isTemplateStr(value)) {
124
+ return `${value.__template.map((entry) => this.parseValue(entry)).join('')}`
125
+ }
126
+
127
+ // If the value is a record turn it into a sys_id
128
+ if (isRecord(value) || isRole(value)) {
129
+ return this.extractSysIdIfRecord(value)
130
+ }
131
+
132
+ // Recurse into object and see if any of its descendents need to be parsed
133
+ const keys = Object.keys(value)
134
+ for (const key of keys) {
135
+ const val = value[key]
136
+ value[key] = this.parseValue(val)
137
+ }
138
+
139
+ // Return parsed object
140
+ return value
141
+ }
142
+
143
+ private isTemplateStr(value: any) {
144
+ return typeof value === 'object' && typeof value.__template !== 'undefined'
145
+ }
146
+
147
+ /**
148
+ * Determines if gem is used at all in this value or down the nested object. If gem is used it is required to use sys_element_mapping in addition to sys_variable_value
149
+ */
150
+ private containsGem(value: any) {
151
+ if (typeof value !== 'object') {
152
+ return false
153
+ }
154
+
155
+ // Don't recurse on entities we are not interested in their keys or children
156
+ if (typeof value?.asRecord !== 'undefined') {
157
+ return false
158
+ }
159
+
160
+ if (this.isGem(value)) {
161
+ return true
162
+ }
163
+
164
+ const results: boolean[] = []
165
+ const keys = Object.keys(value)
166
+ for (const key of keys) {
167
+ const val = value[key]
168
+ results.push(this.containsGem(val))
169
+ }
170
+ return results.includes(true)
171
+ }
172
+
173
+ /**
174
+ *
175
+ * @param value Any value
176
+ * @returns whether the value is a gem mapping from an output variable
177
+ */
178
+ private isGem(value: any) {
179
+ if (typeof value != 'object') {
180
+ return false
181
+ }
182
+ return typeof value.__references !== 'undefined' && typeof value.__value !== 'undefined'
183
+ }
184
+
185
+ private createStepRecord(props: {
186
+ stepConfig: Record<'sys_atf_step_config'>
187
+ name: string
188
+ description?: string
189
+ tableName?: string
190
+ }) {
191
+ const { stepConfig, name, description = 'A step created by fluent', tableName = '' } = props
192
+ const stepRecord = Record({
193
+ $id: `sys_atf_step_${this.test.$id}_${this.order}`, // Id is unique because there is one sys_atf_step record per step qed 1 per order, which ensures this id is unique
194
+ table: 'sys_atf_step',
195
+ data: {
196
+ step_config: stepConfig,
197
+ display_name: name,
198
+ sys_name: name,
199
+ description: description,
200
+ order: this.order,
201
+ test: this.test,
202
+ active: true,
203
+ table: tableName,
204
+ },
205
+ })
206
+ this.stepRecords.push(stepRecord)
207
+ const currentStep = getRecordId(stepRecord, this.context)
208
+ this._records[currentStep] = []
209
+ return stepRecord
210
+ }
211
+
212
+ /**
213
+ * All records: test, step, or metadata, which are necessary for the test
214
+ */
215
+ get records() {
216
+ return this._records
217
+ }
218
+
219
+ private _createGemRecords(props: {
220
+ variable: Record<'var_dictionary'>
221
+ stepConfig: Record<'sys_atf_step_config'>
222
+ value: any
223
+ stepRecord: Record<'sys_atf_step'>
224
+ }): { sys_variable_value: Record<'sys_variable_value'>; element_mapping: Record<'sys_element_mapping'> } {
225
+ const { variable, value, stepRecord, stepConfig } = props
226
+ if (typeof value === 'object') {
227
+ throw Error('Attempted to serialize an object to a value')
228
+ }
229
+ const variableValueRecord = this._createVariableValueRecord({ variable, stepRecord, value: '' })
230
+ const currentStep = getRecordId(stepRecord, this.context)
231
+ const stepConfigId = getRecordId(stepConfig, this.context)
232
+ const table = `var__m_atf_input_variable_${stepConfigId}`
233
+ const field = variable.data.element ? variable.data.element : ''
234
+
235
+ const elementMappingRecord = Record({
236
+ $id: `sys_element_mapping_${this.test.$id}_${this.order}_${variable.$id}`,
237
+ table: 'sys_element_mapping',
238
+ data: {
239
+ id: currentStep,
240
+ field,
241
+ table,
242
+ value,
243
+ },
244
+ })
245
+ if (!this._records[currentStep]) {
246
+ this._records[currentStep] = [elementMappingRecord]
247
+ } else {
248
+ this._records[currentStep].push(elementMappingRecord)
249
+ }
250
+ return { sys_variable_value: variableValueRecord, element_mapping: elementMappingRecord }
251
+ }
252
+
253
+ /**
254
+ * Use createVariable instead unless you have good reason to use this
255
+ * @param props
256
+ * @returns
257
+ */
258
+ private _createVariableValueRecord(props: {
259
+ variable: Record<'var_dictionary'>
260
+ value: any
261
+ stepRecord: Record<'sys_atf_step'>
262
+ }): Record<'sys_variable_value'> {
263
+ const { variable, value, stepRecord } = props
264
+ if (typeof value === 'object') {
265
+ throw Error('Attempted to serialize an object to a value')
266
+ }
267
+
268
+ const currentStep = getRecordId(stepRecord, this.context)
269
+ const variableRecord = Record({
270
+ table: 'sys_variable_value',
271
+ $id: `sys_variable_value_${this.test.$id}_${this.order}_${variable.$id}`,
272
+ data: {
273
+ document: 'sys_atf_step',
274
+ document_key: stepRecord,
275
+ variable,
276
+ value,
277
+ },
278
+ })
279
+ if (!this._records[currentStep]) {
280
+ this._records[currentStep] = [variableRecord]
281
+ } else {
282
+ this._records[currentStep].push(variableRecord)
283
+ }
284
+ return variableRecord
285
+ }
286
+
287
+ private fieldValuesToQuery<T extends TableName>(fieldValues: Partial<Data<T>>): string {
288
+ // This converts records/tables in a field value set to the correct string
289
+ const valuesObj = this.nameValuePairProcessing(fieldValues)
290
+ const queries: string[] = []
291
+
292
+ for (const pair of Object.entries(valuesObj)) {
293
+ const key = pair[0] as keyof Data<T>
294
+ let value = pair[1] as unknown
295
+
296
+ if (typeof value === 'string') {
297
+ value = value.replaceAll('^', '^^')
298
+ } else if (value && typeof value === 'object' && '$id' in value) {
299
+ value = getRecordId(value as Record, this.context)
300
+ }
301
+
302
+ queries.push(`${key as string}=${value}`)
303
+ }
304
+
305
+ return queries.join('^')
306
+ }
307
+
308
+ private recordListToString(recordList: (string | Record | Role)[]): string {
309
+ if (!recordList || recordList.length == 0) {
310
+ return ''
311
+ }
312
+ return recordList
313
+ .map((entry) => {
314
+ return this.extractSysIdIfRecord(entry)
315
+ })
316
+ .join(',')
317
+ }
318
+
319
+ /**
320
+ * Outputs a string value which is either standard_ui or the sys_id of the form view
321
+ */
322
+ private parseFormUI(formUI: atf.FormUIType): string {
323
+ if (typeof formUI === 'string') {
324
+ if (atf.FormUI[formUI]) {
325
+ return typeof atf.FormUI[formUI] === 'string'
326
+ ? (atf.FormUI[formUI] as string)
327
+ : getRecordId(atf.FormUI[formUI] as Record, this.context)
328
+ }
329
+
330
+ return formUI
331
+ }
332
+ return getRecordId(formUI, this.context)
333
+ }
334
+
335
+ private extractSysIdIfRecord(value: string | Record | Role): string {
336
+ if (isRecord(value)) {
337
+ return getRecordId(value, this.context)
338
+ }
339
+ if (isRole(value)) {
340
+ return getRoleId(value, this.context)
341
+ }
342
+
343
+ return value
344
+ }
345
+
346
+ private secondsToDuration(value: number) {
347
+ const ms = value * 1000
348
+ const time = new Date()
349
+ time.setTime(ms)
350
+ const str = time.toISOString().replace('T', ' ').split('.')[0] as string
351
+ return str
352
+ }
353
+
354
+ private nameValuePairProcessing(nvp: Record<TableName> | object | string | number | boolean) {
355
+ if (typeof nvp === 'object') {
356
+ if ('asRecord' in nvp) {
357
+ return getRecordId(nvp as Record<TableName>, this.context)
358
+ }
359
+
360
+ // If Object is an object, iterate over keys and recursively determine the values
361
+ const objKeys = Object.keys(nvp)
362
+ for (const key of objKeys) {
363
+ nvp[key] = this.nameValuePairProcessing(nvp[key])
364
+ }
365
+ }
366
+
367
+ return nvp
368
+ }
369
+
370
+ private createVariable<T>(props: {
371
+ variable: Record<'var_dictionary'>
372
+ stepRecord: Record<'sys_atf_step'>
373
+ stepConfig: Record<'sys_atf_step_config'>
374
+ startingValue: T
375
+ stringifier?: (value: T) => string
376
+ }) {
377
+ const { variable, stepRecord, stringifier, startingValue, stepConfig } = props
378
+ // Do this first becaused parseValue can modify the object in place so it may get rid of gem values down a tree
379
+ const containsGem = this.containsGem(startingValue)
380
+ const parsedValue = stringifier ? stringifier(this.parseValue(startingValue)) : this.parseValue(startingValue)
381
+ if (containsGem) {
382
+ this._createGemRecords({
383
+ stepConfig,
384
+ stepRecord,
385
+ value: parsedValue,
386
+ variable,
387
+ })
388
+ } else {
389
+ this._createVariableValueRecord({
390
+ stepRecord,
391
+ variable,
392
+ value: parsedValue,
393
+ })
394
+ }
395
+ }
396
+
397
+ // ========
398
+ // BELOW THIS POINT IS ALL FUNCTIONS DEFINED IN THE TEST INTERFACE WHICH MAP 1:1 WITH TESTS
399
+ // Define any utility functions above for easy navigation
400
+ // ========
401
+ openExistingRecord(inputs: {
402
+ formUI: atf.FormUIType
403
+ view: string
404
+ recordId: string | Record
405
+ table: TableName
406
+ selectedTabIndex: number
407
+ }) {
408
+ const { table, view, recordId, formUI, selectedTabIndex } = inputs
409
+ const stepConfig = StepConfig.OpenAnExistingRecord
410
+
411
+ const stepRecord = this.createStepRecord({
412
+ name: 'Open an Existing Record',
413
+ stepConfig: stepConfig,
414
+ description: 'Opens an existing record in this table',
415
+ tableName: table,
416
+ })
417
+
418
+ this.createVariable({
419
+ stepRecord,
420
+ stepConfig: stepConfig,
421
+ variable: Variables.OpenExistingRecord.Table,
422
+ startingValue: table,
423
+ })
424
+
425
+ this.createVariable({
426
+ stepRecord,
427
+ variable: Variables.OpenExistingRecord.FormUI,
428
+ stepConfig: stepConfig,
429
+ startingValue: formUI,
430
+ stringifier: (val) => this.parseFormUI(val),
431
+ })
432
+
433
+ this.createVariable({
434
+ stepRecord,
435
+ stepConfig,
436
+ variable: Variables.OpenExistingRecord.RecordPath,
437
+ startingValue: 'record',
438
+ })
439
+
440
+ this.createVariable({
441
+ stepRecord,
442
+ stepConfig,
443
+ variable: Variables.OpenExistingRecord.RecordId,
444
+ startingValue: recordId,
445
+ stringifier: (val) => this.extractSysIdIfRecord(val),
446
+ })
447
+
448
+ this.createVariable({
449
+ stepRecord,
450
+ stepConfig,
451
+ variable: Variables.OpenExistingRecord.View,
452
+ startingValue: view,
453
+ })
454
+
455
+ this.createVariable({
456
+ stepRecord,
457
+ stepConfig,
458
+ variable: Variables.OpenExistingRecord.SelectedTabIndex,
459
+ startingValue: selectedTabIndex,
460
+ })
461
+ }
462
+
463
+ openNewForm(inputs: { table: TableName; view: string; formUI: atf.FormUIType }) {
464
+ const { table: tableName, view = '', formUI } = inputs
465
+ const stepConfig = StepConfig.OpenANewForm
466
+ const stepRecord = this.createStepRecord({
467
+ name: 'Open a New form',
468
+ stepConfig: stepConfig,
469
+ description: `Opens a new form in this table`,
470
+ tableName,
471
+ })
472
+
473
+ this.createVariable({
474
+ stepRecord,
475
+ stepConfig,
476
+ variable: Variables.OpenNewForm.FormUI,
477
+ startingValue: formUI,
478
+ stringifier: (val) => this.parseFormUI(val),
479
+ })
480
+
481
+ this.createVariable({
482
+ stepRecord,
483
+ stepConfig,
484
+ variable: Variables.OpenNewForm.Table,
485
+ startingValue: tableName,
486
+ })
487
+
488
+ this.createVariable({
489
+ stepRecord,
490
+ stepConfig,
491
+ variable: Variables.OpenNewForm.View,
492
+ startingValue: view,
493
+ })
494
+ }
495
+
496
+ fieldValueValidation<T extends TableName>(inputs: { table: T; conditions: string; formUI: atf.FormUIType }) {
497
+ const { table: tableName, conditions, formUI } = inputs
498
+ const stepConfig = StepConfig.FieldValueValidation
499
+
500
+ const stepRecord = this.createStepRecord({
501
+ name: 'Field Values Validation',
502
+ description: `Validates field values on the current form.`,
503
+ tableName,
504
+ stepConfig,
505
+ })
506
+
507
+ this.createVariable({
508
+ stepRecord,
509
+ stepConfig,
510
+ variable: Variables.FieldValueValidation.Table,
511
+ startingValue: tableName,
512
+ })
513
+
514
+ this.createVariable({
515
+ stepRecord,
516
+ stepConfig,
517
+ variable: Variables.FieldValueValidation.FormUI,
518
+ startingValue: formUI,
519
+ stringifier: (val) => this.parseFormUI(val),
520
+ })
521
+
522
+ this.createVariable({
523
+ stepRecord,
524
+ stepConfig,
525
+ variable: Variables.FieldValueValidation.Conditions,
526
+ startingValue: conditions,
527
+ })
528
+ }
529
+
530
+ setFieldValue<T extends TableName>(inputs: { table: T; fieldValues: Partial<Data<T>>; formUI: atf.FormUIType }) {
531
+ const { table, fieldValues, formUI } = inputs
532
+ const stepConfig = StepConfig.SetFieldValues
533
+
534
+ const stepRecord = this.createStepRecord({
535
+ name: 'Set Field Values',
536
+ description: `Set field values on a form.`,
537
+ stepConfig,
538
+ tableName: table,
539
+ })
540
+
541
+ this.createVariable({
542
+ stepRecord,
543
+ stepConfig,
544
+ variable: Variables.SetFieldValues.FormUI,
545
+ startingValue: formUI,
546
+ stringifier: (val) => this.parseFormUI(val),
547
+ })
548
+
549
+ this.createVariable({
550
+ stepRecord,
551
+ stepConfig,
552
+ variable: Variables.SetFieldValues.Table,
553
+ startingValue: table,
554
+ })
555
+
556
+ this.createVariable({
557
+ stepRecord,
558
+ stepConfig,
559
+ variable: Variables.SetFieldValues.FieldValues,
560
+ startingValue: fieldValues,
561
+ stringifier: (val) => this.fieldValuesToQuery(val),
562
+ })
563
+ }
564
+
565
+ submitForm(inputs: { assertType: atf.AssertType; formUI: atf.FormUIType }): any {
566
+ const { assertType, formUI } = inputs
567
+ const stepConfig = StepConfig.SubmitAForm
568
+ const stepRecord = this.createStepRecord({
569
+ name: 'Submit a Form',
570
+ stepConfig,
571
+ description: 'Submits the current form.',
572
+ })
573
+
574
+ this.createVariable({
575
+ stepRecord,
576
+ stepConfig,
577
+ variable: Variables.SubmitForm.FormUI,
578
+ startingValue: formUI,
579
+ stringifier: (val) => this.parseFormUI(val),
580
+ })
581
+
582
+ this.createVariable({
583
+ stepRecord,
584
+ stepConfig,
585
+ variable: Variables.SubmitForm.AssertType,
586
+ startingValue: assertType,
587
+ })
588
+ }
589
+
590
+ validateOutboundEmailGeneratedByNotification(inputs: {
591
+ sourceNotification: string | Record<'sysevent_email_action'>
592
+ conditions: string
593
+ }): any {
594
+ const { sourceNotification, conditions } = inputs
595
+ const stepConfig = StepConfig.ValidateOutboundEmailGeneratedByNotification
596
+ const stepRecord = this.createStepRecord({
597
+ name: 'Validate Outbound Email Generated by Notification',
598
+ stepConfig,
599
+ description: 'Finds and verifies an outbound email generated by a notification',
600
+ tableName: '',
601
+ })
602
+
603
+ this.createVariable({
604
+ stepRecord,
605
+ stepConfig,
606
+ variable: Variables.ValidateOutboundEmailGeneratedByNotification.Table,
607
+ startingValue: 'sys_email',
608
+ })
609
+
610
+ this.createVariable({
611
+ stepConfig,
612
+ stepRecord,
613
+ variable: Variables.ValidateOutboundEmailGeneratedByNotification.SourceNotification,
614
+ startingValue: sourceNotification,
615
+ stringifier: (val) => this.extractSysIdIfRecord(val),
616
+ })
617
+
618
+ this.createVariable({
619
+ stepRecord,
620
+ stepConfig,
621
+ variable: Variables.ValidateOutboundEmailGeneratedByNotification.Conditions,
622
+ startingValue: conditions,
623
+ })
624
+ }
625
+
626
+ recordUpdate<T extends TableName>(inputs: {
627
+ assertType: atf.AssertUpdateType
628
+ enforceSecurity: boolean
629
+ table: T
630
+ recordId: string | Record<T>
631
+ fieldValues: Partial<Data<T>>
632
+ }): any {
633
+ const { table, assertType, enforceSecurity, recordId, fieldValues } = inputs
634
+ const assertValue = assertType
635
+ const stepConfig = StepConfig.RecordUpdate
636
+
637
+ const stepRecord = this.createStepRecord({
638
+ name: 'Record Update',
639
+ stepConfig,
640
+ description: 'Update a record in the table.',
641
+ tableName: table,
642
+ })
643
+
644
+ this.createVariable({
645
+ stepConfig,
646
+ stepRecord,
647
+ variable: Variables.RecordUpdate.EnforceSecurity,
648
+ startingValue: enforceSecurity,
649
+ })
650
+
651
+ this.createVariable({
652
+ stepConfig,
653
+ stepRecord,
654
+ variable: Variables.RecordUpdate.AssertType,
655
+ startingValue: assertValue,
656
+ })
657
+
658
+ this.createVariable({
659
+ stepConfig,
660
+ stepRecord,
661
+ variable: Variables.RecordUpdate.RecordID,
662
+ startingValue: recordId,
663
+ stringifier: (val) => this.extractSysIdIfRecord(val),
664
+ })
665
+
666
+ this.createVariable({
667
+ stepConfig,
668
+ stepRecord,
669
+ variable: Variables.RecordUpdate.FieldValues,
670
+ startingValue: fieldValues,
671
+ stringifier: (val) => this.fieldValuesToQuery(val),
672
+ })
673
+
674
+ this.createVariable({
675
+ stepConfig,
676
+ stepRecord,
677
+ variable: Variables.RecordUpdate.Table,
678
+ startingValue: table,
679
+ })
680
+ }
681
+
682
+ generateRandomString(inputs: { length: number }): any {
683
+ const { length } = inputs
684
+
685
+ const stepConfig = StepConfig.GenerateRandomString
686
+
687
+ const stepRecord = this.createStepRecord({
688
+ name: 'Generate Random String',
689
+ stepConfig,
690
+ description: 'Generate a random string.',
691
+ })
692
+
693
+ this.createVariable({
694
+ stepConfig,
695
+ stepRecord,
696
+ variable: Variables.GenerateARandomString.Length,
697
+ startingValue: length,
698
+ })
699
+ }
700
+
701
+ uiActionVisibility<T extends TableName>(inputs: {
702
+ formUI: atf.FormUIType
703
+ table: T
704
+ visible: (string | Record<'sys_ui_action'>)[]
705
+ notVisible: (string | Record<'sys_ui_action'>)[]
706
+ }): any {
707
+ const { table, formUI, visible, notVisible } = inputs
708
+ const stepConfig = StepConfig.UIActionVisibility
709
+
710
+ const stepRecord = this.createStepRecord({
711
+ name: 'UI Action Visibility',
712
+ stepConfig,
713
+ description: 'Checks if the listed fields are visible or not visible on the form.',
714
+ tableName: table,
715
+ })
716
+
717
+ this.createVariable({
718
+ stepConfig,
719
+ stepRecord,
720
+ variable: Variables.UIActionVisibility.Table,
721
+ startingValue: table,
722
+ })
723
+
724
+ this.createVariable({
725
+ stepConfig,
726
+ stepRecord,
727
+ variable: Variables.UIActionVisibility.FormUI,
728
+ startingValue: formUI,
729
+ stringifier: (val) => this.parseFormUI(val),
730
+ })
731
+
732
+ this.createVariable({
733
+ stepConfig,
734
+ stepRecord,
735
+ variable: Variables.UIActionVisibility.Visible,
736
+ startingValue: visible,
737
+ stringifier: (value) => this.recordListToString(value),
738
+ })
739
+
740
+ this.createVariable({
741
+ stepConfig,
742
+ stepRecord,
743
+ variable: Variables.UIActionVisibility.NotVisible,
744
+ startingValue: notVisible,
745
+ stringifier: (value) => this.recordListToString(value),
746
+ })
747
+ }
748
+
749
+ validatePriceAndRecurringPrice(inputs: {
750
+ price: string | number
751
+ recurringPrice: string | number
752
+ frequency: atf.FrequencyType
753
+ }): any {
754
+ const { price, recurringPrice, frequency } = inputs
755
+ const stepConfig = StepConfig.ValidatePriceAndRecurringPrice
756
+
757
+ const stepRecord = this.createStepRecord({
758
+ name: 'Validate Price and Recurring Price',
759
+ stepConfig,
760
+ description: 'Validate Price and Recurring Price of a catalog item',
761
+ })
762
+
763
+ this.createVariable({
764
+ stepConfig,
765
+ stepRecord,
766
+ variable: Variables.ValidatePriceAndRecurringPrice.Price,
767
+ startingValue: price,
768
+ })
769
+
770
+ this.createVariable({
771
+ stepConfig,
772
+ stepRecord,
773
+ variable: Variables.ValidatePriceAndRecurringPrice.RecurringPrice,
774
+ startingValue: recurringPrice,
775
+ })
776
+
777
+ this.createVariable({
778
+ stepConfig,
779
+ stepRecord,
780
+ variable: Variables.ValidatePriceAndRecurringPrice.RecurringFrequency,
781
+ startingValue: frequency,
782
+ })
783
+ }
784
+
785
+ assertResponseJSONPayloadIsValid(inputs: { [name: string]: never }): any {
786
+ inputs
787
+
788
+ const stepConfig = StepConfig.AssertResponseJSONPayloadIsValid
789
+ this.createStepRecord({
790
+ name: 'Assert Response JSON Payload Is Valid',
791
+ stepConfig,
792
+ description: 'Assert the JSON response payload is valid',
793
+ })
794
+ }
795
+
796
+ clickModalButton(inputs: {
797
+ formUI: atf.FormUIType
798
+ uiPage: string | Record<'sys_ui_page'>
799
+ assertType: atf.AssertModalType
800
+ button: string
801
+ assertTimeout: number
802
+ }): any {
803
+ const { formUI, uiPage, assertType, assertTimeout, button } = inputs
804
+ const assertTimeoutStr = this.secondsToDuration(assertTimeout)
805
+ const assertValue = assertType
806
+ const stepConfig = StepConfig.ClickModalButton
807
+
808
+ const stepRecord = this.createStepRecord({
809
+ name: 'Click Modal Button',
810
+ stepConfig,
811
+ description: 'Click Modal step presses a button in the modal',
812
+ })
813
+
814
+ this.createVariable({
815
+ stepConfig,
816
+ stepRecord,
817
+ variable: Variables.ClickModalButton.FormUI,
818
+ startingValue: formUI,
819
+ stringifier: (val) => this.parseFormUI(val),
820
+ })
821
+
822
+ this.createVariable({
823
+ stepConfig,
824
+ stepRecord,
825
+ variable: Variables.ClickModalButton.UIPage,
826
+ startingValue: uiPage,
827
+ stringifier: (val) => this.extractSysIdIfRecord(val),
828
+ })
829
+
830
+ this.createVariable({
831
+ stepConfig,
832
+ stepRecord,
833
+ variable: Variables.ClickModalButton.Assert,
834
+ startingValue: assertValue,
835
+ })
836
+
837
+ this.createVariable({
838
+ stepConfig,
839
+ stepRecord,
840
+ variable: Variables.ClickModalButton.Button,
841
+ startingValue: button,
842
+ })
843
+
844
+ // TODO: ModalAction/ModalVAlues is sketchy cause the user does not set them explicitly in atf so idk if these values can be different
845
+ this.createVariable({
846
+ stepConfig,
847
+ stepRecord,
848
+ variable: Variables.ClickModalButton.ModalAction,
849
+ startingValue: 'confirm',
850
+ })
851
+
852
+ this.createVariable({
853
+ stepConfig,
854
+ stepRecord,
855
+ variable: Variables.ClickModalButton.ModalValues,
856
+ startingValue: '',
857
+ })
858
+
859
+ this.createVariable({
860
+ stepConfig,
861
+ stepRecord,
862
+ variable: Variables.ClickModalButton.AssertionTimeout,
863
+ startingValue: assertTimeoutStr,
864
+ })
865
+ }
866
+
867
+ addItemToShoppingCart(inputs: { assert: atf.AssertShoppingType }): any {
868
+ const { assert } = inputs
869
+ const assertValue = assert
870
+
871
+ const stepConfig = StepConfig.AddItemToShoppingCart
872
+
873
+ const stepRecord = this.createStepRecord({
874
+ name: 'Add Item to Shopping Cart',
875
+ stepConfig,
876
+ description: 'Add Catalog Item to Shopping Cart',
877
+ })
878
+
879
+ this.createVariable({
880
+ stepConfig,
881
+ stepRecord,
882
+ variable: Variables.AddItemToShoppingCart.Assert,
883
+ startingValue: assertValue,
884
+ })
885
+ }
886
+
887
+ moduleVisibility(inputs: {
888
+ navigator: atf.NavigatorType
889
+ assertNotVisible: atf.AssertModuleNotVisibleType
890
+ notVisibleModules: (string | Record<'sys_app_module'>)[]
891
+ assertVisible: atf.AssertModuleVisibleType
892
+ visibleModules: (string | Record<'sys_app_module'>)[]
893
+ }): any {
894
+ const { navigator, assertNotVisible, assertVisible, notVisibleModules, visibleModules } = inputs
895
+ const navigatorValue = navigator
896
+ const assertNotVisibleValue = assertNotVisible
897
+ const assertVisibleValue = assertVisible[assertVisible]
898
+ const stepConfig = StepConfig.ModuleVisibility
899
+
900
+ const stepRecord = this.createStepRecord({
901
+ name: 'Module Visibility',
902
+ stepConfig,
903
+ description: 'Verifies visibility of modules in the left navigation bar',
904
+ })
905
+
906
+ this.createVariable({
907
+ stepConfig,
908
+ stepRecord,
909
+ variable: Variables.ModuleVisibility.Navigator,
910
+ startingValue: navigatorValue,
911
+ })
912
+
913
+ this.createVariable({
914
+ stepConfig,
915
+ stepRecord,
916
+ variable: Variables.ModuleVisibility.NotVisibleAssert,
917
+ startingValue: assertNotVisibleValue,
918
+ })
919
+
920
+ this.createVariable({
921
+ stepConfig,
922
+ stepRecord,
923
+ variable: Variables.ModuleVisibility.VisibleAssert,
924
+ startingValue: assertVisibleValue,
925
+ })
926
+
927
+ this.createVariable({
928
+ stepConfig,
929
+ stepRecord,
930
+ variable: Variables.ModuleVisibility.VisibleModules,
931
+ startingValue: visibleModules,
932
+ stringifier: (val) => this.recordListToString(val),
933
+ })
934
+
935
+ this.createVariable({
936
+ stepConfig,
937
+ stepRecord,
938
+ variable: Variables.ModuleVisibility.NotVisibleModules,
939
+ startingValue: notVisibleModules,
940
+ stringifier: (val) => this.recordListToString(val),
941
+ })
942
+ }
943
+
944
+ impersonate(inputs: { user: string | Record<'sys_user'> }): any {
945
+ const { user } = inputs
946
+ const descriptionStr =
947
+ 'Impersonates a specified user in the current session for the duration of the test or until another user is impersonated.'
948
+ const stepConfig = StepConfig.Impersonate
949
+ const stepRecord = this.createStepRecord({
950
+ name: 'Impersonate',
951
+ stepConfig,
952
+ description: descriptionStr,
953
+ })
954
+
955
+ this.createVariable({
956
+ stepRecord,
957
+ stepConfig,
958
+ variable: Variables.Impersonate.User,
959
+ startingValue: user,
960
+ stringifier: (str) => this.extractSysIdIfRecord(str),
961
+ })
962
+ }
963
+
964
+ openRecordProducer(inputs: { catalogItem: string | Record<'sc_cat_item_producer'> }): any {
965
+ const { catalogItem } = inputs
966
+ const descriptionStr = 'Opens a Record Producer.'
967
+ const stepConfig = StepConfig.OpenRecordProducer
968
+ const stepRecord = this.createStepRecord({
969
+ name: 'Open Record Producer',
970
+ stepConfig,
971
+ description: descriptionStr,
972
+ })
973
+
974
+ this.createVariable({
975
+ stepRecord,
976
+ stepConfig,
977
+ variable: Variables.OpenRecordProducer.CatalogItem,
978
+ startingValue: catalogItem,
979
+ stringifier: (str) => this.extractSysIdIfRecord(str),
980
+ })
981
+ }
982
+
983
+ recordValidation<T extends TableName>(inputs: {
984
+ enforceSecurity: boolean
985
+ assertType: atf.AssertRecordValidationType
986
+ table: T
987
+ recordId: string | Record
988
+ fieldValues: string
989
+ }): any {
990
+ const { enforceSecurity, assertType, recordId, fieldValues, table } = inputs
991
+ const stepConfig = StepConfig.RecordValidation
992
+
993
+ const stepRecord = this.createStepRecord({
994
+ name: 'Record Validation',
995
+ description: 'Validate a record',
996
+ tableName: table,
997
+ stepConfig,
998
+ })
999
+
1000
+ this.createVariable({
1001
+ stepRecord,
1002
+ stepConfig,
1003
+ variable: Variables.RecordValidation.Table,
1004
+ startingValue: table,
1005
+ })
1006
+
1007
+ this.createVariable({
1008
+ stepRecord,
1009
+ stepConfig,
1010
+ variable: Variables.RecordValidation.EnforceSecurity,
1011
+ startingValue: enforceSecurity,
1012
+ })
1013
+
1014
+ this.createVariable({
1015
+ stepRecord,
1016
+ stepConfig,
1017
+ variable: Variables.RecordValidation.AssertType,
1018
+ startingValue: assertType,
1019
+ })
1020
+
1021
+ this.createVariable({
1022
+ stepRecord,
1023
+ stepConfig,
1024
+ variable: Variables.RecordValidation.RecordId,
1025
+ startingValue: recordId,
1026
+ stringifier: (str) => this.extractSysIdIfRecord(str),
1027
+ })
1028
+
1029
+ this.createVariable({
1030
+ stepRecord,
1031
+ stepConfig,
1032
+ variable: Variables.RecordValidation.FieldValues,
1033
+ startingValue: fieldValues,
1034
+ })
1035
+ }
1036
+
1037
+ setCatalogItemQuantity(inputs: { quantity: number | string }): any {
1038
+ const { quantity } = inputs
1039
+ const stepConfig = StepConfig.SetCatalogItemQuantity
1040
+ const descriptionStr = 'Set quantity to ' + quantity.toString()
1041
+ const stepRecord = this.createStepRecord({
1042
+ name: 'Set Catalog Item Quantity',
1043
+ description: descriptionStr,
1044
+ stepConfig,
1045
+ })
1046
+
1047
+ this.createVariable({
1048
+ stepConfig,
1049
+ stepRecord,
1050
+ variable: Variables.SetCatalogItemQuantity.Quantity,
1051
+ startingValue: quantity,
1052
+ })
1053
+ }
1054
+
1055
+ orderCatalogItem(inputs: { assertType: atf.AssertOrderCatalogItemType }): any {
1056
+ const { assertType } = inputs
1057
+ const stepConfig = StepConfig.OrderCatalogItem
1058
+ let descriptionStr = 'Order item and confirm that ordering is canceled in browser'
1059
+
1060
+ if (assertType === 'form_submitted_to_server') {
1061
+ descriptionStr = 'Order item and confirm that ordering is successful'
1062
+ }
1063
+
1064
+ const stepRecord = this.createStepRecord({
1065
+ name: 'Order Catalog Item',
1066
+ description: descriptionStr,
1067
+ stepConfig,
1068
+ })
1069
+
1070
+ this.createVariable({
1071
+ stepConfig,
1072
+ stepRecord,
1073
+ variable: Variables.OrderCatalogItem.AssertType,
1074
+ startingValue: assertType,
1075
+ })
1076
+ }
1077
+
1078
+ clickDeclarativeAction<T extends TableName>(inputs: {
1079
+ formUI: atf.FormUIType
1080
+ table: T
1081
+ declarativeAction: string | Record<'sys_declarative_action_assignment'>
1082
+ assertType: atf.AssertDeclarativeActionType
1083
+ }): any {
1084
+ const { formUI, declarativeAction, assertType, table } = inputs
1085
+ const stepConfig = StepConfig.ClickADeclarativeAction
1086
+ const descriptionStr = 'Click a declarative action and confirm any relevant form or page reaction'
1087
+
1088
+ const stepRecord = this.createStepRecord({
1089
+ name: 'Click a Declarative Action',
1090
+ description: descriptionStr,
1091
+ tableName: table,
1092
+ stepConfig,
1093
+ })
1094
+
1095
+ this.createVariable({
1096
+ stepConfig,
1097
+ stepRecord,
1098
+ variable: Variables.ClickADeclarativeAction.FormUI,
1099
+ startingValue: formUI,
1100
+ stringifier: (str) => this.parseFormUI(str),
1101
+ })
1102
+
1103
+ this.createVariable({
1104
+ stepRecord,
1105
+ stepConfig,
1106
+ variable: Variables.ClickADeclarativeAction.Table,
1107
+ startingValue: table,
1108
+ })
1109
+
1110
+ this.createVariable({
1111
+ stepConfig,
1112
+ stepRecord,
1113
+ variable: Variables.ClickADeclarativeAction.DeclarativeAction,
1114
+ startingValue: declarativeAction,
1115
+ stringifier: (str) => this.extractSysIdIfRecord(str),
1116
+ })
1117
+
1118
+ this.createVariable({
1119
+ stepConfig,
1120
+ stepRecord,
1121
+ variable: Variables.ClickADeclarativeAction.AssertType,
1122
+ startingValue: assertType,
1123
+ })
1124
+ }
1125
+
1126
+ assertXMLResponsePayloadElement(inputs: {
1127
+ elementPath: string
1128
+ responseOperation: atf.ResponseValueOperationType
1129
+ elementValue: string
1130
+ }): any {
1131
+ const { elementPath, responseOperation, elementValue } = inputs
1132
+ const stepConfig = StepConfig.AssertXMLResponsePayloadElement
1133
+
1134
+ const descriptionStr = 'Assess the XML Response payload element'
1135
+
1136
+ const stepRecord = this.createStepRecord({
1137
+ name: 'Assert XML Response Payload Element',
1138
+ description: descriptionStr,
1139
+ stepConfig,
1140
+ })
1141
+
1142
+ this.createVariable({
1143
+ stepConfig,
1144
+ stepRecord,
1145
+ variable: Variables.AssertXMLResponsePayloadElement.ElementPath,
1146
+ startingValue: elementPath,
1147
+ })
1148
+
1149
+ this.createVariable({
1150
+ stepConfig,
1151
+ stepRecord,
1152
+ variable: Variables.AssertXMLResponsePayloadElement.ResponseOperation,
1153
+ startingValue: responseOperation,
1154
+ })
1155
+
1156
+ this.createVariable({
1157
+ stepConfig,
1158
+ stepRecord,
1159
+ variable: Variables.AssertXMLResponsePayloadElement.ElementValue,
1160
+ startingValue: elementValue,
1161
+ })
1162
+ }
1163
+
1164
+ responsiveDashboardVisibility(inputs: {
1165
+ dashboard: string | Record<'pa_dashboards'>
1166
+ assertType: atf.AssertResponsiveDashboardType
1167
+ }): any {
1168
+ const { dashboard, assertType } = inputs
1169
+ const stepConfig = StepConfig.ResponsiveDashboardVisibility
1170
+
1171
+ const stepRecord = this.createStepRecord({
1172
+ stepConfig,
1173
+ name: 'Responsive Dashboard Visibility',
1174
+ description: 'Confirm whether a responsive dashboard is visible or not',
1175
+ })
1176
+
1177
+ this.createVariable({
1178
+ stepConfig,
1179
+ stepRecord,
1180
+ variable: Variables.ResponsiveDashboardVisibility.Dashboard,
1181
+ startingValue: dashboard,
1182
+ stringifier: (str) => this.extractSysIdIfRecord(str),
1183
+ })
1184
+
1185
+ this.createVariable({
1186
+ stepConfig,
1187
+ stepRecord,
1188
+ variable: Variables.ResponsiveDashboardVisibility.AssertType,
1189
+ startingValue: assertType,
1190
+ })
1191
+ }
1192
+
1193
+ generateInboundReplyEmail<T extends TableName>(inputs: {
1194
+ targetRecord: string | Record<T>
1195
+ subject: string
1196
+ body: string
1197
+ targetTable: T
1198
+ from: string
1199
+ to: string
1200
+ }): any {
1201
+ const { targetRecord, subject, body, from, to, targetTable } = inputs
1202
+ const stepConfig = StepConfig.GenerateInboundReplyEmail
1203
+
1204
+ const stepRecord = this.createStepRecord({
1205
+ stepConfig,
1206
+ name: 'Generate Inbound Reply Email',
1207
+ description: 'Generate an email with subject ' + subject,
1208
+ })
1209
+
1210
+ this.createVariable({
1211
+ stepConfig,
1212
+ stepRecord,
1213
+ variable: Variables.GenerateInboundReplyEmail.TargetRecord,
1214
+ startingValue: targetRecord,
1215
+ stringifier: (str) => this.extractSysIdIfRecord(str),
1216
+ })
1217
+
1218
+ this.createVariable({
1219
+ stepConfig,
1220
+ stepRecord,
1221
+ variable: Variables.GenerateInboundReplyEmail.TargetTable,
1222
+ startingValue: targetTable,
1223
+ })
1224
+
1225
+ this.createVariable({
1226
+ stepConfig,
1227
+ stepRecord,
1228
+ variable: Variables.GenerateInboundReplyEmail.Body,
1229
+ startingValue: body,
1230
+ })
1231
+
1232
+ this.createVariable({
1233
+ stepConfig,
1234
+ stepRecord,
1235
+ variable: Variables.GenerateInboundReplyEmail.From,
1236
+ startingValue: from,
1237
+ })
1238
+
1239
+ this.createVariable({
1240
+ stepConfig,
1241
+ stepRecord,
1242
+ variable: Variables.GenerateInboundReplyEmail.Subject,
1243
+ startingValue: subject,
1244
+ })
1245
+
1246
+ this.createVariable({
1247
+ stepConfig,
1248
+ stepRecord,
1249
+ variable: Variables.GenerateInboundReplyEmail.To,
1250
+ startingValue: to,
1251
+ })
1252
+ }
1253
+
1254
+ assertStatusCodeName(inputs: { responseOperation: atf.ResponseOperationValueType; codeName: string }): any {
1255
+ const { responseOperation, codeName } = inputs
1256
+ const stepConfig = StepConfig.AssertStatusCodeName
1257
+
1258
+ const stepRecord = this.createStepRecord({
1259
+ stepConfig,
1260
+ name: 'Assert Status Code Name',
1261
+ description: 'Assert a response status code name ' + responseOperation + ' ' + codeName,
1262
+ })
1263
+
1264
+ this.createVariable({
1265
+ stepConfig,
1266
+ stepRecord,
1267
+ variable: Variables.AssertStatusCodeName.ResponseOperation,
1268
+ startingValue: responseOperation,
1269
+ })
1270
+
1271
+ this.createVariable({
1272
+ stepConfig,
1273
+ stepRecord,
1274
+ variable: Variables.AssertStatusCodeName.CodeName,
1275
+ startingValue: codeName,
1276
+ })
1277
+ }
1278
+
1279
+ clickUIAction(inputs: {
1280
+ formUI: atf.FormUIType
1281
+ table: TableName
1282
+ actionType: atf.UIActionType
1283
+ declarativeAction: string | Record<'sys_declarative_action_assignment'>
1284
+ uiAction: string | Record<'sys_ui_action'>
1285
+ assertType: atf.UIActionAssertType
1286
+ }): any {
1287
+ const { formUI, table, actionType, declarativeAction, uiAction, assertType } = inputs
1288
+ const stepConfig = StepConfig.ClickUIAction
1289
+ const stepRecord = this.createStepRecord({
1290
+ name: 'Click a UI Action',
1291
+ stepConfig: stepConfig,
1292
+ description: 'Clicks a UI action on the current form',
1293
+ tableName: table,
1294
+ })
1295
+
1296
+ this.createVariable({
1297
+ stepRecord,
1298
+ stepConfig,
1299
+ variable: Variables.ClickUIAction.FormUI,
1300
+ startingValue: formUI,
1301
+ stringifier: (val) => this.parseFormUI(val),
1302
+ })
1303
+
1304
+ this.createVariable({
1305
+ stepRecord,
1306
+ stepConfig,
1307
+ variable: Variables.ClickUIAction.Table,
1308
+ startingValue: table,
1309
+ })
1310
+
1311
+ this.createVariable({
1312
+ stepRecord,
1313
+ stepConfig,
1314
+ variable: Variables.ClickUIAction.ActionType,
1315
+ startingValue: actionType,
1316
+ })
1317
+
1318
+ this.createVariable({
1319
+ stepRecord,
1320
+ stepConfig,
1321
+ variable: Variables.ClickUIAction.DeclarativeAction,
1322
+ startingValue: declarativeAction,
1323
+ stringifier: (val) => this.extractSysIdIfRecord(val),
1324
+ })
1325
+
1326
+ this.createVariable({
1327
+ stepRecord,
1328
+ stepConfig,
1329
+ variable: Variables.ClickUIAction.UIAction,
1330
+ startingValue: uiAction,
1331
+ stringifier: (val) => this.extractSysIdIfRecord(val),
1332
+ })
1333
+
1334
+ this.createVariable({
1335
+ stepRecord,
1336
+ stepConfig,
1337
+ variable: Variables.ClickUIAction.AssertType,
1338
+ startingValue: assertType,
1339
+ })
1340
+ }
1341
+
1342
+ createUser(inputs: {
1343
+ fieldValues: Partial<Data<'sys_user'>>
1344
+ groups: (string | Record<'sys_user_group'>)[]
1345
+ roles: (string | Role)[]
1346
+ impersonate: boolean
1347
+ firstName: string
1348
+ lastName: string
1349
+ }): any {
1350
+ const { fieldValues, groups, roles, impersonate, firstName, lastName } = inputs
1351
+ const tableName = 'sys_user'
1352
+ const stepConfig = StepConfig.CreateAUser
1353
+
1354
+ const stepRecord = this.createStepRecord({
1355
+ name: 'Create a User',
1356
+ description: `Create a User`,
1357
+ stepConfig,
1358
+ tableName: tableName,
1359
+ })
1360
+
1361
+ this.createVariable({
1362
+ stepRecord,
1363
+ stepConfig,
1364
+ variable: Variables.CreateAUser.FieldValues,
1365
+ startingValue: fieldValues,
1366
+ stringifier: (val) => this.fieldValuesToQuery(val),
1367
+ })
1368
+
1369
+ this.createVariable({
1370
+ stepRecord,
1371
+ stepConfig,
1372
+ variable: Variables.CreateAUser.Groups,
1373
+ startingValue: groups,
1374
+ stringifier: (value) => {
1375
+ return this.recordListToString(value)
1376
+ },
1377
+ })
1378
+
1379
+ this.createVariable({
1380
+ stepRecord,
1381
+ stepConfig,
1382
+ variable: Variables.CreateAUser.Roles,
1383
+ startingValue: roles,
1384
+ stringifier: (value) => {
1385
+ return this.recordListToString(value)
1386
+ },
1387
+ })
1388
+
1389
+ this.createVariable({
1390
+ stepRecord,
1391
+ stepConfig,
1392
+ variable: Variables.CreateAUser.Impersonate,
1393
+ startingValue: impersonate,
1394
+ })
1395
+
1396
+ this.createVariable({
1397
+ stepRecord,
1398
+ stepConfig,
1399
+ variable: Variables.CreateAUser.FirstName,
1400
+ startingValue: firstName,
1401
+ })
1402
+
1403
+ this.createVariable({
1404
+ stepRecord,
1405
+ stepConfig,
1406
+ variable: Variables.CreateAUser.LastName,
1407
+ startingValue: lastName,
1408
+ })
1409
+ }
1410
+
1411
+ recordDelete<T extends TableName>(inputs: {
1412
+ enforceSecurity: boolean
1413
+ assertType: atf.RecordDeleteAssertType
1414
+ table: T
1415
+ recordId: string | Record<T>
1416
+ }): any {
1417
+ const { enforceSecurity, assertType, table, recordId } = inputs
1418
+ const stepConfig = StepConfig.RecordDelete
1419
+ const stepRecord = this.createStepRecord({
1420
+ name: 'Record Delete',
1421
+ stepConfig,
1422
+ description: 'Delete a record in the table',
1423
+ })
1424
+
1425
+ this.createVariable({
1426
+ stepRecord,
1427
+ stepConfig,
1428
+ variable: Variables.RecordDelete.EnforceSecurity,
1429
+ startingValue: enforceSecurity,
1430
+ })
1431
+
1432
+ this.createVariable({
1433
+ stepRecord,
1434
+ stepConfig,
1435
+ variable: Variables.RecordDelete.AssertType,
1436
+ startingValue: assertType,
1437
+ })
1438
+
1439
+ this.createVariable({
1440
+ stepRecord,
1441
+ stepConfig,
1442
+ variable: Variables.RecordDelete.Table,
1443
+ startingValue: table,
1444
+ })
1445
+
1446
+ this.createVariable({
1447
+ stepRecord,
1448
+ stepConfig,
1449
+ variable: Variables.RecordDelete.RecordId,
1450
+ startingValue: recordId,
1451
+ stringifier: (val) => this.extractSysIdIfRecord(val),
1452
+ })
1453
+ }
1454
+
1455
+ openCatalogItem(inputs: { catalogItem: string | Record<'sc_cat_item'> }): any {
1456
+ const { catalogItem } = inputs
1457
+ const stepConfig = StepConfig.OpenACatalogItem
1458
+ const stepRecord = this.createStepRecord({
1459
+ name: 'Open a catalog item',
1460
+ stepConfig,
1461
+ description: 'Open a catalog item',
1462
+ })
1463
+
1464
+ this.createVariable({
1465
+ stepRecord,
1466
+ stepConfig,
1467
+ variable: Variables.OpenACatalogItem.CatalogItem,
1468
+ startingValue: catalogItem,
1469
+ stringifier: (val) => this.extractSysIdIfRecord(val),
1470
+ })
1471
+ }
1472
+
1473
+ setVariableValue(inputs: {
1474
+ catalogItem: string | Record<'sc_cat_item'> | Record<'sc_cat_item_producer'>
1475
+ variableValues: string
1476
+ }): any {
1477
+ const { catalogItem, variableValues } = inputs
1478
+ const stepConfig = StepConfig.SetVariableValues
1479
+
1480
+ const stepRecord = this.createStepRecord({
1481
+ name: 'Set Variable Values',
1482
+ stepConfig,
1483
+ description: 'Set variable values on a Catalog Item page',
1484
+ })
1485
+
1486
+ this.createVariable({
1487
+ stepRecord,
1488
+ stepConfig,
1489
+ variable: Variables.SetVariableValues.Item,
1490
+ startingValue: catalogItem,
1491
+ stringifier: (val) => this.extractSysIdIfRecord(val),
1492
+ })
1493
+
1494
+ this.createVariable({
1495
+ stepRecord,
1496
+ stepConfig,
1497
+ variable: Variables.SetVariableValues.VariableValues,
1498
+ startingValue: variableValues,
1499
+ })
1500
+ }
1501
+
1502
+ sendRestRequest(inputs: {
1503
+ basicAuthentication: string | Record<'sys_auth_profile_basic'>
1504
+ method: atf.HTTPMethodType
1505
+ path: string
1506
+ queryParameters: atf.QueryParam
1507
+ headers: { [name: string]: string | number | boolean }
1508
+ body: string
1509
+ }): any {
1510
+ const { basicAuthentication, method, path, queryParameters, headers, body } = inputs
1511
+ const processedParams = this.nameValuePairProcessing(queryParameters)
1512
+ const processedHeaders = this.nameValuePairProcessing(headers)
1513
+ const stepConfig = StepConfig.SendRestRequestInbound
1514
+
1515
+ const stepRecord = this.createStepRecord({
1516
+ name: 'Send REST Request - Inbound',
1517
+ stepConfig,
1518
+ description: 'Send REST Request - Inbound',
1519
+ })
1520
+
1521
+ this.createVariable({
1522
+ stepRecord,
1523
+ stepConfig,
1524
+ variable: Variables.SendRestRequestInbound.BasicAuthentication,
1525
+ startingValue: basicAuthentication,
1526
+ stringifier: (val) => this.extractSysIdIfRecord(val),
1527
+ })
1528
+
1529
+ this.createVariable({
1530
+ stepRecord,
1531
+ stepConfig,
1532
+ variable: Variables.SendRestRequestInbound.Method,
1533
+ startingValue: method,
1534
+ })
1535
+
1536
+ this.createVariable({
1537
+ stepRecord,
1538
+ stepConfig,
1539
+ variable: Variables.SendRestRequestInbound.Path,
1540
+ startingValue: path,
1541
+ })
1542
+
1543
+ this.createVariable({
1544
+ stepRecord,
1545
+ stepConfig,
1546
+ variable: Variables.SendRestRequestInbound.QueryParameters,
1547
+ startingValue: processedParams,
1548
+ stringifier: (value) => JSON.stringify(value),
1549
+ })
1550
+
1551
+ this.createVariable({
1552
+ stepRecord,
1553
+ stepConfig,
1554
+ variable: Variables.SendRestRequestInbound.Headers,
1555
+ startingValue: processedHeaders,
1556
+ stringifier: (value) => JSON.stringify(value),
1557
+ })
1558
+
1559
+ this.createVariable({
1560
+ stepRecord,
1561
+ stepConfig,
1562
+ variable: Variables.SendRestRequestInbound.Body,
1563
+ startingValue: body,
1564
+ })
1565
+ }
1566
+
1567
+ assertStatusCode(inputs: { operation: atf.RestStatusOperationType; statusCode: number }) {
1568
+ const { operation, statusCode } = inputs
1569
+ const stepConfig = StepConfig.AssertStatusCode
1570
+
1571
+ const stepRecord = this.createStepRecord({
1572
+ name: 'Assert Status Code',
1573
+ stepConfig,
1574
+ description: 'Assert the HTTP response status code is equals to a specified value',
1575
+ })
1576
+
1577
+ this.createVariable({
1578
+ stepRecord,
1579
+ stepConfig,
1580
+ variable: Variables.AssertStatusCode.Operation,
1581
+ startingValue: operation,
1582
+ })
1583
+
1584
+ this.createVariable({
1585
+ stepRecord,
1586
+ stepConfig,
1587
+ variable: Variables.AssertStatusCode.StatusCode,
1588
+ startingValue: statusCode,
1589
+ })
1590
+ }
1591
+
1592
+ assertResponseXMLPayloadIsWellFormed(inputs: { [name: string]: never }) {
1593
+ inputs
1594
+ const stepConfig = StepConfig.AssertResponseXMLPayloadIsWellFormed
1595
+
1596
+ this.createStepRecord({
1597
+ name: 'Assert Response XML Payload Is Well-Formed',
1598
+ stepConfig,
1599
+ description: 'Assert the XML response payload is well-formed',
1600
+ })
1601
+ }
1602
+
1603
+ responsiveDashboardSharing(inputs: {
1604
+ dashboard: string | Record<'pa_dashboards'>
1605
+ assertType: atf.DashboardSharingAssertType
1606
+ }) {
1607
+ const { dashboard, assertType } = inputs
1608
+ const descriptionStr = 'Confirm a dashboard can or cannot be shared'
1609
+ const stepConfig = StepConfig.ResponsiveDashboardSharing
1610
+ const stepRecord = this.createStepRecord({
1611
+ name: 'Responsive Dashboard Sharing',
1612
+ stepConfig,
1613
+ description: descriptionStr,
1614
+ })
1615
+
1616
+ this.createVariable({
1617
+ stepRecord,
1618
+ stepConfig,
1619
+ variable: Variables.ResponsiveDashboardSharing.Dashboard,
1620
+ startingValue: dashboard,
1621
+ stringifier: (val) => this.extractSysIdIfRecord(val),
1622
+ })
1623
+
1624
+ this.createVariable({
1625
+ stepRecord,
1626
+ stepConfig,
1627
+ variable: Variables.ResponsiveDashboardSharing.AssertType,
1628
+ startingValue: assertType,
1629
+ })
1630
+ }
1631
+
1632
+ log(inputs: { log: string }) {
1633
+ const { log } = inputs
1634
+ const stepConfig = StepConfig.Log
1635
+
1636
+ const stepRecord = this.createStepRecord({
1637
+ name: 'Log',
1638
+ stepConfig,
1639
+ description: 'Log an output',
1640
+ })
1641
+
1642
+ this.createVariable({
1643
+ stepRecord,
1644
+ stepConfig,
1645
+ variable: Variables.Log.Log,
1646
+ startingValue: log,
1647
+ })
1648
+ }
1649
+
1650
+ declarativeActionVisibility(inputs: {
1651
+ formUI: atf.FormUIType
1652
+ table: TableName
1653
+ visible: (string | Record<'sys_declarative_action_assignment'>)[]
1654
+ notVisible: (string | Record<'sys_declarative_action_assignment'>)[]
1655
+ }) {
1656
+ const { formUI, table, visible, notVisible } = inputs
1657
+ const stepConfig = StepConfig.DeclarativeActionVisibility
1658
+
1659
+ const stepRecord = this.createStepRecord({
1660
+ name: 'Declarative Action Visibility',
1661
+ stepConfig,
1662
+ description: 'Validate the visible, not visible fields of the form',
1663
+ })
1664
+
1665
+ this.createVariable({
1666
+ stepRecord,
1667
+ stepConfig,
1668
+ variable: Variables.DeclarativeActionVisibility.FormUI,
1669
+ startingValue: formUI,
1670
+ stringifier: (val) => this.parseFormUI(val),
1671
+ })
1672
+
1673
+ this.createVariable({
1674
+ stepRecord,
1675
+ stepConfig,
1676
+ variable: Variables.DeclarativeActionVisibility.Table,
1677
+ startingValue: table,
1678
+ })
1679
+
1680
+ this.createVariable({
1681
+ stepRecord,
1682
+ stepConfig,
1683
+ variable: Variables.DeclarativeActionVisibility.Visible,
1684
+ startingValue: visible,
1685
+ stringifier: (value) => {
1686
+ return this.recordListToString(value)
1687
+ },
1688
+ })
1689
+
1690
+ this.createVariable({
1691
+ stepRecord,
1692
+ stepConfig,
1693
+ variable: Variables.DeclarativeActionVisibility.NotVisible,
1694
+ startingValue: notVisible,
1695
+ stringifier: (value) => {
1696
+ return this.recordListToString(value)
1697
+ },
1698
+ })
1699
+ }
1700
+
1701
+ navigateToModule(inputs: { module: string | Record<'sys_app_module'> }) {
1702
+ const { module } = inputs
1703
+ const stepConfig = StepConfig.NavigateToModule
1704
+
1705
+ const stepRecord = this.createStepRecord({
1706
+ name: 'Navigate to Module',
1707
+ stepConfig,
1708
+ description: 'Navigates to a module, as if a user had clicked on it',
1709
+ })
1710
+
1711
+ this.createVariable({
1712
+ stepConfig,
1713
+ stepRecord,
1714
+ variable: Variables.NavigateToModule.Module,
1715
+ startingValue: module,
1716
+ stringifier: (val) => this.extractSysIdIfRecord(val),
1717
+ })
1718
+ }
1719
+
1720
+ applicationMenuVisibility(inputs: {
1721
+ navigator: atf.NavigatorType
1722
+ visible: (string | Record<'sys_app_application'>)[]
1723
+ assertVisible: atf.AssertApplicationVisibleType
1724
+ notVisible: (string | Record<'sys_app_application'>)[]
1725
+ assertNotVisible: atf.AssertApplicationNotVisibleType
1726
+ }) {
1727
+ const { navigator, visible, assertNotVisible, assertVisible, notVisible } = inputs
1728
+ const stepConfig = StepConfig.ApplicationMenuVisibility
1729
+
1730
+ const stepRecord = this.createStepRecord({
1731
+ name: 'Application Menu Visibility',
1732
+ stepConfig,
1733
+ description: 'Verifies visibility of application menus in the left navigation bar',
1734
+ })
1735
+
1736
+ this.createVariable({
1737
+ stepConfig,
1738
+ stepRecord,
1739
+ variable: Variables.ApplicationMenuVisibility.Navigator,
1740
+ startingValue: navigator,
1741
+ })
1742
+
1743
+ this.createVariable({
1744
+ stepConfig,
1745
+ stepRecord,
1746
+ variable: Variables.ApplicationMenuVisibility.VisibileAssert,
1747
+ startingValue: assertVisible,
1748
+ })
1749
+
1750
+ this.createVariable({
1751
+ stepConfig,
1752
+ stepRecord,
1753
+ variable: Variables.ApplicationMenuVisibility.NotVisibleAssert,
1754
+ startingValue: assertNotVisible,
1755
+ })
1756
+
1757
+ this.createVariable({
1758
+ stepConfig,
1759
+ stepRecord,
1760
+ variable: Variables.ApplicationMenuVisibility.VisibleApplications,
1761
+ startingValue: visible,
1762
+ stringifier: (val) => this.recordListToString(val),
1763
+ })
1764
+
1765
+ this.createVariable({
1766
+ stepConfig,
1767
+ stepRecord,
1768
+ variable: Variables.ApplicationMenuVisibility.NotVisibleApplications,
1769
+ startingValue: notVisible,
1770
+ stringifier: (val) => this.recordListToString(val),
1771
+ })
1772
+ }
1773
+
1774
+ checkoutShoppingCart(inputs: {
1775
+ assert: atf.AssertCartType
1776
+ requestedFor: string | Record<'sys_user'>
1777
+ deliveryAddress: string
1778
+ specialInstructions: string
1779
+ }): any {
1780
+ const { assert, requestedFor, deliveryAddress, specialInstructions } = inputs
1781
+ const stepConfig = StepConfig.CheckoutShoppingCart
1782
+
1783
+ const stepRecord = this.createStepRecord({
1784
+ name: 'Checkout Shopping Cart',
1785
+ stepConfig,
1786
+ description: 'Checkout Shopping Cart',
1787
+ })
1788
+
1789
+ this.createVariable({
1790
+ stepConfig,
1791
+ stepRecord,
1792
+ variable: Variables.CheckoutShoppingCart.Assert,
1793
+ startingValue: assert,
1794
+ })
1795
+
1796
+ this.createVariable({
1797
+ stepConfig,
1798
+ stepRecord,
1799
+ variable: Variables.CheckoutShoppingCart.DeliveryAddress,
1800
+ startingValue: deliveryAddress,
1801
+ })
1802
+
1803
+ this.createVariable({
1804
+ stepConfig,
1805
+ stepRecord,
1806
+ variable: Variables.CheckoutShoppingCart.Instructions,
1807
+ startingValue: specialInstructions,
1808
+ })
1809
+
1810
+ this.createVariable({
1811
+ stepConfig,
1812
+ stepRecord,
1813
+ variable: Variables.CheckoutShoppingCart.Requested,
1814
+ startingValue: requestedFor,
1815
+ stringifier: (val) => this.extractSysIdIfRecord(val),
1816
+ })
1817
+ }
1818
+
1819
+ submitRecordProducer(inputs: { assert: atf.AssertProducerType }): any {
1820
+ const { assert } = inputs
1821
+ const stepConfig = StepConfig.SubmitRecordProducer
1822
+
1823
+ const stepRecord = this.createStepRecord({
1824
+ name: 'Submit Record Producer',
1825
+ stepConfig,
1826
+ description: 'Submit a Record Producer',
1827
+ })
1828
+
1829
+ this.createVariable({
1830
+ stepConfig,
1831
+ stepRecord,
1832
+ variable: Variables.SubmitRecordProducer.Assert,
1833
+ startingValue: assert,
1834
+ })
1835
+ }
1836
+
1837
+ openRecordProducer_SP(inputs: {
1838
+ portal: string | Record<'sp_portal'>
1839
+ page: string | Record<'sp_page'>
1840
+ recordProducer: string | Record<'sc_cat_item_producer'>
1841
+ queryParameters: atf.QueryParam
1842
+ }) {
1843
+ const { portal, page, recordProducer, queryParameters } = inputs
1844
+ const processedParams = this.nameValuePairProcessing(queryParameters)
1845
+ const stepConfig = StepConfig.OpenRecordProducer_SP
1846
+
1847
+ const stepRecord = this.createStepRecord({
1848
+ name: 'Open a Record Producer (SP)',
1849
+ stepConfig,
1850
+ description: 'Open a Record Producer (SP)',
1851
+ })
1852
+
1853
+ this.createVariable({
1854
+ stepConfig,
1855
+ stepRecord,
1856
+ variable: Variables.OpenRecordProducer_SP.Page,
1857
+ startingValue: page,
1858
+ stringifier: (val) => this.extractSysIdIfRecord(val),
1859
+ })
1860
+
1861
+ this.createVariable({
1862
+ stepConfig,
1863
+ stepRecord,
1864
+ variable: Variables.OpenRecordProducer_SP.Portal,
1865
+ startingValue: portal,
1866
+ stringifier: (val) => this.extractSysIdIfRecord(val),
1867
+ })
1868
+
1869
+ this.createVariable({
1870
+ stepConfig,
1871
+ stepRecord,
1872
+ variable: Variables.OpenRecordProducer_SP.RecordProducer,
1873
+ startingValue: recordProducer,
1874
+ stringifier: (val) => this.extractSysIdIfRecord(val),
1875
+ })
1876
+
1877
+ this.createVariable({
1878
+ stepConfig,
1879
+ stepRecord,
1880
+ variable: Variables.OpenRecordProducer_SP.QueryParam,
1881
+ startingValue: processedParams,
1882
+ stringifier: JSON.stringify,
1883
+ })
1884
+ }
1885
+
1886
+ openOrderGuide_SP(inputs: {
1887
+ portal: string | Record<'sp_portal'>
1888
+ page: string | Record<'sp_page'>
1889
+ orderGuide: string | Record<'sc_cat_item_guide'>
1890
+ queryParameters: atf.QueryParam
1891
+ }): any {
1892
+ const { portal, page, orderGuide, queryParameters } = inputs
1893
+ const queryParametersProcessed = this.nameValuePairProcessing(queryParameters)
1894
+ const stepConfig = StepConfig.OpenOrderGuide_SP
1895
+
1896
+ const stepRecord = this.createStepRecord({
1897
+ name: 'Open an Order Guide (SP)',
1898
+ stepConfig,
1899
+ description: 'Open an Order Guide (SP)',
1900
+ })
1901
+
1902
+ this.createVariable({
1903
+ stepConfig,
1904
+ stepRecord,
1905
+ variable: Variables.OpenOrderGuide_SP.Page,
1906
+ startingValue: page,
1907
+ stringifier: (val) => this.extractSysIdIfRecord(val),
1908
+ })
1909
+
1910
+ this.createVariable({
1911
+ stepConfig,
1912
+ stepRecord,
1913
+ variable: Variables.OpenOrderGuide_SP.Portal,
1914
+ startingValue: portal,
1915
+ stringifier: (val) => this.extractSysIdIfRecord(val),
1916
+ })
1917
+
1918
+ this.createVariable({
1919
+ stepConfig,
1920
+ stepRecord,
1921
+ variable: Variables.OpenOrderGuide_SP.OrderGuide,
1922
+ startingValue: orderGuide,
1923
+ stringifier: (val) => this.extractSysIdIfRecord(val),
1924
+ })
1925
+
1926
+ this.createVariable({
1927
+ stepConfig,
1928
+ stepRecord,
1929
+ variable: Variables.OpenOrderGuide_SP.QueryParam,
1930
+ startingValue: queryParametersProcessed,
1931
+ stringifier: JSON.stringify,
1932
+ })
1933
+ }
1934
+
1935
+ openForm_SP<T extends TableName>(inputs: {
1936
+ portal: string | Record<'sp_portal'>
1937
+ page: string | Record<'sp_page'>
1938
+ table: T
1939
+ paramID: string | Record<T>
1940
+ view: string
1941
+ queryParameters: atf.QueryParam
1942
+ }) {
1943
+ const { portal, page, paramID, view, queryParameters, table } = inputs
1944
+ const queryParametersProcessed = this.nameValuePairProcessing(queryParameters)
1945
+ const stepConfig = StepConfig.OpenAForm_SP
1946
+
1947
+ const stepRecord = this.createStepRecord({
1948
+ name: 'Open a Form (SP)',
1949
+ stepConfig,
1950
+ description: 'Open a Form (SP)',
1951
+ tableName: table,
1952
+ })
1953
+
1954
+ this.createVariable({
1955
+ stepConfig,
1956
+ stepRecord,
1957
+ variable: Variables.OpenAForm_SP.Portal,
1958
+ startingValue: portal,
1959
+ stringifier: (val) => this.extractSysIdIfRecord(val),
1960
+ })
1961
+
1962
+ this.createVariable({
1963
+ stepConfig,
1964
+ stepRecord,
1965
+ variable: Variables.OpenAForm_SP.Page,
1966
+ startingValue: page,
1967
+ stringifier: (val) => this.extractSysIdIfRecord(val),
1968
+ })
1969
+
1970
+ this.createVariable({
1971
+ stepConfig,
1972
+ stepRecord,
1973
+ variable: Variables.OpenAForm_SP.ParamID,
1974
+ startingValue: paramID,
1975
+ stringifier: (val) => this.extractSysIdIfRecord(val),
1976
+ })
1977
+
1978
+ this.createVariable({
1979
+ stepConfig,
1980
+ stepRecord,
1981
+ variable: Variables.OpenAForm_SP.Table,
1982
+ startingValue: table,
1983
+ })
1984
+
1985
+ this.createVariable({
1986
+ stepConfig,
1987
+ stepRecord,
1988
+ variable: Variables.OpenAForm_SP.View,
1989
+ startingValue: view,
1990
+ })
1991
+
1992
+ this.createVariable({
1993
+ stepConfig,
1994
+ stepRecord,
1995
+ variable: Variables.OpenAForm_SP.QueryParam,
1996
+ startingValue: queryParametersProcessed,
1997
+ stringifier: JSON.stringify,
1998
+ })
1999
+ }
2000
+
2001
+ openCatalogItem_SP(inputs: {
2002
+ portal: string | Record<'sp_portal'>
2003
+ page: string | Record<'sp_page'>
2004
+ catItem: string | Record<'sc_cat_item'>
2005
+ queryParameters: atf.QueryParam
2006
+ }) {
2007
+ const { portal, page, catItem, queryParameters } = inputs
2008
+ const queryParametersProcessed = this.nameValuePairProcessing(queryParameters)
2009
+ const stepConfig = StepConfig.OpenCatalogItem_SP
2010
+
2011
+ const stepRecord = this.createStepRecord({
2012
+ name: 'Open a Catalog Item (SP)',
2013
+ stepConfig,
2014
+ description: 'Open a Catalog Item (SP)',
2015
+ })
2016
+
2017
+ this.createVariable({
2018
+ stepConfig,
2019
+ stepRecord,
2020
+ variable: Variables.OpenCatalogItem_SP.Portal,
2021
+ startingValue: portal,
2022
+ stringifier: (val) => this.extractSysIdIfRecord(val),
2023
+ })
2024
+
2025
+ this.createVariable({
2026
+ stepConfig,
2027
+ stepRecord,
2028
+ variable: Variables.OpenCatalogItem_SP.Page,
2029
+ startingValue: page,
2030
+ stringifier: (val) => this.extractSysIdIfRecord(val),
2031
+ })
2032
+
2033
+ this.createVariable({
2034
+ stepConfig,
2035
+ stepRecord,
2036
+ variable: Variables.OpenCatalogItem_SP.CatalogItem,
2037
+ startingValue: catItem,
2038
+ stringifier: (val) => this.extractSysIdIfRecord(val),
2039
+ })
2040
+
2041
+ this.createVariable({
2042
+ stepConfig,
2043
+ stepRecord,
2044
+ variable: Variables.OpenCatalogItem_SP.QueryParam,
2045
+ startingValue: queryParametersProcessed,
2046
+ stringifier: JSON.stringify,
2047
+ })
2048
+ }
2049
+
2050
+ saveCurrentRowOfMultiRowVariableSet_SP(inputs: { assert: atf.AssertMultiRowType }) {
2051
+ const { assert } = inputs
2052
+ const stepConfig = StepConfig.SaveCurrentRowOfMultiRowVariableSet_SP
2053
+
2054
+ const stepRecord = this.createStepRecord({
2055
+ name: 'Save current row of multi-row variable set (SP)',
2056
+ stepConfig,
2057
+ description: 'Save current row of multi-row variable set (SP)',
2058
+ })
2059
+
2060
+ this.createVariable({
2061
+ stepConfig,
2062
+ stepRecord,
2063
+ variable: Variables.SaveCurrentRowOfMultiRowVariableSet_SP.Assert,
2064
+ startingValue: assert,
2065
+ })
2066
+ }
2067
+
2068
+ addRowToMultiRowVariableSet_SP(inputs: {
2069
+ catItem: string | Record<'sc_cat_item'>
2070
+ variableSet: string | Record<'item_option_new_set'>
2071
+ }) {
2072
+ const { catItem, variableSet } = inputs
2073
+ const stepConfig = StepConfig.AddRowToMultiRowVariableSet_SP
2074
+
2075
+ const stepRecord = this.createStepRecord({
2076
+ name: 'Add row to multi-row variable set (SP)',
2077
+ stepConfig,
2078
+ description: 'Add row to multi-row variable set (SP)',
2079
+ })
2080
+
2081
+ this.createVariable({
2082
+ stepConfig,
2083
+ stepRecord,
2084
+ variable: Variables.AddRowToMultiRowVariableSet_SP.CatalogItem,
2085
+ startingValue: catItem,
2086
+ stringifier: (val) => this.extractSysIdIfRecord(val),
2087
+ })
2088
+
2089
+ this.createVariable({
2090
+ stepConfig,
2091
+ stepRecord,
2092
+ variable: Variables.AddRowToMultiRowVariableSet_SP.VariableSet,
2093
+ startingValue: variableSet,
2094
+ stringifier: (val) => this.extractSysIdIfRecord(val),
2095
+ })
2096
+ }
2097
+
2098
+ fieldStateValidation<T extends TableName>(inputs: {
2099
+ formUI: atf.FormUIType
2100
+ table: T
2101
+ visible: (keyof Data<T> | atf.SomeOtherString)[]
2102
+ notVisible: (keyof Data<T> | atf.SomeOtherString)[]
2103
+ readOnly: (keyof Data<T> | atf.SomeOtherString)[]
2104
+ notReadOnly: (keyof Data<T> | atf.SomeOtherString)[]
2105
+ mandatory: (keyof Data<T> | atf.SomeOtherString)[]
2106
+ notMandatory: (keyof Data<T> | atf.SomeOtherString)[]
2107
+ }) {
2108
+ const { formUI, visible, notMandatory, notReadOnly, notVisible, readOnly, mandatory, table } = inputs
2109
+ const stepConfig = StepConfig.FieldStateValidation
2110
+
2111
+ const stepRecord = this.createStepRecord({
2112
+ name: 'Field State Validation',
2113
+ stepConfig,
2114
+ description: "Assert that fields are or aren't: mandatory, read only, and visible on the form.",
2115
+ })
2116
+
2117
+ this.createVariable({
2118
+ stepConfig,
2119
+ stepRecord,
2120
+ variable: Variables.FieldStateValidation.Table,
2121
+ startingValue: table,
2122
+ })
2123
+
2124
+ this.createVariable({
2125
+ stepConfig,
2126
+ stepRecord,
2127
+ variable: Variables.FieldStateValidation.FormUI,
2128
+ startingValue: formUI,
2129
+ stringifier: (val) => this.parseFormUI(val),
2130
+ })
2131
+
2132
+ this.createVariable({
2133
+ stepConfig,
2134
+ stepRecord,
2135
+ variable: Variables.FieldStateValidation.Mandatory,
2136
+ startingValue: mandatory,
2137
+ stringifier: (val) => this.recordListToString(val as string[]), // Since it is a list of strings we can re-use this recordListToString
2138
+ })
2139
+
2140
+ this.createVariable({
2141
+ stepConfig,
2142
+ stepRecord,
2143
+ variable: Variables.FieldStateValidation.NotMandatory,
2144
+ startingValue: notMandatory,
2145
+ stringifier: (val) => this.recordListToString(val as string[]),
2146
+ })
2147
+
2148
+ this.createVariable({
2149
+ stepConfig,
2150
+ stepRecord,
2151
+ variable: Variables.FieldStateValidation.Visible,
2152
+ startingValue: visible,
2153
+ stringifier: (val) => this.recordListToString(val as string[]),
2154
+ })
2155
+
2156
+ this.createVariable({
2157
+ stepConfig,
2158
+ stepRecord,
2159
+ variable: Variables.FieldStateValidation.NotVisible,
2160
+ startingValue: notVisible,
2161
+ stringifier: (val) => this.recordListToString(val as string[]),
2162
+ })
2163
+
2164
+ this.createVariable({
2165
+ stepConfig,
2166
+ stepRecord,
2167
+ variable: Variables.FieldStateValidation.ReadOnly,
2168
+ startingValue: readOnly,
2169
+ stringifier: (val) => this.recordListToString(val as string[]),
2170
+ })
2171
+
2172
+ this.createVariable({
2173
+ stepConfig,
2174
+ stepRecord,
2175
+ variable: Variables.FieldStateValidation.NotReadOnly,
2176
+ startingValue: notReadOnly,
2177
+ stringifier: (val) => this.recordListToString(val as string[]),
2178
+ })
2179
+ }
2180
+
2181
+ validateOutboundEmailGeneratedByFlow(inputs: { sourceFlow: string | Record<'sys_hub_flow'>; conditions: string }) {
2182
+ const { sourceFlow, conditions } = inputs
2183
+ const stepConfig = StepConfig.ValidateOutboundEmailGeneratedByFlow
2184
+ const stepRecord = this.createStepRecord({
2185
+ name: 'Validate Outbound Email Generated by Flow',
2186
+ stepConfig,
2187
+ description: 'Finds and verifies an outbound email.',
2188
+ tableName: '',
2189
+ })
2190
+
2191
+ this.createVariable({
2192
+ stepRecord,
2193
+ stepConfig,
2194
+ variable: Variables.ValidateOutboundEmailGeneratedByFlow.Table,
2195
+ startingValue: 'sys_email',
2196
+ })
2197
+
2198
+ this.createVariable({
2199
+ stepRecord,
2200
+ stepConfig,
2201
+ variable: Variables.ValidateOutboundEmailGeneratedByFlow.SourceFlow,
2202
+ startingValue: sourceFlow,
2203
+ stringifier: (val) => this.extractSysIdIfRecord(val),
2204
+ })
2205
+
2206
+ this.createVariable({
2207
+ stepRecord,
2208
+ stepConfig,
2209
+ variable: Variables.ValidateOutboundEmailGeneratedByFlow.Conditions,
2210
+ startingValue: conditions,
2211
+ })
2212
+ }
2213
+
2214
+ reportVisibility(inputs: { report: string | Record<'sys_report'>; assertType: atf.AssertReportVisibilityType }) {
2215
+ const { report, assertType } = inputs
2216
+ const stepConfig = StepConfig.ReportVisibility
2217
+ const stepRecord = this.createStepRecord({
2218
+ name: 'Report Visibility',
2219
+ stepConfig,
2220
+ description: 'Assert a report can or cannot be viewed.',
2221
+ tableName: '',
2222
+ })
2223
+
2224
+ this.createVariable({
2225
+ stepRecord,
2226
+ stepConfig,
2227
+ variable: Variables.ReportVisibility.Report,
2228
+ startingValue: report,
2229
+ stringifier: (val) => this.extractSysIdIfRecord(val),
2230
+ })
2231
+
2232
+ this.createVariable({
2233
+ stepRecord,
2234
+ stepConfig,
2235
+ variable: Variables.ReportVisibility.AssertType,
2236
+ startingValue: assertType,
2237
+ })
2238
+ }
2239
+
2240
+ openServicePortalPage(inputs: {
2241
+ portal: string | Record<'sp_portal'>
2242
+ page: string | Record<'sp_page'>
2243
+ queryParams: atf.QueryParam
2244
+ }) {
2245
+ const { portal, page, queryParams } = inputs
2246
+ const stepConfig = StepConfig.OpenServicePortalPage
2247
+ const processedParams = this.nameValuePairProcessing(queryParams)
2248
+ const stepRecord = this.createStepRecord({
2249
+ name: 'Open Service Portal Page',
2250
+ stepConfig,
2251
+ description: 'Open a page in Service Portal',
2252
+ tableName: '',
2253
+ })
2254
+
2255
+ this.createVariable({
2256
+ stepRecord,
2257
+ stepConfig,
2258
+ variable: Variables.OpenServicePortalPage.Portal,
2259
+ startingValue: portal,
2260
+ stringifier: (val) => this.extractSysIdIfRecord(val),
2261
+ })
2262
+
2263
+ this.createVariable({
2264
+ stepRecord,
2265
+ stepConfig,
2266
+ variable: Variables.OpenServicePortalPage.Page,
2267
+ startingValue: page,
2268
+ stringifier: (val) => this.extractSysIdIfRecord(val),
2269
+ })
2270
+
2271
+ this.createVariable({
2272
+ stepRecord,
2273
+ stepConfig,
2274
+ variable: Variables.OpenServicePortalPage.QueryParams,
2275
+ startingValue: processedParams,
2276
+ stringifier: JSON.stringify,
2277
+ })
2278
+ }
2279
+
2280
+ recordQuery<T extends TableName>(inputs: {
2281
+ enforceSecurity: boolean
2282
+ assertType: atf.AssertQueryType
2283
+ table: T
2284
+ fieldValues: string
2285
+ }): any {
2286
+ const { enforceSecurity, assertType, table, fieldValues } = inputs
2287
+ const stepConfig = StepConfig.RecordQuery
2288
+
2289
+ const stepRecord = this.createStepRecord({
2290
+ name: 'Record Query',
2291
+ stepConfig,
2292
+ description: 'Select a record and validate field values.',
2293
+ tableName: '',
2294
+ })
2295
+
2296
+ this.createVariable({
2297
+ stepRecord,
2298
+ stepConfig,
2299
+ variable: Variables.RecordQuery.EnforceSecurity,
2300
+ startingValue: enforceSecurity,
2301
+ })
2302
+
2303
+ this.createVariable({
2304
+ stepRecord,
2305
+ stepConfig,
2306
+ variable: Variables.RecordQuery.AssertType,
2307
+ startingValue: assertType,
2308
+ })
2309
+
2310
+ this.createVariable({
2311
+ stepRecord,
2312
+ stepConfig,
2313
+ variable: Variables.RecordQuery.Table,
2314
+ startingValue: table,
2315
+ })
2316
+
2317
+ this.createVariable({
2318
+ stepRecord,
2319
+ stepConfig,
2320
+ variable: Variables.RecordQuery.FieldValues,
2321
+ startingValue: fieldValues,
2322
+ })
2323
+ }
2324
+
2325
+ generateInboundEmail(inputs: { from: string; to: string; subject: string; body: string }): any {
2326
+ const { from, to, subject, body } = inputs
2327
+ const stepConfig = StepConfig.GenerateInboundEmail
2328
+ const stepRecord = this.createStepRecord({
2329
+ name: 'Generate Inbound Email',
2330
+ stepConfig,
2331
+ description: 'Generate an inbound email.',
2332
+ tableName: '',
2333
+ })
2334
+
2335
+ this.createVariable({
2336
+ stepRecord,
2337
+ stepConfig,
2338
+ variable: Variables.GenerateInboundEmail.From,
2339
+ startingValue: from,
2340
+ })
2341
+
2342
+ this.createVariable({
2343
+ stepRecord,
2344
+ stepConfig,
2345
+ variable: Variables.GenerateInboundEmail.To,
2346
+ startingValue: to,
2347
+ })
2348
+
2349
+ this.createVariable({
2350
+ stepRecord,
2351
+ stepConfig,
2352
+ variable: Variables.GenerateInboundEmail.Subject,
2353
+ startingValue: subject,
2354
+ })
2355
+
2356
+ this.createVariable({
2357
+ stepRecord,
2358
+ stepConfig,
2359
+ variable: Variables.GenerateInboundEmail.Body,
2360
+ startingValue: body,
2361
+ })
2362
+ }
2363
+
2364
+ validateVariableValue(inputs: { catalogItem: Record<'sc_cat_item'>; catalogConditions: string }) {
2365
+ const { catalogItem, catalogConditions } = inputs
2366
+ const stepConfig = StepConfig.ValidateVariableValues
2367
+ const stepRecord = this.createStepRecord({
2368
+ name: 'Validate Variable Values',
2369
+ stepConfig,
2370
+ description: 'Validates Variable values on the Catalog Item.',
2371
+ tableName: '',
2372
+ })
2373
+
2374
+ this.createVariable({
2375
+ stepRecord,
2376
+ stepConfig,
2377
+ variable: Variables.ValidateVariableValues.CatalogItem,
2378
+ startingValue: catalogItem,
2379
+ stringifier: (val) => this.extractSysIdIfRecord(val),
2380
+ })
2381
+
2382
+ this.createVariable({
2383
+ stepRecord,
2384
+ stepConfig,
2385
+ variable: Variables.ValidateVariableValues.CatalogConditions,
2386
+ startingValue: catalogConditions,
2387
+ })
2388
+ }
2389
+
2390
+ assertResponseTime(inputs: { responseOperation: atf.ResponseConditionOperationType; responseTime: number }): any {
2391
+ const { responseOperation, responseTime } = inputs
2392
+ const stepConfig = StepConfig.AssertResponseTime
2393
+ const stepRecord = this.createStepRecord({
2394
+ name: 'Assert Response Time',
2395
+ stepConfig,
2396
+ description: 'Assert the HTTP response time is less than or greater than a specified value',
2397
+ tableName: '',
2398
+ })
2399
+
2400
+ this.createVariable({
2401
+ stepRecord,
2402
+ stepConfig,
2403
+ variable: Variables.AssertResponseTime.ResponseOperation,
2404
+ startingValue: responseOperation,
2405
+ })
2406
+
2407
+ this.createVariable({
2408
+ stepRecord,
2409
+ stepConfig,
2410
+ variable: Variables.AssertResponseTime.ResponseTime,
2411
+ startingValue: responseTime,
2412
+ })
2413
+ }
2414
+
2415
+ assertJsonResponsePayloadElement(inputs: {
2416
+ elementName: string
2417
+ operation: atf.AssertResponseOperationType
2418
+ elementValue: string
2419
+ }): any {
2420
+ const { elementName, operation, elementValue } = inputs
2421
+ const stepConfig = StepConfig.AssertJsonResponsePayloadElement
2422
+ const stepRecord = this.createStepRecord({
2423
+ name: 'Assert JSON Response Payload Element',
2424
+ stepConfig,
2425
+ description:
2426
+ 'Assert the JSON response payload element exists, or the element value is equals to or contains a specified value',
2427
+ tableName: '',
2428
+ })
2429
+
2430
+ this.createVariable({
2431
+ stepRecord,
2432
+ stepConfig,
2433
+ variable: Variables.AssertJsonResponsePayloadElement.ElementName,
2434
+ startingValue: elementName,
2435
+ })
2436
+
2437
+ this.createVariable({
2438
+ stepRecord,
2439
+ stepConfig,
2440
+ variable: Variables.AssertJsonResponsePayloadElement.ResponseOperation,
2441
+ startingValue: operation,
2442
+ })
2443
+
2444
+ this.createVariable({
2445
+ stepRecord,
2446
+ stepConfig,
2447
+ variable: Variables.AssertJsonResponsePayloadElement.ElementValue,
2448
+ startingValue: elementValue,
2449
+ })
2450
+ }
2451
+
2452
+ setVariableValue_SP(inputs: {
2453
+ catItem: string | Record<'sc_cat_item'> | Record<'sc_cat_item_producer'>
2454
+ variableSet: string | Record<'item_option_new_set'>
2455
+ variableValues: string
2456
+ }) {
2457
+ const { catItem, variableSet, variableValues } = inputs
2458
+ const stepConfig = StepConfig.SetVariableValues_SP
2459
+
2460
+ const stepRecord = this.createStepRecord({
2461
+ name: 'Set Variable Values (SP)',
2462
+ stepConfig,
2463
+ description: 'Set Variable Values (SP)',
2464
+ })
2465
+
2466
+ this.createVariable({
2467
+ stepConfig,
2468
+ stepRecord,
2469
+ variable: Variables.SetVariableValues_SP.Item,
2470
+ startingValue: catItem,
2471
+ stringifier: (val) => this.extractSysIdIfRecord(val),
2472
+ })
2473
+
2474
+ this.createVariable({
2475
+ stepConfig,
2476
+ stepRecord,
2477
+ variable: Variables.SetVariableValues_SP.VariableSet,
2478
+ startingValue: variableSet,
2479
+ stringifier: (val) => this.extractSysIdIfRecord(val),
2480
+ })
2481
+
2482
+ this.createVariable({
2483
+ stepConfig,
2484
+ stepRecord,
2485
+ variable: Variables.SetVariableValues_SP.VariableValues,
2486
+ startingValue: variableValues,
2487
+ })
2488
+ }
2489
+
2490
+ validateVariableValue_SP(inputs: {
2491
+ catItem: string | Record<'sc_cat_item'>
2492
+ variableSet: string | Record<'item_option_new_set'>
2493
+ variableValues: string
2494
+ }) {
2495
+ const { catItem, variableSet, variableValues } = inputs
2496
+ const stepConfig = StepConfig.ValidateVariableValues_SP
2497
+ const stepRecord = this.createStepRecord({
2498
+ name: 'Validate Variable Values (SP)',
2499
+ stepConfig,
2500
+ description: 'Validates Variable values on the Catalog Item.',
2501
+ })
2502
+
2503
+ this.createVariable({
2504
+ stepConfig,
2505
+ stepRecord,
2506
+ variable: Variables.ValidateVariableValues_SP.Item,
2507
+ startingValue: catItem,
2508
+ stringifier: (val) => this.extractSysIdIfRecord(val),
2509
+ })
2510
+
2511
+ this.createVariable({
2512
+ stepConfig,
2513
+ stepRecord,
2514
+ variable: Variables.ValidateVariableValues_SP.VariableSet,
2515
+ startingValue: variableSet,
2516
+ stringifier: (val) => this.extractSysIdIfRecord(val),
2517
+ })
2518
+
2519
+ this.createVariable({
2520
+ stepConfig,
2521
+ stepRecord,
2522
+ variable: Variables.ValidateVariableValues_SP.Conditions,
2523
+ startingValue: variableValues,
2524
+ })
2525
+ }
2526
+
2527
+ variableStateValidation_SP(inputs: {
2528
+ catItem: string | Record<'sc_cat_item'>
2529
+ variableSet: string | Record<'item_option_new_set'>
2530
+ visible: string[]
2531
+ notVisible: string[]
2532
+ readonly: string[]
2533
+ notReadonly: string[]
2534
+ mandatory: string[]
2535
+ notMandatory: string[]
2536
+ }) {
2537
+ const { catItem, variableSet, visible, notMandatory, notReadonly, notVisible, mandatory, readonly } = inputs
2538
+ const stepConfig = StepConfig.VariableStateValidation_SP
2539
+
2540
+ const stepRecord = this.createStepRecord({
2541
+ name: 'Variable State Validation (SP)',
2542
+ stepConfig,
2543
+ description:
2544
+ "Assert that variables are or aren't: mandatory, read only, and visible in service portal view on the catalog item.",
2545
+ })
2546
+
2547
+ this.createVariable({
2548
+ stepConfig,
2549
+ stepRecord,
2550
+ variable: Variables.VariableStateValidation_SP.Item,
2551
+ startingValue: catItem,
2552
+ stringifier: (val) => this.extractSysIdIfRecord(val),
2553
+ })
2554
+
2555
+ this.createVariable({
2556
+ stepConfig,
2557
+ stepRecord,
2558
+ variable: Variables.VariableStateValidation_SP.VariableSet,
2559
+ startingValue: variableSet,
2560
+ stringifier: (val) => this.extractSysIdIfRecord(val),
2561
+ })
2562
+
2563
+ this.createVariable({
2564
+ stepConfig,
2565
+ stepRecord,
2566
+ variable: Variables.VariableStateValidation_SP.Visible,
2567
+ startingValue: visible,
2568
+ stringifier: (val) => this.recordListToString(val),
2569
+ })
2570
+
2571
+ this.createVariable({
2572
+ stepConfig,
2573
+ stepRecord,
2574
+ variable: Variables.VariableStateValidation_SP.NotVisible,
2575
+ startingValue: notVisible,
2576
+ stringifier: (val) => this.recordListToString(val),
2577
+ })
2578
+
2579
+ this.createVariable({
2580
+ stepConfig,
2581
+ stepRecord,
2582
+ variable: Variables.VariableStateValidation_SP.Mandatory,
2583
+ startingValue: mandatory,
2584
+ stringifier: (val) => this.recordListToString(val),
2585
+ })
2586
+
2587
+ this.createVariable({
2588
+ stepConfig,
2589
+ stepRecord,
2590
+ variable: Variables.VariableStateValidation_SP.NotMandatory,
2591
+ startingValue: notMandatory,
2592
+ stringifier: (val) => this.recordListToString(val),
2593
+ })
2594
+
2595
+ this.createVariable({
2596
+ stepConfig,
2597
+ stepRecord,
2598
+ variable: Variables.VariableStateValidation_SP.ReadOnly,
2599
+ startingValue: readonly,
2600
+ stringifier: (val) => this.recordListToString(val),
2601
+ })
2602
+
2603
+ this.createVariable({
2604
+ stepConfig,
2605
+ stepRecord,
2606
+ variable: Variables.VariableStateValidation_SP.NotReadOnly,
2607
+ startingValue: notReadonly,
2608
+ stringifier: (val) => this.recordListToString(val),
2609
+ })
2610
+ }
2611
+
2612
+ validatePriceAndRecurringPrice_SP(inputs: {
2613
+ price: string | number
2614
+ recurringPrice: string | number
2615
+ frequency: atf.FrequencyType
2616
+ }) {
2617
+ const { price, recurringPrice, frequency } = inputs
2618
+ const stepConfig = StepConfig.ValidatePriceandRecurringPrice_SP
2619
+
2620
+ const stepRecord = this.createStepRecord({
2621
+ stepConfig,
2622
+ name: 'Validate Price and Recurring Price (SP)',
2623
+ description: 'Validate Price and Recurring Price (SP)',
2624
+ })
2625
+
2626
+ this.createVariable({
2627
+ stepConfig,
2628
+ stepRecord,
2629
+ variable: Variables.ValidatePriceandRecurringPrice_SP.Price,
2630
+ startingValue: price,
2631
+ })
2632
+
2633
+ this.createVariable({
2634
+ stepConfig,
2635
+ stepRecord,
2636
+ variable: Variables.ValidatePriceandRecurringPrice_SP.RecurringPrice,
2637
+ startingValue: recurringPrice,
2638
+ })
2639
+
2640
+ this.createVariable({
2641
+ stepConfig,
2642
+ stepRecord,
2643
+ variable: Variables.ValidatePriceandRecurringPrice_SP.RecurringFrequency,
2644
+ startingValue: frequency,
2645
+ })
2646
+ }
2647
+
2648
+ navigatewithinOrderGuide_SP(inputs: { guideStep: atf.GuideStepType; assert: atf.AssertNavigate }) {
2649
+ const { guideStep, assert } = inputs
2650
+ const stepConfig = StepConfig.NavigatewithinOrderGuide_SP
2651
+
2652
+ const stepRecord = this.createStepRecord({
2653
+ stepConfig,
2654
+ name: 'Navigate within Order Guide (SP)',
2655
+ description: 'Navigate in Order Guide (SP)',
2656
+ })
2657
+
2658
+ this.createVariable({
2659
+ stepConfig,
2660
+ stepRecord,
2661
+ variable: Variables.NavigatewithinOrderGuide_SP.GuideStep,
2662
+ startingValue: guideStep,
2663
+ })
2664
+
2665
+ this.createVariable({
2666
+ stepConfig,
2667
+ stepRecord,
2668
+ variable: Variables.NavigatewithinOrderGuide_SP.Assert,
2669
+ startingValue: assert,
2670
+ })
2671
+ }
2672
+
2673
+ setFieldValue_SP<T extends TableName>(inputs: { table: T; fieldValues: Partial<Data<T>> }) {
2674
+ const { table, fieldValues } = inputs
2675
+ const stepConfig = StepConfig.SetFieldValues_SP
2676
+ const stepRecord = this.createStepRecord({
2677
+ name: 'Set Field Values (SP)',
2678
+ stepConfig,
2679
+ description: 'Set Field Values (SP)',
2680
+ tableName: table,
2681
+ })
2682
+
2683
+ this.createVariable({
2684
+ stepConfig,
2685
+ stepRecord,
2686
+ variable: Variables.SetFieldValues_SP.Table,
2687
+ startingValue: table,
2688
+ })
2689
+
2690
+ this.createVariable({
2691
+ stepConfig,
2692
+ stepRecord,
2693
+ variable: Variables.SetFieldValues_SP.FieldValues,
2694
+ startingValue: fieldValues,
2695
+ stringifier: (val) => this.fieldValuesToQuery(val),
2696
+ })
2697
+ }
2698
+
2699
+ setCatalogItemQuantity_SP(inputs: { quantity: string | number }) {
2700
+ const { quantity } = inputs
2701
+ const stepConfig = StepConfig.SetCatalogItemQuantity_SP
2702
+
2703
+ const stepRecord = this.createStepRecord({
2704
+ stepConfig,
2705
+ name: 'Set Catalog Item Quantity (SP)',
2706
+ description: 'Set Catalog Item Quantity (SP)',
2707
+ })
2708
+
2709
+ this.createVariable({
2710
+ stepConfig,
2711
+ stepRecord,
2712
+ variable: Variables.SetCatalogItemQuantity_SP.Quantity,
2713
+ startingValue: quantity,
2714
+ })
2715
+ }
2716
+
2717
+ validateOrderGuideItem_SP(inputs: { items: (string | Record<'sc_cat_item'>)[] }) {
2718
+ const { items } = inputs
2719
+ const stepConfig = StepConfig.ValidateOrderGuideItems_SP
2720
+
2721
+ const stepRecord = this.createStepRecord({
2722
+ name: 'Validate Order Guide Items (SP)',
2723
+ stepConfig,
2724
+ description: 'Validate Order Guide Items (SP)',
2725
+ })
2726
+
2727
+ this.createVariable({
2728
+ stepConfig,
2729
+ stepRecord,
2730
+ variable: Variables.ValidateOrderGuideItems_SP.Items,
2731
+ startingValue: items,
2732
+ stringifier: (val) => this.recordListToString(val),
2733
+ })
2734
+ }
2735
+
2736
+ reviewOrderGuideSummary_SP(inputs: { items: (string | Record<'sc_cat_item'>)[]; price: string | number }) {
2737
+ const { items, price } = inputs
2738
+ const stepConfig = StepConfig.ReviewOrderGuideSummary_SP
2739
+
2740
+ const stepRecord = this.createStepRecord({
2741
+ stepConfig,
2742
+ name: 'Review Order Guide Summary (SP)',
2743
+ description: 'Review Order Guide Summary (SP)',
2744
+ })
2745
+
2746
+ this.createVariable({
2747
+ stepConfig,
2748
+ stepRecord,
2749
+ variable: Variables.ReviewOrderGuideSummary_SP.Price,
2750
+ startingValue: price,
2751
+ })
2752
+
2753
+ this.createVariable({
2754
+ stepConfig,
2755
+ stepRecord,
2756
+ variable: Variables.ReviewOrderGuideSummary_SP.Items,
2757
+ startingValue: items,
2758
+ stringifier: (val) => this.recordListToString(val),
2759
+ })
2760
+ }
2761
+
2762
+ fieldValueValidation_SP<T extends TableName>(inputs: { table: T; conditions: string }) {
2763
+ const { table, conditions } = inputs
2764
+ const stepConfig = StepConfig.FieldValuesValidation_SP
2765
+ const stepRecord = this.createStepRecord({
2766
+ stepConfig,
2767
+ name: 'Field Values Validation (SP)',
2768
+ description: 'Field Values Validation (SP)',
2769
+ })
2770
+
2771
+ this.createVariable({
2772
+ stepConfig,
2773
+ stepRecord,
2774
+ variable: Variables.FieldValuesValidation_SP.Table,
2775
+ startingValue: table,
2776
+ })
2777
+
2778
+ this.createVariable({
2779
+ stepConfig,
2780
+ stepRecord,
2781
+ variable: Variables.FieldValuesValidation_SP.Conditions,
2782
+ startingValue: conditions,
2783
+ })
2784
+ }
2785
+
2786
+ fieldStateValidation_SP<T extends TableName>(inputs: {
2787
+ table: T
2788
+ visible: (keyof Data<T> | atf.SomeOtherString)[]
2789
+ notVisible: (keyof Data<T> | atf.SomeOtherString)[]
2790
+ mandatory: (keyof Data<T> | atf.SomeOtherString)[]
2791
+ notMandatory: (keyof Data<T> | atf.SomeOtherString)[]
2792
+ readonly: (keyof Data<T> | atf.SomeOtherString)[]
2793
+ notReadonly: (keyof Data<T> | atf.SomeOtherString)[]
2794
+ }) {
2795
+ const { table, mandatory, notMandatory, notReadonly, notVisible, readonly, visible } = inputs
2796
+ const stepConfig = StepConfig.FieldStateValidation_SP
2797
+
2798
+ const stepRecord = this.createStepRecord({
2799
+ stepConfig,
2800
+ name: 'Field State Validation (SP)',
2801
+ description: 'Field State Validation (SP)',
2802
+ tableName: table,
2803
+ })
2804
+
2805
+ this.createVariable({
2806
+ stepConfig,
2807
+ stepRecord,
2808
+ variable: Variables.FieldStateValidation_SP.Table,
2809
+ startingValue: table,
2810
+ })
2811
+
2812
+ this.createVariable({
2813
+ stepConfig,
2814
+ stepRecord,
2815
+ variable: Variables.FieldStateValidation_SP.Mandatory,
2816
+ startingValue: mandatory,
2817
+ stringifier: (val) => this.recordListToString(val as string[]),
2818
+ })
2819
+
2820
+ this.createVariable({
2821
+ stepConfig,
2822
+ stepRecord,
2823
+ variable: Variables.FieldStateValidation_SP.NotMandatory,
2824
+ startingValue: notMandatory,
2825
+ stringifier: (val) => this.recordListToString(val as string[]),
2826
+ })
2827
+
2828
+ this.createVariable({
2829
+ stepConfig,
2830
+ stepRecord,
2831
+ variable: Variables.FieldStateValidation_SP.ReadOnly,
2832
+ startingValue: readonly,
2833
+ stringifier: (val) => this.recordListToString(val as string[]),
2834
+ })
2835
+
2836
+ this.createVariable({
2837
+ stepConfig,
2838
+ stepRecord,
2839
+ variable: Variables.FieldStateValidation_SP.NotReadOnly,
2840
+ startingValue: notReadonly,
2841
+ stringifier: (val) => this.recordListToString(val as string[]),
2842
+ })
2843
+
2844
+ this.createVariable({
2845
+ stepConfig,
2846
+ stepRecord,
2847
+ variable: Variables.FieldStateValidation_SP.Visible,
2848
+ startingValue: visible,
2849
+ stringifier: (val) => this.recordListToString(val as string[]),
2850
+ })
2851
+
2852
+ this.createVariable({
2853
+ stepConfig,
2854
+ stepRecord,
2855
+ variable: Variables.FieldStateValidation_SP.NotVisible,
2856
+ startingValue: notVisible,
2857
+ stringifier: (val) => this.recordListToString(val as string[]),
2858
+ })
2859
+ }
2860
+
2861
+ uiActionVisibilityValidation_SP<T extends TableName>(inputs: {
2862
+ table: T
2863
+ visible: (string | Record<'sys_ui_action'>)[]
2864
+ notVisible: (string | Record<'sys_ui_action'>)[]
2865
+ }) {
2866
+ const { table, visible, notVisible } = inputs
2867
+ const stepConfig = StepConfig.UIActionVisibilityValidation_SP
2868
+
2869
+ const stepRecord = this.createStepRecord({
2870
+ name: 'UI Action Visibility Validation (SP)',
2871
+ stepConfig,
2872
+ description: 'UI Action Visibility Validation (SP)',
2873
+ tableName: table,
2874
+ })
2875
+
2876
+ this.createVariable({
2877
+ stepConfig,
2878
+ stepRecord,
2879
+ variable: Variables.UIActionVisibilityValidation_SP.Table,
2880
+ startingValue: table,
2881
+ })
2882
+
2883
+ this.createVariable({
2884
+ stepConfig,
2885
+ stepRecord,
2886
+ variable: Variables.UIActionVisibilityValidation_SP.Visible,
2887
+ startingValue: visible,
2888
+ stringifier: (val) => this.recordListToString(val),
2889
+ })
2890
+
2891
+ this.createVariable({
2892
+ stepConfig,
2893
+ stepRecord,
2894
+ variable: Variables.UIActionVisibilityValidation_SP.NotVisible,
2895
+ startingValue: notVisible,
2896
+ stringifier: (val) => this.recordListToString(val),
2897
+ })
2898
+ }
2899
+
2900
+ reviewIteminOrderGuide_SP(inputs: { item: string | Record<'sc_cat_item'>; included: boolean }) {
2901
+ const { item, included } = inputs
2902
+ const stepConfig = StepConfig.ReviewIteminOrderGuide_SP
2903
+ const stepRecord = this.createStepRecord({
2904
+ name: 'Review Item in Order Guide (SP)',
2905
+ stepConfig,
2906
+ description: 'Review Item in Order Guide (SP)',
2907
+ })
2908
+
2909
+ this.createVariable({
2910
+ stepConfig,
2911
+ stepRecord,
2912
+ variable: Variables.ReviewIteminOrderGuide_SP.Item,
2913
+ startingValue: item,
2914
+ stringifier: (val) => this.extractSysIdIfRecord(val),
2915
+ })
2916
+
2917
+ this.createVariable({
2918
+ stepConfig,
2919
+ stepRecord,
2920
+ variable: Variables.ReviewIteminOrderGuide_SP.Included,
2921
+ startingValue: included,
2922
+ })
2923
+ }
2924
+
2925
+ clickUIAction_SP<T extends TableName>(inputs: {
2926
+ table: T
2927
+ uiAction: string | Record<'sys_ui_action'>
2928
+ assert: atf.AssertClickUIActionSP
2929
+ }): any {
2930
+ const { table, uiAction, assert } = inputs
2931
+ const stepConfig = StepConfig.ClickaUIAction_SP
2932
+
2933
+ const stepRecord = this.createStepRecord({
2934
+ stepConfig,
2935
+ name: 'Click a UI Action (SP)',
2936
+ description: 'Click a UI Action (SP)',
2937
+ tableName: table,
2938
+ })
2939
+
2940
+ this.createVariable({
2941
+ stepConfig,
2942
+ stepRecord,
2943
+ variable: Variables.ClickaUIAction_SP.Table,
2944
+ startingValue: table,
2945
+ })
2946
+
2947
+ this.createVariable({
2948
+ stepConfig,
2949
+ stepRecord,
2950
+ variable: Variables.ClickaUIAction_SP.Assert,
2951
+ startingValue: assert,
2952
+ })
2953
+
2954
+ this.createVariable({
2955
+ stepConfig,
2956
+ stepRecord,
2957
+ variable: Variables.ClickaUIAction_SP.UIAction,
2958
+ startingValue: uiAction,
2959
+ stringifier: (val) => this.extractSysIdIfRecord(val),
2960
+ })
2961
+ }
2962
+
2963
+ submitForm_SP(inputs: { assert: atf.AssertSubmitFormSP }): any {
2964
+ const { assert } = inputs
2965
+ const stepConfig = StepConfig.SubmitForm_SP
2966
+
2967
+ const stepRecord = this.createStepRecord({
2968
+ name: 'Submit a Form (SP)',
2969
+ stepConfig,
2970
+ description: 'Submits the current form.',
2971
+ })
2972
+
2973
+ this.createVariable({
2974
+ stepConfig,
2975
+ stepRecord,
2976
+ variable: Variables.SubmitForm_SP.Assert,
2977
+ startingValue: assert,
2978
+ })
2979
+ }
2980
+
2981
+ addItemtoShoppingCart_SP(inputs: { assert: atf.AssertAddItemToCartSP }): any {
2982
+ const { assert } = inputs
2983
+ const stepConfig = StepConfig.AddItemtoShoppingCart_SP
2984
+
2985
+ const stepRecord = this.createStepRecord({
2986
+ stepConfig,
2987
+ name: 'Add Item to Shopping Cart (SP)',
2988
+ description: 'Add Item to Shopping Cart (SP)',
2989
+ })
2990
+
2991
+ this.createVariable({
2992
+ stepConfig,
2993
+ stepRecord,
2994
+ variable: Variables.AddItemtoShoppingCart_SP.Assert,
2995
+ startingValue: assert,
2996
+ })
2997
+ }
2998
+
2999
+ addOrderGuidetoShoppingCart_SP(inputs: { assert: atf.AssertAddOrderGuidetoShoppingCart_SP }) {
3000
+ const { assert } = inputs
3001
+ const stepConfig = StepConfig.AddOrderGuidetoShoppingCart_SP
3002
+
3003
+ const stepRecord = this.createStepRecord({
3004
+ stepConfig,
3005
+ name: 'Add Order Guide to Shopping Cart (SP)',
3006
+ description: 'Add Order Guide to Shopping Cart (SP)',
3007
+ })
3008
+
3009
+ this.createVariable({
3010
+ stepConfig,
3011
+ stepRecord,
3012
+ variable: Variables.AddOrderGuidetoShoppingCart_SP.Assert,
3013
+ startingValue: assert,
3014
+ })
3015
+ }
3016
+
3017
+ submitOrderGuide_SP(inputs: { assert: atf.AssertSubmitOrderGuideSP }): any {
3018
+ const { assert } = inputs
3019
+ const stepConfig = StepConfig.SubmitOrderGuide_SP
3020
+
3021
+ const stepRecord = this.createStepRecord({
3022
+ name: 'Submit an Order Guide (SP)',
3023
+ stepConfig,
3024
+ description: 'Submit an Order Guide (SP)',
3025
+ })
3026
+
3027
+ this.createVariable({
3028
+ stepConfig,
3029
+ stepRecord,
3030
+ variable: Variables.SubmitOrderGuide_SP.Assert,
3031
+ startingValue: assert,
3032
+ })
3033
+ }
3034
+
3035
+ submitRecordProducer_SP(inputs: { assert: atf.AssertRecordProducerSubmitSP }): any {
3036
+ const { assert } = inputs
3037
+ const stepConfig = StepConfig.SubmitRecordProducer_SP
3038
+
3039
+ const stepRecord = this.createStepRecord({
3040
+ stepConfig,
3041
+ name: 'Submit Record Producer (SP)',
3042
+ description: 'Submit a Record Producer (SP)',
3043
+ })
3044
+
3045
+ this.createVariable({
3046
+ stepConfig,
3047
+ stepRecord,
3048
+ variable: Variables.SubmitRecordProducer_SP.Assert,
3049
+ startingValue: assert,
3050
+ })
3051
+ }
3052
+
3053
+ orderCatalogItem_SP(inputs: { assert: atf.AssertOrderCatalogItemSP }): any {
3054
+ const { assert } = inputs
3055
+ const stepConfig = StepConfig.OrderCatalogItem_SP
3056
+
3057
+ const stepRecord = this.createStepRecord({
3058
+ name: 'Order a Catalog Item (SP)',
3059
+ stepConfig,
3060
+ description: 'Order a Catalog Item (SP)',
3061
+ })
3062
+
3063
+ this.createVariable({
3064
+ stepConfig,
3065
+ stepRecord,
3066
+ variable: Variables.OrderCatalogItem_SP.Assert,
3067
+ startingValue: assert,
3068
+ })
3069
+ }
3070
+
3071
+ validateOutboundEmail(inputs: { conditions: string }) {
3072
+ const { conditions } = inputs
3073
+ const stepConfig = StepConfig.ValidateOutboundEmail
3074
+
3075
+ const stepRecord = this.createStepRecord({
3076
+ name: 'Validate Outbound Email',
3077
+ stepConfig,
3078
+ description: 'Filters the Email [sys_email] table to find an email that was sent during testing',
3079
+ })
3080
+
3081
+ this.createVariable({
3082
+ stepConfig,
3083
+ stepRecord,
3084
+ variable: Variables.ValidateOutboundEmail.Conditions,
3085
+ startingValue: conditions,
3086
+ })
3087
+
3088
+ this.createVariable({
3089
+ stepConfig,
3090
+ stepRecord,
3091
+ variable: Variables.ValidateOutboundEmail.Table,
3092
+ startingValue: 'sys_email',
3093
+ })
3094
+ }
3095
+
3096
+ recordInsert<T extends TableName>(inputs: {
3097
+ assertType: atf.AssertInsert
3098
+ enforceSecurity: boolean
3099
+ table: T
3100
+ fieldValues: Partial<Data<T>>
3101
+ }): any {
3102
+ const { assertType, enforceSecurity, table, fieldValues } = inputs
3103
+ const stepConfig = StepConfig.RecordInsert
3104
+
3105
+ const stepRecord = this.createStepRecord({
3106
+ name: 'Record Insert',
3107
+ stepConfig,
3108
+ description: 'Insert a record to the table',
3109
+ })
3110
+
3111
+ this.createVariable({
3112
+ stepConfig,
3113
+ stepRecord,
3114
+ variable: Variables.RecordInsert.AssertType,
3115
+ startingValue: assertType,
3116
+ })
3117
+
3118
+ this.createVariable({
3119
+ stepConfig,
3120
+ stepRecord,
3121
+ variable: Variables.RecordInsert.EnforceSecurity,
3122
+ startingValue: enforceSecurity,
3123
+ })
3124
+
3125
+ this.createVariable({
3126
+ stepConfig,
3127
+ stepRecord,
3128
+ variable: Variables.RecordInsert.Table,
3129
+ startingValue: table,
3130
+ })
3131
+
3132
+ this.createVariable({
3133
+ stepConfig,
3134
+ stepRecord,
3135
+ variable: Variables.RecordInsert.FieldValues,
3136
+ startingValue: fieldValues,
3137
+ stringifier: (val) => this.fieldValuesToQuery(val),
3138
+ })
3139
+ }
3140
+
3141
+ searchForCatalogItem(inputs: {
3142
+ search_in_portal: boolean
3143
+ search_term: string
3144
+ catalog: string | Record<'sc_catalog'>
3145
+ category: string | Record<'sc_category'>
3146
+ assert_item: string | Record<'sc_cat_item'>
3147
+ assert_type: atf.AssertCatalogItem
3148
+ }): any {
3149
+ const { search_in_portal, search_term, catalog, category, assert_item, assert_type } = inputs
3150
+ const stepConfig = StepConfig.SearchForACatalogItem
3151
+ const stepRecord = this.createStepRecord({
3152
+ name: 'Search for a Catalog Item',
3153
+ stepConfig,
3154
+ description: 'Perform search for a Catalog Item or Record Producer in the specified Catalog and Category',
3155
+ })
3156
+
3157
+ this.createVariable({
3158
+ stepConfig,
3159
+ stepRecord,
3160
+ variable: Variables.SearchForACatalogItem.SearchInPortalOnly,
3161
+ startingValue: search_in_portal,
3162
+ })
3163
+
3164
+ this.createVariable({
3165
+ stepConfig,
3166
+ stepRecord,
3167
+ variable: Variables.SearchForACatalogItem.SearchTerm,
3168
+ startingValue: search_term,
3169
+ })
3170
+
3171
+ this.createVariable({
3172
+ stepConfig,
3173
+ stepRecord,
3174
+ variable: Variables.SearchForACatalogItem.Catalog,
3175
+ startingValue: catalog,
3176
+ stringifier: (val) => this.extractSysIdIfRecord(val),
3177
+ })
3178
+
3179
+ this.createVariable({
3180
+ stepConfig,
3181
+ stepRecord,
3182
+ variable: Variables.SearchForACatalogItem.Category,
3183
+ startingValue: category,
3184
+ stringifier: (val) => this.extractSysIdIfRecord(val),
3185
+ })
3186
+
3187
+ this.createVariable({
3188
+ stepConfig,
3189
+ stepRecord,
3190
+ variable: Variables.SearchForACatalogItem.AssertItem,
3191
+ startingValue: assert_item,
3192
+ stringifier: (val) => this.extractSysIdIfRecord(val),
3193
+ })
3194
+
3195
+ this.createVariable({
3196
+ stepConfig,
3197
+ stepRecord,
3198
+ variable: Variables.SearchForACatalogItem.AssertType,
3199
+ startingValue: assert_type,
3200
+ })
3201
+ }
3202
+
3203
+ replayRequestItem(inputs: { request_item: string | Record<'sc_req_item'> }): any {
3204
+ const { request_item } = inputs
3205
+ const stepConfig = StepConfig.ReplayRequestItem
3206
+
3207
+ const stepRecord = this.createStepRecord({
3208
+ name: 'Replay Request Item',
3209
+ stepConfig,
3210
+ description: 'Replays a previously created request item with the same values and options',
3211
+ })
3212
+
3213
+ this.createVariable({
3214
+ stepConfig,
3215
+ stepRecord,
3216
+ variable: Variables.ReplayRequestItem.OriginalRequestItem,
3217
+ startingValue: request_item,
3218
+ stringifier: (val) => this.extractSysIdIfRecord(val),
3219
+ })
3220
+ }
3221
+
3222
+ variableStateValidation(inputs: {
3223
+ catalog_item: string | Record<'sc_cat_item'>
3224
+ visible: string[]
3225
+ not_visible: string[]
3226
+ read_only: string[]
3227
+ not_read_only: string[]
3228
+ mandatory: string[]
3229
+ not_mandatory: string[]
3230
+ }) {
3231
+ const { catalog_item, visible, not_visible, read_only, not_read_only, mandatory, not_mandatory } = inputs
3232
+ const stepConfig = StepConfig.VariableStateValidation
3233
+ const stepRecord = this.createStepRecord({
3234
+ name: 'Variable State Validation',
3235
+ stepConfig,
3236
+ description: 'Validates states of the desired variables',
3237
+ })
3238
+
3239
+ this.createVariable({
3240
+ stepConfig,
3241
+ stepRecord,
3242
+ variable: Variables.VariableStateValidation.CatalogItem,
3243
+ startingValue: catalog_item,
3244
+ stringifier: (val) => this.extractSysIdIfRecord(val),
3245
+ })
3246
+
3247
+ this.createVariable({
3248
+ stepConfig,
3249
+ stepRecord,
3250
+ variable: Variables.VariableStateValidation.Visible,
3251
+ startingValue: visible,
3252
+ stringifier: (val) => this.recordListToString(val),
3253
+ })
3254
+
3255
+ this.createVariable({
3256
+ stepConfig,
3257
+ stepRecord,
3258
+ variable: Variables.VariableStateValidation.NotVisible,
3259
+ startingValue: not_visible,
3260
+ stringifier: (val) => this.recordListToString(val),
3261
+ })
3262
+
3263
+ this.createVariable({
3264
+ stepConfig,
3265
+ stepRecord,
3266
+ variable: Variables.VariableStateValidation.ReadOnly,
3267
+ startingValue: read_only,
3268
+ stringifier: (val) => this.recordListToString(val),
3269
+ })
3270
+
3271
+ this.createVariable({
3272
+ stepConfig,
3273
+ stepRecord,
3274
+ variable: Variables.VariableStateValidation.NotReadOnly,
3275
+ startingValue: not_read_only,
3276
+ stringifier: (val) => this.recordListToString(val),
3277
+ })
3278
+
3279
+ this.createVariable({
3280
+ stepConfig,
3281
+ stepRecord,
3282
+ variable: Variables.VariableStateValidation.Mandatory,
3283
+ startingValue: mandatory,
3284
+ stringifier: (val) => this.recordListToString(val),
3285
+ })
3286
+
3287
+ this.createVariable({
3288
+ stepConfig,
3289
+ stepRecord,
3290
+ variable: Variables.VariableStateValidation.NotMandatory,
3291
+ startingValue: not_mandatory,
3292
+ stringifier: (val) => this.recordListToString(val),
3293
+ })
3294
+ }
3295
+
3296
+ assertResponseHeader(inputs: {
3297
+ header_name: string
3298
+ response_operation: atf.AssertResponseHeader
3299
+ header_value: string
3300
+ }) {
3301
+ const { header_name, response_operation, header_value } = inputs
3302
+ const stepConfig = StepConfig.AssertResponseHeader
3303
+
3304
+ const stepRecord = this.createStepRecord({
3305
+ name: 'Assert Response Header',
3306
+ stepConfig,
3307
+ description: 'Assert an HTTP response header',
3308
+ })
3309
+
3310
+ this.createVariable({
3311
+ stepConfig,
3312
+ stepRecord,
3313
+ variable: Variables.AssertResponseHeader.Header,
3314
+ startingValue: header_name,
3315
+ })
3316
+
3317
+ this.createVariable({
3318
+ stepConfig,
3319
+ stepRecord,
3320
+ variable: Variables.AssertResponseHeader.Operation,
3321
+ startingValue: response_operation,
3322
+ })
3323
+
3324
+ this.createVariable({
3325
+ stepConfig,
3326
+ stepRecord,
3327
+ variable: Variables.AssertResponseHeader.Value,
3328
+ startingValue: header_value,
3329
+ })
3330
+ }
3331
+
3332
+ assertResponsePayload(inputs: { response_body: string; response_operation: atf.AssertResponsePayload }) {
3333
+ const { response_body, response_operation } = inputs
3334
+ const stepConfig = StepConfig.AssertResponsePayload
3335
+
3336
+ const stepRecord = this.createStepRecord({
3337
+ name: 'Assert Response Payload',
3338
+ stepConfig,
3339
+ description: 'Assert the HTTP response payload is equals to or contains a specified value',
3340
+ })
3341
+
3342
+ this.createVariable({
3343
+ stepConfig,
3344
+ stepRecord,
3345
+ variable: Variables.AssertResponsePayload.ResponseBody,
3346
+ startingValue: response_body,
3347
+ })
3348
+
3349
+ this.createVariable({
3350
+ stepConfig,
3351
+ stepRecord,
3352
+ variable: Variables.AssertResponsePayload.Operation,
3353
+ startingValue: response_operation,
3354
+ })
3355
+ }
3356
+ }