13
13
node = "node"
14
14
app = "npx"
15
15
// libName = "../../tracetest-js/packages/tracetest-playwright-engine"
16
- libName = "@tracetest/playwright-engine"
17
- scriptPath = "script.js"
16
+ libName = "@tracetest/playwright-engine"
17
+ baseScriptPath = "script.js"
18
18
)
19
19
20
20
func PLAYWRIGHTENGINE () Triggerer {
@@ -38,18 +38,19 @@ func (te *playwrightTriggerer) Trigger(ctx context.Context, triggerConfig Trigge
38
38
return response , err
39
39
}
40
40
41
+ scriptPath := fmt .Sprintf ("%s-%s" , opts .TraceID , baseScriptPath )
42
+
41
43
err = os .WriteFile (scriptPath , []byte (triggerConfig .PlaywrightEngine .Script ), 0644 )
42
44
if err != nil {
43
45
return response , err
44
46
}
45
47
46
- out , err := start (opts .TraceID .String (), opts .SpanID .String (), triggerConfig .PlaywrightEngine .Target , triggerConfig .PlaywrightEngine .Method )
48
+ out , err := start (opts .TraceID .String (), opts .SpanID .String (), triggerConfig .PlaywrightEngine .Target , triggerConfig .PlaywrightEngine .Method , scriptPath )
49
+ os .Remove (scriptPath )
47
50
if err != nil {
48
- os .Remove (scriptPath )
49
51
return response , err
50
52
}
51
53
52
- os .Remove (scriptPath )
53
54
response .Result .PlaywrightEngine .Success = true
54
55
response .Result .PlaywrightEngine .Out = out
55
56
return response , err
@@ -75,7 +76,7 @@ func validate() error {
75
76
return nil
76
77
}
77
78
78
- func start (traceId , spanId , url , method string ) (string , error ) {
79
+ func start (traceId , spanId , url , method , scriptPath string ) (string , error ) {
79
80
wd , err := os .Getwd ()
80
81
if err != nil {
81
82
return "" , err
0 commit comments