私は、Selenium Hubを使ってDockerでnightwatchjsを使って並列にテストを実行しようとしています。私はSelenium HubなしでDockerでテストを並行して実行することができますが、一部の子プロセスはタイムアウトして複数の再試行を引き起こします。結果は非常に矛盾しています。私はテスト結果がより一貫性があり、安定しており、タイムアウトしないように、タイムアウトと再試行を削除するためにSelenium Hubまたは同様のものを使用したいと考えています。nightwatchjsパラレルモードセレンハブドッカーを作成
ただし、今度はdocker-compose run --rm nightwatch
を実行すると、次のコードを使用して、セレンサーバーが並列モードで起動し、複数の子プロセスが開始されますが、最初のプロセスのみが実行されます。他の子プロセスはError retrieving a new session from the selenium server. Connection refused! Is selenium server started?
になりますnightwatchjsテストをタイムアウトせずに並行して実行するには何か不足していますか?
nightwatch.conf.js
module.exports = {
src_folders: ['tests'],
output_folder: 'reports',
custom_commands_path: '',
custom_assertions_path: '',
page_objects_path: 'page_objects',
test_workers: true,
live_output: true,
detailed_output: true,
selenium: {
start_process: true,
server_path: './bin/selenium-server-standalone-3.0.1.jar',
log_path: '',
host: '127.0.0.1',
port: 4444,
cli_args: {
'webdriver.chrome.driver' : './node_modules/chromedriver/bin/chromedriver'
}
},
test_settings: {
default: {
launch_url: 'https://example.com',
selenium_port: 4444,
selenium_host: 'hub',
silent: true,
screenshots: {
'enabled': false,
'path': ''
},
desiredCapabilities: {
browserName: 'chrome',
javascriptEnabled: true,
acceptSslCerts: true,
chromeOptions: {
args: [
'--window-size=1024,768',
'--no-sandbox'
]
}
},
globals: {
waitForConditionTimeout: 20000,
asyncHookTimeout: 70000
}
}
};
ドッカー-compose.yml
version: '2'
services:
nightwatch:
build:
context: .
command: /bin/sh -c "node ./node_modules/nightwatch/bin/nightwatch"
links:
- chrome
- hub
volumes:
- .:/opt/nightwatch
chrome:
environment:
VIRTUAL_HOST: node.chrome.docker
HUB_PORT_4444_TCP_ADDR: hub
HUB_PORT_4444_TCP_PORT: 4444
image: selenium/node-chrome:3.1.0-astatine
links:
- hub
hub:
ports:
- 4444:4444
image: selenium/hub:3.1.0-astatine
Dockerfile
FROM java:8-jre
## Node.js setup
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash -
RUN apt-get install -y nodejs
RUN npm config set spin false
WORKDIR /app
COPY . ./
RUN npm install
ナイトウォッチドッカーファイルを投稿できますか? –
@BaoTran私はnightwatch Dockerfileを含めました。 – wwwuser