system-testing 1.0.12 → 1.0.14
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.
package/package.json
CHANGED
|
@@ -98,20 +98,32 @@ export default class SystemTestBrowserHelper {
|
|
|
98
98
|
return this.originalConsoleLog(...args)
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
consoleLogMessage(arg) {
|
|
101
|
+
consoleLogMessage(arg, scannedObjects = []) {
|
|
102
102
|
if (Array.isArray(arg)) {
|
|
103
|
+
if (scannedObjects.includes(arg)) {
|
|
104
|
+
return "[recursive]"
|
|
105
|
+
} else {
|
|
106
|
+
scannedObjects.push(arg)
|
|
107
|
+
}
|
|
108
|
+
|
|
103
109
|
const result = []
|
|
104
110
|
|
|
105
111
|
for (const value of arg) {
|
|
106
|
-
result.push(this.consoleLogMessage(value))
|
|
112
|
+
result.push(this.consoleLogMessage(value, scannedObjects))
|
|
107
113
|
}
|
|
108
114
|
|
|
109
115
|
return result
|
|
110
116
|
} else if (Object.prototype.toString.call(arg) === '[object Object]') {
|
|
117
|
+
if (scannedObjects.includes(arg)) {
|
|
118
|
+
return "[recursive]"
|
|
119
|
+
} else {
|
|
120
|
+
scannedObjects.push(arg)
|
|
121
|
+
}
|
|
122
|
+
|
|
111
123
|
const result = {}
|
|
112
124
|
|
|
113
125
|
for (const key in arg) {
|
|
114
|
-
result[key] = this.consoleLogMessage(arg[key])
|
|
126
|
+
result[key] = this.consoleLogMessage(arg[key], scannedObjects)
|
|
115
127
|
}
|
|
116
128
|
|
|
117
129
|
return result
|
package/src/system-test.js
CHANGED
|
@@ -71,7 +71,14 @@ export default class SystemTest {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
async find(selector, args = {}) {
|
|
74
|
-
|
|
74
|
+
let elements
|
|
75
|
+
|
|
76
|
+
try {
|
|
77
|
+
elements = await this.all(selector, args)
|
|
78
|
+
} catch (error) {
|
|
79
|
+
// Re-throw to recover stack trace
|
|
80
|
+
throw new Error(`${error.message} (selector: ${selector})`)
|
|
81
|
+
}
|
|
75
82
|
|
|
76
83
|
if (elements.length > 1) {
|
|
77
84
|
throw new Error(`More than 1 elements (${elements.length}) was found by CSS: ${selector}`)
|
|
@@ -84,7 +91,7 @@ export default class SystemTest {
|
|
|
84
91
|
return elements[0]
|
|
85
92
|
}
|
|
86
93
|
|
|
87
|
-
|
|
94
|
+
async findByTestID(testID, args) { return await this.find(`[data-testid='${testID}']`, args) }
|
|
88
95
|
|
|
89
96
|
async findNoWait(selector) {
|
|
90
97
|
await this.driverSetTimeouts(0)
|
|
@@ -146,13 +153,8 @@ export default class SystemTest {
|
|
|
146
153
|
return notificationMessageTexts
|
|
147
154
|
}
|
|
148
155
|
|
|
149
|
-
isStarted() {
|
|
150
|
-
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
async getHTML() {
|
|
154
|
-
return await this.driver.getPageSource()
|
|
155
|
-
}
|
|
156
|
+
isStarted() { return this._started }
|
|
157
|
+
async getHTML() { return await this.driver.getPageSource() }
|
|
156
158
|
|
|
157
159
|
async start() {
|
|
158
160
|
if (process.env.SYSTEM_TEST_HOST == "expo-dev-server") {
|