-
Notifications
You must be signed in to change notification settings - Fork 40
codeGraph/canvas tests #285
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe changes introduce new functionality to the Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
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.
Copilot reviewed 2 out of 2 changed files in this pull request and generated no suggestions.
Comments skipped due to low confidence (1)
e2e/logic/POM/codeGraph.ts:140
- The parameter 'checkbox' should be of type 'number' instead of 'string' to avoid confusion and potential errors.
private get codeGraphCheckbox(): (checkbox: string) => Locator {
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.
Actionable comments posted: 2
🧹 Outside diff range and nitpick comments (1)
e2e/tests/codeGraph.spec.ts (1)
129-138: LGTM with a suggestion for enhanced test coverageThe test cases effectively verify the checkbox functionality for each color. Consider adding complementary tests to verify that:
- Nodes are visible by default before unchecking
- Re-checking the checkbox makes the nodes visible again
colors.forEach((color, index) => { const checkboxIndex = index + 1; test(`Verify that unchecking the ${color} checkbox hides ${color} nodes on the canvas`, async () => { const codeGraph = await browser.createNewPage(CodeGraph, urls.baseUrl); await codeGraph.selectGraph(GRAPH_ID); + const initialResult = await codeGraph.getCanvasAnalysis(); + expect(initialResult[color].length).toBeGreaterThan(0); await codeGraph.selectCodeGraphCheckbox(checkboxIndex.toString()); const result = await codeGraph.getCanvasAnalysis(); expect(result[color].length).toBe(0); + await codeGraph.selectCodeGraphCheckbox(checkboxIndex.toString()); + const finalResult = await codeGraph.getCanvasAnalysis(); + expect(finalResult[color].length).toBe(initialResult[color].length); }); })
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
e2e/logic/POM/codeGraph.ts(3 hunks)e2e/tests/codeGraph.spec.ts(2 hunks)
🔇 Additional comments (2)
e2e/tests/codeGraph.spec.ts (1)
5-5: LGTM: Import changes align with test requirements
The additional imports are appropriately used in the new test cases.
e2e/logic/POM/codeGraph.ts (1)
140-146: LGTM: Locator implementations are consistent
The new locators follow the established patterns and use consistent XPath selectors.
| test(`Verify "Clear graph" button resets canvas view`, async () => { | ||
| const codeGraph = await browser.createNewPage(CodeGraph, urls.baseUrl); | ||
| await codeGraph.selectGraph(GRAPH_ID); | ||
| const initialAnalysis = await codeGraph.getCanvasAnalysis(); | ||
| const initialNodeCount = initialAnalysis.green.length + initialAnalysis.yellow.length + initialAnalysis.red.length; | ||
| await codeGraph.clickOnshowPathBtn(); | ||
| await codeGraph.insertInputForShowPath("1", Node_Import_Data); | ||
| await codeGraph.insertInputForShowPath("2", Node_Add_Edge); | ||
| await codeGraph.clickOnClearGraphBtn(); | ||
| const finalAnalysis = await codeGraph.getCanvasAnalysis(); | ||
| const finalNodeCount = finalAnalysis.green.length + finalAnalysis.yellow.length + finalAnalysis.red.length; | ||
| expect(initialNodeCount).toBe(finalNodeCount); | ||
|
|
||
| }); |
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
Enhance test coverage for clear graph functionality
While the test verifies node count consistency, consider adding assertions to verify that:
- The show path is no longer visible
- The input fields are cleared
- The graph state is fully reset
test(`Verify "Clear graph" button resets canvas view`, async () => {
const codeGraph = await browser.createNewPage(CodeGraph, urls.baseUrl);
await codeGraph.selectGraph(GRAPH_ID);
const initialAnalysis = await codeGraph.getCanvasAnalysis();
const initialNodeCount = initialAnalysis.green.length + initialAnalysis.yellow.length + initialAnalysis.red.length;
await codeGraph.clickOnshowPathBtn();
await codeGraph.insertInputForShowPath("1", Node_Import_Data);
await codeGraph.insertInputForShowPath("2", Node_Add_Edge);
+ // Verify path is visible before clearing
+ expect(await codeGraph.isNodeVisibleInLastChatPath(Node_Import_Data)).toBe(true);
+ expect(await codeGraph.isNodeVisibleInLastChatPath(Node_Add_Edge)).toBe(true);
await codeGraph.clickOnClearGraphBtn();
const finalAnalysis = await codeGraph.getCanvasAnalysis();
const finalNodeCount = finalAnalysis.green.length + finalAnalysis.yellow.length + finalAnalysis.red.length;
expect(initialNodeCount).toBe(finalNodeCount);
+ // Verify path is cleared
+ expect(await codeGraph.isNodeVisibleInLastChatPath(Node_Import_Data)).toBe(false);
+ expect(await codeGraph.isNodeVisibleInLastChatPath(Node_Add_Edge)).toBe(false);
+ // Verify input fields are cleared
+ expect(await codeGraph.getSearchBarInputValue()).toBe("");
});Committable suggestion skipped: line range outside the PR's diff.
| async selectCodeGraphCheckbox(checkbox: string): Promise<void> { | ||
| await this.codeGraphCheckbox(checkbox).click(); | ||
| } | ||
|
|
||
| async clickOnClearGraphBtn(): Promise<void> { | ||
| await this.clearGraphBtn.click(); | ||
| } |
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
Add wait states for improved test reliability
Consider adding wait states similar to other methods in the class to ensure reliable test execution.
async selectCodeGraphCheckbox(checkbox: string): Promise<void> {
+ await this.page.waitForLoadState('networkidle');
await this.codeGraphCheckbox(checkbox).click();
}
async clickOnClearGraphBtn(): Promise<void> {
+ await this.page.waitForLoadState('networkidle');
await this.clearGraphBtn.click();
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| async selectCodeGraphCheckbox(checkbox: string): Promise<void> { | |
| await this.codeGraphCheckbox(checkbox).click(); | |
| } | |
| async clickOnClearGraphBtn(): Promise<void> { | |
| await this.clearGraphBtn.click(); | |
| } | |
| async selectCodeGraphCheckbox(checkbox: string): Promise<void> { | |
| await this.page.waitForLoadState('networkidle'); | |
| await this.codeGraphCheckbox(checkbox).click(); | |
| } | |
| async clickOnClearGraphBtn(): Promise<void> { | |
| await this.page.waitForLoadState('networkidle'); | |
| await this.clearGraphBtn.click(); | |
| } |
- adding delay for tip popup dismissal - update node drag test for correct validation - increase playwright workers number
Summary by CodeRabbit
New Features
Bug Fixes
Tests