From 446d9f8cc7f12fbbf3d8643f5d3414822a18c51d Mon Sep 17 00:00:00 2001
From: Chocobozzz <me@florianbigard.com>
Date: Thu, 22 Aug 2019 15:12:44 +0200
Subject: [PATCH] Fix e2e tests

---
 client/angular.json          |  6 ++++--
 client/e2e/proxy.config.json | 37 ++++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+), 2 deletions(-)
 create mode 100644 client/e2e/proxy.config.json

diff --git a/client/angular.json b/client/angular.json
index e1e4f4850..950ac059e 100644
--- a/client/angular.json
+++ b/client/angular.json
@@ -86,7 +86,8 @@
           "options": {
             "baseHref": "/",
             "deployUrl": "client/",
-            "browserTarget": "PeerTube:build"
+            "browserTarget": "PeerTube:build",
+            "proxyConfig": "proxy.config.json"
           },
           "configurations": {
             "production": {
@@ -96,7 +97,8 @@
               "browserTarget": "PeerTube:build:hmr"
             },
             "e2e": {
-              "browserTarget": "PeerTube:build:e2e"
+              "browserTarget": "PeerTube:build:e2e",
+              "proxyConfig": "e2e/proxy.config.json"
             }
           }
         },
diff --git a/client/e2e/proxy.config.json b/client/e2e/proxy.config.json
new file mode 100644
index 000000000..00bda5eb7
--- /dev/null
+++ b/client/e2e/proxy.config.json
@@ -0,0 +1,37 @@
+{
+  "/api": {
+    "target": "http://localhost:9000",
+    "secure": false
+  },
+  "/plugins": {
+    "target": "http://localhost:9000",
+    "secure": false
+  },
+  "/themes": {
+    "target": "http://localhost:9000",
+    "secure": false
+  },
+  "/static": {
+    "target": "http://localhost:9000",
+    "secure": false
+  },
+  "/lazy-static": {
+    "target": "http://localhost:9000",
+    "secure": false
+  },
+  "/socket.io": {
+    "target": "ws://localhost:9000",
+    "secure": false,
+    "ws": true
+  },
+  "/!(client)**": {
+    "target": "http://localhost:3333/client/index.html",
+    "secure": false,
+    "logLevel": "debug"
+  },
+  "/!(client)**/**": {
+    "target": "http://localhost:3333/client/index.html",
+    "secure": false,
+    "logLevel": "debug"
+  }
+}