Skip to content

Commit cab441f

Browse files
committed
Add ACCEPT_VISUAL variable
1 parent 32e3961 commit cab441f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/e2e/e2e_test.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,13 @@ func TestE2e(t *testing.T) {
7878
t.Fatal(fmt.Errorf("No e2e tests found in %s", searchGlob))
7979
}
8080

81+
runArgs := []string{"npx", "playwright", "test"}
82+
83+
// To update snapshot outputs
84+
if _, set := os.LookupEnv("ACCEPT_VISUAL"); set {
85+
runArgs = append(runArgs, "--update-snapshots")
86+
}
87+
8188
// Create new test for each input file
8289
for _, path := range paths {
8390
_, filename := filepath.Split(path)
@@ -86,7 +93,7 @@ func TestE2e(t *testing.T) {
8693
t.Run(testname, func(t *testing.T) {
8794
// Default 2 minute timeout
8895
onGiteaRun(t, func(*testing.T, *url.URL) {
89-
cmd := exec.Command("npx", "playwright", "test")
96+
cmd := exec.Command(runArgs[0], runArgs...)
9097
cmd.Env = os.Environ()
9198
cmd.Env = append(cmd.Env, fmt.Sprintf("GITEA_URL=%s", setting.AppURL))
9299
var out bytes.Buffer

0 commit comments

Comments
 (0)