

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
1234## Pytest Integration Tests567- Look to `app/factories/` to generate any required database state8 - Here's an example of how to create + persist a factory `DistributionFactory.save(domain=PYTHON_TEST_SERVER_HOST)`9- Add the `server` factory to each test10- Use the `faker` factory to generate emails, etc.11- Don't add obvious `assert` descriptions12- Do not use the `db_session` fixture here. Instead, use `with test_session():` if you need to setup complex database state13- if a UI timeout is occuring, it could be because it cannot find a element because the rendering has changed. Check the failure screenshot and see if you can correct the test assertion.14- The integration tests can take a very long time to run. Do not abort them if they are taking a long time.15- Use `expect(page.get_by_text("Screening is fully booked")).to_be_visible()` instead of `expect(page.get_by_role("heading")).to_contain_text("Screening is fully booked")`. It's less brittle.16- Do not use `client` fixtures in an integration test. Integration tests should only use the frontend of the website to interact with the application, not the API.17- Use `with page.expect_response("https://example.com/resource") as response_info:` to assert against network activity.18- Do not `next_button.evaluate("el => el.click()")` instead, just `locator.click()`. If this doesn't work, stop your work and let me know.19- Only use `wait_for_loading(page)` if a `LONG_INTEGRATION_TEST_TIMEOUT` on an expectation does not work: `expect(page.get_by_text("Your Matched Doctors")).to_be_visible(timeout=LONG_INTEGRATION_TEST_TIMEOUT)`20 - `LONG_INTEGRATION_TEST_TIMEOUT` should only be used as a last resort. If you have many of these in a test, let me know and I will debug it.21- Prefer fewer integration tests that cover more functionality. Unlike unit tests, where each test is designed to test a very particular piece of functionality, I want integration tests to cover entire workflows. It's preferred to add more steps to an integration test to test an entire workflow.22- Prefer simple locators. If a `filter`, `or_`, etc is required to capture a button in multiple states it indicates something is wrong in the code.23- Use `react_router_url` to generate the frontend url path and do not set `base_url`.24- End all Playwright tests with `from pytest_playwright_artifacts import assert_no_console_errors` and `assert_no_console_errors(request)` (capture is the plugin's `playwright_console_logging` fixture).25 - Test-Specific Ignores: Pass `ignore=[...]` to `assert_no_console_errors` per `pytest-playwright-artifacts` (regex strings, compiled patterns, or `{"file": "...", "message": "..."}` dicts); add a comment explaining why.26 - Global Ignores: Use `playwright_console_ignore` under `[tool.pytest.ini_options]` in `pyproject.toml` (see `pytest-playwright-artifacts` README).2728### Example Integration Test2930Below is an example test. Notice the following:3132- Code comments are used to describe the key user steps that are being tested33- We avoid long timeouts or wait commands34- Fixtures and factories are generated at the beginning of the test35- We assert against database state after each major user action36- Some of the comments (i.e. comments on included fixtures) are included for instructional purposes only and should not be included in the tests you write3738```python39from pytest_playwright_artifacts import assert_no_console_errors404142def test_streaming_checkout_creates_user_and_links_order(43 # this fixture ensures that the underlying python server is started44 server,45 faker,46 page: Page,47 # if you need to create objects (like factories) tied to a common session, include this fixture48 db_truncate_session,49 # for asserting against the console logs50 request: FixtureRequest,51) -> None:52 distribution = DistributionWithWebhooksFactory.save()53 test_email = clerk_test_email()5455 # 1) Run through streaming checkout56 page.goto(react_router_url("/streaming"))5758 page.get_by_placeholder("your@email.com").first.fill(test_email)59 page.get_by_placeholder("your@email.com").last.fill(test_email)6061 # Check TOS62 page.get_by_role("checkbox").last.check()6364 fill_stripe_checkout(page)6566 # 2) Complete checkout67 # the stripe checkout form will expand and cause the purchase button to move below the screen68 safely_scroll_then_click(page.get_by_role("button", name="Complete Purchase"))6970 expect(page.get_by_role("heading", name="You're ready to watch!")).to_be_visible()71 page.get_by_role("link", name="Login & Start Watching").click()7273 # 3) Assert against database and Clerk state7475 # One StreamingOrder should be created for this distribution and email76 assert StreamingOrder.count() == 177 streaming_order = StreamingOrder.get(email=test_email)78 assert streaming_order7980 assert streaming_order.status.value == "completed"81 assert streaming_order.user_id is not None8283 # 4) Login to the app via the Clerk login page84 clerk_login_and_verify(page, test_email)8586 expect(page.get_by_text("Triumph of the Heart").first).to_be_visible()8788 # 5) Play the video89 page.get_by_role("button").filter(has_text="Play").click()9091 # wait for the page to completely load92 wait_for_loading(page)9394 expect(page.get_by_text("Triumph of the Heart").first).to_be_visible()95 expect(page.get_by_text("Play")).not_to_be_visible()9697 assert_no_console_errors(98 request,99 ignore=[100 {101 # if there are console errors specific to the project, exclude them here. Match to the specific URL if you can.102 "file": r"https://iframe.cloudflarestream.com/.*",103 "message": "the server responded with a status of 403",104 }105 ],106 )107```108
One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| iloveitaly/llm-ide-rules.cursor/rules/python.mdc · 13 | Cursor rules | setupstyletypesdo-not | 88/100 | 14 days ago | |
| iloveitaly/llm-ide-rules.cursor/rules/alembic-migrations.mdc · 13 | Cursor rules | no sections | 50/100 | 14 days ago | |
| iloveitaly/llm-ide-rules.cursor/rules/fastapi.mdc · 13 | Cursor rules | no sections | 24/100 | 14 days ago | |
| iloveitaly/llm-ide-rules.cursor/rules/general.mdc · 13 | Cursor rules | teststyledo-notagent-behaviour+1 | 92/100 | 14 days ago | |
| iloveitaly/llm-ide-rules.cursor/rules/justfiles.mdc · 13 | Cursor rules | do-not | 31/100 | 14 days ago | |
| iloveitaly/llm-ide-rules.cursor/rules/pytest-integration-tests.mdc · 13 | Cursor rules | teststyletesting-strategy | 73/100 | 14 days ago | |
| iloveitaly/llm-ide-rules.cursor/rules/pytest-tests.mdc · 13 | Cursor rules | testarchtesting-strategyapi+1 | 61/100 | 14 days ago | |
| iloveitaly/llm-ide-rules.cursor/rules/python-app.mdc · 13 | Cursor rules | styledatabasedocs | 61/100 | 14 days ago | |
| iloveitaly/llm-ide-rules.cursor/rules/python-route-tests.mdc · 13 | Cursor rules | api | 24/100 | 14 days ago | |
| iloveitaly/llm-ide-rules.cursor/rules/react-router.mdc · 13 | Cursor rules | testing-strategy | 57/100 | 14 days ago | |
| iloveitaly/llm-ide-rules.cursor/rules/react.mdc · 13 | Cursor rules | styletesting-strategyuido-not | 60/100 | 14 days ago | |
| iloveitaly/llm-ide-rules.cursor/rules/shell.mdc · 13 | Cursor rules | no sections | 4/100 | 14 days ago | |
| iloveitaly/llm-ide-rules.cursor/rules/typescript.mdc · 13 | Cursor rules | styletypessecurity | 63/100 | 14 days ago | |
| iloveitaly/llm-ide-rules.github/copilot-instructions.md · 13 | Copilot instructions | teststyledo-notagent-behaviour+1 | 92/100 | 14 days ago | |
| iloveitaly/llm-ide-rules.github/instructions/alembic-migrations.instructions.md · 13 | Copilot instructions | no sections | 50/100 | 14 days ago | |
| iloveitaly/llm-ide-rules.github/instructions/fastapi.instructions.md · 13 | Copilot instructions | no sections | 16/100 | 14 days ago | |
| iloveitaly/llm-ide-rules.github/instructions/justfiles.instructions.md · 13 | Copilot instructions | do-not | 31/100 | 14 days ago | |
| iloveitaly/llm-ide-rules.github/instructions/pytest-tests.instructions.md · 13 | Copilot instructions | testarchtesting-strategyapi+1 | 53/100 | 14 days ago | |
| iloveitaly/llm-ide-rules.github/instructions/python-app.instructions.md · 13 | Copilot instructions | styledatabasedocs | 61/100 | 14 days ago | |
| iloveitaly/llm-ide-rules.github/instructions/python-route-tests.instructions.md · 13 | Copilot instructions | api | 16/100 | 14 days ago |
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| pytorch/pytorch.github/copilot-instructions.md · 102k | Copilot instructions | setupbuildteststyle+5 | 100/100 | 14 days ago | |
| hiyouga/LlamaFactory.github/copilot-instructions.md · 74k | Copilot instructions | setupbuildtestlint-format+5 | 97/100 | 13 days ago | |
| doubts-suplab/eeik-bootstrap.github/instructions/cdk-terraform.instructions.md · 1 | Copilot instructions | teststylearchtypes+2 | 96/100 | today | |
| darkmatter/nixmac.github/copilot-instructions.md · 25 | Copilot instructions | setupbuildtestlint-format+8 | 96/100 | 14 days ago | |
| doubts-suplab/eeik-bootstrap.github/instructions/java-quality.instructions.md · 1 | Copilot instructions | testlint-formatstyletesting-strategy+3 | 93/100 | today | |
| doubts-suplab/eeik-bootstrap.github/instructions/python.instructions.md · 1 | Copilot instructions | testlint-formatstyletypes+3 | 93/100 | today | |
| iloveitaly/llm-ide-rules.github/copilot-instructions.md · 13 | Copilot instructions | teststyledo-notagent-behaviour+1 | 92/100 | 14 days ago | |
| gasbasd/mtg-utils.github/copilot-instructions.md · 0 | Copilot instructions | setupbuildtestlint-format+3 | 89/100 | 8 days ago |
A badge carrying the measured quality of the strongest agent config file in this repository, out of 100. It reads from this index every time somebody loads your page, so it changes when the measurement changes and there is nothing to keep up to date. Free, no account, and the value is not something you or we can set by hand.
[](https://rulestack.kynth.studio/configs/iloveitaly-llm-ide-rules-github-instructions-pytest-integration-tests-instructions)Would rather not hotlink us? Every badge is also served in shields.io’s endpoint schema, so shields renders the image and your readers never talk to our domain:
Published by Toolproof, the masthead over this index and eight others. The method behind the number is at toolproof.kynth.studio/methodology, and the whole thing is readable as JSON with no key at /api.