Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
miquecg opened this issue Jun 24, 2020 · 1 comment
Open

Comments

@miquecg
Copy link

miquecg commented Jun 24, 2020

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>
@mhanberg
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants