diff --git a/src/app/proxy/pixa_test.go b/src/app/proxy/pixa_test.go index 9455487..7766f60 100644 --- a/src/app/proxy/pixa_test.go +++ b/src/app/proxy/pixa_test.go @@ -2,6 +2,7 @@ package proxy_test import ( "fmt" + "os" "path/filepath" . "github.com/onsi/ginkgo/v2" @@ -18,6 +19,15 @@ import ( "github.com/snivilised/pixa/src/internal/matchers" ) +func openInputTTY() (*os.File, error) { + f, err := os.Open("/dev/tty") + if err != nil { + return nil, fmt.Errorf("could not open a new TTY: %w", err) + } + + return f, nil +} + const ( BackyardWorldsPlanet9Scan01 = "nasa/exo/Backyard Worlds - Planet 9/sessions/scan-01" BackyardWorldsPlanet9Scan02 = "nasa/exo/Backyard Worlds - Planet 9/sessions/scan-02" @@ -80,15 +90,15 @@ func assertInFs(entry *samplerTE, bs *command.Bootstrap, directory string) { vfs := bs.Vfs if entry.mandatory != nil && entry.dry { - dejaVuSupplement := filepath.Join(common.Definitions.Filing.DejaVu, entry.supplement) - supplement := helpers.Path(entry.intermediate, dejaVuSupplement) + dejaVu := filepath.Join(common.Definitions.Filing.DejaVu, entry.supplement) + supplement := helpers.Path(entry.intermediate, dejaVu) for _, original := range entry.mandatory { originalPath := filepath.Join(supplement, original) if entry.withFake { - withFake := filing.ComposeFake(original, bs.Configs.Advanced.FakeLabel()) - originalPath = filepath.Join(directory, withFake) + fake := filing.ComposeFake(original, bs.Configs.Advanced.FakeLabel()) + originalPath = filepath.Join(directory, fake) } Expect(matchers.AsFile(originalPath)).To(matchers.ExistInFS(vfs)) @@ -98,17 +108,28 @@ func assertInFs(entry *samplerTE, bs *command.Bootstrap, directory string) { var _ = Describe("pixa", Ordered, func() { var ( - repo string - l10nPath string - configPath string - root string - vfs storage.VirtualFS + repo string + l10nPath string + configPath string + root string + vfs storage.VirtualFS + withoutRenderer bool ) BeforeAll(func() { repo = helpers.Repo("") l10nPath = helpers.Path(repo, "test/data/l10n") configPath = helpers.Path(repo, "test/data/configuration") + + var ( + err error + f *os.File + ) + + if f, err = openInputTTY(); err != nil { + withoutRenderer = true + } + f.Close() }) BeforeEach(func() { @@ -130,7 +151,7 @@ var _ = Describe("pixa", Ordered, func() { bootstrap := command.Bootstrap{ Vfs: vfs, Presentation: common.PresentationOptions{ - WithoutRenderer: true, + WithoutRenderer: withoutRenderer, }, } @@ -138,6 +159,8 @@ var _ = Describe("pixa", Ordered, func() { args = append(args, "--no-tui") } + fmt.Printf("======> XTERM: '%v'\n", os.Getenv("XTERM")) + tester := helpers.CommandTester{ Args: args, Root: bootstrap.Root(func(co *command.ConfigureOptionsInfo) { diff --git a/test/data/configuration/pixa-test.yml b/test/data/configuration/pixa-test.yml index 662e20e..204ee12 100644 --- a/test/data/configuration/pixa-test.yml +++ b/test/data/configuration/pixa-test.yml @@ -22,7 +22,7 @@ sampler: folders: 1 interaction: tui: - per-item-delay: "1s" + per-item-delay: "1ms" advanced: abort-on-error: false overwrite-on-collision: false