WebdriverIO test passed locally via vscode debugger, but wont passes in GitLab CI.   
Tags: node, help, testing
Published: 2020-12-23 11:20:10

FYI (the 2 images illustrates both scenarios when running the same test, locally & when in GitLab):

$  /usr/bin/env CI=true 'NODE_OPTIONS=--require "c:/Program Files/Microsoft VS Code/resources/app/extensions/ms-vscode.js-debug/src/bootloader.bundle.js" --inspect-publish-uid=http' 'VSCODE_INSPECTOR_OPTIONS={"inspectorIpc":"\\\\.\\pipe\\node-cdp.18868-17.sock","deferredMode":false,"waitForDebugger":"","execPath":"C:\\Program Files\\nodejs\\node.exe","onlyEntrypoint":false,"autoAttachMode":"always","fileCallback":"C:\\Users\\ISMAIL~1\\AppData\\Local\\Temp\\node-debug-callback-168bf9d0ea5ce47d"}' C:\\Users\\ismailalabou\\Documents\\Gitlab\\deploy-react-app-to-heroku-via-gitlab-ci-test-with-webdriverio/node_modules/Debugger attached.
Debugger attached.
 PASS  src/App.test.js (41.716s)
  √ renders learn react link (279ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        52.98s
Ran all test suites.
Waiting for the debugger to disconnect...
Waiting for the debugger to disconnect...

------------------------------------------------------------------
[chrome 87.0.4280.88 Linux #0-0] Spec: /builds/heroku-gang/deploy-react-app-to-heroku-via-gitlab-ci-test-with-webdriverio/test/app.test.js
[chrome 87.0.4280.88 Linux #0-0] Running: chrome (v87.0.4280.88) on Linux
[chrome 87.0.4280.88 Linux #0-0] Session ID: 5cdb3b153de8afab8819cb956acaf095
[chrome 87.0.4280.88 Linux #0-0]
[chrome 87.0.4280.88 Linux #0-0] React application home page
[chrome 87.0.4280.88 Linux #0-0]    ✖ Verify that the app link says Learn React
[chrome 87.0.4280.88 Linux #0-0]
[chrome 87.0.4280.88 Linux #0-0] 1 failing (14.6s)
[chrome 87.0.4280.88 Linux #0-0]
[chrome 87.0.4280.88 Linux #0-0] 1) React application home page Verify that the app link says Learn React
[chrome 87.0.4280.88 Linux #0-0] $(...).getText is not a function
[chrome 87.0.4280.88 Linux #0-0] TypeError: $(...).getText is not a function
[chrome 87.0.4280.88 Linux #0-0]     at Context.<anonymous> (/builds/heroku-gang/deploy-react-app-to-heroku-via-gitlab-ci-test-with-webdriverio/test/app.test.js:4:35)
[chrome 87.0.4280.88 Linux #0-0]     at Context.executeAsync (/builds/heroku-gang/deploy-react-app-to-heroku-via-gitlab-ci-test-with-webdriverio/node_modules/@wdio/utils/build/shim.js:123:21)
[chrome 87.0.4280.88 Linux #0-0]     at Context.testFrameworkFnWrapper (/builds/heroku-gang/deploy-react-app-to-heroku-via-gitlab-ci-test-with-webdriverio/node_modules/@wdio/utils/build/test-framework/testFnWrapper.js:49:28)
Spec Files:	 0 passed, 1 failed, 1 total (100% completed) in 00:00:19 
2020-12-22T18:07:52.477Z INFO @wdio/local-runner: Shutting down spawned worker
2020-12-22T18:07:52.728Z INFO @wdio/local-runner: Waiting for 0 to shut down gracefully
2020-12-22T18:07:52.729Z INFO @wdio/local-runner: shutting down
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-webdriverio-gitlab-ci-cd@0.1.0 wdioTest: `node ./node_modules/.bin/wdio ./wdio.conf.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the react-webdriverio-gitlab-ci-cd@0.1.0 wdioTest script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /tmp/.npm/_logs/2020-12-22T18_07_52_750Z-debug.log

-----------------------------------------------------------------
I don't know how to fix this #helpNeeded