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

an intermittent error on async false tests #431

Open
gabrielmancini opened this issue Mar 23, 2023 · 1 comment
Open

an intermittent error on async false tests #431

gabrielmancini opened this issue Mar 23, 2023 · 1 comment

Comments

@gabrielmancini
Copy link

gabrielmancini commented Mar 23, 2023

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?

@btkostner
Copy link
Member

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.

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