diff --git a/test/Api.IntegrationTest/Factories/ApiApplicationFactory.cs b/test/Api.IntegrationTest/Factories/ApiApplicationFactory.cs index d8ff8961f6..131371f03f 100644 --- a/test/Api.IntegrationTest/Factories/ApiApplicationFactory.cs +++ b/test/Api.IntegrationTest/Factories/ApiApplicationFactory.cs @@ -5,6 +5,7 @@ using Bit.IntegrationTestCommon; using Bit.IntegrationTestCommon.Factories; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.TestHost; +using Xunit; #nullable enable @@ -50,6 +51,10 @@ public class ApiApplicationFactory : WebApplicationFactoryBase public async Task<(string Token, string RefreshToken)> LoginWithNewAccount( string email = "integration-test@bitwarden.com", string masterPasswordHash = "master_password_hash") { + // This might be the first action in a test and since it forwards to the Identity server, we need to ensure that + // this server is initialized since it's responsible for seeding the database. + Assert.NotNull(Services); + await _identityApplicationFactory.RegisterNewIdentityFactoryUserAsync( new RegisterFinishRequestModel { diff --git a/test/Events.IntegrationTest/EventsApplicationFactory.cs b/test/Events.IntegrationTest/EventsApplicationFactory.cs index 9fb7800bed..f8be94b033 100644 --- a/test/Events.IntegrationTest/EventsApplicationFactory.cs +++ b/test/Events.IntegrationTest/EventsApplicationFactory.cs @@ -45,6 +45,10 @@ public class EventsApplicationFactory : WebApplicationFactoryBase /// public async Task<(string Token, string RefreshToken)> LoginWithNewAccount(string email = "integration-test@bitwarden.com", string masterPasswordHash = "master_password_hash") { + // This might be the first action in a test and since it forwards to the Identity server, we need to ensure that + // this server is initialized since it's responsible for seeding the database. + Assert.NotNull(Services); + await _identityApplicationFactory.RegisterNewIdentityFactoryUserAsync( new RegisterFinishRequestModel {