diff --git a/Content.IntegrationTests/Tests/Actions/ActionPvsDetachTest.cs b/Content.IntegrationTests/Tests/Actions/ActionPvsDetachTest.cs index 420a90a50bd8..b07c352c81dd 100644 --- a/Content.IntegrationTests/Tests/Actions/ActionPvsDetachTest.cs +++ b/Content.IntegrationTests/Tests/Actions/ActionPvsDetachTest.cs @@ -32,11 +32,16 @@ public async Task TestActionDetach() // PVS-detach action entities // We do this by just giving them the ghost layer var visSys = server.System(); - var enumerator = server.Transform(ent).ChildEnumerator; - while (enumerator.MoveNext(out var child)) + + await server.WaitPost(() => { - visSys.AddLayer(child, (int) VisibilityFlags.Ghost); - } + var enumerator = server.Transform(ent).ChildEnumerator; + while (enumerator.MoveNext(out var child)) + { + visSys.AddLayer(child, (int)VisibilityFlags.Ghost); + } + }); + await pair.RunTicksSync(5); // Client's actions have left been detached / are out of view, but action comp state has not changed @@ -44,11 +49,14 @@ public async Task TestActionDetach() Assert.That(cSys.GetActions(cEnt).Count(), Is.EqualTo(initActions)); // Re-enter PVS view - enumerator = server.Transform(ent).ChildEnumerator; - while (enumerator.MoveNext(out var child)) + await server.WaitPost(() => { - visSys.RemoveLayer(child, (int) VisibilityFlags.Ghost); - } + var enumerator = server.Transform(ent).ChildEnumerator; + while (enumerator.MoveNext(out var child)) + { + visSys.RemoveLayer(child, (int) VisibilityFlags.Ghost); + } + }); await pair.RunTicksSync(5); Assert.That(sys.GetActions(ent).Count(), Is.EqualTo(initActions)); Assert.That(cSys.GetActions(cEnt).Count(), Is.EqualTo(initActions)); diff --git a/Content.IntegrationTests/Tests/Buckle/BuckleDragTest.cs b/Content.IntegrationTests/Tests/Buckle/BuckleDragTest.cs index 82d5d3baa04c..19e8aba1824e 100644 --- a/Content.IntegrationTests/Tests/Buckle/BuckleDragTest.cs +++ b/Content.IntegrationTests/Tests/Buckle/BuckleDragTest.cs @@ -34,7 +34,11 @@ public async Task BucklePullTest() Assert.That(pullable.BeingPulled, Is.False); // Strap the human to the chair - Assert.That(Server.System().TryBuckle(sUrist, SPlayer, STarget.Value)); + await Server.WaitAssertion(() => + { + Assert.That(Server.System().TryBuckle(sUrist, SPlayer, STarget.Value)); + }); + await RunTicks(5); Assert.That(buckle.Buckled, Is.True); Assert.That(buckle.BuckledTo, Is.EqualTo(STarget)); diff --git a/Content.IntegrationTests/Tests/CargoTest.cs b/Content.IntegrationTests/Tests/CargoTest.cs index 89018d9d17c6..1b29e7ea7a99 100644 --- a/Content.IntegrationTests/Tests/CargoTest.cs +++ b/Content.IntegrationTests/Tests/CargoTest.cs @@ -257,9 +257,12 @@ public async Task StackPrice() var entManager = server.ResolveDependency(); var priceSystem = entManager.System(); - var ent = entManager.SpawnEntity("StackEnt", MapCoordinates.Nullspace); - var price = priceSystem.GetPrice(ent); - Assert.That(price, Is.EqualTo(100.0)); + await server.WaitAssertion(() => + { + var ent = entManager.SpawnEntity("StackEnt", MapCoordinates.Nullspace); + var price = priceSystem.GetPrice(ent); + Assert.That(price, Is.EqualTo(100.0)); + }); await pair.CleanReturnAsync(); } diff --git a/Content.IntegrationTests/Tests/Commands/SuicideCommandTests.cs b/Content.IntegrationTests/Tests/Commands/SuicideCommandTests.cs index 540e86c650af..e1eef2be4a9d 100644 --- a/Content.IntegrationTests/Tests/Commands/SuicideCommandTests.cs +++ b/Content.IntegrationTests/Tests/Commands/SuicideCommandTests.cs @@ -143,10 +143,10 @@ await server.WaitPost(() => mobStateComp = entManager.GetComponent(player); mobThresholdsComp = entManager.GetComponent(player); damageableComp = entManager.GetComponent(player); - }); - if (protoMan.TryIndex("Slash", out var slashProto)) - damageableSystem.TryChangeDamage(player, new DamageSpecifier(slashProto, FixedPoint2.New(46.5))); + if (protoMan.TryIndex("Slash", out var slashProto)) + damageableSystem.TryChangeDamage(player, new DamageSpecifier(slashProto, FixedPoint2.New(46.5))); + }); // Check that running the suicide command kills the player // and properly ghosts them without them being able to return to their body diff --git a/Content.IntegrationTests/Tests/Shuttle/DockTest.cs b/Content.IntegrationTests/Tests/Shuttle/DockTest.cs index a1aa462a6973..f6e99596e904 100644 --- a/Content.IntegrationTests/Tests/Shuttle/DockTest.cs +++ b/Content.IntegrationTests/Tests/Shuttle/DockTest.cs @@ -97,13 +97,14 @@ public async Task TestPlanetDock() var entManager = server.ResolveDependency(); var dockingSystem = entManager.System(); var mapSystem = entManager.System(); + MapGridComponent mapGrid = default!; - var mapGrid = entManager.AddComponent(map.MapUid); var shuttle = EntityUid.Invalid; // Spawn shuttle and affirm no valid docks. await server.WaitAssertion(() => { + mapGrid = entManager.AddComponent(map.MapUid); entManager.DeleteEntity(map.Grid); Assert.That(entManager.System().TryLoad(otherMap.MapId, "/Maps/Shuttles/emergency.yml", out var rootUids)); shuttle = rootUids[0];