Jenkins CI E2E test process failing with code 127, then 199 (or 135) - selenium

Initial disclaimer - I'm very new to Jenkins so I don't really get much about it yet. Baby steps would be appreciated very muchly.
I'm in the process of trying to set up a Jenkins job to run through a series of end to end tests I've written for my web app in a headless version of Chrome, as I have witnessed and read that PhantomJS is rather unreliable. I can get them to run absolutely fine locally on my machine, but when I try to run it on Jenkins I get it come back with the below:
The error log
[13:25:24] I/file_manager - creating folder /var/jenkins/workspace/Web_App_feature_e2e-chrome-YUH5PYKKXHHXSQT3HLIZ74DQIBAH3D5D6WZCOLDVI2LYG4RGOVBQ/node_modules/protractor/node_modules/webdriver-manager/selenium
[13:25:24] I/update - chromedriver: unzipping chromedriver_2.30.zip
[13:25:24] I/update - chromedriver: setting permissions to 0755 for /var/jenkins/workspace/Web_App_feature_e2e-chrome-YUH5PYKKXHHXSQT3HLIZ74DQIBAH3D5D6WZCOLDVI2LYG4RGOVBQ/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.30
[13:25:24] I/launcher - Running 1 instances of WebDriver
[13:25:24] I/direct - Using ChromeDriver directly...
[13:25:25] E/launcher - Server terminated early with status 127
[13:25:25] E/launcher - Error: Server terminated early with status 127
at earlyTermination.catch.e (/var/jenkins/workspace/Web_App_feature_e2e-chrome-YUH5PYKKXHHXSQT3HLIZ74DQIBAH3D5D6WZCOLDVI2LYG4RGOVBQ/node_modules/selenium-webdriver/remote/index.js:252:52)
at process._tickCallback (internal/process/next_tick.js:103:7)
From: Task: WebDriver.createSession()
at Function.createSession (/var/jenkins/workspace/Web_App_feature_e2e-chrome-YUH5PYKKXHHXSQT3HLIZ74DQIBAH3D5D6WZCOLDVI2LYG4RGOVBQ/node_modules/selenium-webdriver/lib/webdriver.js:777:24)
at Function.createSession (/var/jenkins/workspace/Web_App_feature_e2e-chrome-YUH5PYKKXHHXSQT3HLIZ74DQIBAH3D5D6WZCOLDVI2LYG4RGOVBQ/node_modules/selenium-webdriver/chrome.js:709:29)
at Direct.getNewDriver (/var/jenkins/workspace/Web_App_feature_e2e-chrome-YUH5PYKKXHHXSQT3HLIZ74DQIBAH3D5D6WZCOLDVI2LYG4RGOVBQ/node_modules/protractor/lib/driverProviders/direct.ts:90:25)
at Runner.createBrowser (/var/jenkins/workspace/Web_App_feature_e2e-chrome-YUH5PYKKXHHXSQT3HLIZ74DQIBAH3D5D6WZCOLDVI2LYG4RGOVBQ/node_modules/protractor/lib/runner.ts:225:39)
at q.then.then (/var/jenkins/workspace/Web_App_feature_e2e-chrome-YUH5PYKKXHHXSQT3HLIZ74DQIBAH3D5D6WZCOLDVI2LYG4RGOVBQ/node_modules/protractor/lib/runner.ts:391:27)
at _fulfilled (/var/jenkins/workspace/Web_App_feature_e2e-chrome-YUH5PYKKXHHXSQT3HLIZ74DQIBAH3D5D6WZCOLDVI2LYG4RGOVBQ/node_modules/protractor/node_modules/q/q.js:834:54)
at self.promiseDispatch.done (/var/jenkins/workspace/Web_App_feature_e2e-chrome-YUH5PYKKXHHXSQT3HLIZ74DQIBAH3D5D6WZCOLDVI2LYG4RGOVBQ/node_modules/protractor/node_modules/q/q.js:863:30)
at Promise.promise.promiseDispatch (/var/jenkins/workspace/Web_App_feature_e2e-chrome-YUH5PYKKXHHXSQT3HLIZ74DQIBAH3D5D6WZCOLDVI2LYG4RGOVBQ/node_modules/protractor/node_modules/q/q.js:796:13)
at /var/jenkins/workspace/Web_App_feature_e2e-chrome-YUH5PYKKXHHXSQT3HLIZ74DQIBAH3D5D6WZCOLDVI2LYG4RGOVBQ/node_modules/protractor/node_modules/q/q.js:556:49
at runSingle (/var/jenkins/workspace/Web_App_feature_e2e-chrome-YUH5PYKKXHHXSQT3HLIZ74DQIBAH3D5D6WZCOLDVI2LYG4RGOVBQ/node_modules/protractor/node_modules/q/q.js:137:13)
at flush (/var/jenkins/workspace/Web_App_feature_e2e-chrome-YUH5PYKKXHHXSQT3HLIZ74DQIBAH3D5D6WZCOLDVI2LYG4RGOVBQ/node_modules/protractor/node_modules/q/q.js:125:13)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
[13:25:25] E/launcher - Process exited with error code 199
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
[Bitbucket] Notifying commit build result
[Bitbucket] Build result notified
ERROR: script returned exit code 199
Finished: FAILURE
I've been stumbling around in the dark with these for a day or so now and have tried almost 100 different combinations of what the internet says should fix it, but to no avail..
My Jenkinsfile
properties([[$class: 'jenkins.model.BuildDiscarderProperty',
strategy: [$class: 'LogRotator', numToKeepStr: '30', artifactNumToKeepStr: '1']]])
node('web-app-build') {
try {
stage('Clean workspace') {
deleteDir()
}
stage('Install NodeJS and NPM') {
def nodeHome = tool name: 'NodeJS 7.2.0', type: 'jenkins.plugins.nodejs.tools.NodeJSInstallation'
env.PATH = "${nodeHome}/bin:${env.PATH}"
}
stage('Checkout') {
checkout scm
}
stage('Install Dependencies') {
sh "npm install --silent"
sh "npm install -g #angular/cli#latest"
sh "ng set --global warnings.versionMismatch=false"
sh "npm install protractor -g"
}
stage('Run E2E tests') {
sh "webdriver-manager update --versions.chrome=2.30 --gecko=false"
sh "ng e2e"
}
stage('Publish Reports') {
publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: 'coverage', reportFiles: 'index.html', reportName: 'HTML Report'])
step([$class: 'JUnitResultArchiver', testResults: '**/junit/junit.xml'])
step([
$class: 'CloverPublisher',
cloverReportDir: 'coverage',
cloverReportFileName: 'clover.xml',
healthyTarget: [methodCoverage: 70, conditionalCoverage: 80, statementCoverage: 80],
unhealthyTarget: [methodCoverage: 50, conditionalCoverage: 50, statementCoverage: 50],
failingTarget: [methodCoverage: 0, conditionalCoverage: 0, statementCoverage: 0]
])
}
if (env.BRANCH_NAME == 'develop') {
stage('Create env=staging build ready for S3') {
sh "ng build --env=staging --output-hashing=all"
}
stage('Deploy Build to S3 -----------------') {
env.AWS_ACCESS_KEY_ID = '------------------------'
env.AWS_SECRET_ACCESS_KEY = '------------------------'
sh "npm install s3-deploy -g"
sh "s3-deploy 'dist/**' --cwd './dist' --region 'us-west-2' --bucket '-----------------' --cache 60 --etag"
}
stage('Create env=ci build ready for S3') {
sh "ng build --env=ci --output-hashing=all"
}
stage('Deploy Build to S3 ---------------') {
env.AWS_ACCESS_KEY_ID = '--------------------'
env.AWS_SECRET_ACCESS_KEY = '---------------------'
sh "npm install s3-deploy -g"
sh "s3-deploy 'dist/**' --cwd './dist' --region 'us-west-2' --bucket '-----------------------' --cache 60 --etag"
}
stage('Create env=e2e build ready for S3 ------------------') {
sh "ng build --env=e2e --output-hashing=all"
}
stage('Deploy Build to S3 ------------------') {
env.AWS_ACCESS_KEY_ID = '-----------------------'
env.AWS_SECRET_ACCESS_KEY = '--------------------------'
sh "npm install s3-deploy -g"
sh "s3-deploy 'dist/**' --cwd './dist' --region 'us-west-2' --bucket '-------------------------' --cache 60 --etag"
}
stage('Run "Web App e2e" Tests') {
build job: '../Web App e2e', wait: false
}
}
} catch (e) {
throw e
}
}
protractor.conf.js
/*global jasmine */
var SpecReporter = require('jasmine-spec-reporter').SpecReporter;
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./e2e/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome',
'chromeOptions': {
args: ['--headless', 'no-sandbox', '--disable-gpu', '--window-size=800x600']
}
},
directConnect: true,
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function () {
}
},
useAllAngular2AppRoots: true,
beforeLaunch: function () {
require('ts-node').register({
project: 'e2e'
});
},
onPrepare: function () {
jasmine.getEnv().addReporter(new SpecReporter());
}
};
If someone could explain why this is happening, and how to stop it from doing so, that would be much appreciated.
Thanks in advance!
EDIT
This is the output when I don't connect directly
[15:03:50] I/file_manager - creating folder /var/jenkins/workspace/Web_App_feature_e2e-chrome-YUH5PYKKXHHXSQT3HLIZ74DQIBAH3D5D6WZCOLDVI2LYG4RGOVBQ/node_modules/protractor/node_modules/webdriver-manager/selenium
[15:03:51] I/update - chromedriver: unzipping chromedriver_2.30.zip
[15:03:51] I/update - chromedriver: setting permissions to 0755 for /var/jenkins/workspace/Web_App_feature_e2e-chrome-YUH5PYKKXHHXSQT3HLIZ74DQIBAH3D5D6WZCOLDVI2LYG4RGOVBQ/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.30
[15:03:51] I/launcher - Running 1 instances of WebDriver
[15:03:51] E/local - Error code: 135
[15:03:51] E/local - Error message: No update-config.json found. Run 'webdriver-manager update' to download binaries.
[15:03:51] E/local - Error: No update-config.json found. Run 'webdriver-manager update' to download binaries.
at Local.addDefaultBinaryLocs_ (/var/jenkins/workspace/Web_App_feature_e2e-chrome-YUH5PYKKXHHXSQT3HLIZ74DQIBAH3D5D6WZCOLDVI2LYG4RGOVBQ/node_modules/protractor/lib/driverProviders/local.ts:47:15)
at Local.setupDriverEnv (/var/jenkins/workspace/Web_App_feature_e2e-chrome-YUH5PYKKXHHXSQT3HLIZ74DQIBAH3D5D6WZCOLDVI2LYG4RGOVBQ/node_modules/protractor/lib/driverProviders/local.ts:98:10)
at Local.setupEnv (/var/jenkins/workspace/Web_App_feature_e2e-chrome-YUH5PYKKXHHXSQT3HLIZ74DQIBAH3D5D6WZCOLDVI2LYG4RGOVBQ/node_modules/protractor/lib/driverProviders/driverProvider.ts:124:30)
at q.then (/var/jenkins/workspace/Web_App_feature_e2e-chrome-YUH5PYKKXHHXSQT3HLIZ74DQIBAH3D5D6WZCOLDVI2LYG4RGOVBQ/node_modules/protractor/lib/runner.ts:387:39)
at _fulfilled (/var/jenkins/workspace/Web_App_feature_e2e-chrome-YUH5PYKKXHHXSQT3HLIZ74DQIBAH3D5D6WZCOLDVI2LYG4RGOVBQ/node_modules/protractor/node_modules/q/q.js:834:54)
at self.promiseDispatch.done (/var/jenkins/workspace/Web_App_feature_e2e-chrome-YUH5PYKKXHHXSQT3HLIZ74DQIBAH3D5D6WZCOLDVI2LYG4RGOVBQ/node_modules/protractor/node_modules/q/q.js:863:30)
at Promise.promise.promiseDispatch (/var/jenkins/workspace/Web_App_feature_e2e-chrome-YUH5PYKKXHHXSQT3HLIZ74DQIBAH3D5D6WZCOLDVI2LYG4RGOVBQ/node_modules/protractor/node_modules/q/q.js:796:13)
at /var/jenkins/workspace/Web_App_feature_e2e-chrome-YUH5PYKKXHHXSQT3HLIZ74DQIBAH3D5D6WZCOLDVI2LYG4RGOVBQ/node_modules/protractor/node_modules/q/q.js:857:14
at runSingle (/var/jenkins/workspace/Web_App_feature_e2e-chrome-YUH5PYKKXHHXSQT3HLIZ74DQIBAH3D5D6WZCOLDVI2LYG4RGOVBQ/node_modules/protractor/node_modules/q/q.js:137:13)
at flush (/var/jenkins/workspace/Web_App_feature_e2e-chrome-YUH5PYKKXHHXSQT3HLIZ74DQIBAH3D5D6WZCOLDVI2LYG4RGOVBQ/node_modules/protractor/node_modules/q/q.js:125:13)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
[15:03:51] E/launcher - Process exited with error code 135
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
[Bitbucket] Notifying commit build result
[Bitbucket] Build result notified
ERROR: script returned exit code 135
Finished: FAILURE

Related

Generation Allure Reporter

I have the following Jenkins Pipline
node('api50analysis') {
def err = null
currentBuild.result = "SUCCESS"
try {
dir ('/var/www/TMS/tests') {
stage 'Delete old report'
sh 'rm -Rf ./allure-report'
sh 'rm -Rf ./allure-results'
stage 'Get AutoTest from git'
git credentialsId: '9d6d49c0-9e6c-4e81-8893-cb5993b6fd83', url: '$git_url_test', branch: '$branch_test'
stage 'Install dependencies'
sh 'sudo chown -R $(whoami) /var/www/TMS/tests'
sh 'npm install'
stage 'WEB tests as admin'
sh 'npm run clearDB'
sh 'npx wdio run wdio.conf.ts --suite adminSuites'
sh 'npm run clearDB'
sh 'npx wdio run wdio.conf.ts --suite aidLimit'
sh 'npm run clearDB'
sh 'npx wdio run wdio.conf.ts --suite limit'
sh 'npm run clearDB'
sh 'npx wdio run wdio.conf.ts --suite configuration'
sh 'npm run clearDB'
sh 'npx wdio run wdio.conf.ts --suite merchant'
sh 'npx wdio run wdio.conf.ts --suite terminal'
sh 'npx wdio run wdio.conf.ts --suite deviceType'
sh 'npm run clearDB'
sh 'npx wdio run wdio.conf.ts --suite device'
sh 'npm run clearDB'
}
}
catch (caughtError) {
err = caughtError
currentBuild.result = "FAILURE"
build job: 'telegram_job',
parameters: [string(name: 'msg',
value: "----------\n"+
"Job name: ${JOB_NAME}\n"+
"Status: $currentBuild.result\n"+
"Build number: ${BUILD_NUMBER}\n"+
"Build URL ${BUILD_URL}\n"+
"----------")]
} finally {
stage 'Allure'
script {allure([
includeProperties: false,
jdk: '',
properties: [],
reportBuildPolicy: 'ALWAYS',
results: [[path: 'target/allure-results']]
])}
if (err) {
throw err
}
}
}
The Allure report is always generated, however, if at least one test has failed, it generates an empty report, instead of generating it with data on which tests passed, which tests failed and attach a screenshot to the place where the test fell (configured in the Webdriver IO config )
What could be the problem? The server where autotests run is managed by CentOS 7 enter image description here. Here is an example of a report when all tests pass enter image description here
In the console in this case
[Pipeline] stage (Allure)
Using the ‘stage’ step without a block argument is deprecated
Entering stage Allure
Proceeding
[Pipeline] script
[Pipeline] {
[Pipeline] allure
[TMS_AUTOTEST] $ /opt/jenkins/tools/ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation/Allure/bin/allure generate -c -o /opt/jenkins/workspace/TMS_AUTOTEST/allure-report
allure-results does not exist
Report successfully generated to /opt/jenkins/workspace/TMS_AUTOTEST/allure-report
Allure report was successfully generated.
Creating artifact for the build.
Artifact was added to the build.
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 3
Finished: FAILURE

CoreUi - why nightwatch cannot run e2e tests?

I want to start working with CoreUi Admin template and create project containing unit and e2e testing.
In the begining, I install CoreUi like shown in documentation:
git clone https://github.com/coreui/coreui-free-vue-admin-template.git CoreUI-Vue
cd CoreUI-Vue
npm install
Everything is ok. Now I want to run whole unit and e2e tests:
npm run test:unit
npm run test:e2e
All unit tests run properly. But when I run e2e test I got the following errors:
> #coreui/coreui-free-vue-admin-template#3.1.4 test:e2e
> vue-cli-service test:e2e
INFO Starting development server...
[BABEL] Note: The code generator has deoptimised the styling of /home/bagsiur/Projects/B2B/test-coreui/CoreUI-Vue/node_modules/#coreui/vue/dist/coreui-vue.common.js as it exceeds the max of 500KB.
WARNING Compiled with 2 warnings 2:47:38 PM
warning
asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
css/app.10fee0d6.css (383 KiB) js/chunk-28d6db65.e7636129.js (488 KiB)
js/chunk-2d0a400c.650c6f3a.js (3.37 MiB) js/chunk-2d0ae5e6.22010046.js (390 KiB)
js/chunk-2d237b34.468fc7b7.js (1.36 MiB)
js/chunk-vendors.03b8fe62.js (687 KiB)
warning
entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
app (1.07 MiB)
js/chunk-vendors.03b8fe62.js
css/app.10fee0d6.css
js/app.94002fbe.js
App running at:
- Local: http://localhost:8080/
- Network: http://172.31.33.121:8080/
App is served in production mode.
Note this is for preview or E2E testing only.
INFO Running end-to-end tests ...
[Test] Test Suite
=================
⚠ Error connecting to localhost on port 9515.
_________________________________________________
TEST FAILURE: 1 error during execution; 0 tests failed, 0 passed (348ms)
✖ test
An error occurred while retrieving a new session: "unknown error: Chrome failed to start: exited abnormally."
Error: An error occurred while retrieving a new session: "unknown error: Chrome failed to start: exited abnormally."
at endReadableNT (_stream_readable.js:1201:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Error: An error occurred while retrieving a new session: "unknown error: Chrome failed to start: exited abnormally." at endReadableNT (_stream_readable.js:1201:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
SKIPPED:
- CoreUI Vue e2e tests
ERROR Error: Command failed: /home/bagsiur/Projects/B2B/test-coreui/CoreUI-Vue/node_modules/nightwatch/bin/nightwatch --config /home/bagsiur/Projects/B2B/test-coreui/CoreUI-Vue/node_modules/#vue/cli-plugin-e2e-nightwatch/nightwatch.config.js --env chrome
Error: Command failed: /home/bagsiur/Projects/B2B/test-coreui/CoreUI-Vue/node_modules/nightwatch/bin/nightwatch --config /home/bagsiur/Projects/B2B/test-coreui/CoreUI-Vue/node_modules/#vue/cli-plugin-e2e-nightwatch/nightwatch.config.js --env chrome
at makeError (/home/bagsiur/Projects/B2B/test-coreui/CoreUI-Vue/node_modules/execa/index.js:174:9)
at /home/bagsiur/Projects/B2B/test-coreui/CoreUI-Vue/node_modules/execa/index.js:278:16
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
bagsiur#DESKTOP-718MBR1:~/Projects/B2B/test-coreui/CoreUI-Vue$
bagsiur#DESKTOP-718MBR1:~/Projects/B2B/test-coreui/CoreUI-Vue$ npm run test:e2e
> #coreui/coreui-free-vue-admin-template#3.1.4 test:e2e
> vue-cli-service test:e2e
INFO Starting development server...
WARNING Compiled with 2 warnings 3:06:39 PM
warning
asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
css/app.10fee0d6.css (383 KiB)
js/chunk-28d6db65.e7636129.js (488 KiB)
js/chunk-2d0a400c.650c6f3a.js (3.37 MiB)
js/chunk-2d0ae5e6.22010046.js (390 KiB)
js/chunk-2d237b34.468fc7b7.js (1.36 MiB)
js/chunk-vendors.03b8fe62.js (687 KiB)
warning
entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
app (1.07 MiB)
js/chunk-vendors.03b8fe62.js
css/app.10fee0d6.css
js/app.94002fbe.js
App running at:
- Local: http://localhost:8080/
- Network: http://172.31.33.121:8080/
App is served in production mode.
Note this is for preview or E2E testing only.
INFO Running end-to-end tests ...
[Test] Test Suite
=================
⚠ Error connecting to localhost on port 9515.
_________________________________________________
TEST FAILURE: 1 error during execution; 0 tests failed, 0 passed (348ms)
✖ test
An error occurred while retrieving a new session: "unknown error: Chrome failed to start: exited abnormally."
Error: An error occurred while retrieving a new session: "unknown error: Chrome failed to start: exited abnormally."
at endReadableNT (_stream_readable.js:1201:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Error: An error occurred while retrieving a new session: "unknown error: Chrome failed to start: exited abnormally." at endReadableNT (_stream_readable.js:1201:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
SKIPPED:
- CoreUI Vue e2e tests
ERROR Error: Command failed: /home/bagsiur/Projects/B2B/test-coreui/CoreUI-Vue/node_modules/nightwatch/bin/nightwatch --config /home/bagsiur/Projects/B2B/test-coreui/CoreUI-Vue/node_modules/#vue/cli-plugin-e2e-nightwatch/nightwatch.config.js --env chrome
Error: Command failed: /home/bagsiur/Projects/B2B/test-coreui/CoreUI-Vue/node_modules/nightwatch/bin/nightwatch --config /home/bagsiur/Projects/B2B/test-coreui/CoreUI-Vue/node_modules/#vue/cli-plugin-e2e-nightwatch/nightwatch.config.js --env chrome
at makeError (/home/bagsiur/Projects/B2B/test-coreui/CoreUI-Vue/node_modules/execa/index.js:174:9)
at /home/bagsiur/Projects/B2B/test-coreui/CoreUI-Vue/node_modules/execa/index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:97:5)
I work on wsl2 and Debian. My node.js version is v13.14.0 and npm is 7.12.1. I installed chromedriver in version: ChromeDriver 2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706) and last stable google chrome: google-chrome-stable 90.0.4430.212-1
What do I miss? Where could be the cause of the error in running e2e tests?
#UPDATE: I put the configuration of Nightwatch.conf.json:
// http://nightwatchjs.org/gettingstarted#settings-file
const path = require('path')
const deepmerge = require('deepmerge')
const chromedriver = require('chromedriver')
// user may have not installed geckodriver
let geckodriver = {}
try {
geckodriver = require('geckodriver')
} catch (e) {}
const userOptions = JSON.parse(process.env.VUE_NIGHTWATCH_USER_OPTIONS || '{}')
const useSelenium = process.env.VUE_NIGHTWATCH_USE_SELENIUM === '1'
const startHeadless = process.env.VUE_NIGHTWATCH_HEADLESS === '1'
const concurrentMode = process.env.VUE_NIGHTWATCH_CONCURRENT === '1'
const chromeArgs = []
const geckoArgs = []
if (startHeadless) {
chromeArgs.push('headless')
geckoArgs.push('--headless')
}
const defaultSettings = {
src_folders: ['tests/e2e/specs'],
output_folder: 'tests/e2e/reports',
page_objects_path: 'tests/e2e/page-objects',
custom_assertions_path: 'tests/e2e/custom-assertions',
custom_commands_path: 'tests/e2e/custom-commands',
globals_path: path.resolve('tests/e2e/globals.js'),
test_workers: concurrentMode,
test_settings: {
default: {
detailed_output: !concurrentMode,
launch_url: '${VUE_DEV_SERVER_URL}'
},
chrome: {
desiredCapabilities: {
browserName: 'chrome',
chromeOptions: {
w3c: false,
args: chromeArgs
}
}
},
firefox: {
desiredCapabilities: {
browserName: 'firefox',
alwaysMatch: {
acceptInsecureCerts: true,
'moz:firefoxOptions': {
args: geckoArgs
}
}
},
webdriver: useSelenium ? {} : {
server_path: geckodriver.path,
port: 4444
}
}
}
}
const baseSettings = deepmerge(defaultSettings, webdriverServerSettings())
module.exports = deepmerge(baseSettings, adaptUserSettings(userOptions))
function adaptUserSettings (settings) {
// The path to nightwatch external globals file needs to be made absolute
// if it is supplied in an additional config file, due to merging of config files
if (settings.globals_path) {
settings.globals_path = path.resolve(settings.globals_path)
}
return settings
}
function webdriverServerSettings () {
if (useSelenium) {
return {
selenium: {
start_process: true,
host: '127.0.0.1',
port: 4444,
server_path: require('selenium-server').path,
cli_args: {
'webdriver.chrome.driver': chromedriver.path,
'webdriver.gecko.driver': geckodriver.path
}
}
}
}
return {
webdriver: {
start_process: true,
port: 9515,
server_path: chromedriver.path
}
}
}
Version mismatch of chromedriver and chrome is the most common reason of e2e failing like this.
ChromeDriver 2.41 supports Chrome v67-69
your google-chrome-stable 90.0.4430 needs ChromeDriver 90.0.4430

Nuxt taking more than 1 hours to Build

I'm building a Nuxt application. I've done some research but found no definitive solution.
Step 6/8 : EXPOSE 8080
---> Running in e5d36d6e86fe
Removing intermediate container e5d36d6e86fe
---> f655ef5cccc2
Step 7/8 : RUN npm run build
---> Running in f6445150af4c
> nuxt build
ℹ Production build
ℹ Bundling for server and client side
ℹ Target: server
ℹ Using components loader to optimize imports
ℹ Discovered Components: .nuxt/components/readme.md
✔ Builder initialized
✔ Nuxt files generated
ℹ Warming up worker pools
✔ Worker pools ready
ℹ Compiling Client
✔ Client: Compiled successfully in 1.00h
ℹ Compiling Server
✔ Server: Compiled successfully in 1.81m
Update Config
There are several experimental ways of improving build speed.
https://nuxtjs.org/api/configuration-build#parallel
https://nuxtjs.org/api/configuration-build#cache
https://nuxtjs.org/api/configuration-build#hardsource
build: {
// standalone: true,
analyze: false,
parallel: true,
cache: true,
hardSource: false,
splitChunks: {
layouts: false,
pages: false,
components: false,
},
html: {
minify: {
minifyCSS: false,
minifyJS: false
}
},
loaders: {
vue: {
prettify: false
}
},
transpile: ["#coreui/vue", "#coreui/utils", "#ag-grid-community/vue"],
extend(config, ctx) {
if (ctx.isDev) {
config.devtool = ctx.isClient ? "source-map" : "inline-source-map";
}
}
}
Dockerfile
FROM node:14
COPY package*.json ./tmp/
RUN cd /tmp && npm install
RUN mkdir -p /usr/src/app && cp -a /tmp/node_modules /usr/src/app
WORKDIR /usr/src/app
COPY . .
#COPY package*.json ./
#RUN npm install
EXPOSE 8080
RUN npm run build
# RUN npm run generate
CMD [ "npm", "run", "start" ]

Webdriver instances not created for custom protractor.conf file

I want to integrate my E2E suite in Travis, so I followed this article. As mentioned in the article I've created a custom protractor.ci.conf.js file of the Travis build. I've placed this file inside my e2e folder (path: e2e/protractor.ci.conf.js).
The only difference in my custom e2e/protractor.ci.conf.js and angular generated protractor.conf.js files is the value in args property displayed below.
e2e/protractor.ci.conf.js
chromeOptions: {
args: [
'--headless',
'window-size=1920,1080'
]
}
protractor.conf.js
const SpecReporter = require('jasmine-spec-reporter').SpecReporter;
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./e2e/**/*.e2e-spec.ts'
],
capabilities: {
shardTestFiles: true,
maxInstances: 2,
'browserName': 'chrome',
chromeOptions: {
args: ['--start-maximized']
}
},
directConnect: true,
baseUrl: 'localhost:4000/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 300000,
print: function () {
}
},
useAllAngular2AppRoots: true,
onPrepare: function () {
jasmine.getEnv().addReporter(new SpecReporter());
require('ts-node').register({
project: 'e2e/tsconfig.json'
});
}
};
In my package.json file there are 2 scripts one for running tests locally and one on Travis.
Package.json (at the same level where protractor.conf.js is located)
"scripts": {
...
"test": "ng test --watch=false",
"pree2e": "webdriver-manager update",
"e2e": "concurrently --kill-others \"ng e2e --port=4000\" \"npm run _server:run\"",
"e2e:ci": "concurrently --kill-others \"ng e2e --port=4000 --protractor-config=e2e/protractor.ci.conf.js\" \"npm run _server:run\"",
"_server:run": "tsc -p ./server && concurrently \"tsc -w -p ./server\" \"nodemon dist/server/index.js\" ",
...
},
.travis.yml
branches:
only:
- staging
- prod
- functional-testing
script:
...
- if [[ $TRAVIS_COMMIT_MESSAGE == *"[skip e2e]"* ]]; then echo "skipping E2E test"; else npm run e2e:ci; fi
...
before_deploy:
- sed -i '/dist/d' .gitignore
- git add . && git commit -m "latest build"
- cd $TRAVIS_BUILD_DIR/dist
PROBLEM
When simply running npm run e2e, every test is working fine. But when I'm using npm run e2e:ci command scripts hangs and no instance of WebDriver runs.
I/launcher — Running 0 instances of WebDriver
is coming instead of 1 or 2 instances.
That's because since you made a new config file and apparently placed in the folder
/e2e instead of the default root folder.
The path to the test files in your case should also be updated.
So './e2e/**/*.e2e-spec.ts' will get changed to './**/*.e2e-spec.ts'
Since, currently the test is not able to find any files specified, it doesn't run any instances.

Protractor : ERROR - Unable to start a WebDriver session

I wrote test cases three months back at that time they worked fine now i want to run those test cases in another system so i did basic setup. When i try to run protractor test case now they are failing with 'Unable to start a WebDriver session'. I have tried so many solutions but they didn't work for me.
Here i am attaching my protractor.conf.js file and error details.
protractor.conf.js
'use strict';
exports.config = {
seleniumAddress: 'http://127.0.0.1:4444/wd/hub',
baseUrl: 'http://localhost:' + (process.env.PORT || '3036'),
chromeOnly: true,
// To get the maximimum test screen size
onPrepare: function() {
browser.driver.manage().window().maximize();
},
// list of files / patterns to load in the browser
specs: [
'e2e/attributeSection/search_spec.js', 'e2e/attributeSection/create_spec.js',
'e2e/attributeSection/edit_spec.js', 'e2e/attribute/search_spec.js',
'e2e/attribute/create_spec.js', 'e2e/attribute/edit_spec.js',
'e2e/classification/search_spec.js', 'e2e/classification/create_spec.js',
'e2e/classification/edit_spec.js', 'e2e/classificationGroup/create_spec.js',
'e2e/classificationGroup/edit_spec.js'
],
exclude: [],
capabilities: {
'browserName': 'chrome',
'chromeOptions': {
binary: 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe',
args: [],
extensions: [],
}
},
framework: 'jasmine',
jasmineNodeOpts: {
defaultTimeoutInterval: 60000
}
};
Error in console
Using the selenium server at http://127.0.0.1:4444/wd/hub
[launcher] Running 1 instances of WebDriver
ERROR - Unable to start a WebDriver session.
C:\Users\Cronj- 4\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\http\index.js:145
callback(new Error(message));
^
Error: ECONNREFUSED connect ECONNREFUSED
at ClientRequest.<anonymous> (C:\Users\Cronj-4\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\http\index.js:145:16)
at ClientRequest.emit (events.js:95:17)
at Socket.socketErrorListener (http.js:1552:9)
at Socket.emit (events.js:95:17)
at net.js:441:14
at process._tickCallback (node.js:442:13)
From: Task: WebDriver.createSession()
at Function.webdriver.WebDriver.acquireSession_ (C:\Users\Cronj-4\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:155:22)
at Function.webdriver.WebDriver.createSession (C:\Users\Cronj-4\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:129:30)
at [object Object].Builder.build (C:\Users\Cronj-4\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\builder.js:416:22)
at [object Object].DriverProvider.getNewDriver (C:\Users\Cronj-4\AppData\Roaming\npm\node_modules\protractor\lib\driverProviders\driverProvider.js:38:7)
at [object Object].Runner.createBrowser (C:\Users\Cronj-4\AppData\Roaming\npm\node_modules\protractor\lib\runner.js:180:37)
at C:\Users\Cronj-4\AppData\Roaming\npm\node_modules\protractor\lib\runner.js:257:21
at _fulfilled (C:\Users\Cronj-4\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:797:54)
at self.promiseDispatch.done (C:\Users\Cronj-4\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:826:30)
at Promise.promise.promiseDispatch (C:\Users\Cronj-4\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:759:13)
Could anyone help me out? Thanks in advance
I believe the "chromeOnly" option got deprecated in v2.0.0.
chromeOnly: true,
This used to mean use "direct" mode without a selenium server. But since both firefox and chrome support direct mode, the property was renamed to "directConnect". So change that line to:
directConnect: true,
In this mode you don't need a selenium server, so you can drop the seleniumAddress property which is just confusing folks.
See https://github.com/angular/protractor/pull/1933/files
I ran webdriver-manager start in one command prompt and protractor in another command prompt then only test cases started running