github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/test/integration/e2eissues_int_test.go (about) 1 package integration 2 3 import ( 4 "path/filepath" 5 "runtime" 6 "testing" 7 "time" 8 9 "github.com/ActiveState/termtest" 10 11 "github.com/ActiveState/cli/internal/fileutils" 12 "github.com/ActiveState/cli/internal/testhelpers/e2e" 13 ) 14 15 /* 16 Tests in this file are failing due to bugs in the test framework. They are skipped so as not to break our CI. 17 The intend is to collect e2e bugs here so that we can test that they are fixed once we refactor the framework. 18 */ 19 20 func TestMultipleSends(t *testing.T) { 21 if runtime.GOOS != "windows" { 22 t.Skip("This test is only relevant on Windows") 23 } 24 25 ts := e2e.New(t, true) 26 defer ts.Close() 27 28 promptFile := filepath.Join(ts.Dirs.Work, "prompt.bat") 29 err := fileutils.WriteFile(promptFile, []byte(` 30 @echo off 31 set /p "prompt1=Prompt 1: " 32 echo "Prompt 1: %prompt1%" 33 set /p "prompt2=Prompt 2: " 34 echo "Prompt 2: %prompt2%" 35 `)) 36 if err != nil { 37 t.Fatal(err) 38 } 39 40 tp := ts.SpawnCmdWithOpts(promptFile, e2e.OptTermTest(termtest.OptDefaultTimeout(5*time.Second))) 41 tp.Expect("Prompt 1:") 42 tp.SendLine("Answer 1") 43 tp.Expect("Prompt 1: Answer 1") 44 tp.Expect("Prompt 2:") 45 tp.SendLine("Answer 2") 46 tp.Expect("Prompt 2: Answer 2") 47 tp.ExpectExitCode(0) 48 }