Skip to content

Commit 681e655

Browse files
committed
remove logging, increase workers
1 parent c214063 commit 681e655

4 files changed

Lines changed: 12 additions & 48 deletions

File tree

e2e/logic/POM/codeGraph.ts

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -462,23 +462,18 @@ export default class CodeGraph extends BasePage {
462462
await button.click();
463463
}
464464

465-
async nodeClick(x: number, y: number): Promise<void> {
466-
console.log(`Clicking node at (${x}, ${y})`);
467-
468-
for (let attempt = 1; attempt <= 5; attempt++) {
465+
async nodeClick(x: number, y: number): Promise<void> {
466+
for (let attempt = 1; attempt <= 2; attempt++) {
469467
await this.canvasElement.hover({ position: { x, y } });
470468
await this.page.waitForTimeout(500);
471469

472470
if (await waitForElementToBeVisible(this.nodeToolTip)) {
473-
console.log("Tooltip visible, right-clicking...");
474471
await this.canvasElement.click({ position: { x, y }, button: 'right' });
475472
return;
476473
}
477-
478-
console.warn(`Attempt ${attempt}: Tooltip not visible, retrying...`);
479474
await this.page.waitForTimeout(1000);
480475
}
481-
476+
482477
throw new Error("Tooltip not visible after multiple attempts!");
483478
}
484479

@@ -584,8 +579,8 @@ export default class CodeGraph extends BasePage {
584579

585580
async getGraphDetails(): Promise<any> {
586581
await this.canvasElementBeforeGraphSelection.waitFor({ state: 'detached' });
587-
await this.page.waitForTimeout(3000); //canvas animation
588582
await this.page.waitForFunction(() => window.graph && window.graph.elements.nodes.length > 0);
583+
await this.page.waitForTimeout(2000); //canvas animation
589584

590585
const graphData = await this.page.evaluate(() => {
591586
return window.graph;
@@ -595,18 +590,14 @@ export default class CodeGraph extends BasePage {
595590
}
596591

597592
async transformNodeCoordinates(graphData: any): Promise<any[]> {
598-
let maxRetries = 5;
593+
let maxRetries = 3;
599594
let transform = null;
600595
let canvasRect = null;
601-
602-
// Ensure the graph is fully loaded before proceeding
603596
await this.page.waitForFunction(() => window.graph && window.graph.elements?.nodes?.length > 0);
604-
await this.page.waitForTimeout(3000); // Wait for canvas animations to settle
605597

606598
for (let attempt = 1; attempt <= maxRetries; attempt++) {
607-
await this.page.waitForTimeout(1000); // Allow further stabilization before fetching data
599+
await this.page.waitForTimeout(1000);
608600

609-
// Fetch canvas properties
610601
const result = await this.canvasElement.evaluate((canvas: HTMLCanvasElement) => {
611602
const rect = canvas.getBoundingClientRect();
612603
const ctx = canvas.getContext('2d');
@@ -615,24 +606,22 @@ export default class CodeGraph extends BasePage {
615606
canvasTop: rect.top,
616607
canvasWidth: rect.width,
617608
canvasHeight: rect.height,
618-
transform: ctx?.getTransform() || null, // Ensure transform is not null
609+
transform: ctx?.getTransform() || null,
619610
};
620611
});
621612

622613
if (!result.transform) {
623614
console.warn(`Attempt ${attempt}: Transform not available yet, retrying...`);
624-
continue; // Retry if transform is not available
615+
continue;
625616
}
626617

627-
// If we successfully get a transform, store and break out of retry loop
628618
transform = result.transform;
629619
canvasRect = result;
630620
break;
631621
}
632622

633623
if (!transform) throw new Error("Canvas transform data not available after multiple attempts!");
634-
635-
// Convert graph coordinates to screen coordinates
624+
636625
return graphData.elements.nodes.map((node: any) => {
637626
const adjustedX = node.x * transform.a + transform.e;
638627
const adjustedY = node.y * transform.d + transform.f;

e2e/tests/canvas.spec.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,8 @@ test.describe("Canvas tests", () => {
5858
const codeGraph = await browser.createNewPage(CodeGraph, urls.baseUrl);
5959
await codeGraph.selectGraph(GRAPH_ID);
6060
const initialGraph = await codeGraph.getGraphDetails();
61-
const nod = findNodeByName(initialGraph.elements.nodes, node.nodeName);
62-
console.log("before x:", nod.x, " before y: ",nod.y);
6361
const convertCoordinates = await codeGraph.transformNodeCoordinates(initialGraph);
6462
const targetNode = findNodeByName(convertCoordinates, node.nodeName);
65-
console.log("after test: ", targetNode.screenX, " ", targetNode.screenY);
6663
await codeGraph.nodeClick(targetNode.screenX, targetNode.screenY);
6764
await codeGraph.clickOnRemoveNodeViaElementMenu();
6865
const updatedGraph = await codeGraph.getGraphDetails();
@@ -76,11 +73,8 @@ test.describe("Canvas tests", () => {
7673
const codeGraph = await browser.createNewPage(CodeGraph, urls.baseUrl);
7774
await codeGraph.selectGraph(GRAPH_ID);
7875
const initialGraph = await codeGraph.getGraphDetails();
79-
const nod = findNodeByName(initialGraph.elements.nodes, node.nodeName);
80-
console.log("before x:", nod.x, " before y: ",nod.y);
8176
const convertCoordinates = await codeGraph.transformNodeCoordinates(initialGraph);
8277
const targetNode = findNodeByName(convertCoordinates, node.nodeName);
83-
console.log("after test: ", targetNode.screenX, " ", targetNode.screenY);
8478
await codeGraph.nodeClick(targetNode.screenX, targetNode.screenY);
8579
await codeGraph.clickOnRemoveNodeViaElementMenu();
8680
await codeGraph.clickOnUnhideNodesBtn();
@@ -176,11 +170,8 @@ test.describe("Canvas tests", () => {
176170
const codeGraph = await browser.createNewPage(CodeGraph, urls.baseUrl);
177171
await codeGraph.selectGraph(GRAPH_ID);
178172
const graphData = await codeGraph.getGraphDetails();
179-
const nod = findNodeByName(graphData.elements.nodes, node.nodeName);
180-
console.log("before x:", nod.x, " before y: ",nod.y);
181173
const convertCoordinates = await codeGraph.transformNodeCoordinates(graphData);
182174
const targetNode = findNodeByName(convertCoordinates, node.nodeName);
183-
console.log("after x:", targetNode.x, " after y: ",targetNode.y);
184175
await codeGraph.nodeClick(targetNode.screenX, targetNode.screenY);
185176
const result = await codeGraph.clickOnCopyToClipboard();
186177
const api = new ApiCalls();

e2e/tests/nodeDetailsPanel.spec.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,8 @@ test.describe("Node details panel tests", () => {
2323
const codeGraph = await browser.createNewPage(CodeGraph, urls.baseUrl);
2424
await codeGraph.selectGraph(GRAPH_ID);
2525
const graphData = await codeGraph.getGraphDetails();
26-
const nod = findNodeByName(graphData.elements.nodes, node.nodeName);
27-
console.log("before x:", nod.x, " before y: ",nod.y);
2826
const convertCoordinates = await codeGraph.transformNodeCoordinates(graphData);
2927
const targetNode = findNodeByName(convertCoordinates, node.nodeName);
30-
console.log("after test: ", targetNode.screenX, " ", targetNode.screenY);
3128
expect(targetNode).toBeDefined();
3229
await codeGraph.nodeClick(targetNode.screenX, targetNode.screenY);
3330
await codeGraph.clickOnViewNode();
@@ -40,11 +37,8 @@ test.describe("Node details panel tests", () => {
4037
const codeGraph = await browser.createNewPage(CodeGraph, urls.baseUrl);
4138
await codeGraph.selectGraph(GRAPH_ID);
4239
const graphData = await codeGraph.getGraphDetails();
43-
const nod = findNodeByName(graphData.elements.nodes, node.nodeName);
44-
console.log("before x:", nod.x, " before y: ",nod.y);
4540
const convertCoordinates = await codeGraph.transformNodeCoordinates(graphData);
4641
const node1 = findNodeByName(convertCoordinates, node.nodeName);
47-
console.log("after test: ", node1.screenX, " ", node1.screenY);
4842
await codeGraph.nodeClick(node1.screenX, node1.screenY);
4943
await codeGraph.clickOnViewNode();
5044
await codeGraph.clickOnNodeDetailsCloseBtn();
@@ -57,11 +51,8 @@ test.describe("Node details panel tests", () => {
5751
const codeGraph = await browser.createNewPage(CodeGraph, urls.baseUrl);
5852
await codeGraph.selectGraph(GRAPH_ID);
5953
const graphData = await codeGraph.getGraphDetails();
60-
const nod = findNodeByName(graphData.elements.nodes, node.nodeName);
61-
console.log("before x:", nod.x, " before y: ",nod.y);
6254
const convertCoordinates = await codeGraph.transformNodeCoordinates(graphData);
6355
const node1 = findNodeByName(convertCoordinates, node.nodeName);
64-
console.log("after test: ", node1.screenX, " ", node1.screenY);
6556
await codeGraph.nodeClick(node1.screenX, node1.screenY);
6657
expect(await codeGraph.getNodeDetailsHeader()).toContain(node.nodeName.toUpperCase())
6758
})
@@ -72,11 +63,8 @@ test.describe("Node details panel tests", () => {
7263
const codeGraph = await browser.createNewPage(CodeGraph, urls.baseUrl);
7364
await codeGraph.selectGraph(GRAPH_ID);
7465
const graphData = await codeGraph.getGraphDetails();
75-
const nod = findNodeByName(graphData.elements.nodes, node.nodeName);
76-
console.log("before x:", nod.x, " before y: ",nod.y);
7766
const convertCoordinates = await codeGraph.transformNodeCoordinates(graphData);
7867
const nodeData = findNodeByName(convertCoordinates, node.nodeName);
79-
console.log("after test: ", nodeData.screenX, " ", nodeData.screenY);
8068
await codeGraph.nodeClick(nodeData.screenX, nodeData.screenY);
8169
await codeGraph.clickOnViewNode();
8270
const result = await codeGraph.clickOnCopyToClipboardNodePanelDetails();
@@ -91,13 +79,9 @@ test.describe("Node details panel tests", () => {
9179
test(`Validate view node panel keys via api for ${node.nodeName}`, async () => {
9280
const codeGraph = await browser.createNewPage(CodeGraph, urls.baseUrl);
9381
await codeGraph.selectGraph(GRAPH_ID);
94-
const graphData = await codeGraph.getGraphDetails();
95-
const nod = findNodeByName(graphData.elements.nodes, node.nodeName);
96-
console.log("before x:", nod.x, " before y: ",nod.y);
97-
82+
const graphData = await codeGraph.getGraphDetails();
9883
const convertCoordinates = await codeGraph.transformNodeCoordinates(graphData);
9984
const node1 = findNodeByName(convertCoordinates, node.nodeName);
100-
console.log("after test: ", node1.screenX, " ", node1.screenY);
10185
const api = new ApiCalls();
10286
const response = await api.getProject(PROJECT_NAME);
10387
const data: any = response.result.entities.nodes;

playwright.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ export default defineConfig({
1616
/* Run tests in files in parallel */
1717
fullyParallel: true,
1818
/* Fail the build on CI if you accidentally left test.only in the source code. */
19-
forbidOnly: !!process.env.CI,
19+
forbidOnly: !!process.env.CI,
2020
/* Retry on CI only */
2121
retries: process.env.CI ? 2 : 0,
2222
/* Opt out of parallel tests on CI. */
23-
workers: process.env.CI ? 2 : undefined,
23+
workers: process.env.CI ? 3 : undefined,
2424
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
2525
reporter: [['html', { outputFolder: 'playwright-report' }]],
2626
outputDir: 'playwright-report/artifacts',

0 commit comments

Comments
 (0)