From 9a22e92183b6b6a6643612232d87adf1209429ce Mon Sep 17 00:00:00 2001 From: Claudio Ortolina Date: Wed, 22 Oct 2025 11:35:19 +0100 Subject: [PATCH] Remove redundand testing guidelines --- AGENTS.md | 100 ------------------------------------------------------ 1 file changed, 100 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 251fb74d..dc1ff278 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -413,112 +413,12 @@ mix usage_rules.search_docs "Enum.zip" --query-by title - Read the docs and options fully before using tasks ## Testing - -### Running Tests - Run tests in a specific file with `mix test test/my_test.exs` and a specific test with the line number `mix test path/to/test.exs:123` - Limit the number of failed tests with `mix test --max-failures n` - Use `@tag` to tag specific tests, and `mix test --only tag` to run only those tests - Use `assert_raise` for testing expected exceptions: `assert_raise ArgumentError, fn -> invalid_function() end` - Use `mix help test` to for full documentation on running tests -### PhoenixTest Guidelines -- **Always** use PhoenixTest for LiveView testing instead of `Phoenix.LiveViewTest` functions -- PhoenixTest provides a clean, chainable API for testing web interactions -- Import test helpers with `use MusicLibraryWeb.ConnCase` (ConnCase already includes PhoenixTest) -- **Never** import `Phoenix.LiveViewTest` in test files - PhoenixTest replaces it - -### PhoenixTest Patterns - -#### Navigation and Assertions -- Use `visit(conn, path)` to navigate to pages -- Chain assertions using `|>` for cleaner test flow -- Use `assert_has(selector)` or `assert_has(selector, text: "expected")` to verify element presence -- Use `refute_has(selector)` or `refute_has(selector, text: "unexpected")` to verify element absence - -#### Interactions -- Use `click_button("Button Text")` instead of `element("#id") |> render_click()` -- Use `fill_in("Label", with: "value")` instead of `form("#id", params) |> render_change()` -- For accessibility: ensure form inputs have associated labels (use `