beam-community/ex_machina

an intermittent error on async false tests

gabrielmancini opened this issue · 3 comments

i had this case:

test "saves new group", %{conn: conn} do
      project = insert(:project, [], prefix: conn.assigns.tenant)
      page = insert(:page, [project: project], prefix: conn.assigns.tenant)
      user = insert(:user, [], prefix: conn.assigns.tenant)

      {:ok, index_live, _html} = live(conn, ~p"/default/groups")

      assert index_live |> element("a", "New Group") |> render_click() =~
               "New Group"

      assert_patch(index_live, ~p"/default/groups/new")

      assert index_live
             |> form("#group-form", group: @invalid_attrs)
             |> render_change() =~ "can't be blank"

      param_group = params_for(:group, users: [user.id], pages: [page.id])

      {:ok, _, html} =
        index_live
        |> form("#group-form", group: param_group)
        |> render_submit()
        |> follow_redirect(conn, ~p"/default/groups")

      assert html =~ "Group created successfully"
      assert html =~ param_group.name
    end

sometimes works, but sometimes don't because my select box on the screen not found the previous inserted user or page .
what i am doing wrong here?

This code example is pretty hard to debug alone. Are you able to post a link to your repo? Otherwise we will need to see your factories and live views you are trying to test.

This issue has been automatically marked as "stale:discard". We are sorry that we haven't been able to prioritize it yet.
If this issue still relevant, please leave any comment if you have any new additional information that helps to solve this issue. We encourage you to create a pull request, if you can. We are happy to help you with that.

Closing this issue after a prolonged period of inactivity. If this issue is still relevant, feel free to re-open the issue. Thank you!