about summary refs log tree commit diff
path: root/__e2e__
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2024-01-04 17:33:57 -0800
committerGitHub <noreply@github.com>2024-01-04 17:33:57 -0800
commit34817628e12d9bce2ba4136e192e3163d7aa0eee (patch)
tree3c4e0224f0a3913eedabddc313f346c9c3b12403 /__e2e__
parent67e70918e33fc7e4fb2bcadc118f49128faf9201 (diff)
downloadvoidsky-34817628e12d9bce2ba4136e192e3163d7aa0eee.tar.zst
E2E runner fixes (#2428)
* Fix mock-server run script

* Bump detox

* Replace fetch with node-native api
Diffstat (limited to '__e2e__')
-rw-r--r--__e2e__/util.ts27
1 files changed, 24 insertions, 3 deletions
diff --git a/__e2e__/util.ts b/__e2e__/util.ts
index f6f3b1b80..c5668d042 100644
--- a/__e2e__/util.ts
+++ b/__e2e__/util.ts
@@ -1,5 +1,6 @@
 import {resolveConfig} from 'detox/internals'
 import {execSync} from 'child_process'
+import http from 'http'
 
 const platform = device.getPlatform()
 
@@ -105,9 +106,29 @@ async function openAppForDebugBuild(platform: string, opts: any) {
 }
 
 export async function createServer(path = '') {
-  const res = await fetch(`http://localhost:1986/${path}`, {method: 'POST'})
-  const resBody = await res.text()
-  return resBody
+  return new Promise(function (resolve, reject) {
+    var req = http.request(
+      {
+        method: 'POST',
+        host: 'localhost',
+        port: 1986,
+        path: `/${path}`,
+      },
+      function (res) {
+        const body: Buffer[] = []
+        res.on('data', chunk => body.push(chunk))
+        res.on('end', function () {
+          try {
+            resolve(Buffer.concat(body).toString())
+          } catch (e) {
+            reject(e)
+          }
+        })
+      },
+    )
+    req.on('error', reject)
+    req.end()
+  })
 }
 
 const getDeepLinkUrl = (url: string) =>