У меня проблемы с запуском системных тестов в свежем приложении Rails 5.2 из Ubuntu 18.04, работающем на WSL.
Я установил chromium-browser
в Ubuntu, используя sudo apt-get install chromium-browser
.
test / application_system_test_case.rb:
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
end
test / system / authentication_test.rb:
class AuthenticationTest < ApplicationSystemTestCase
test 'prompting for credentials' do
visit '/'
assert new_user_session_path, current_path
end
end
При запуске rails test:system
происходит сбой со следующим:
2019-07-03 13:07:58 WARN Selenium [DEPRECATION] Selenium::WebDriver::Chrome#driver_path= is deprecated. Use Selenium::WebDriver::Chrome::Service#driver_path= instead.
Started with run options --seed 62037
AuthenticationTest
test_prompting_for_credentials ERROR (1.44s)
Selenium::WebDriver::Error::UnknownError: Selenium::WebDriver::Error::UnknownError: unknown error: Chrome failed to start: crashed
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
test/system/authentication_test.rb:6:in `block in <class:AuthenticationTest>'
Если я изменю путь Chrome, чтобы он указывал на мою установку Windows Chrome, добавив следующее в базовый класс тестирования системы:
Selenium::WebDriver::Chrome.path = '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe'
Когда я запускаю rails test:system
, он открывает два окна консоли и два окна Chrome.
Chrome выдает ошибку «Не удалось загрузить расширение из C: \ tmp.com.google. \ Internal. Файл манифеста отсутствует или не читается».
В обоих окнах консоли есть следующие ошибки:
[14148:9072:0703/131126.030:ERROR:database.cc(1601)] Cookie sqlite error 5, errno 1: database is locked, sql: PRAGMA auto_vacuum
[14148:9072:0703/131126.034:ERROR:database.cc(1601)] Cookie sqlite error 5, errno 1: database is locked, sql: PRAGMA journal_mode=TRUNCATE
[14148:9072:0703/131126.040:ERROR:database.cc(1601)] Cookie sqlite error 5, errno 1: database is locked, sql: SELECT 1 FROM sqlite_master WHERE type=? AND name=?
[14148:9072:0703/131126.044:ERROR:database.cc(1601)] Cookie sqlite error 5, errno 1: database is locked, sql: SELECT 1 FROM sqlite_master WHERE type=? AND name=?
[14148:9072:0703/131126.048:ERROR:database.cc(1601)] Cookie sqlite error 5, errno 1: database is locked, sql: CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY, value LONGVARCHAR)
[14148:6880:0703/131126.217:ERROR:backend_impl.cc(1437)] Unable to map Index file
[14148:10312:0703/131126.230:ERROR:cache_util_win.cc(21)] Unable to move the cache: The system cannot find the file specified. (0x2)
[14148:10312:0703/131126.230:ERROR:cache_util.cc(141)] Unable to move cache folder \\wsl$\Ubuntu-18.04\tmp\.com.google.Chrome.HgtI05\Default\Cache to \\wsl$\Ubuntu-18.04\tmp\.com.google.Chrome.HgtI05\Default\old_Cache_000
[14148:10312:0703/131126.230:ERROR:disk_cache.cc(178)] Unable to create cache
[14148:9072:0703/131126.233:ERROR:database.cc(1601)] Cookie sqlite error 5, errno 1: database is locked, sql: PRAGMA auto_vacuum
[14148:9072:0703/131126.237:ERROR:database.cc(1601)] Cookie sqlite error 5, errno 1: database is locked, sql: PRAGMA journal_mode=TRUNCATE
[14148:9072:0703/131126.241:ERROR:database.cc(1601)] Cookie sqlite error 5, errno 1: database is locked, sql: SELECT 1 FROM sqlite_master WHERE type=? AND name=?
[14148:9072:0703/131126.245:ERROR:database.cc(1601)] Cookie sqlite error 5, errno 1: database is locked, sql: SELECT 1 FROM sqlite_master WHERE type=? AND name=?
[14148:9072:0703/131126.249:ERROR:database.cc(1601)] Cookie sqlite error 5, errno 1: database is locked, sql: CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY, value LONGVARCHAR)
и тест завершается с:
AuthenticationTest
test_prompting_for_credentials ERROR (62.19s)
Selenium::WebDriver::Error::SessionNotCreatedError: Selenium::WebDriver::Error::SessionNotCreatedError: session not created
from tab crashed
(Session info: chrome=75.0.3770.100)
test/system/authentication_test.rb:6:in `block in <class:AuthenticationTest>'