darabos commited on
Commit
b546ff0
·
1 Parent(s): 9d1deea

Make connectBoxes reliable. (I think!)

Browse files
Files changed (1) hide show
  1. lynxkite-app/web/tests/lynxkite.ts +4 -11
lynxkite-app/web/tests/lynxkite.ts CHANGED
@@ -126,27 +126,20 @@ export class Workspace {
126
  await this.page.mouse.up();
127
  }
128
 
129
- async tryToConnectBoxes(sourceId: string, targetId: string) {
130
  const sourceHandle = this.getBoxHandle(sourceId, "right");
131
  const targetHandle = this.getBoxHandle(targetId, "left");
 
 
132
  await sourceHandle.hover();
133
  await this.page.mouse.down();
134
  await expect(this.page.locator(".react-flow__connectionline")).toBeVisible({ timeout: 1000 });
135
  await targetHandle.hover();
136
  await this.page.mouse.up();
137
  await expect(
138
- this.page.locator(`.react-flow__edge[aria-label="Edge from ${sourceId} to ${targetId}"`),
139
  ).toBeVisible({ timeout: 1000 });
140
  }
141
- async connectBoxes(sourceId: string, targetId: string) {
142
- for (let retry = 0; retry < 10; retry++) {
143
- try {
144
- await this.tryToConnectBoxes(sourceId, targetId);
145
- return;
146
- } catch (e) {}
147
- }
148
- await this.tryToConnectBoxes(sourceId, targetId);
149
- }
150
 
151
  async execute() {
152
  const request = this.page.waitForResponse(/api[/]execute_workspace/);
 
126
  await this.page.mouse.up();
127
  }
128
 
129
+ async connectBoxes(sourceId: string, targetId: string) {
130
  const sourceHandle = this.getBoxHandle(sourceId, "right");
131
  const targetHandle = this.getBoxHandle(targetId, "left");
132
+ await expect(sourceHandle).toBeVisible();
133
+ await expect(targetHandle).toBeVisible();
134
  await sourceHandle.hover();
135
  await this.page.mouse.down();
136
  await expect(this.page.locator(".react-flow__connectionline")).toBeVisible({ timeout: 1000 });
137
  await targetHandle.hover();
138
  await this.page.mouse.up();
139
  await expect(
140
+ this.page.locator(`.react-flow__edge[aria-label="Edge from ${sourceId} to ${targetId}"]`),
141
  ).toBeVisible({ timeout: 1000 });
142
  }
 
 
 
 
 
 
 
 
 
143
 
144
  async execute() {
145
  const request = this.page.waitForResponse(/api[/]execute_workspace/);