diff --git a/tests/e2e/game/index.py b/tests/e2e/game/index.py index b7e436cd..bca31c02 100644 --- a/tests/e2e/game/index.py +++ b/tests/e2e/game/index.py @@ -19,6 +19,8 @@ def reset_farm(username, coins=100000): get_table("game_quests").delete(farm_uid=farm["uid"]) get_table("game_farms").delete(uid=farm["uid"]) get_table("game_cosmetics").delete(user_uid=uid) + get_table("game_steals").delete(thief_uid=uid) + get_table("game_steals").delete(owner_uid=uid) get_table("game_market_ticks").delete() clear_game_caches() farm = store.ensure_farm(uid) @@ -84,7 +86,7 @@ def test_game_page_loads(alice): assert page.locator(".game-header h1").is_visible() expect(page.locator("[data-hud-coins]")).to_have_text("100000") expect(page.locator("[data-game-grid] [data-slot]")).to_have_count(4) - expect(page.locator(".perk-card:not(.legacy-card)")).to_have_count(4) + expect(page.locator("[data-perk-host] .perk-card")).to_have_count(4) expect(page.locator(".quest-item")).to_have_count(3) @@ -159,7 +161,7 @@ def test_claim_daily(alice): open_game(page) page.locator("form[data-game-action='daily'] button").click() expect(page.locator("[data-hud-coins]")).to_have_text("100020") - expect(page.locator(".daily-claimed")).to_be_visible() + expect(page.locator("[data-daily-host] .daily-claimed")).to_be_visible() def test_upgrade_perk(alice): @@ -448,6 +450,15 @@ def test_crop_shows_saturated_label_when_overfarmed(alice): open_game(page) option = page.locator("form[data-game-action='plant'] select option[value='shell']").first option.wait_for(state="attached") + deadline = datetime.now(timezone.utc) + timedelta(seconds=40) + while "saturated" not in option.inner_text() and datetime.now(timezone.utc) < deadline: + page.wait_for_timeout(2000) + page.reload(wait_until="domcontentloaded") + page.locator("[data-game-grid]").first.wait_for(state="visible") + option = page.locator( + "form[data-game-action='plant'] select option[value='shell']" + ).first + option.wait_for(state="attached") assert "saturated" in option.inner_text()