Skip to content

Commit 62c69a1

Browse files
committed
test #306
1 parent 76d089d commit 62c69a1

File tree

2 files changed

+38
-6
lines changed

2 files changed

+38
-6
lines changed

e2e/logic/POM/codeGraph.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ export default class CodeGraph extends BasePage {
192192
return this.page.locator("//div[@data-name='node-details-panel']/main/div[1]/p[2]");
193193
}
194194

195+
private get nodedetailsPanelElements(): Locator {
196+
return this.page.locator("//div[@data-name='node-details-panel']/main/div/p[1]");
197+
}
198+
195199
/* NavBar functionality */
196200
async clickOnFalkorDbLogo(): Promise<Page> {
197201
await this.page.waitForLoadState('networkidle');
@@ -451,4 +455,10 @@ export default class CodeGraph extends BasePage {
451455
return await this.nodedetailsPanelID.innerHTML();
452456
}
453457

458+
async getNodeDetailsPanelElements(): Promise<string[]> {
459+
await this.elementMenuButton("View Node").click();
460+
await delay(500)
461+
const elements = await this.nodedetailsPanelElements.all();
462+
return Promise.all(elements.map(element => element.innerHTML()));
463+
}
454464
}

e2e/tests/codeGraph.spec.ts

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -252,17 +252,14 @@ test.describe("Code graph tests", () => {
252252
await codeGraph.clickOnshowPathBtn();
253253
await codeGraph.insertInputForShowPath("1", firstNode);
254254
await codeGraph.insertInputForShowPath("2", secondNode);
255-
const result = await codeGraph.getCanvasAnalysis();
256-
console.log(result);
257-
255+
const result = await codeGraph.getCanvasAnalysis();
258256
const res = [];
259257
for (const node of result.green) {
260258
await codeGraph.rightClickOnNode(node.x, node.y);
261259
const details = await codeGraph.getNodeDetailsHeader();
262260
await codeGraph.clickOnNodeDetailsCloseBtn();
263261
res.push(details);
264262
}
265-
console.log(res);
266263

267264
expect(res.some((item) => item.includes(firstNode.toUpperCase()))).toBe(true);
268265
expect(res.some((item) => item.includes(secondNode.toUpperCase()))).toBe(true);
@@ -302,5 +299,30 @@ test.describe("Code graph tests", () => {
302299
);
303300
expect(containsDetails).toBe(true);
304301
});
305-
306-
});
302+
303+
test(`Validate view node panel keys for required and optional fields`, async () => {
304+
const codeGraph = await browser.createNewPage(CodeGraph, urls.baseUrl);
305+
await codeGraph.selectGraph(GRAPH_ID);
306+
const analysis = await codeGraph.getCanvasAnalysis();
307+
const requiredKeys: string[] = ['id', 'name', 'args', 'path', 'src_end', 'src_start'];
308+
const optionalKeys: string[] = ['src'];
309+
await Promise.all(
310+
analysis.green.slice(0, 2).map(async (node) => {
311+
await codeGraph.rightClickOnNode(node.x, node.y);
312+
const elements = await codeGraph.getNodeDetailsPanelElements();
313+
314+
requiredKeys.forEach((key) => {
315+
const isKeyPresent = elements.some((element) => element.includes(key));
316+
expect(isKeyPresent).toBe(true);
317+
});
318+
optionalKeys.forEach((key) => {
319+
const isKeyPresent = elements.some((element) => element.includes(key));
320+
if (isKeyPresent) {
321+
expect(isKeyPresent).toBe(true);
322+
}
323+
});
324+
})
325+
);
326+
});
327+
328+
});

0 commit comments

Comments
 (0)