-
Notifications
You must be signed in to change notification settings - Fork 516
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
Modified the cypress file structure docs #9925
Merged
+48
−11
Merged
Changes from 9 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
9c4b18e
added a facility card visibility check
nihal467 fe7146c
Merge branch 'develop' into cypres-patch-2
nihal467 93d631e
adjust the facility name verification
nihal467 44eae65
adjust the typeintofield command function verification check
nihal467 77ec9c7
adjusted the command function
nihal467 7d2b51f
adjusted the delay in command function
nihal467 bf5514a
modified the file structure
nihal467 cf0419f
Merge branch 'develop' into cypres-patch-2
nihal467 8604028
fixed the facility search flaky test
nihal467 2623699
fixed the api request
nihal467 530d859
match default debounce
nihal467 13fd331
Merge branch 'develop' into cypres-patch-2
nihal467 f5434ae
trying out a hack to control search field
nihal467 8275679
Merge branch 'cypres-patch-2' of https://github.com/ohcnetwork/care_f…
nihal467 62bc4e3
implement force true to bypass cypress behavior
nihal467 9a80534
removed should check
nihal467 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,52 @@ | ||
# Best Practices | ||
|
||
## Test Independence | ||
|
||
- Each test should be independent and isolated | ||
- Clean up test data after tests | ||
- Don't rely on the state from other tests | ||
|
||
## API Testing | ||
|
||
- Use cy.intercept() for API verification | ||
- Use waitUntil() for API completion | ||
- Avoid cy.wait() except for API responses | ||
|
||
## Element Interaction | ||
|
||
- Always verify element state before interaction | ||
- Use data-cy attributes for selectors | ||
- Verify button text before clicking | ||
- Always verify loading states before and after interactions | ||
|
||
## Code Organization | ||
|
||
- Keep tests focused and concise | ||
- Follow AAA pattern (Arrange, Act, Assert) | ||
- Use meaningful test descriptions | ||
|
||
## Common Pitfalls to Avoid | ||
|
||
- Redundant visibility checks with verifyAndClickElement | ||
- Hardcoded values in page objects | ||
- Unnecessary waits | ||
- Test interdependencies | ||
- Skipping API verifications | ||
- Using arbitrary timeouts instead of proper waits | ||
|
||
## Performance Considerations | ||
|
||
- Minimize unnecessary API calls | ||
- Use efficient selectors | ||
- Batch similar operations | ||
- Batch similar operations | ||
|
||
## Testing Checklist | ||
|
||
Before submitting your test, verify: | ||
|
||
- [ ] All API calls are intercepted and verified | ||
- [ ] Loading states are handled properly | ||
- [ ] Success/error states are verified | ||
- [ ] No arbitrary timeouts used | ||
- [ ] Search operations include debounce handling | ||
- [ ] Form submissions verify both request and response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Improve API interception and search handling.
While adding API verification is good, there are a few improvements needed:
**/api/v1/facility/**
is too broad and could catch unintended requestsConsider this implementation: