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

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

Related

Running cypress tests in docker image cypress/base:17.3.0 gives error ''CertVerifyProcBuiltin for ws14.hotjar.com failed'

I am running my tests with this docker image cypress/base:17.3.0. I got plenty of this kind of error even if the tests are passing... Any idea in order to fix them?
[33:0614/080128.399356:ERROR:cert_verify_proc_builtin.cc(681)] CertVerifyProcBuiltin for ws14.hotjar.com failed:
----- Certificate i=0 (OU=Cypress Proxy Server Certificate,O=Cypress Proxy CA,L=Internet,ST=Internet,C=Internet,CN=ws14.hotjar.com) -----
ERROR: No matching issuer found
Seems to be an electron headless browser issue.
Try setting your headless browser to chrome.
cypress run --headless --browser chrome

Circle Ci - Start react server and test via 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/

Issue while running npm run sonar

I am using sonar for analysis of nodejs code but when I run npm run sonar I get this error
Error occurred during initialization of VM
Failure when starting JFR on_vm_start
when when I run the command with my root user it works fine.What could be the reason for same?

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.

Composer script to start a background process, whose lifetime is bound to that of the Composer script

I've started experimenting with Composer Scripts.
I have a project where there are "Functional tests" of the API endpoints. Running the whole test suite requires running the following commands in order:
composer install to install all required dependencies of the backend APIs
php yii server --test to start a lite server that is connected to the "test" MySQL database. The test server starts running on localhost:9000.
sh vendor/bin/phpunit --configuration tests/functional/phpunit.xml to run th actual tests. This last command triggers the execution of all test cases, most of which execute HTTP calls to the lite server, launched at step 2.
I would like to automate and "atomize" this 3 step process into a single Composer script that can be easily started, killed and restarted effortlessly.
Here's my current progress:
"scripts": {
"test-functional": [
"#composer install",
"php yii server --test",
"sh vendor/bin/phpunit --configuration tests/functional/phpunit.xml"
]
}
The problem is that the 2-nd command (php yii server --test) "steals" the terminal because PHPs built-in lite server requires the terminal to be open while the command is running. Killing the command kills the lite server as well. I tried suffixing the second step of the script with & which generally makes processes go in the background and not steal the terminal, but it seems this trick doesn't work for Composer Scripts. Any other workaround or possibility that I'm missing?
My final goal is to make the 3 steps execute in an atomic way, output the results of the tests and end the command, cleaning up everything (including killing the lite server, launched in step 2).

Resources