system-testing 1.0.14 → 1.0.15

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/system-test.js +13 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "system-testing",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "description": "System testing with Selenium and browsers.",
5
5
  "keywords": [
6
6
  "system",
@@ -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 = "http://localhost:8081"
169
+ this.currentUrl = `http://${this._host}:${this._port}`
162
170
  } else if (process.env.SYSTEM_TEST_HOST == "dist") {
163
- this.currentUrl = "http://localhost:1984"
171
+ this.currentUrl = `http://${this._host}:1984`
164
172
  this.systemTestHttpServer = new SystemTestHttpServer()
165
173
 
166
174
  await this.systemTestHttpServer.start()