Skip to content

Commit fe32302

Browse files
Copilotgkorland
andauthored
fix flaky CI for pinned e2e fixtures and docker build
Agent-Logs-Url: https://github.com/FalkorDB/code-graph/sessions/910ca5a2-cae1-4314-888b-d3524d86d7bc Co-authored-by: gkorland <753206+gkorland@users.noreply.github.com>
1 parent c97b7eb commit fe32302

6 files changed

Lines changed: 47 additions & 18 deletions

File tree

Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ COPY --from=node-base /usr/local/bin/node /usr/local/bin/node
2121
COPY --from=node-base /usr/local/lib/node_modules /usr/local/lib/node_modules
2222

2323
# Install netcat for wait loop in start.sh and system build tools
24-
RUN apt-get update && apt-get install -y --no-install-recommends \
24+
RUN apt-get update \
25+
&& DEBIAN_FRONTEND=noninteractive apt-get -y --fix-broken install \
26+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
2527
netcat-openbsd \
2628
git \
2729
build-essential \

e2e/logic/POM/codeGraph.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ export default class CodeGraph extends BasePage {
114114
return (buttonNum: string) => this.scopedLocator(`//div[@data-name='search-bar']//button[${buttonNum}]`);
115115
}
116116

117+
private get searchBarOptionByName(): (name: string) => Locator {
118+
return (name: string) => this.scopedLocator(`//div[@data-name='search-bar-list']//button[.//p[@title='${name}']]`).first();
119+
}
120+
117121
private get searchBarList(): Locator {
118122
return this.scopedLocator('div[data-name="search-bar-list"]');
119123
}
@@ -471,13 +475,18 @@ export default class CodeGraph extends BasePage {
471475
}
472476

473477
async getSearchBarElementsText(): Promise<string[]> {
478+
await interactWhenVisible(this.searchBarAutoCompleteOptions.first(), async () => {}, 'Search auto-complete options');
474479
return await this.searchBarElements.allTextContents();
475480
}
476481

477482
async selectSearchBarOptionBtn(buttonNum: string): Promise<void> {
478483
await interactWhenVisible(this.searchBarOptionBtn(buttonNum), (el) => el.click(), `Search bar option ${buttonNum}`);
479484
}
480485

486+
async selectSearchBarOption(name: string): Promise<void> {
487+
await interactWhenVisible(this.searchBarOptionByName(name), (el) => el.click(), `Search bar option ${name}`);
488+
}
489+
481490
async getSearchBarInputValue(): Promise<string | null> {
482491
const isVisible = await waitForElementToBeVisible(this.searchBarListFirstButtonInput);
483492
if (!isVisible) return null;

e2e/seed_test_data.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import os
55
import sys
66
import logging
7+
import subprocess
78

89
logging.basicConfig(
910
level=logging.INFO,
@@ -15,8 +16,14 @@
1516
from api.project import Project
1617

1718
REPOS = [
18-
"https://github.com/FalkorDB/GraphRAG-SDK",
19-
"https://github.com/pallets/flask",
19+
{
20+
"url": "https://github.com/FalkorDB/GraphRAG-SDK",
21+
"commit": "6e824d644757d2ad8079d4f6354ad06ffc2f855f",
22+
},
23+
{
24+
"url": "https://github.com/pallets/flask",
25+
"commit": "7374c85ddefc3f4b177a698ab9f0cbb6a5c0b392",
26+
},
2027
]
2128

2229
# CALLS edges required by E2E path tests (caller → callee)
@@ -60,10 +67,23 @@ def ensure_calls_edges(graph_name: str) -> None:
6067
)
6168

6269

70+
def checkout_commit(repo_path: str, commit_hash: str) -> None:
71+
logger.info("Checking out %s at %s", repo_path, commit_hash[:7])
72+
subprocess.run(
73+
["git", "-C", repo_path, "checkout", commit_hash],
74+
check=True,
75+
capture_output=True,
76+
text=True,
77+
)
78+
79+
6380
def main():
64-
for url in REPOS:
81+
for repo in REPOS:
82+
url = repo["url"]
83+
commit_hash = repo["commit"]
6584
logger.info("Seeding %s ...", url)
6685
proj = Project.from_git_repository(url)
86+
checkout_commit(str(proj.path), commit_hash)
6787
proj.analyze_sources()
6888
logger.info("Done seeding %s", url)
6989

e2e/tests/canvas.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ test.describe("Canvas tests", () => {
6363
await browser.setPageToFullScreen();
6464
await codeGraph.selectGraph(GRAPHRAG_SDK);
6565
await codeGraph.fillSearchBar(nodes[0].nodeName);
66-
await codeGraph.selectSearchBarOptionBtn("1");
66+
await codeGraph.selectSearchBarOption(nodes[0].nodeName);
6767
await codeGraph.waitForCanvasAnimationToEnd();
6868
const initialGraph = await codeGraph.getGraphNodes();
6969
const targetNode = findNodeByName(initialGraph, nodes[0].nodeName);
@@ -81,7 +81,7 @@ test.describe("Canvas tests", () => {
8181
await browser.setPageToFullScreen();
8282
await codeGraph.selectGraph(GRAPHRAG_SDK);
8383
await codeGraph.fillSearchBar(nodes[0].nodeName);
84-
await codeGraph.selectSearchBarOptionBtn("1");
84+
await codeGraph.selectSearchBarOption(nodes[0].nodeName);
8585
await codeGraph.waitForCanvasAnimationToEnd();
8686
await codeGraph.rightClickAtCanvasCenter();
8787
await codeGraph.clickOnRemoveNodeViaElementMenu();
@@ -148,7 +148,7 @@ test.describe("Canvas tests", () => {
148148
const initialGraph = await codeGraph.getGraphNodes();
149149
const nodeName = initialGraph[nodeIndex].name || initialGraph[nodeIndex].data?.name;
150150
await codeGraph.fillSearchBar(nodeName);
151-
await codeGraph.selectSearchBarOptionBtn("1");
151+
await codeGraph.selectSearchBarOption(nodeName);
152152
await codeGraph.waitForCanvasAnimationToEnd();
153153
const updatedGraph = await codeGraph.getGraphNodes();
154154
const targetNode = findNodeByName(updatedGraph, nodeName);
@@ -243,7 +243,7 @@ test.describe("Canvas tests", () => {
243243
await codeGraph.selectGraph(GRAPHRAG_SDK);
244244
await codeGraph.getGraphDetails();
245245
await codeGraph.fillSearchBar(node.nodeName);
246-
await codeGraph.selectSearchBarOptionBtn("1");
246+
await codeGraph.selectSearchBarOption(node.nodeName);
247247
await codeGraph.waitForCanvasAnimationToEnd();
248248
await codeGraph.hoverAtCanvasCenter();
249249
expect(await codeGraph.isNodeToolTipVisible(node.nodeName)).toBe(true);

e2e/tests/nodeDetailsPanel.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ test.describe("Node details panel tests", () => {
2424
await browser.setPageToFullScreen();
2525
await codeGraph.selectGraph(GRAPHRAG_SDK);
2626
await codeGraph.fillSearchBar(node.nodeName);
27-
await codeGraph.selectSearchBarOptionBtn("1");
27+
await codeGraph.selectSearchBarOption(node.nodeName);
2828
await codeGraph.waitForCanvasAnimationToEnd();
2929
const graphData = await codeGraph.getGraphNodes();
3030

@@ -42,7 +42,7 @@ test.describe("Node details panel tests", () => {
4242
await browser.setPageToFullScreen();
4343
await codeGraph.selectGraph(GRAPHRAG_SDK);
4444
await codeGraph.fillSearchBar(node.nodeName);
45-
await codeGraph.selectSearchBarOptionBtn("1");
45+
await codeGraph.selectSearchBarOption(node.nodeName);
4646
await codeGraph.waitForCanvasAnimationToEnd();
4747
const graphData = await codeGraph.getGraphNodes();
4848
const targetNode = findNodeByName(graphData, node.nodeName);
@@ -60,7 +60,7 @@ test.describe("Node details panel tests", () => {
6060
await browser.setPageToFullScreen();
6161
await codeGraph.selectGraph(GRAPHRAG_SDK);
6262
await codeGraph.fillSearchBar(node.nodeName);
63-
await codeGraph.selectSearchBarOptionBtn("1");
63+
await codeGraph.selectSearchBarOption(node.nodeName);
6464
await codeGraph.waitForCanvasAnimationToEnd();
6565
const graphData = await codeGraph.getGraphNodes();
6666
const targetNode = findNodeByName(graphData, node.nodeName);
@@ -79,7 +79,7 @@ test.describe("Node details panel tests", () => {
7979
const targetNode = graphData.find(node => node.src) || graphData[0];
8080
const nodeName = targetNode.name || targetNode.data?.name;
8181
await codeGraph.fillSearchBar(nodeName);
82-
await codeGraph.selectSearchBarOptionBtn("1");
82+
await codeGraph.selectSearchBarOption(nodeName);
8383
await codeGraph.waitForCanvasAnimationToEnd();
8484

8585
await codeGraph.rightClickAtCanvasCenter();
@@ -96,7 +96,7 @@ test.describe("Node details panel tests", () => {
9696
await browser.setPageToFullScreen();
9797
await codeGraph.selectGraph(GRAPHRAG_SDK);
9898
await codeGraph.fillSearchBar(node.nodeName);
99-
await codeGraph.selectSearchBarOptionBtn("1");
99+
await codeGraph.selectSearchBarOption(node.nodeName);
100100
await codeGraph.waitForCanvasAnimationToEnd();
101101
const graphData = await codeGraph.getGraphNodes();
102102
const targetNode = findNodeByName(graphData, node.nodeName);

e2e/tests/searchBar.spec.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ test.describe("search bar tests", () => {
3535
const codeGraph = await browser.createNewPage(CodeGraph, urls.baseUrl);
3636
await codeGraph.selectGraph(GRAPHRAG_SDK);
3737
await codeGraph.fillSearchBar(searchInput);
38-
expect(await codeGraph.getSearchBarInputValue()).toBe(
39-
completedSearchInput
40-
);
38+
expect(await codeGraph.getSearchBarElementsText()).toContain(completedSearchInput!);
4139
});
4240
});
4341

@@ -80,11 +78,11 @@ test.describe("search bar tests", () => {
8078
await codeGraph.selectGraph(GRAPHRAG_SDK);
8179
await codeGraph.getGraphDetails();
8280
await codeGraph.fillSearchBar(nodeName);
83-
await codeGraph.selectSearchBarOptionBtn("1");
81+
await codeGraph.selectSearchBarOption(nodeName);
8482
await codeGraph.waitForCanvasAnimationToEnd();
8583
await codeGraph.rightClickAtCanvasCenter();
8684
expect(await codeGraph.getNodeToolTipContent()).toContain(nodeName);
8785

8886
});
8987
})
90-
})
88+
})

0 commit comments

Comments
 (0)