diff options
| author | James Elliott <james-d-elliott@users.noreply.github.com> | 2023-11-18 18:48:56 +1100 | 
|---|---|---|
| committer | James Elliott <james-d-elliott@users.noreply.github.com> | 2024-03-04 20:29:11 +1100 | 
| commit | 744b6179d28a12c69ae5a649f916806f5ddadfcd (patch) | |
| tree | fe8516f9f2b5733cf8bb760b1944b13210661f2c /internal/suites/suite_standalone_test.go | |
| parent | 85562a2465218273161cf9240ffebfe2ba6b187f (diff) | |
test(suites): add and fix tests for coverage
Add tests and adjust tests and code as appropriate. This also ensures we have thorough coverage of the code.
Signed-off-by: James Elliott <james-d-elliott@users.noreply.github.com>
Diffstat (limited to 'internal/suites/suite_standalone_test.go')
| -rw-r--r-- | internal/suites/suite_standalone_test.go | 15 | 
1 files changed, 7 insertions, 8 deletions
diff --git a/internal/suites/suite_standalone_test.go b/internal/suites/suite_standalone_test.go index 6ff0d2775..72e7aed5b 100644 --- a/internal/suites/suite_standalone_test.go +++ b/internal/suites/suite_standalone_test.go @@ -31,8 +31,7 @@ func NewStandaloneWebDriverSuite() *StandaloneWebDriverSuite {  func (s *StandaloneWebDriverSuite) SetupSuite() {  	s.BaseSuite.SetupSuite() -	browser, err := StartRod() - +	browser, err := NewRodSession(RodSessionWithCredentials(s))  	if err != nil {  		log.Fatal(err)  	} @@ -65,7 +64,7 @@ func (s *StandaloneWebDriverSuite) TestShouldLetUserKnowHeIsAlreadyAuthenticated  		s.collectScreenshot(ctx.Err(), s.Page)  	}() -	_ = s.doRegisterAndLogin2FA(s.T(), s.Context(ctx), "john", "password", false, "") +	s.doRegisterTOTPAndLogin2FA(s.T(), s.Context(ctx), "john", "password", false, "")  	// Visit home page to change context.  	s.doVisit(s.T(), s.Context(ctx), HomeBaseURL) @@ -108,7 +107,7 @@ func (s *StandaloneWebDriverSuite) TestShouldRedirectAlreadyAuthenticatedUser()  		s.collectScreenshot(ctx.Err(), s.Page)  	}() -	_ = s.doRegisterAndLogin2FA(s.T(), s.Context(ctx), "john", "password", false, "") +	s.doRegisterTOTPAndLogin2FA(s.T(), s.Context(ctx), "john", "password", false, "")  	// Visit home page to change context.  	s.doVisit(s.T(), s.Context(ctx), HomeBaseURL) @@ -129,7 +128,7 @@ func (s *StandaloneWebDriverSuite) TestShouldNotRedirectAlreadyAuthenticatedUser  		s.collectScreenshot(ctx.Err(), s.Page)  	}() -	_ = s.doRegisterAndLogin2FA(s.T(), s.Context(ctx), "john", "password", false, "") +	s.doRegisterTOTPAndLogin2FA(s.T(), s.Context(ctx), "john", "password", false, "")  	// Visit home page to change context.  	s.doVisit(s.T(), s.Context(ctx), HomeBaseURL) @@ -162,7 +161,7 @@ func (s *StandaloneWebDriverSuite) TestShouldCheckUserIsAskedToRegisterDevice()  	s.WaitElementLocatedByClassName(s.T(), s.Context(ctx), "state-not-registered")  	// Then register the TOTP factor. -	s.doRegisterTOTP(s.T(), s.Context(ctx)) +	s.doRegisterTOTP(s.T(), s.Context(ctx), username)  	// And logout.  	s.doLogout(s.T(), s.Context(ctx)) @@ -331,8 +330,8 @@ func (s *StandaloneSuite) Test1FAScenario() {  	suite.Run(s.T(), New1FAScenario())  } -func (s *StandaloneSuite) Test2FAScenario() { -	suite.Run(s.T(), New2FAScenario()) +func (s *StandaloneSuite) NewTwoFactorTOTPScenario() { +	suite.Run(s.T(), NewTwoFactorTOTPScenario())  }  func (s *StandaloneSuite) TestBypassPolicyScenario() {  | 
