wallaby icon indicating copy to clipboard operation
wallaby copied to clipboard

[request] Option to output errors if some resource fails to be loaded

Open miquecg opened this issue 4 years ago • 1 comments

Issue

I have a proposal in case is not contemplated yet. I've run into an issue on CI that didn't happen on my local dev environment. It turned out to be completely my fault but maybe wallaby could have give some extra information.

One feature test was failing to find elements that in fact were there. As I've said, everything was running fine on my machine™ so this was odd, until I've realized what the problem was.

Those elements are empty <div> that are converted to grid elements after applying some CSS, so in case of a missing stylesheet those elements will not be visible at all, and I forgot to build the assets with webpack on CI environment, so no styles were applied.

If wallaby had complained or at least warned about that 404 error when loading the CSS resource, I'd had a hint pointing in the right direction.

Having an option to make wallaby output network errors after loading a page would be helpful in similar scenarios.

Test Code & HTML

defmodule HeroesWeb.AcceptanceTest do
  use HeroesWeb.BrowserCase, async: true
  @moduletag :browser

  import Wallaby.Query, only: [css: 2]

  @game game_path(@endpoint, :index)

  feature "When a browser opens the game endpoint the board grid is loaded", %{session: session} do
    Application.put_env(:heroes_server, :board, GameBoards.Oblivion)

    session
    |> visit(@game)
    |> assert_has(css("#grid .cell", count: 48))
    |> assert_has(css(".cell.wall", count: 7))
  end
end
<section>
  <h1>Heroes Board Game</h1>
  <div id="grid">
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell wall"></div>
    <div class="cell"></div>
    <!-- and so on ... -->
</section>

miquecg avatar Jun 24 '20 15:06 miquecg

Thanks for taking the time to open an issue 😄.

I'll take a look at the WebDriver spec to see if there is anything built in for this.

mhanberg avatar Jun 24 '20 15:06 mhanberg