diff options
author | Otto Richter <git@otto.splvs.net> | 2025-01-14 22:28:13 +0100 |
---|---|---|
committer | Otto Richter <git@otto.splvs.net> | 2025-01-15 19:16:28 +0100 |
commit | f7ba8f0e413db23006e72af7e78d5b9ec2f36413 (patch) | |
tree | 3e8b5aaf7bef16441761f0b0f8b3929746252edd | |
parent | tests(e2e): Explicitly generate screenshots (diff) | |
download | forgejo-f7ba8f0e413db23006e72af7e78d5b9ec2f36413.tar.xz forgejo-f7ba8f0e413db23006e72af7e78d5b9ec2f36413.zip |
tests(e2e): Do not fail early when comparing screenshots
Also set a unique outputDir so that artifacts are preserved and not overwritten by the following tests.
-rw-r--r-- | tests/e2e/e2e_test.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go index 88b254b6f9..8e4a9653cd 100644 --- a/tests/e2e/e2e_test.go +++ b/tests/e2e/e2e_test.go @@ -82,6 +82,7 @@ func TestE2e(t *testing.T) { runArgs := []string{"npx", "playwright", "test"} + _, testVisual := os.LookupEnv("VISUAL_TEST") // To update snapshot outputs if _, set := os.LookupEnv("ACCEPT_VISUAL"); set { runArgs = append(runArgs, "--update-snapshots") @@ -105,6 +106,10 @@ func TestE2e(t *testing.T) { onForgejoRun(t, func(*testing.T, *url.URL) { defer DeclareGitRepos(t)() thisTest := runArgs + // when all tests are run, use unique artifacts directories per test to preserve artifacts from other tests + if testVisual { + thisTest = append(thisTest, "--output=tests/e2e/test-artifacts/"+testname) + } thisTest = append(thisTest, path) cmd := exec.Command(runArgs[0], thisTest...) cmd.Env = os.Environ() @@ -114,7 +119,7 @@ func TestE2e(t *testing.T) { cmd.Stderr = os.Stderr err := cmd.Run() - if err != nil { + if err != nil && !testVisual { log.Fatal("Playwright Failed: %s", err) } }) |