fix(ads): fire the hint interstitial on the confirmed move, not on the hint
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 11s
CI / integration (pull_request) Successful in 21s
CI / ui (pull_request) Successful in 1m10s
CI / conformance (pull_request) Successful in 10s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m48s
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 11s
CI / integration (pull_request) Successful in 21s
CI / ui (pull_request) Successful in 1m10s
CI / conformance (pull_request) Successful in 10s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m48s
Taking a hint fired the post-move interstitial immediately, when the hint's preview tiles landed — interrupting the turn and reverting the board to the rack on the ad's close while the hint stayed spent. Move the trigger to the move confirmation: a hint applied this turn marks it (hintUsedThisTurn), and the confirmed play fires the hint-kind interstitial (its own cooldown) instead of the plain move one; the marker clears on any turn boundary (applyMoveResult) so a hint-then-pass does not leak into the next move. e2e: taking a hint fires no ad; confirming a move does.
This commit is contained in:
@@ -48,6 +48,33 @@ test('placing a tile and confirming via ✅ commits the move', async ({ page })
|
||||
await expect(page.locator('.make')).toBeHidden();
|
||||
});
|
||||
|
||||
// Regression: taking a hint must NOT fire the post-move interstitial. Firing on the hint interrupted
|
||||
// placing the preview and reverted the board on the ad's close while the hint stayed spent (the
|
||||
// reported bug). In mock mode the ad stub shows an "ad fired" toast, standing in for a real VK ad.
|
||||
test('taking a hint does not fire the interstitial', async ({ page }) => {
|
||||
await openGame(page);
|
||||
// Take a hint (the control confirms on a second tap). It produces a legal preview, so the ✅
|
||||
// control appears — proof the hint fired.
|
||||
const hint = page.getByRole('button', { name: 'Hint' });
|
||||
await hint.click();
|
||||
await hint.click();
|
||||
await expect(page.locator('.make')).toBeVisible();
|
||||
// A spurious ad would have toasted by now; none may.
|
||||
await page.waitForTimeout(400);
|
||||
await expect(page.getByText('ad fired')).toHaveCount(0);
|
||||
});
|
||||
|
||||
// The interstitial fires once the move is CONFIRMED (never on the hint / pass / exchange / resign).
|
||||
test('confirming a move fires the interstitial', async ({ page }) => {
|
||||
await openGame(page);
|
||||
await page.locator('.rack .tile').first().click();
|
||||
await page.locator('[data-cell]:not(.filled)').nth(30).click();
|
||||
await expect(page.locator('[data-cell].pending')).toHaveCount(1);
|
||||
|
||||
await page.locator('.make').click();
|
||||
await expect(page.getByText('ad fired')).toBeVisible();
|
||||
});
|
||||
|
||||
test('a placed tile is saved as a draft and restored on reopening the game', async ({ page }) => {
|
||||
await openGame(page);
|
||||
await page.locator('.rack .tile').first().click();
|
||||
|
||||
Reference in New Issue
Block a user