mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-02-23 11:55:48 -05:00
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.
This commit is contained in:
parent
a975b6ab94
commit
f7ba8f0e41
1 changed files with 6 additions and 1 deletions
|
@ -82,6 +82,7 @@ func TestE2e(t *testing.T) {
|
||||||
|
|
||||||
runArgs := []string{"npx", "playwright", "test"}
|
runArgs := []string{"npx", "playwright", "test"}
|
||||||
|
|
||||||
|
_, testVisual := os.LookupEnv("VISUAL_TEST")
|
||||||
// To update snapshot outputs
|
// To update snapshot outputs
|
||||||
if _, set := os.LookupEnv("ACCEPT_VISUAL"); set {
|
if _, set := os.LookupEnv("ACCEPT_VISUAL"); set {
|
||||||
runArgs = append(runArgs, "--update-snapshots")
|
runArgs = append(runArgs, "--update-snapshots")
|
||||||
|
@ -105,6 +106,10 @@ func TestE2e(t *testing.T) {
|
||||||
onForgejoRun(t, func(*testing.T, *url.URL) {
|
onForgejoRun(t, func(*testing.T, *url.URL) {
|
||||||
defer DeclareGitRepos(t)()
|
defer DeclareGitRepos(t)()
|
||||||
thisTest := runArgs
|
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)
|
thisTest = append(thisTest, path)
|
||||||
cmd := exec.Command(runArgs[0], thisTest...)
|
cmd := exec.Command(runArgs[0], thisTest...)
|
||||||
cmd.Env = os.Environ()
|
cmd.Env = os.Environ()
|
||||||
|
@ -114,7 +119,7 @@ func TestE2e(t *testing.T) {
|
||||||
cmd.Stderr = os.Stderr
|
cmd.Stderr = os.Stderr
|
||||||
|
|
||||||
err := cmd.Run()
|
err := cmd.Run()
|
||||||
if err != nil {
|
if err != nil && !testVisual {
|
||||||
log.Fatal("Playwright Failed: %s", err)
|
log.Fatal("Playwright Failed: %s", err)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Reference in a new issue