elixir-wallaby / wallaby

Concurrent browser tests for your Elixir web apps.
https://twitter.com/elixir_wallaby
MIT License
1.68k stars 198 forks source link

Setup docs unclear when using Phoenix but not Ecto #771

Closed Corkle closed 6 months ago

Corkle commented 6 months ago

Elixir and Erlang/OTP versions

Elixir 1.16.2 Erlang/OTP 26

Operating system

Debian 12

Browser

Chrome

Driver

ChromeDriver

Correct Configuration

Current behavior

I had some difficulty parsing the setup docs to understand what configuration is required for a Phoenix application without Ecto. Below are the sections that did not seem required when first reading the docs:

  1. Under the Installation section of the docs, the final statement reads like it is dependent on the previous statement. Because of the word "then" in the last statement, my initial understanding was that it was conditional on using Ecto.

wallaby_ex_1

Without this statement in my test helpers file, I would get a process not alive error. I deduce that this is a required configuration step for all applications regardless of using Ecto.

  1. The other configuration step that was unclear is under the Phoenix section. The first line of this section states that the following step only applies if using Phoenix with Ecto and sandbox supported database. Every statement that follows in this section has a reference to a database or sandbox except the final one which appears to be a required configuration step regardless of using Ecto or a database. The word "finally" made me think this statement was also dependent on the previous steps which did not apply in my case.

wallaby_ex_2

The error message thrown when running a test without this configuration in test helpers was very helpful in pointing out what was missing.

Expected behavior

If these two configuration steps are required to test Phoenix applications even without using Ecto, the documentation could be improved to make this more obvious. The fact that they are at the very end of their respective sections followed by conditional cases makes it easy to skim past them or misinterpret their importance.

I think removing the adverbs in these statements and/or moving the statements above the conditionals for Ecto could make this more clear that they need to be added to test_helpers.exs.

Test Code & HTML

N/A

Demonstration Project

No response

Corkle commented 6 months ago

I also missed the configuration change needed to enable the server for tests. The flow of the instructions made it seem related to configuring sandbox options.

wallaby_ex_3

mhanberg commented 6 months ago

PR to clarify the docs would be appreciated!

Corkle commented 6 months ago

You got it! #772