darabos commited on
Commit
19adf28
·
1 Parent(s): aa9e014

Elaborate system that fails to fix unreliable connections.

Browse files
Files changed (1) hide show
  1. lynxkite-app/web/tests/lynxkite.ts +15 -5
lynxkite-app/web/tests/lynxkite.ts CHANGED
@@ -97,10 +97,7 @@ export class Workspace {
97
  }
98
 
99
  getBoxHandle(boxId: string, pos?: string) {
100
- if (pos) {
101
- return this.page.locator(`[data-id="${boxId}"] [data-handlepos="${pos}"]`);
102
- }
103
- return this.page.getByTestId(boxId);
104
  }
105
 
106
  async moveBox(
@@ -129,13 +126,26 @@ export class Workspace {
129
  await this.page.mouse.up();
130
  }
131
 
132
- async connectBoxes(sourceId: string, targetId: string) {
133
  const sourceHandle = this.getBoxHandle(sourceId, "right");
134
  const targetHandle = this.getBoxHandle(targetId, "left");
135
  await sourceHandle.hover();
136
  await this.page.mouse.down();
 
137
  await targetHandle.hover();
138
  await this.page.mouse.up();
 
 
 
 
 
 
 
 
 
 
 
 
139
  }
140
 
141
  async execute() {
 
97
  }
98
 
99
  getBoxHandle(boxId: string, pos?: string) {
100
+ return this.page.locator(`.connectable[data-nodeid="${boxId}"][data-handlepos="${pos}"]`);
 
 
 
101
  }
102
 
103
  async moveBox(
 
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() {