Skip to content

Commit 15c5e1d

Browse files
committed
fixup! Render graph visualization as PNG files
1 parent 5a70a4f commit 15c5e1d

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

graph-visualization/artifactDependenciesGraph/artifactDependenciesGraph.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@
1313
<script type="text/javascript" src="artifactDependenciesGraph.js"></script>
1414
</head>
1515

16-
<body onload="draw()">
16+
<body">
17+
<span>
18+
<label for="neo4j-server-password">Neo4j Server Password:</label>
19+
<input type="password" id="neo4j-server-password" name="neo4j-server-password" />
20+
<input type="submit" id="neo4j-server-login" value="Login" onClick="draw()" />
21+
</span>
1722
<div id="viz"></div>
1823
</body>
1924

graph-visualization/artifactDependenciesGraph/artifactDependenciesGraph.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ function draw() {
44
neo4j: {
55
serverUrl: "bolt://localhost:7687",
66
serverUser: "neo4j",
7-
serverPassword: "neo4jinitial",
7+
serverPassword: document.getElementById("neo4j-server-password").value || "neo4jinitial",
88
},
99
visConfig: {
1010
nodes: {

graph-visualization/renderVisualizations.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,17 @@ const camelToKebabCase = (str) => str.replace(/[A-Z]/g, (letter) => `-${letter.t
2626
const takeCanvasScreenshots = async (browser, htmlFilename) => {
2727
const page = await browser.newPage();
2828
await page.setViewport({ width: 1600, height: 1000, isMobile: false, isLandscape: true, hasTouch: false, deviceScaleFactor: 1 });
29-
await page.goto(`file://${htmlFilename}`, { waitUntil: "domcontentloaded" });
3029

31-
// Wait for a canvas element on the page
32-
await page.waitForSelector("div canvas", { timeout: 40_000 });
30+
console.log(`Loading ${htmlFilename}`);
31+
await page.goto(`file://${htmlFilename}`);
32+
33+
// Login with Neo4j server password from the environment variable NEO4J_INITIAL_PASSWORD
34+
const loginButton = await page.waitForSelector('#neo4j-server-login');
35+
await page.type('#neo4j-server-password', process.env.NEO4J_INITIAL_PASSWORD);
36+
await loginButton.click();
37+
38+
// Wait for the graph visualization to be rendered onto a HTML5 canvas
39+
await page.waitForSelector("div canvas");
3340

3441
// Get all HTML canvas tag elements
3542
const canvasElements = await page.$$("div canvas");

0 commit comments

Comments
 (0)