Circle Ci - Start react server and test via cypress - cypress

I'm running cypress on a server started in cirleci script. Though cypress can't seam to find the local server that I just started. Here's my scripts / setup. I've also tried the cypress circlci-orb and get the same error, so was trying run things myself to help debug. Here's the script details:
- run:
name: 'Run app tests'
command: |
cd app
yarn install --frozen-lockfile
yarn lint
yarn cypress:ci
package.json script:
"cypress:ci": "CYPRESS_BASE_URL=http://localhost:3000 yarn start & wait-on http-get://localhost:3000 && cypress run"
Error:
$ craco start
ℹ 「wds」: Project is running at http://192.168.208.3/
ℹ 「wds」: webpack output is served from
ℹ 「wds」: Content not from webpack is served from /root/project/app/public
ℹ 「wds」: 404s will fallback to /
Starting the development server...
.....
react startup output
......
Cypress tests are kicked off and get the following error
We attempted to make an http request to this URL but the request failed without a response.
We received this error at the network level:
> Error: connect ECONNREFUSED 127.0.0.1:3000

The solution: Up your resource class! In your circleci/config.yml
jobs:
continuous-integration:
resource_class: large
It was non obvious as there were no memory/resource warnings, but according to the circle ci team:
When the machine runs out of memory processes are killed which could include the server.
That server was the cra-server i was trying to start. I upped the resource class and voilà it ran and was found by cypress! In our case we bumped it from a medium to a large class, but may be different for you.
Here's the available resource classes you can use:
https://circleci.com/product/features/resource-classes/

Related

Getting Quarkus working with podman-compose

I installed quarkus, but it is failing when trying to download resources. I installed podman, podman-compose, podman-docker and podman-remote.
It looks like podman-compose is not being called by 'docker compose'. Is there another package I need to install or configure on RHEL9 to use Quarkus?
% ./mvnw quarkus:dev
...
2023-01-31 09:27:25,288 INFO [🐳 .io/postgres:14]] (docker-java-stream--933788147) Starting to pull image
2023-01-31 09:27:55,287 ERROR [🐳 .io/postgres:14]] (testcontainers-pull-watchdog-1) Docker image pull has not made progress in 30s - aborting pull
docker.io had hit a timeout limit. Logging in cleared the limit and now the skeleton project works. It looks like maven is actually using podman compose correctly under the covers.

Browsershot not wroking on Laravel queue

I have an issue where as I am taking screenshots of responses using Browsershot which works fine when using dispatchSync. But as soon as I switch over to dispatch and use the queue (redis) the jobs fail with the following output;
Working directory: /var/www/html
Output:
================
Error Output:
================
Error: Failed to launch the browser process! spawn /usr/bin/chromium-browser ENOENT
I might also mention this is running through a Docker container.

Run TestCafe in Firefox browser using docker container via Jenkins

I want to run the TestCafe in firefox browser(not headless) through Jenkins.
I'm using docker container which has chromium and firefox installed.
When I try to run it firefox it's throwing an error as
ERROR Unable to establish one or more of the specified browser connections. This can be caused by network issues or remote device failure.
My Jenkins file looks like
steps
{
container('testcafe') {
sh 'npm install'
sh "npm run live-docker"
}
}
where live-docker is mentioned in package.json as "live-docker":"testcafe 'firefox --no-sandbox' e2e/user.spec.js -r xunit:TEST-new_user.xml”
I even tried using "live-docker":"testcafe firefox e2e/user.spec.js -r xunit:TEST-new_user.xml” but getting the same error.

Running nightwatch tests on a create-react-app on travis

I have an issue Running nightwatch tests on a create-react-app server (npm start) on travis. I'm starting the creat-react-app with
.travis.yml:
before_script:
- npm --prefix ./client start ./client &
script: npm run test-ci
however when nightwatch runs I am always getting
Starting the development server...
Starting selenium server... Warning: The 'no-use-before-declare' rule requires type information.
ts-loader: Using typescript#2.5.3 and /home/travis/build/client/tsconfig.json
started - PID: 4017
You can now view app in the browser.
Local: http://localhost:3000/
On Your Network: http://172.17.0.3:3000/
Note that the development build is not optimized.
To create a production build, use npm run build.
Error retrieving a new session from the selenium server
Connection refused! Is selenium server started?
{ Error: socket hang up
However the starting & running the nightwatch tests locally works perfect.
The issue was with Chrome, not a problem with react or Nightwatch.
https://github.com/travis-ci/travis-ci/issues/8836

Composer-Rest-Server not connecting

I am testing a a business network I created, I ran the Composer-rest-server and all worked fine, then shut the server as suggested in the developers guide , then I proceeded use the yo hyperledger composer to create the skeleton of the angular app, however, now the angular app is showing in the local browser, however, the composer-rest- server is not.
Expected Behavior:
I should start the composer-rest- server in localhost:3000 and the angular app as well
Actual Behavior:
I get this message;
scovering types from business network definition ...
Connection fails: Error: Error trying to ping. Error: Error trying to query chaincode. Error: Connect Failed
It will be retried for the next request.
Exception: Error: Error trying to ping. Error: Error trying to query chaincode. Error: Connect Failed
Error: Error trying to ping. Error: Error trying to query chaincode. Error: Connect Failed
at _checkRuntimeVersions.then.catch (/home/node/.nvm/versions/node/v6.11.2/lib/node_modules/composer-rest-server/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:696:34)
Your Environment
composer-cli#0.11.3
generator-hyperledger-composer#0.11.3
composer-rest-server#0.11.3
Docker version 17.06.0-ce, build 02c1d87
docker-compose version 1.13.0, build 1719ceb
The Problem
If you kill your fabric instance using ./stopFabric that you started using the ./startFabric command then all the containers that were apart of the business network were killed as well and therefore you need to reinstall the .bna and start the network again. (the development flow provided is purposely volatile for rapid development)
The Solution
1.) Type docker ps to see all of your running containers. You should see none if you are getting that error because your peer is not responding to pings
2.) Open a separate terminal and navigate to where you have fabric-dev-servers in the terminal and run ./fabricStart. This will start all the containers like your network Certificate Authority, the peer, the orderer, etc.
3.) Return to your project in another terminal. Do Step 1 & 2 found at the developer tutorial (you likely won't need to do step 3 since you likely already imported the network administrator identity going through the tutorial)
4.) Run composer network ping --card admin#tutorial-network. The ping should go through.
5.) Run docker ps. You should see 4 containers running
6.) Run composer-rest-server and follow the steps from the tutorial.
7.) Run cd tutorial-network-app to switch to where your angular application is (or wherever you generated it with the yo command)
8.) Navigate to http://localhost:3000 and everything should work.
Any other questions or problems just reply here and I can help.
The expected behaviour is that the REST server is already running (the the generator uses Loopback to spin up a REST server already (that's why you shut down the previous REST server)). Its described here https://hyperledger.github.io/composer/unstable/tutorials/developer-guide.html under 'Generate your Skeleton Web Application'.
After you created the application - following completion of the yo hyperledger-composer questions (and after providing the answers) you run your application using npm start from within the generated application directory. Your app is accessible at http://localhost:4200.

Resources