Code Monkey home page Code Monkey logo

Comments (7)

rajzik avatar rajzik commented on August 31, 2024 4

Change http-get://localhost:3000 to https-get://localhost:3000 this should resolve your issue.
If not try following script:
START_SERVER_AND_TEST_INSECURE=1 start-server-and-test start http-get://localhost:3000 cy:open.

from start-server-and-test.

goldylucks avatar goldylucks commented on August 31, 2024 1

@rajzik

Change http-get://localhost:3000 to https-get://localhost:3000 this should resolve your issue.
If not try following script:
START_SERVER_AND_TEST_INSECURE=1 start-server-and-test start http-get://localhost:3000 cy:open.

I can confirm this works for me:

// package.json
    "start": "HTTPS=true PORT=3001 react-app-rewired start",
    "cy:run": "cypress run",
    "cy:ci": "START_SERVER_AND_TEST_INSECURE=1 start-server-and-test start:ci https-get://localhost:3001 cy:run",

@praneetha-ck-robo , can you try this and tell if it works?

from start-server-and-test.

rodoabad avatar rodoabad commented on August 31, 2024

Piggybacking on this thread.

#163

Does that mean @rajzik that if I have two servers...

{
  "scripts": {
    "test": "node src/test",
    "start:api": "node src/api",
    "start:server": "node src/server",
    "start:server-and-api": "start-test start:api 7600 start:server",
    "test:all": "start-test start:server-and-api http-get://localhost:3000 test"
  }
}

If I do this I get...

TypeError: Cannot read property 'indexOf' of undefined
[./node_modules/webpack-dev-server/client/index.js?http://localhost:5555] (webpack)-dev-server/client?http://localhost:5555 8.1 KiB {main} [built]
    + 1202 hidden modules
ℹ 「wdm」: Compiled successfully.
TypeError: Cannot read property 'indexOf' of undefined

My server starts at http://localhost:3000/#/ do I need to include the hash?

from start-server-and-test.

rajzik avatar rajzik commented on August 31, 2024

@rodoabad
The error comes from where?

If you have some sort of routing inside of your application and you get redirected from / to /#/ it shouldn't be problem.

start-test waiting for response from sever. Also it looks like something running on port 5555, maybe it's only debugging port.

There might be problem with timing of your servers.
start-test waits only for one server.

from start-server-and-test.

goldylucks avatar goldylucks commented on August 31, 2024

@rodoabad you can try to isolate what is causing the error. Try each command separately:

  "scripts": {
    "test": "node src/test",
    "start:api": "node src/api",
    "start:server": "node src/server",
    "start:server-and-api": "start-test start:api 7600 start:server",
    "test:all": "start-test start:server-and-api http-get://localhost:3000 test"
  }

this is step 1, to validate the problem is actually in test:all.

If your server runs on https, see my previous comment

from start-server-and-test.

jamiehaywood avatar jamiehaywood commented on August 31, 2024

I'm also having this problem with CRA (react-scripts v3.4.3).

The way my HTTPS is set is in my .env file:

HTTPS=true
SSL_CRT_FILE=./.cert/cert.pem
SSL_KEY_FILE=./.cert/key.pem

I've tried the answer you suggested @goldylucks, however it seems that when the Webpack server starts it hijacks / overrides the rest of the script.

My workaround was to execute this script:

HTTPS=false start-server-and-test start:pwa http-get://localhost:3000 cy:run

from start-server-and-test.

finnmerlett avatar finnmerlett commented on August 31, 2024

Just chipping in to add that I was trying to run end-to-end tests on my Create React App on localhost with https enabled. Initially the server would start but then the test would not get triggered, but by adding the command START_SERVER_AND_TEST_INSECURE=1 before running start-server-and-test it worked perfectly.

from start-server-and-test.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.