Skip to content

Commit a9ef198

Browse files
committed
fix tests
1 parent 0e4d9a2 commit a9ef198

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

e2e/logic/utils.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,8 @@ export function findNodeByName(nodes: { name: string }[], nodeName: string): any
2121

2222
export function findFirstNodeWithSrc(nodes: { src?: string }[]): any {
2323
return nodes.find((node) => node.src !== undefined);
24+
}
25+
26+
export function findNodeWithSpecificSrc(nodes: { src?: string }[], srcContent: string): any {
27+
return nodes.find((node) => node.src && node.src.includes(srcContent));
2428
}

e2e/tests/nodeDetailsPanel.spec.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import { test, expect } from "@playwright/test";
22
import BrowserWrapper from "../infra/ui/browserWrapper";
33
import CodeGraph from "../logic/POM/codeGraph";
44
import urls from "../config/urls.json";
5-
import { FLASK_GRAPH, GRAPHRAG_SDK, } from "../config/constants";
5+
import { FLASK_GRAPH, GRAPHRAG_SDK } from "../config/constants";
6+
import { findNodeByName, findFirstNodeWithSrc, findNodeWithSpecificSrc } from "../logic/utils";
67
import { nodes } from "../config/testData";
78
import { ApiCalls } from "../logic/api/apiCalls";
8-
import { findFirstNodeWithSrc, findNodeByName } from "../logic/utils";
99

1010
test.describe("Node details panel tests", () => {
1111
let browser: BrowserWrapper;
@@ -58,17 +58,21 @@ test.describe("Node details panel tests", () => {
5858
})
5959

6060

61-
test(`Validate copy functionality for node inside node details panel and verify with api`, async () => {
61+
test.only(`Validate copy functionality for node inside node details panel and verify with api`, async () => {
62+
const api = new ApiCalls();
63+
const response = await api.getProject(FLASK_GRAPH);
64+
6265
const codeGraph = await browser.createNewPage(CodeGraph, urls.baseUrl);
6366
await browser.setPageToFullScreen();
6467
await codeGraph.selectGraph(FLASK_GRAPH);
6568
const graphData = await codeGraph.getGraphNodes();
66-
const targetNode = findFirstNodeWithSrc(graphData);
69+
const targetNode = findNodeWithSpecificSrc(graphData, "test_options_work");
70+
71+
await new Promise(resolve => setTimeout(resolve, 2000));
6772
await codeGraph.nodeClick(targetNode.screenX, targetNode.screenY);
6873
await codeGraph.clickOnViewNode();
6974
const result = await codeGraph.clickOnCopyToClipboardNodePanelDetails();
70-
const api = new ApiCalls();
71-
const response = await api.getProject(FLASK_GRAPH);
75+
7276
const foundNode = response.result.entities.nodes.find((nod) => nod.properties?.name === targetNode.name);
7377
expect(foundNode?.properties.src).toBe(result);
7478
});

0 commit comments

Comments
 (0)