github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/test/integration/errors_int_test.go (about)

     1  package integration
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/ActiveState/cli/internal/testhelpers/suite"
     7  
     8  	"github.com/ActiveState/cli/internal/testhelpers/e2e"
     9  	"github.com/ActiveState/cli/internal/testhelpers/tagsuite"
    10  )
    11  
    12  type ErrorsIntegrationTestSuite struct {
    13  	tagsuite.Suite
    14  }
    15  
    16  func (suite *ErrorsIntegrationTestSuite) TestTips() {
    17  	suite.OnlyRunForTags(tagsuite.Errors, tagsuite.Critical)
    18  	ts := e2e.New(suite.T(), false)
    19  	defer ts.Close()
    20  
    21  	cp := ts.Spawn("__test", "multierror")
    22  	cp.Expect("Need More Help?")
    23  	cp.Expect("Run →")
    24  	cp.Expect("Ask For Help →")
    25  	cp.ExpectExitCode(1)
    26  	ts.IgnoreLogErrors()
    27  }
    28  
    29  func (suite *ErrorsIntegrationTestSuite) TestMultiError() {
    30  	suite.OnlyRunForTags(tagsuite.Errors, tagsuite.Critical)
    31  	ts := e2e.New(suite.T(), false)
    32  	defer ts.Close()
    33  
    34  	cp := ts.Spawn("__test", "multierror")
    35  	cp.ExpectRe(`\s+x error1.\s+\s+x error2.\s+x error3.\s+x error4.\s+█\s+Need More Help`)
    36  	cp.ExpectExitCode(1)
    37  	ts.IgnoreLogErrors()
    38  }
    39  
    40  func TestErrorsIntegrationTestSuite(t *testing.T) {
    41  	suite.Run(t, new(ErrorsIntegrationTestSuite))
    42  }