phoenix_test
334
Stars
—
Forks
0
Watchers
—
Open Issues
待补全
许可证
Elixir
语言
—
创建时间
最近更新
项目能做什么
提供统一的功能测试方案,支持 LiveView 与静态非 LiveView 页面。
来源:基于仓库元数据
· 内容以仓库实际 README 为准
使用说明 查看原始 README 原仓库文档
中文使用说明暂未生成。下面保留原仓库 README 摘录,命令与配置均以原文为准。
原始 README 摘录(英文原文,节选前 3000 字符)
# PhoenixTest
[](https://hex.pm/packages/phoenix_test/)
[](https://hexdocs.pm/phoenix_test/)
[](https://github.com/germsvel/phoenix_test/blob/main/LICENSE)
PhoenixTest provides a unified way of writing feature tests -- regardless of
whether you're testing LiveView pages or static (non-LiveView) pages.
It also handles navigation between LiveView and static pages seamlessly. So, you
don't have to worry about what type of page you're visiting. Just write the
tests from the user's perspective.
Thus, you can test a flow going from static to LiveView pages and back without
having to worry about the underlying implementation.
This is a sample flow:
```elixir
test "admin can create a user", %{conn: conn} do
conn
|> visit("/")
|> click_link("Users")
|> fill_in("Name", with: "Aragorn")
|> click_button("Create")
|> assert_has(".user", "Aragorn")
end
```
Note that PhoenixTest does not handle JavaScript. If you're looking for
something that supports JavaScript, take a look at
[Wallaby](https://hexdocs.pm/wallaby/readme.html).
For full documentation, take a look at [PhoenixTest docs](https://hexdocs.pm/phoenix_test/PhoenixTest.html).
## Why PhoenixTest?
### A unified way of writing feature tests
With the advent of LiveView, I find myself writing less and less JavaScript.
Sure, there are sprinkles of it here and there, and there’s always the
occasional need for something more.
But for the most part:
- If I’m going to build a page that needs interactivity, I use LiveView.
- If I’m going to write a static page, I use regular controllers + views/HTML
modules.
The problem is that LiveView pages and static pages have _vastly different_
testing strategies.
If we use LiveView, we have a good set of helpers.
```elixir
{:ok, view, _html} = live(conn, ~p"/")
html =
view
|> element("#greet-guest")
|> render_click()
assert html =~ "Hello, guest!"
```
But if we're testing a static page, we have to resort to controller testing:
```elixir
conn = get(conn, ~p"/greet_page")
assert html_response(conn, 200) =~ "Hello, guest!"
```
That means we don’t have ways of interacting with static pages at all!
What if we want to submit a form or click a link? And what if a click takes us
from a LiveView to a static view or vice versa?
Instead, I'd like to have a unified way of testing Phoenix apps -- regardless of
whether we're testing LiveView pages or static pages.
### Improved assertions
And then there's the problem of assertions.
Because LiveView and controller tests use `=~` for assertions, the error
messages aren't very helpful when assertions fail.
After all, we’re just comparing two blobs of text – and trust me, HTML pages can
get very large and hard to read as a blob of text in your terminal.
LiveView tries to help with its `has_element?/3` helpe
阅读完整原文
项目深度分析 规则生成(AI 未配置)
综合评分 35.8 分。该项目在“个人可实施性”维度得 35 分,“付费可能性”维度得 20.0 分,差异化空间 45.0 分(评分依据见评分卡)。
面向细分需求的二次开发产品
| 产品构想 | 基于 phoenix_test 的核心能力,聚焦一个更窄的场景(如某平台、某行业)做差异化。 |
| 目标用户 | 该细分场景用户 |
| 难度/周期 | 中 · 2~6 周 |
| 收费模式 | 买断制 / 订阅制 / 广告 |
| 竞争风险 | 细分需求规模需验证 |
| 依据 | AI 推测:基于项目主题标签的判断 |
以上为规则引擎基于仓库公开数据生成的参考结论,包含推测成分,不构成投资或创业承诺;配置 AI 后可获得更深入的分析。
报告会保存到 个人中心
竞品与相似项目 GitHub Search 真实检索
| 项目 | 中文简介 | Stars | 语言 |
|---|---|---|---|
| dwyl/phoenix-chat-example | 中文介绍暂未生成 💬 The Step-by-Step Beginners Tutorial for Building, Testing |
817 | Elixir |
| phoenixframework/phoenix_ecto | 中文介绍暂未生成 Phoenix and Ecto integration with support for concurrent acc |
578 | Elixir |
| boydm/phoenix_integration | 中文介绍暂未生成 Lightweight server side integration test tools for Phoenix |
220 | Elixir |
| ftes/phoenix_test_playwright | 中文介绍暂未生成 Execute PhoenixTest cases in an actual browser via Playwrigh |
90 | Elixir |
以上为通过 GitHub 官方 Search API 检索的相似项目,功能差异与优劣势需进一步人工确认,配置 AI 后可生成对比分析。
项目优势与风险
| 技术成熟度 | 创建时间待补全,最近推送 |
| 社区活跃 | Star 334 / Fork 0 / Issue 0(数据支持,可自行核实) |
| 许可证 | 未检测到(需人工确认) |
| 主要风险 | 上游项目方向可能变化;同赛道竞争者较多(见竞品表);热度与需求不完全等价 |
安装与使用
此项目未提供 Docker 镜像,安装步骤以原仓库 README 为准(涉及依赖安装与环境配置,对新手门槛较高)。