首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Elixir Wallaby在混合测试中崩溃

Elixir Wallaby在混合测试中崩溃
EN

Stack Overflow用户
提问于 2020-04-10 21:16:18
回答 1查看 75关注 0票数 0

我正在尝试将Wallaby整合到我的phoenix应用程序中。我已经严格遵循安装指南,并确保phantomjs已正确安装,但是在mix测试中,我得到以下错误:

代码语言:javascript
复制
** (MatchError) no match of right hand side value:

我的操作系统是Windows10。Elixir版本: 1.10.1 Phoenix版本: 1.4.15 Wallaby版本: 0.23.0 Phantomjs版本: 2.1.1完整输出如下:

代码语言:javascript
复制
mix test

06:21:54.255 [info]  Already up
06:21:55.380 [error] Task #PID<0.486.0> started from #PID<0.488.0> terminating
** (stop) :eacces
    erlang.erl:2213: :erlang.open_port({:spawn_executable, 'C:\\Users\\SARELV~1\\AppData\\Local\\Temp/kz9cgp/wrapper'}, [:binary, :stream, :use_stdio, :exit_status, :stderr_to_stdout, {:args, ["phantomjs", "--webdriver=55182", "--local-storage-path=C:\\Users\\SARELV~1\\AppData\\Local\\Temp/kz9cgp/local_storage"]}])
    (wallaby 0.23.0) lib/wallaby/phantom/server/start_task.ex:85: Wallaby.Phantom.Server.StartTask.start_phantom/1
    (wallaby 0.23.0) lib/wallaby/phantom/server/start_task.ex:28: Wallaby.Phantom.Server.StartTask.run/2
    (elixir 1.10.1) lib/task/supervised.ex:90: Task.Supervised.invoke_mfa/2
    (elixir 1.10.1) lib/task/supervised.ex:35: Task.Supervised.reply/5
    (stdlib 3.8) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Function: &Wallaby.Phantom.Server.StartTask.run/2
    Args: [#PID<0.486.0>, %Wallaby.Phantom.Server.ServerState{phantom_args: [], phantom_os_pid: nil, phantom_path: "phantomjs", port_number: 55182, workspace_path: "C:\\Users\\SARELV~1\\AppData\\Local\\Temp/kz9cgp", wrapper_script_os_pid: nil, wrapper_script_port: nil}]
** (MatchError) no match of right hand side value: {:error, {:wallaby, {{:shutdown, {:failed_to_start_child, Wallaby.Phantom, {:shutdown, {:failed_to_start_child, Wallaby.ServerPool, {{:badmatch, {:error, {:eacces, [{:erlang, :open_port, [{:spawn_executable, 'C:\\Users\\SARELV~1\\AppData\\Local\\Temp/kz9cgp/wrapper'}, [:binary, :stream, :use_stdio, :exit_status, :stderr_to_stdout, {:args, ["phantomjs", "--webdriver=55182", "--local-storage-path=C:\\Users\\SARELV~1\\AppData\\Local\\Temp/kz9cgp/local_storage"]}]], [file: 'erlang.erl', line: 2213]}, {Wallaby.Phantom.Server.StartTask, :start_phantom, 1, [file: 'lib/wallaby/phantom/server/start_task.ex', line: 85]}, {Wallaby.Phantom.Server.StartTask, :run, 2, [file: 'lib/wallaby/phantom/server/start_task.ex', line: 28]}, {Task.Supervised, :invoke_mfa, 2, [file: 'lib/task/supervised.ex', line: 90]}, {Task.Supervised, :reply, 5, [file: 'lib/task/supervised.ex', line: 35]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 249]}]}}}, [{:poolboy, :new_worker, 1, [file: 'c:/Coding/Projects/BoomhuisOnline/boomhuis/deps/poolboy/src/poolboy.erl', line: 283]}, {:poolboy, :prepopulate, 3, [file: 'c:/Coding/Projects/BoomhuisOnline/boomhuis/deps/poolboy/src/poolboy.erl', line: 304]}, {:poolboy, :init, 3, [file: 'c:/Coding/Projects/BoomhuisOnline/boomhuis/deps/poolboy/src/poolboy.erl', line: 153]}, {:gen_server, :init_it, 2, [file: 'gen_server.erl', line: 374]}, {:gen_server, :init_it, 6, [file: 'gen_server.erl', line: 342]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 249]}]}}}}}, {Wallaby, :start, [:normal, []]}}}}
    test/test_helper.exs:5: (file)
    (elixir 1.10.1) lib/code.ex:917: Code.require_file/2
    (elixir 1.10.1) lib/enum.ex:783: Enum."-each/2-lists^foreach/1-0-"/2
    (elixir 1.10.1) lib/enum.ex:783: Enum.each/2
06:21:55.392 [error] GenServer #PID<0.485.0> terminating
** (MatchError) no match of right hand side value: {:error, {:eacces, [{:erlang, :open_port, [{:spawn_executable, 'C:\\Users\\SARELV~1\\AppData\\Local\\Temp/kz9cgp/wrapper'}, [:binary, :stream, :use_stdio, :exit_status, :stderr_to_stdout, {:args, ["phantomjs", "--webdriver=55182", "--local-storage-path=C:\\Users\\SARELV~1\\AppData\\Local\\Temp/kz9cgp/local_storage"]}]], [file: 'erlang.erl', line: 2213]}, {Wallaby.Phantom.Server.StartTask, :start_phantom, 1, [file: 'lib/wallaby/phantom/server/start_task.ex', line: 85]}, {Wallaby.Phantom.Server.StartTask, :run, 2, [file: 'lib/wallaby/phantom/server/start_task.ex', line: 28]}, {Task.Supervised, :invoke_mfa, 2, [file: 'lib/task/supervised.ex', line: 90]}, {Task.Supervised, :reply, 5, [file: 'lib/task/supervised.ex', line: 35]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 249]}]}}
    (poolboy 1.5.2) c:/Coding/Projects/BoomhuisOnline/boomhuis/deps/poolboy/src/poolboy.erl:283: :poolboy.new_worker/1
    (poolboy 1.5.2) c:/Coding/Projects/BoomhuisOnline/boomhuis/deps/poolboy/src/poolboy.erl:304: :poolboy.prepopulate/3
    (poolboy 1.5.2) c:/Coding/Projects/BoomhuisOnline/boomhuis/deps/poolboy/src/poolboy.erl:153: :poolboy.init/3
    (stdlib 3.8) gen_server.erl:374: :gen_server.init_it/2
    (stdlib 3.8) gen_server.erl:342: :gen_server.init_it/6
    (stdlib 3.8) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: {:EXIT, #PID<0.484.0>, {{:badmatch, {:error, {:eacces, [{:erlang, :open_port, [{:spawn_executable, 'C:\\Users\\SARELV~1\\AppData\\Local\\Temp/kz9cgp/wrapper'}, [:binary, :stream, :use_stdio, :exit_status, :stderr_to_stdout, {:args, ["phantomjs", "--webdriver=55182", "--local-storage-path=C:\\Users\\SARELV~1\\AppData\\Local\\Temp/kz9cgp/local_storage"]}]], [file: 'erlang.erl', line: 2213]}, {Wallaby.Phantom.Server.StartTask, :start_phantom, 1, [file: 'lib/wallaby/phantom/server/start_task.ex', line: 85]}, {Wallaby.Phantom.Server.StartTask, :run, 2, [file: 'lib/wallaby/phantom/server/start_task.ex', line: 28]}, {Task.Supervised, :invoke_mfa, 2, [file: 'lib/task/supervised.ex', line: 90]}, {Task.Supervised, :reply, 5, [file: 'lib/task/supervised.ex', line: 35]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 249]}]}}}, [{:poolboy, :new_worker, 1, [file: 'c:/Coding/Projects/BoomhuisOnline/boomhuis/deps/poolboy/src/poolboy.erl', line: 283]}, {:poolboy, :prepopulate, 3, [file: 'c:/Coding/Projects/BoomhuisOnline/boomhuis/deps/poolboy/src/poolboy.erl', line: 304]}, {:poolboy, :init, 3, [file: 'c:/Coding/Projects/BoomhuisOnline/boomhuis/deps/poolboy/src/poolboy.erl', line: 153]}, {:gen_server, :init_it, 2, [file: 'gen_server.erl', line: 374]}, {:gen_server, :init_it, 6, [file: 'gen_server.erl', line: 342]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 249]}]}}

任何帮助/建议都将不胜感激!

EN

回答 1

Stack Overflow用户

发布于 2020-04-10 22:31:16

导致匹配失败(尽管有必要向Wallaby项目报告,因为当进程由于端口访问问题而无法启动时,匹配失败是值得的),真正的原因是进程无法在此处打开端口:

代码语言:javascript
复制
(stop) :eacces
    erlang.erl:2213: :erlang.open_port({:spawn_executable,
      'C:\\Users\\SARELV~1\\AppData\\Local\\Temp/kz9cgp/wrapper'}, ...)

有问题的端口是port_number: 55182。我不熟悉Windows,但这可能意味着PhantomJS在打开这个端口或连接到它时有问题。Windows是否限制普通用户访问端口?您可能需要在操作系统设置或类似设置中明确允许这一点。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61141093

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档