-
Couldn't load subscription status.
- Fork 18
TestContext for E2E Debugging #1312
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
base: main
Are you sure you want to change the base?
Conversation
…w inferred return type
…ectPageEvalToPass for event assertions
…eEvalToPass for assertions
…e2e-client-tests-new-util-pattern
|
|
Claude finished @LittorWired's task —— View job Code Review Complete ✅I've reviewed the TestContext for E2E Debugging implementation. Overall, this is a well-structured addition that provides valuable debugging capabilities for e2e tests. Todo List:
Code Quality & Best Practices ⭐Strengths:
Areas for Improvement:
Potential Bugs & Issues 🐛
Performance Considerations ⚡
Security Assessment 🔒Low Risk Areas:
Recommendations:
Test Coverage Analysis 🧪Missing Test Coverage:
Suggested Tests: // Example test structure
describe('TestContext', () => {
it('should categorize SDK events correctly')
it('should handle malformed payloads gracefully')
it('should prevent memory leaks with large event counts')
})Specific Code Issues 📝
Recommendations Summary 📋High Priority:
Medium Priority:
Low Priority:
Changeset Notice 📦The bot correctly identified that this PR needs a changeset. Since this adds new e2e testing utilities, consider adding: "@sw-internal/e2e-client": patchOverall Assessment: This is a solid implementation that will significantly improve e2e test debugging capabilities. The main concerns are around memory management and error handling robustness, but these are addressable in follow-up iterations. |
|
@jpsantosbh , @RafaelPChequer can you please take a look at this branch and let me know your thoughts on how we can better leverage this to improve the e2e debugging experience for the SDK/server events? This is just a preliminary idea and still needs work to improve the debugging process but I'd like to get early feedback to see if things are on track.
|
internal/e2e-client/TestContext.ts
Outdated
| type EventCategory = | ||
| | 'connection' | ||
| | 'call' | ||
| | 'room' | ||
| | 'member' | ||
| | 'chat' | ||
| | 'verto' | ||
| | 'voice' | ||
| | 'other' |
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.
I feel we should have fewer categories: transport(WS), connection(signalwire.), callSession(others !conversations), conversations(conversations.), tests(artificial events describing the tests)
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.
Reduced the categories to the one's mentioned transport , connection, callSession , conversations , and tests
| } | ||
| } | ||
|
|
||
| private getCategory(payload: Payload) { |
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.
Maybe we could have a concrete implementation for the SDKEvent interface with these utilities
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.
Based on the feedback, I implemented the SDKEvent as its own class.
| await use(maker) | ||
| } finally { | ||
| // attach test context if failed test | ||
| if (testInfo.status !== 'passed' && testInfo.status !== 'skipped') { |
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.
Are there any drawbacks to always attaching the context, but only rendering the summary in the failure reports? Will the attachments be available to download in GHA?
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.
Are there any drawbacks to always attaching the context, but only rendering the summary in the failure reports?
I am not aware of anything other than potentially having some minor perf issues?
Will the attachments be available to download in GHA?
That should be possible if the trace artifact is uploaded to GH see: https://playwright.dev/docs/ci-intro#setting-up-github-actions
Example
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30
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.
I'm like this so far...
Is it possible to add an utility to create manual events inside the test implementations.
Also, is it possible ass some context expectation, not to be asserted but just as a contrast in the final report, like: events: received 10 - expected 11
Co-authored-by: João Paulo Barbosa Marques dos Santos <[email protected]>
…in e2e playwright tests
… into tl/cp-16075-e2e-test-context
|
Claude finished @LittorWired's task —— View job I'm reviewing the TestContext for E2E Debugging implementation. Let me analyze the code changes and provide comprehensive feedback. Review Tasks
Code Review Complete ✅I've reviewed the TestContext for E2E Debugging implementation. Overall, this is a well-structured addition that provides valuable debugging capabilities for e2e tests. The implementation follows SignalWire's event-driven architecture patterns and integrates cleanly with the existing Playwright setup. Code Quality & Best Practices ⭐Strengths:
Areas for Improvement:
Potential Bugs & Issues 🐛High Priority:
Medium Priority:
Performance Considerations ⚡
Security Assessment 🔒Low Risk Overall:
Recommendations:
Test Coverage Analysis 🧪Missing Coverage:
Suggested Test Structure: describe('TestContext', () => {
it('should categorize SDK events correctly')
it('should handle malformed WebSocket payloads gracefully')
it('should prevent memory leaks with event limits')
it('should maintain stats accuracy across different event types')
})Addressing Previous Review Comments 📝@jpsantosbh's feedback alignment:
Specific Code Issues 📍
Recommendations Summary 🎯Immediate (Before Merge):
Short Term:
Future Enhancements:
Changeset Requirement 📦The changeset bot correctly identified this needs a changeset. Recommend: "@sw-internal/e2e-client": patchOverall Assessment: This is a solid foundation for e2e debugging that will significantly improve developer experience. The main concerns around memory management and performance optimization are addressable in follow-up iterations. The implementation demonstrates good understanding of the SignalWire architecture and testing patterns. |
…ssion, conversations, and tests
|
Claude finished @LittorWired's task —— View job I'll review this TestContext for E2E Debugging implementation and provide comprehensive feedback. Review Tasks
Code Review Complete ✅I've reviewed the TestContext for E2E Debugging implementation. Overall, this is a well-structured addition that provides valuable debugging capabilities for e2e tests. The implementation follows SignalWire's event-driven architecture patterns and integrates cleanly with the existing Playwright setup. Code Quality & Best Practices ⭐Strengths:
Areas for Improvement:
Potential Bugs & Issues 🐛High Priority:
Medium Priority:
Performance Considerations ⚡
Security Assessment 🔒Low Risk Overall:
Recommendations:
Test Coverage Analysis 🧪Missing Coverage:
Suggested Test Structure: describe('TestContext', () => {
it('should categorize SDK events correctly')
it('should handle malformed WebSocket payloads gracefully')
it('should prevent memory leaks with event limits')
it('should maintain accurate statistics across different event types')
it('should handle concurrent WebSocket connections')
})Addressing Previous Review Comments 📝@jpsantosbh's feedback alignment:
Specific Code Issues 📍
Recommendations Summary 🎯Immediate (Before Merge):
Short Term:
Future Enhancements:
Changeset Requirement 📦The changeset bot correctly identified this needs a changeset. Recommend: "@sw-internal/e2e-client": patchOverall Assessment: This is a solid foundation for e2e debugging that will significantly improve developer experience when troubleshooting test failures. The main concerns around memory management and performance optimization are addressable in follow-up iterations. The implementation demonstrates good understanding of the SignalWire architecture and testing patterns. The screenshots show a clean, informative debug interface that will be very helpful for developers. This feature addresses a real pain point in e2e test debugging and follows good software engineering practices. |
Thank you. I think the additional comments will need to be handed over to someone else to complete at this point, as I am directed to transition my work. |



Description
Creates an e2e test utility, the
TestContextto help with e2e tests debugging by collecting and categorizing WS events.Type of change
Code snippets
In case of new feature or breaking changes, please include code snippets.