У меня есть рабочий пример на моей машине windows 10. Когда я переношу это на linux, через контейнер, используя: node: 8, я получаю ошибку 127.
Я недостаточно знаком с linux или основными требованиями, ie нужна ли ему java установка или другое?
пакет. json
{
"name": "test1",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"webdriver-update": "webdriver-manager update",
"webdriver-update-chrome": "webdriver-manager update --versions.chrome=78.0.3904.105",
"test-protractor": "protractor protractor.conf.js --disableChecks"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"cucumber": "^6.0.5",
"jasmine-spec-reporter": "^4.2.1",
"protractor": "^5.4.2",
"protractor-cucumber-framework": "^6.2.0",
"rimraf": "^3.0.1"
}
}
protractor.conf
const protractor = require('protractor');
// console.log('browser = ', browser);
exports.config = {
framework: 'custom',
frameworkPath: require.resolve('protractor-cucumber-framework'),
getPageTimeout: 60000,
allScriptsTimeout: 500000,
specs: ['features/*.feature'],
baseURL: 'http://www.google.com/',
cucumberOpts: {
require: [
'./features/step_definitions/stepDefinitions.js'
],
tags: false,
profile: false,
'no-source': true
},
onPrepare: function() {
browser.ignoreSynchronization = true;
browser.manage().window().maximize();
browser.manage().timeouts().implicitlyWait(5000);
},
capabilities: {
browserName: "chrome",
acceptInsecureCerts: true,
chromeOptions: {
args: [
'--allow-insecure-localhost',
'--headless',
'--disaple-gpu',
'--window-size=1920,1080',
'--no-sandbox',
'--disable-dev-shm-usage'
],
prefs: {
download: {
prompt_for_download: false,
extensions_to_open: ''
},
profile: {
default_content_settings: {
popups: 0
}
},
directory_upgrade: true
},
useAutomationExtension: false
}
},
// connec direct to webdriver, instead of local selenium server!
directConnect: true,
ignoreUncaughtException: true,
onComplete: () => {
// Reporter.createHtmlReport();
}
}
Dockerfile
FROM node:8
# Create and define the node_modules's cache directory.
RUN mkdir /usr/src/cache
WORKDIR /usr/src/cache
COPY . .
RUN npm install
# run update to get all drivers
RUN npm run webdriver-update
## update to specific chrome version - 78.0.3904.105
RUN npm run webdriver-update-chrome
# overwrite any remaining references to wrong chromedriver...
RUN sed -i -e 's/chromedriver[^"]*/chromedriver_78.0.3904.105/g' node_modules/protractor/node_modules/webdriver-manager/selenium/update-config.json
# run tests
RUN npm run test-protractor
Приведенная выше команда sed просто гарантирует, что обновление -config. json использует выбранную выше chrome версию.
update-config. json
например:
"node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_78.0.3904.105.exe"
Ошибка:
Сервер досрочно завершил работу со статусом 127