From ad6ac9a8543537325cdb12c7ed5226c007a8e0a6 Mon Sep 17 00:00:00 2001 From: Romain Beaumont Date: Sun, 18 May 2025 13:32:02 +0000 Subject: [PATCH 1/3] Improve shared test reset: reset weather, time, effects, health, food, gamerules, difficulty, and OP status to reduce flakiness across all tests. --- test/externalTests/plugins/testCommon.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/externalTests/plugins/testCommon.js b/test/externalTests/plugins/testCommon.js index 9249e605c..ddbd0ef26 100644 --- a/test/externalTests/plugins/testCommon.js +++ b/test/externalTests/plugins/testCommon.js @@ -91,6 +91,18 @@ function inject (bot) { await teleport(new Vec3(0, bot.test.groundY, 0)) await bot.waitForChunksToLoad() await resetBlocksToSuperflat() + // Reset weather and time + bot.chat('/weather clear') + bot.chat('/time set day') + // Reset health and food + bot.chat('/effect clear @a') + bot.chat('/effect clear @p') + bot.chat('/gamerule doDaylightCycle true') + bot.chat('/gamerule doWeatherCycle true') + bot.chat('/difficulty peaceful') + bot.chat('/difficulty normal') + // Ensure OP status for the bot + bot.chat(`/op ${bot.username}`) await sleep(1000) await clearInventory() } From 15a330e0cdfa05836787f34acaade9926c4cfa8f Mon Sep 17 00:00:00 2001 From: Romain Beaumont Date: Sun, 18 May 2025 15:35:35 +0200 Subject: [PATCH 2/3] Update test/externalTests/plugins/testCommon.js Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- test/externalTests/plugins/testCommon.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/externalTests/plugins/testCommon.js b/test/externalTests/plugins/testCommon.js index ddbd0ef26..cf00c4465 100644 --- a/test/externalTests/plugins/testCommon.js +++ b/test/externalTests/plugins/testCommon.js @@ -97,6 +97,8 @@ function inject (bot) { // Reset health and food bot.chat('/effect clear @a') bot.chat('/effect clear @p') + bot.chat('/attribute @p minecraft:generic.max_health base set 20') + bot.chat('/effect give @p minecraft:saturation 1 20 true') bot.chat('/gamerule doDaylightCycle true') bot.chat('/gamerule doWeatherCycle true') bot.chat('/difficulty peaceful') From 452bb0f1e93dd936cf357e47c86b88ffca9299be Mon Sep 17 00:00:00 2001 From: Romain Beaumont Date: Sun, 18 May 2025 15:37:14 +0200 Subject: [PATCH 3/3] Update testCommon.js --- test/externalTests/plugins/testCommon.js | 1 - 1 file changed, 1 deletion(-) diff --git a/test/externalTests/plugins/testCommon.js b/test/externalTests/plugins/testCommon.js index cf00c4465..0f1d8e4a7 100644 --- a/test/externalTests/plugins/testCommon.js +++ b/test/externalTests/plugins/testCommon.js @@ -102,7 +102,6 @@ function inject (bot) { bot.chat('/gamerule doDaylightCycle true') bot.chat('/gamerule doWeatherCycle true') bot.chat('/difficulty peaceful') - bot.chat('/difficulty normal') // Ensure OP status for the bot bot.chat(`/op ${bot.username}`) await sleep(1000)