[Test] Fix some test flakiness involving `doKillOpponents()` (#4571)

* [Test] Fix some test flakiness involving game.doKillOpponents()

* PR Feedback

* Fix linting

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
This commit is contained in:
PigeonBar 2024-10-04 10:42:20 -04:00 committed by GitHub
parent a5db2e1d6d
commit 2bc5f50154
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 16 deletions

View File

@ -5,6 +5,7 @@ import { Moves } from "#app/enums/moves";
import { Biome } from "#app/enums/biome";
import { Mode } from "#app/ui/ui";
import ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler";
import { Species } from "#enums/species";
//const TIMEOUT = 20 * 1000;
@ -53,12 +54,11 @@ describe("Shop modifications", async () => {
game.override
.startingWave(9)
.startingBiome(Biome.ICE_CAVE) // Will lead to Snowy Forest with randomly generated weather
.startingBiome(Biome.ICE_CAVE)
.battleType("single")
.startingLevel(100) // Avoid levelling up
.enemyLevel(1000) // Avoid opponent dying before game.doKillOpponents()
.disableTrainerWaves()
.moveset([ Moves.KOWTOW_CLEAVE ])
.moveset([ Moves.SPLASH ])
.enemyMoveset(Moves.SPLASH);
game.modifiers
.addCheck("EVIOLITE")
@ -71,9 +71,8 @@ describe("Shop modifications", async () => {
});
it("should not have Eviolite and Mini Black Hole available in Classic if not unlocked", async () => {
await game.classicMode.startBattle();
game.move.select(Moves.KOWTOW_CLEAVE);
await game.phaseInterceptor.to("DamagePhase");
await game.classicMode.startBattle([ Species.BULBASAUR ]);
game.move.select(Moves.SPLASH);
await game.doKillOpponents();
await game.phaseInterceptor.to("BattleEndPhase");
game.onNextPrompt("SelectModifierPhase", Mode.MODIFIER_SELECT, () => {
@ -86,8 +85,7 @@ describe("Shop modifications", async () => {
it("should have Eviolite and Mini Black Hole available in Daily", async () => {
await game.dailyMode.startBattle();
game.move.select(Moves.KOWTOW_CLEAVE);
await game.phaseInterceptor.to("DamagePhase");
game.move.select(Moves.SPLASH);
await game.doKillOpponents();
await game.phaseInterceptor.to("BattleEndPhase");
game.onNextPrompt("SelectModifierPhase", Mode.MODIFIER_SELECT, () => {

View File

@ -44,15 +44,13 @@ describe("Reload", () => {
.startingWave(10)
.battleType("single")
.startingLevel(100) // Avoid levelling up
.enemyLevel(1000) // Avoid opponent dying before game.doKillOpponents()
.disableTrainerWaves()
.moveset([ Moves.KOWTOW_CLEAVE ])
.moveset([ Moves.SPLASH ])
.enemyMoveset(Moves.SPLASH);
await game.dailyMode.startBattle();
// Transition from Wave 10 to Wave 11 in order to trigger biome switch
game.move.select(Moves.KOWTOW_CLEAVE);
await game.phaseInterceptor.to("DamagePhase");
game.move.select(Moves.SPLASH);
await game.doKillOpponents();
game.onNextPrompt("SelectBiomePhase", Mode.OPTION_SELECT, () => {
(game.scene.time as MockClock).overrideDelay = null;
@ -79,15 +77,13 @@ describe("Reload", () => {
.startingBiome(Biome.ICE_CAVE) // Will lead to Snowy Forest with randomly generated weather
.battleType("single")
.startingLevel(100) // Avoid levelling up
.enemyLevel(1000) // Avoid opponent dying before game.doKillOpponents()
.disableTrainerWaves()
.moveset([ Moves.KOWTOW_CLEAVE ])
.moveset([ Moves.SPLASH ])
.enemyMoveset(Moves.SPLASH);
await game.classicMode.startBattle(); // Apparently daily mode would override the biome
// Transition from Wave 10 to Wave 11 in order to trigger biome switch
game.move.select(Moves.KOWTOW_CLEAVE);
await game.phaseInterceptor.to("DamagePhase");
game.move.select(Moves.SPLASH);
await game.doKillOpponents();
await game.toNextWave();
expect(game.phaseInterceptor.log).toContain("NewBiomeEncounterPhase");