diff --git a/docker-compose.e2e.yml b/docker-compose.e2e.yml index 75a4979a1..d97fb6bef 100644 --- a/docker-compose.e2e.yml +++ b/docker-compose.e2e.yml @@ -39,6 +39,8 @@ services: interval: 5s timeout: 3s retries: 60 + ports: + - 4000:4000 e2e: build: diff --git a/src/api/helpers.js b/src/api/helpers.js index a7e1b624b..50841a495 100644 --- a/src/api/helpers.js +++ b/src/api/helpers.js @@ -132,6 +132,7 @@ export const promisedRequest = async ({ ) } } catch (error) { + if (error.name === 'StatusCodeError') throw error throw new Error(error, { url, options }, response) } } diff --git a/src/stores/admin_settings.js b/src/stores/admin_settings.js index 06bcab9ae..44146756f 100644 --- a/src/stores/admin_settings.js +++ b/src/stores/admin_settings.js @@ -87,22 +87,19 @@ export const useAdminSettingsStore = defineStore('adminSettings', { loadAdminStuff() { getInstanceDBConfig({ credentials: useOAuthStore().token, - }).then(({ data: backendDbConfig }) => { - if (backendDbConfig.error) { - if (backendDbConfig.error.status === 400) { - backendDbConfig.error.json().then((errorJson) => { - if (/configurable_from_database/.test(errorJson.error)) { - this.setInstanceAdminNoDbConfig() - } - }) - } - } else { + }) + .then(({ data: backendDbConfig }) => this.setInstanceAdminSettings({ credentials: useOAuthStore().token, backendDbConfig, - }) - } - }) + })) + .catch(({ statusCode, statusText }) => { + if (statusCode === 400) { + if (/configurable_from_database/.test(statusText)) { + this.setInstanceAdminNoDbConfig() + } + } + }) if (this.descriptions === null) { getInstanceConfigDescriptions({ credentials: useOAuthStore().token, diff --git a/test/e2e-playwright/playwright.config.mjs b/test/e2e-playwright/playwright.config.mjs index 04747ee77..00bc15723 100644 --- a/test/e2e-playwright/playwright.config.mjs +++ b/test/e2e-playwright/playwright.config.mjs @@ -1,7 +1,7 @@ /* global process */ import { defineConfig, devices } from 'playwright/test' -const baseURL = process.env.E2E_BASE_URL || 'http://localhost:8080' +const baseURL = process.env.E2E_BASE_URL || 'http://localhost:8099' export default defineConfig({ testDir: './specs', @@ -25,12 +25,14 @@ export default defineConfig({ video: 'retain-on-failure', }, webServer: { - command: 'yarn dev -- --host 0.0.0.0 --port 8080 --strictPort', + command: 'yarn dev -- --host 0.0.0.0 --strictPort', url: baseURL, reuseExistingServer: !process.env.CI, timeout: 120_000, env: { ...process.env, + PORT: + process.env.PORT || '8099', VITE_PROXY_TARGET: process.env.VITE_PROXY_TARGET || 'http://localhost:4000', VITE_PROXY_ORIGIN: