跳到主要内容
知仓学习社ZHICANG

django-selenium-functional-tests

Design, debug, and maintain Django Selenium functional tests with live server setup, explicit waits, test isolation, page objects, screenshots, CI a…

不碰外部(只输出文字)无严重或高危命中hashgraph-online/awesome-codex-plugins

它会碰到什么

扫了多少4 个文本文件,7 KB
它会碰到什么不碰外部(只输出文字)
命中总数0 处
命中统计严重 0 · 高 0 · 中 0 · 低 0

这一栏是扫描器报的事实,不是结论。命中多不等于有毒(安全工具、规则库、示例脚本本来就会包含危险写法),命中少也不等于干净。它和你手上的凭据、文件、网络有什么关系,需要你自己看。

技能内容

Django Selenium Functional Tests

Use Selenium functional tests sparingly and deliberately: they prove that Django, templates, static assets, JavaScript, persistence, and browser behavior work together. Keep them user-facing, isolated, and stable enough to inspire confidence.

Source Traceability

Primary source: Harry Percival, Test-Driven Development with Python, 3rd ed. Guidance is transformed and paraphrased from chapters 1, 2, 4, 6, 13, 22, 23, 25, 26, and Appendix A, especially explicit waits, functional test isolation, page pattern, screenshots, and CI debugging.

Workflow

  1. State the user journey in comments or helper names.
  • Keep test language at the user behavior level.
  • Avoid asserting implementation details unless the browser contract requires them.
  1. Use the right server boundary.
  • Use StaticLiveServerTestCase when static files matter.
  • Use a staging URL or Docker URL when verifying deployed/container behavior.
  • Keep local and remote setup explicit.
  1. Remove timing guesses.
  • Prefer explicit waits for a visible condition, DOM change, URL, or text.
  • Avoid time.sleep() except as a temporary debugging probe that is removed.
  1. Isolate state.
  • Create per-test data through app APIs, fixtures, management commands, or direct setup helpers.
  • Avoid tests depending on order, prior browser state, or shared accounts.
  1. Factor repeated journeys.
  • Start with helper methods.
  • Move to a page pattern when selectors and workflows are repeated enough to obscure intent.

Read [selenium-patterns.md](references/selenium-patterns.md) for wait helpers, page pattern guidance, and CI debugging tactics.

Debugging Order

  1. Reproduce locally with the same browser/headless setting when possible.
  2. Capture the current URL, page source, browser logs, and screenshot.
  3. Decide whether the failure is timing, selector drift, server error, static asset issue, or data isolation.
  4. Add the smallest stable wait or assertion that matches the real condition.
  5. Run the single functional test, then the affected functional test file.

Guardrails

  • Do not make Selenium prove every validation branch; faster Django tests should carry detail.
  • Do not hide browser failures behind broad retry loops.
  • Do not share mutable test accounts across parallel or CI runs.
  • Do not assert brittle CSS layout unless layout is the behavior under test.
  • Keep screenshots and artifacts for CI failures when they materially reduce diagnosis time.

Verification

Before finishing, confirm:

  • The test names and helpers describe user behavior.
  • All waits observe a real condition.
  • The test can run alone.
  • CI/headless-specific behavior is handled or documented.
  • Focused command and result are recorded.

想直接用这个技能?

本站把开放许可(MIT / Apache 等)的技能按仓库打包整理到网盘,点一下转存到你自己的网盘,不用一个个从 GitHub 拉。许可未声明的技能只给原始仓库链接,不打包。

它属于哪个仓库

星标★ 1,027
本站分层T1
该仓技能数1910
原文件路径plugins/LVTD-LLC/skills/skills/django-selenium-functional-tests/SKILL.md

同一个仓库里的其他技能

看这个仓库的全部 1910 个技能