Skip to content

Commit 3f847aa

Browse files
authored
test: save trace in job CI artifacts directory when ui e2e tests fails (#1204)
* experiment * save trace in the job CI artifact directory * requested change
1 parent 4ed521a commit 3f847aa

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

testsupport/sandbox-ui/trace.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,16 @@ func trace(t *testing.T, context playwright.BrowserContext, testName string) {
2222

2323
dir, err := os.Getwd()
2424
require.NoError(t, err)
25-
tracePath := filepath.Join(dir, fmt.Sprintf("../../trace/trace-%s.zip", testName))
25+
tracePath := filepath.Join(dir, "..", "..", "trace", fmt.Sprintf("trace-%s.zip", testName))
2626

2727
if os.Getenv("RUNNING_IN_CONTAINER") == "true" {
28-
tracePath = filepath.Join(os.Getenv("E2E_REPO_PATH"), fmt.Sprintf("/trace/trace-%s.zip", testName))
28+
tracePath = filepath.Join(os.Getenv("E2E_REPO_PATH"), "trace", fmt.Sprintf("trace-%s.zip", testName))
29+
}
30+
31+
if os.Getenv("CI") == "true" {
32+
// save trace in the job CI artifact directory
33+
// artifacts/e2e/test/artifacts/sandbox-ui/trace/trace-%s.zip
34+
tracePath = filepath.Join(os.Getenv("ARTIFACT_DIR"), "sandbox-ui", "trace", fmt.Sprintf("trace-%s.zip", testName))
2935
}
3036

3137
t.Cleanup(func() {

0 commit comments

Comments
 (0)