How can I use saucelabs connect with circle-ci 2.0? - node.js

In circle-ci 1.0 the config file seemed to specify dependencies. I noticed that in circle-ci 2.0 that this concept is gone to some degree.
Sooo I tried the following:
steps:
- checkout
- run:
name: Install Sauce Connect
command: |
wget https://saucelabs.com/downloads/sc-latest-linux.tar.gz
tar -xzf sc-latest-linux.tar.gz
...
- run: yarn integration
Seems like this didn't quite pan out. I get the following result in circle-ci's console:
#!/bin/bash -eo pipefail
yarn run integration
yarn run v0.24.6
$ node_modules/.bin/wdio test/wdio.conf.js
A service failed in the 'onPrepare' hook
Error: Could not start Sauce Connect. Exit code 1 signal: null
at ChildProcess.<anonymous> (/home/circleci/repo/node_modules/sauce-connect-launcher/lib/sauce-connect-launcher.js:559:12)
at emitTwo (events.js:125:13)
at ChildProcess.emit (events.js:213:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:197:12)
Continue...
ERROR: connect ECONNREFUSED 127.0.0.1:4445
chrome
Error
ERROR: connect ECONNREFUSED 127.0.0.1:4445
chrome
Error
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Exited with code 1
I'm using wdio, with the sauce and mocha plugins. It works locally. Ideas? Any guides that exist anywhere for this? Google didn't produce any answers for circle-ci 2.0 and saucelabs integrations.

Related

"vitest --ui" causing "Error: spawn xdg-open ENOENT"

I'm trying to check out Vitest's fancy UI server in my node docker container. But can't get it up and running. When running the npm script vitest --ui I get a node error spawn xdg-open ENOENT.
Here the full error message:
$ npm run test-ui
> wpvite#0.0.0 test-ui
> vitest --ui
DEV v0.23.4 /home/node/apps/main/frontend
UI started at http://localhost:51204/__vitest__/
node:events:491
throw er; // Unhandled 'error' event
^
Error: spawn xdg-open ENOENT
at ChildProcess._handle.onexit (node:internal/child_process:283:19)
at onErrorNT (node:internal/child_process:476:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
at ChildProcess._handle.onexit (node:internal/child_process:289:12)
at onErrorNT (node:internal/child_process:476:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn xdg-open',
path: 'xdg-open',
spawnargs: [ 'https://localhost:51204/__vitest__/' ]
}
Node.js v18.10.0
Google is no help at all - nothing related to Vitest even close. Also I'm obviously not a Node.js expert.
Even though the Node.js error message appears pretty cryptic to me, I still was lucky to use Ubuntu as my primary OS (beside macOS) which made me draw my attention to xdg-open in the error message - I occasionally use the command to open all kind of programs/apps on Ubuntu. Don't know why, but you need to have xdg-open installed on your system, to be able to run vitest --ui, even though it's neither mentioned in Vitest nor in Vite Github repos with a single word. Anyway for debian based containers it's:
apt install xdg-utils --fix-missing
Allthough this made the ENOENT error go away and the UI server starts up without errors, I still don't get to see the UI app due to some runtime-dom errors... I give it up. But maybe someone else finds the xdg-open info helpful.
UPDATE: It's working!
I just had to append /__vitest__/ to my proxied local url as clearly described in the docs:
"Then you can visit the Vitest UI at http://localhost:51204/__vitest__/"

Electron Builde errror on GitLab CI

On GitLab CI the electron build fails with: x509: certificate signed by unknown authority
Since we have set the env-var GIT_SSL_NO_VERIFY to true, this should not happen, right? GitLab Docs
Any idea how to fix this?
Relevant log output:
$ export GIT_SSL_NO_VERIFY=true
..
> nx run dmc-el:make
*********************************************************
DO NOT FORGET TO REBUILD YOUR FRONTEND & BACKEND PROJECTS
FOR PRODUCTION BEFORE PACKAGING / MAKING YOUR ARTIFACT!
*********************************************************
• electron-builder version=22.14.13 os=5.4.109+
• skipped dependencies rebuild reason=npmRebuild is set to false
• packaging platform=linux arch=x64 electron=18.3.4 appOutDir=dist/apps/dmc-executables/linux-unpacked
⨯ Get "https://github.com/electron/electron/releases/download/v18.3.4/electron-v18.3.4-linux-x64.zip": x509: certificate signed by unknown authority
github.com/develar/app-builder/pkg/download.(*Downloader).follow.func1
/Volumes/data/Documents/app-builder/pkg/download/downloader.go:206
github.com/develar/app-builder/pkg/download.(*Downloader).follow
/Volumes/data/Documents/app-builder/pkg/download/downloader.go:234
github.com/develar/app-builder/pkg/download.(*Downloader).DownloadNoRetry
/Volumes/data/Documents/app-builder/pkg/download/downloader.go:128
github.com/develar/app-builder/pkg/download.(*Downloader).Download
/Volumes/data/Documents/app-builder/pkg/download/downloader.go:112
github.com/develar/app-builder/pkg/electron.(*ElectronDownloader).doDownload
/Volumes/data/Documents/app-builder/pkg/electron/electronDownloader.go:192
github.com/develar/app-builder/pkg/electron.(*ElectronDownloader).Download
/Volumes/data/Documents/app-builder/pkg/electron/electronDownloader.go:177
github.com/develar/app-builder/pkg/electron.downloadElectron.func1.1
/Volumes/data/Documents/app-builder/pkg/electron/electronDownloader.go:73
github.com/develar/app-builder/pkg/util.MapAsyncConcurrency.func2
/Volumes/data/Documents/app-builder/pkg/util/async.go:68
runtime.goexit
/usr/local/Cellar/go/1.16.5/libexec/src/runtime/asm_amd64.s:1371
Error: /builds/daqmon/src/node_modules/app-builder-bin/linux/x64/app-builder exited with code ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
at ChildProcess.<anonymous> (/builds/daqmon/src/node_modules/builder-util/src/util.ts:250:14)
at Object.onceWrapper (node:events:642:26)
at ChildProcess.emit (node:events:527:28)
at maybeClose (node:internal/child_process:1092:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
Notes:
when we execute the same commands in a local docker container (same image as used by GitLab CI), it works
The error was not related to git, so GIT_SSL_NO_VERIFY was useless.
The error occurred when electron-builder tried to download some files from GitHub via https.
The solution is to update the CA certficates in the docker-container before executing electron-builder:
apt-get update && apt-get --yes install ca-certificates && update-ca-certificates
I guess that my local docker-container had newer certificates for some reason, than the GitLab CI docker-container.
Thanks Jonas V for the helpful comment!

Execution failed for task ':app:installDebug'. > com.android.builder.testing.api.DeviceException: No online devices found

When I normally running my react-native from visual code in Android Virtual Device (Emulator) via terminal with npx react-native run android, suddenly I'm facing this error
1. info Running jetifier to migrate libraries to AndroidX. You can
disable it using "--no-jetifier" flag. Jetifier found 954 file(s) to
forward-jetify. Using 8 workers... info Starting JS server... info
Launching emulator... error Failed to launch emulator. Reason: Could
not start emulator within 30 seconds.. warn Please launch an
emulator manually or connect a device. Otherwise app may fail to
launch. info Installing the app...
> Configure project :react-native-firebase_app :react-native-firebase_app package.json found at
C:\Users\admin\Desktop\TheOriginalsAgency\Stage-pre-emcauche\MilinusApp\node_modules\#react-native-firebase\app\package.json
:react-native-firebase_app:firebase.bom using default value: 28.1.0
:react-native-firebase_app:play.play-services-auth using default
value: 19.0.0 :react-native-firebase_app package.json found at
C:\Users\admin\Desktop\TheOriginalsAgency\Stage-pre-emcauche\MilinusApp\node_modules\#react-native-firebase\app\package.json
:react-native-firebase_app:version set from package.json: 12.1.0
(12,1,0 - 12001000) :react-native-firebase_app:android.compileSdk
using custom value: 29 :react-native-firebase_app:android.targetSdk
using custom value: 29 :react-native-firebase_app:android.minSdk
using custom value: 21
:react-native-firebase_app:reactNativeAndroidDir
C:\Users\admin\Desktop\TheOriginalsAgency\Stage-pre-emcauche\MilinusApp\node_modules\react-native\android
> Task :app:installDebug FAILED Skipping device 'emulator-5554' (emulator-5554): Device is OFFLINE. 64 actionable tasks: 2 executed,
62 up-to-date
FAILURE: Build failed with an exception.
* What went wrong: Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: No online devices found.
* Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 16s
error Failed to install the app. Make sure you have the Android
development environment set up:
https://reactnative.dev/docs/environment-setup. Error: Command
failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong: Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: No online devices found.
* Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 16s
at makeError (C:\Users\admin\Desktop\TheOriginalsAgency\Stage-pre-emcauche\MilinusApp\node_modules\execa\index.js:174:9)
at C:\Users\admin\Desktop\TheOriginalsAgency\Stage-pre-emcauche\MilinusApp\node_modules\execa\index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:94:5)
at async runOnAllDevices (C:\Users\admin\Desktop\TheOriginalsAgency\Stage-pre-emcauche\MilinusApp\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5)
at async Command.handleAction (C:\Users\admin\Desktop\TheOriginalsAgency\Stage-pre-emcauche\MilinusApp\node_modules\react-native\node_modules\#react-native-community\cli\build\index.js:186:9)
info Run CLI with --verbose flag for more details.
I don't know if you already fixed this but I just solved it!
I added more space to the Android Virtual Device.
You have to:
Edit the device or create a new one
On the ¨Verify Configuration¨ page, click on ¨Show Advanced Settings¨
Scroll down to ¨Memory and Storage¨
Change the Internal Storage MB amount
Initially the device that I've created had 2048MB and so I changed it to 6000MB but that wasn't enough so I finally put 10000MB of Internal Storage and with that amount I didn't get this error anymore.
Hope it works, good luck!

Error while executing an automated script from azure pipeline

We have a script which was written in Protractor using node.js and grunt.
We have built an azure pipeline to execute that automated script by fetching it from github. Please see the commands we have written in yml file.
pool:
vmImage: 'vs2017-win2016'
steps:
- task: NodeTool#0
inputs:
versionSpec: '8.x'
displayName: 'Install Node.js'
- script: |
node --version
npm install
npm install -g grunt-cli
npm install grunt-cli
npm install grunt --save-dev
displayName: 'npm install and run grunt'
- script: |
npm install webdriver-manager -g
npm install protractor -g
webdriver-manager update
webdriver-manager start
displayName: 'Webdriver install'
- task: CmdLine#2
inputs:
script: |
cd resources
grunt
Question1: The script executes in 5 mins whereas with azure pipeline it takes 15 to 20 mins to run. Is it really worth to install all packages everytime and execute script through azure.
Question2: the command webdriver-manager start is a mandatory step for execution of the script(This is to make the selenium hub up and running), but while running the yml file, this particular step is throwing error and gets skipped.
Please see the error below.
[12:36:53] I/launcher - Running 1 instances of WebDriver
2018-12-18T12:36:53.4831548Z [12:36:53] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
2018-12-18T12:36:54.2436510Z [12:36:54] E/launcher - Error code: 135
2018-12-18T12:36:54.2436720Z [12:36:54] E/launcher - Error message: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:4444
2018-12-18T12:36:54.2436826Z [12:36:54] E/launcher - Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:4444
2018-12-18T12:36:54.2441705Z [12:36:54] E/launcher - Process exited with error code 135
2018-12-18T12:36:54.2532843Z ‌>> ‌
2018-12-18T12:36:54.2537675Z ‌Warning: Tests failed, protractor exited with code: 135 Use --force to continue.‌
2018-12-18T12:36:54.2608988Z
2018-12-18T12:36:54.2609215Z ‌Aborted due to warnings.‌
2018-12-18T12:36:54.3660216Z ##[error]Cmd.exe exited with code '135'.
We have tried another way to execute the script, by hardcoding the selenium hub address in config.js (instead of localhost, ip address is provided) like this
seleniumAddress: 'http://<ipaddress>:4444/wd/hub',
but we see a different error as shown below.
2018-12-18T12:23:06.4867590Z ‌Running "protractor:e2e_tests" (protractor) task‌
2018-12-18T12:23:07.0061140Z I/launcher - Running 1 instances of WebDriver
2018-12-18T12:23:07.0061367Z I/hosted - Using the selenium server at http://:4444/wd/hub
2018-12-18T12:23:28.0555423Z E/launcher - ETIMEDOUT connect ETIMEDOUT :4444
2018-12-18T12:23:28.0556179Z E/launcher - Error: ETIMEDOUT connect ETIMEDOUT :4444
2018-12-18T12:23:28.0571368Z E/launcher - Process exited with error code 199
2018-12-18T12:23:28.0635055Z ‌>> ‌
2018-12-18T12:23:28.0635654Z ‌Warning: Tests failed, protractor exited with code: 199 Use --force to continue.‌
2018-12-18T12:23:28.0668847Z
2018-12-18T12:23:28.0688725Z ‌Aborted due to warnings.‌
2018-12-18T12:23:28.1695155Z ##[error]Cmd.exe exited with code '199'.
Any help will be highly appreciated. Thanks in advance!!

Sitespeed.io and graphite

I m actually trying to use sitespeed.io and graphite together and I m facing a problem.
In fact, I want to use this commande line :
sitespeed.io -u http://google.com -b firefox --graphiteHost http://127.0.0.1:3000 --graphiteNamespace sitespeed.io.newyork
and here's the error that I get :
error: Error getting versions: { [Error: Command failed: /home/skahrz/.nvm/v0.11.16/lib/node_modules/sitespeed.io/node_modules/phantomjs/lib/phantom/bin/phantomjs --version
/home/skahrz/.nvm/v0.11.16/lib/node_modules/sitespeed.io/node_modules/phantomjs/lib/phantom/bin/phantomjs: error while loading shared libraries: libfontconfig.so.1: cannot open shared object file: No such file or directory
]
killed: false,
code: 127,
signal: null,
cmd: '/home/skahrz/.nvm/v0.11.16/lib/node_modules/sitespeed.io/node_modules/phantomjs/lib/phantom/bin/phantomjs --version' }
error: Error: Command failed: /home/skahrz/.nvm/v0.11.16/lib/node_modules/sitespeed.io/node_modules/phantomjs/lib/phantom/bin/phantomjs --version
/home/skahrz/.nvm/v0.11.16/lib/node_modules/sitespeed.io/node_modules/phantomjs/lib/phantom/bin/phantomjs: error while loading shared libraries: libfontconfig.so.1: cannot open shared object file: No such file or directory
at ChildProcess.exithandler (child_process.js:744:12)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1008:16)
at Socket.<anonymous> (child_process.js:1176:11)
at Socket.emit (events.js:107:17)
at Pipe.close (net.js:476:12)
I dont know how to work through this and to well generate my sitespeed report.
Any ideas ?
If graphite is running on same host or different host doesnt matter- but carbon will be listening on 2003 and not 3000... 3000 is grafana default port.
you cannot pass the port like a normal url... if u want to pass graphite port to sitespeed... use --graphitePort 2003 or wherever your carbon is listening.

Resources