1
1
import { test } from "@playwright/test" ;
2
2
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test" ;
3
-
3
+ import { removeOldApiKeys } from "../../utils/remove-old-api-keys" ;
4
+ import { updateOldComponents } from "../../utils/update-old-components" ;
5
+ import { zoomOut } from "../../utils/zoom-out" ;
4
6
// TODO: fix this test
5
7
test (
6
8
"user must be able to stop a building" ,
@@ -16,18 +18,11 @@ test(
16
18
17
19
await page
18
20
. getByTestId ( "inputsText Input" )
19
- . dragTo ( page . locator ( '//*[@id="react-flow-id"]' ) ) ;
20
-
21
- await page . getByTestId ( "zoom_out" ) . click ( ) ;
22
- await page
23
- . locator ( '//*[@id="react-flow-id"]' )
24
- . hover ( )
25
- . then ( async ( ) => {
26
- await page . mouse . down ( ) ;
27
- await page . mouse . move ( - 800 , 300 ) ;
21
+ . dragTo ( page . locator ( '//*[@id="react-flow-id"]' ) , {
22
+ targetPosition : { x : 0 , y : 0 } ,
28
23
} ) ;
29
24
30
- await page . mouse . up ( ) ;
25
+ await zoomOut ( page , 3 ) ;
31
26
32
27
//second component
33
28
@@ -36,97 +31,50 @@ test(
36
31
37
32
await page
38
33
. getByTestId ( "dataURL" )
39
- . dragTo ( page . locator ( '//*[@id="react-flow-id"]' ) ) ;
40
-
41
- await page . getByTestId ( "zoom_out" ) . click ( ) ;
42
- await page
43
- . locator ( '//*[@id="react-flow-id"]' )
44
- . hover ( )
45
- . then ( async ( ) => {
46
- await page . mouse . down ( ) ;
47
- await page . mouse . move ( - 800 , 300 ) ;
34
+ . dragTo ( page . locator ( '//*[@id="react-flow-id"]' ) , {
35
+ targetPosition : { x : 100 , y : 200 } ,
48
36
} ) ;
49
37
50
- await page . mouse . up ( ) ;
51
-
52
38
//third component
53
39
54
40
await page . getByTestId ( "sidebar-search-input" ) . click ( ) ;
55
41
await page . getByTestId ( "sidebar-search-input" ) . fill ( "split text" ) ;
56
42
57
43
await page
58
44
. getByTestId ( "processingSplit Text" )
59
- . dragTo ( page . locator ( '//*[@id="react-flow-id"]' ) ) ;
60
-
61
- await page . getByTestId ( "zoom_out" ) . click ( ) ;
62
- await page
63
- . locator ( '//*[@id="react-flow-id"]' )
64
- . hover ( )
65
- . then ( async ( ) => {
66
- await page . mouse . down ( ) ;
67
- await page . mouse . move ( - 800 , 300 ) ;
45
+ . dragTo ( page . locator ( '//*[@id="react-flow-id"]' ) , {
46
+ targetPosition : { x : 300 , y : 300 } ,
68
47
} ) ;
69
48
70
- await page . mouse . up ( ) ;
71
-
72
49
//fourth component
73
50
74
51
await page . getByTestId ( "sidebar-search-input" ) . click ( ) ;
75
52
await page . getByTestId ( "sidebar-search-input" ) . fill ( "parse data" ) ;
76
53
77
54
await page
78
55
. getByTestId ( "processingParse Data" )
79
- . dragTo ( page . locator ( '//*[@id="react-flow-id"]' ) ) ;
80
-
81
- await page . getByTestId ( "zoom_out" ) . click ( ) ;
82
- await page
83
- . locator ( '//*[@id="react-flow-id"]' )
84
- . hover ( )
85
- . then ( async ( ) => {
86
- await page . mouse . down ( ) ;
87
- await page . mouse . move ( - 800 , 300 ) ;
56
+ . dragTo ( page . locator ( '//*[@id="react-flow-id"]' ) , {
57
+ targetPosition : { x : 100 , y : 400 } ,
88
58
} ) ;
89
59
90
- await page . mouse . up ( ) ;
91
-
92
60
//fifth component
93
61
94
62
await page . getByTestId ( "sidebar-search-input" ) . click ( ) ;
95
63
await page . getByTestId ( "sidebar-search-input" ) . fill ( "chat output" ) ;
96
64
97
65
await page
98
66
. getByTestId ( "outputsChat Output" )
99
- . dragTo ( page . locator ( '//*[@id="react-flow-id"]' ) ) ;
100
-
101
- await page . getByTestId ( "zoom_out" ) . click ( ) ;
102
- await page
103
- . locator ( '//*[@id="react-flow-id"]' )
104
- . hover ( )
105
- . then ( async ( ) => {
106
- await page . mouse . down ( ) ;
107
- await page . mouse . move ( - 800 , 300 ) ;
67
+ . dragTo ( page . locator ( '//*[@id="react-flow-id"]' ) , {
68
+ targetPosition : { x : 600 , y : 300 } ,
108
69
} ) ;
109
70
110
- await page . mouse . up ( ) ;
111
-
112
- let outdatedComponents = await page
113
- . getByTestId ( "icon-AlertTriangle" )
114
- . count ( ) ;
115
-
116
- while ( outdatedComponents > 0 ) {
117
- await page . getByTestId ( "icon-AlertTriangle" ) . first ( ) . click ( ) ;
118
- outdatedComponents = await page . getByTestId ( "icon-AlertTriangle" ) . count ( ) ;
119
- }
120
-
121
- let filledApiKey = await page . getByTestId ( "remove-icon-badge" ) . count ( ) ;
122
- while ( filledApiKey > 0 ) {
123
- await page . getByTestId ( "remove-icon-badge" ) . first ( ) . click ( ) ;
124
- await page . waitForTimeout ( 1000 ) ;
125
- filledApiKey = await page . getByTestId ( "remove-icon-badge" ) . count ( ) ;
126
- }
71
+ await updateOldComponents ( page ) ;
72
+ await removeOldApiKeys ( page ) ;
127
73
128
74
await page . getByTestId ( "fit_view" ) . click ( ) ;
129
75
76
+ await zoomOut ( page , 2 ) ;
77
+
130
78
//connection 1
131
79
const urlOutput = await page
132
80
. getByTestId ( "handle-url-shownode-data-right" )
151
99
await splitTextInput . hover ( ) ;
152
100
await page . mouse . up ( ) ;
153
101
154
- await page . getByTestId ( "fit_view" ) . click ( ) ;
155
-
156
102
//connection 3
157
103
const splitTextOutput = await page
158
104
. getByTestId ( "handle-splittext-shownode-chunks-right" )
0 commit comments