简体   繁体   中英

Elixir Wallaby crashes on mix test

I am trying to incorporate Wallaby into my phoenix app. I have followed the setup guide closely and made sure that phantomjs is properly installed, however on mix test I get the following error:

** (MatchError) no match of right hand side value:

My operating system is Windows10. Elixir version: 1.10.1 Phoenix version: 1.4.15 Wallaby version: 0.23.0 Phantomjs version: 2.1.1 Here is the full output:

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]}]}}

Any help/advice will be greatly appreciated!

The match failure is induced (although it is worth to report to the Wallaby project because they should not blow up when the process cannot start due to port access issues,) the real cause is the process cannot open the port here:

(stop) :eacces
    erlang.erl:2213: :erlang.open_port({:spawn_executable,
      'C:\\Users\\SARELV~1\\AppData\\Local\\Temp/kz9cgp/wrapper'}, ...)

The port in question is port_number: 55182 . I am not familiar with Windows, but this probably means that either PhantomJS has issues opening this port or Wallaby connecting to it. Does Windows limits access to ports for regular users? You might need to explicitly allow this somewhere in the OS settings, or like.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM