From d1cdc733105638fe16ddd55bade5ed9e48173199 Mon Sep 17 00:00:00 2001 From: Katarzyna Rachwal Date: Wed, 20 Dec 2023 14:52:21 -0500 Subject: [PATCH] Workaround for localhost vs IP cypress testing issue --- python-backend/main.py | 6 +++--- react-frontend/src/components/Form.tsx | 2 +- react-frontend/vite.config.js | 3 +++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/python-backend/main.py b/python-backend/main.py index 98eba5e..b9509ed 100644 --- a/python-backend/main.py +++ b/python-backend/main.py @@ -11,7 +11,7 @@ import constants import logger -import math_utils +from graph_utils import error_coordinates, delta_coordinates from input import Input, convert from wolfram_client import WolframClient @@ -57,8 +57,8 @@ async def analyze(request: Request): "wolfram_limit": WolframClient.limit(str(simple)), "limit": json.dumps(float(limit)), "denominator_limit": json.dumps(float(q_limit)), - "log_error": json.dumps(math_utils.error_coordinates(simple, x, limit)), - "delta": json.dumps(math_utils.delta_coordinates(simple, simple_q, x, limit)), + "log_error": json.dumps(error_coordinates(simple, x, limit)), + "delta": json.dumps(delta_coordinates(simple, simple_q, x, limit)), "computed_value": json.dumps(float(limit)) # @TODO: replace with actual computation to i } diff --git a/react-frontend/src/components/Form.tsx b/react-frontend/src/components/Form.tsx index 0661bcb..38b53e3 100644 --- a/react-frontend/src/components/Form.tsx +++ b/react-frontend/src/components/Form.tsx @@ -58,7 +58,7 @@ function Form() { }; console.log(body); axios - .post('http://127.0.0.1:8000/analyze', body) + .post('http://localhost:8000/analyze', body) .then((response) => { if (response.status == 200) { setResults(response.data); diff --git a/react-frontend/vite.config.js b/react-frontend/vite.config.js index 7b18977..4e8af1d 100644 --- a/react-frontend/vite.config.js +++ b/react-frontend/vite.config.js @@ -1,6 +1,9 @@ import { defineConfig } from 'vite'; import eslint from 'vite-plugin-eslint'; import react from '@vitejs/plugin-react'; +// for the following see https://github.com/cypress-io/cypress/issues/25397#issuecomment-1775454875 +import dns from 'dns' +dns.setDefaultResultOrder('ipv4first') export default defineConfig(() => { return {