system-testing 1.0.14 → 1.0.16
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 +1 -1
- package/src/system-test.js +13 -5
package/package.json
CHANGED
package/src/system-test.js
CHANGED
|
@@ -12,9 +12,9 @@ import {WebSocketServer} from "ws"
|
|
|
12
12
|
class ElementNotFoundError extends Error { }
|
|
13
13
|
|
|
14
14
|
export default class SystemTest {
|
|
15
|
-
static current() {
|
|
15
|
+
static current(args) {
|
|
16
16
|
if (!globalThis.systemTest) {
|
|
17
|
-
globalThis.systemTest = new SystemTest()
|
|
17
|
+
globalThis.systemTest = new SystemTest(args)
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
return globalThis.systemTest
|
|
@@ -36,8 +36,16 @@ export default class SystemTest {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
constructor() {
|
|
39
|
+
constructor({host = "localhost", port = 8081, ...restArgs} = {}) {
|
|
40
|
+
const restArgsKeys = Object.keys(restArgs)
|
|
41
|
+
|
|
42
|
+
if (restArgsKeys.length > 0) {
|
|
43
|
+
throw new Error(`Unknown arguments: ${restArgsKeys.join(", ")}`)
|
|
44
|
+
}
|
|
45
|
+
|
|
40
46
|
this.communicator = new SystemTestCommunicator({onCommand: this.onCommandReceived})
|
|
47
|
+
this._host = host
|
|
48
|
+
this._port = port
|
|
41
49
|
this._responses = {}
|
|
42
50
|
this._sendCount = 0
|
|
43
51
|
}
|
|
@@ -158,9 +166,9 @@ export default class SystemTest {
|
|
|
158
166
|
|
|
159
167
|
async start() {
|
|
160
168
|
if (process.env.SYSTEM_TEST_HOST == "expo-dev-server") {
|
|
161
|
-
this.currentUrl =
|
|
169
|
+
this.currentUrl = `http://${this._host}:${this._port}`
|
|
162
170
|
} else if (process.env.SYSTEM_TEST_HOST == "dist") {
|
|
163
|
-
this.currentUrl =
|
|
171
|
+
this.currentUrl = `http://${this._host}:1984`
|
|
164
172
|
this.systemTestHttpServer = new SystemTestHttpServer()
|
|
165
173
|
|
|
166
174
|
await this.systemTestHttpServer.start()
|