-
Notifications
You must be signed in to change notification settings - Fork 7
feat: FM-967 QA Automation coverage for Replay level flow. (Playwrigh… #2001
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ashwinnair-chimple
wants to merge
1
commit into
develop
Choose a base branch
from
FM-967
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| /** | ||
| * FTM_TC_017 | Level Replay | ||
| * | ||
| * Continues directly from FTM_TC_016 (tc-016-level-completion.spec.ts), which | ||
| * deliberately stays on the Level End screen instead of clicking Map. Clicks | ||
| * Replay (#levelend-retry-btn) and verifies the same level reloads into a | ||
| * fresh, interactive gameplay state. | ||
| * | ||
| * Precondition: the orchestrator plays Level 2 (0-based currentLevel === 1), | ||
| * which always renders the Replay button regardless of star count | ||
| * (levelend-scene.ts renderButtonsHTML — Replay is hidden only for a passed | ||
| * Level 1 / currentLevel === 0). | ||
| * | ||
| * Run via the orchestrator: e2e/tests/ftm-assessment-survey-flow.spec.ts | ||
| */ | ||
|
|
||
| import { test, expect } from '../../fixtures/game-fixtures'; | ||
| import type { Page } from '@playwright/test'; | ||
| import { Timeouts } from '../../constants/timeouts'; | ||
| import { LevelEndPage } from '../../pages/level-end-page'; | ||
| import { GameplayPage } from '../../pages/gameplay-page'; | ||
| import { assertCanvasHasContent } from '../../helpers/canvas-helpers'; | ||
| import { getHitboxCenter, waitForStonesReady } from '../../helpers'; | ||
|
|
||
| export function registerTests(getPage: () => Page): void { | ||
| test('FTM_TC_017 | Level Replay | Replay button restarts the same level with fresh, interactive puzzle state', async () => { | ||
| const page = getPage(); | ||
| const levelEndPage = new LevelEndPage(page); | ||
| const gameplayPage = new GameplayPage(page); | ||
|
|
||
| await test.step('Level end screen from TC_016 is still loaded', async () => { | ||
| await levelEndPage.assertLevelEndVisible(); | ||
| }); | ||
|
|
||
| await test.step('Wait for UI to settle before interacting with Replay', async () => { | ||
| await page.waitForTimeout(Timeouts.replaySettleDelay); | ||
| }); | ||
|
|
||
| await test.step('Click Replay button', async () => { | ||
| await levelEndPage.clickRetryButton(); | ||
| }); | ||
|
|
||
| await test.step('Gameplay scene reloads after Replay', async () => { | ||
| await gameplayPage.waitForGameplayScene(); | ||
| }); | ||
|
|
||
| await test.step('Click the monster hotspot to trigger stones on the fresh puzzle', async () => { | ||
| await page.waitForFunction( | ||
| () => (window as any).__ftm?.gameStateService?.getHitBoxRanges?.() != null, | ||
| { timeout: Timeouts.sceneTransition }, | ||
| ); | ||
| const hitboxCenter = await getHitboxCenter(page); | ||
| expect(hitboxCenter).not.toBeNull(); | ||
| const canvasBB = await gameplayPage.mainCanvas.boundingBox(); | ||
| expect(canvasBB).not.toBeNull(); | ||
| await page.mouse.click( | ||
| canvasBB!.x + hitboxCenter!.x, | ||
| canvasBB!.y + hitboxCenter!.y, | ||
| ); | ||
| }); | ||
|
|
||
| await test.step('Gameplay canvas re-renders with interactive content', async () => { | ||
| await waitForStonesReady(page); | ||
| await assertCanvasHasContent(page, GameplayPage.SELECTORS.mainCanvas); | ||
| }); | ||
|
|
||
| await test.step('Same level (Level 2) context is maintained after replay', async () => { | ||
| const restartedLevel = await page.evaluate( | ||
| () => (window as any).__ftm?.gameStateService?.gamePlayData?.selectedLevelNumber, | ||
| ); | ||
| expect(restartedLevel).toBe(1); // 0-based → "Level 2" | ||
| }); | ||
| }); | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: curiouslearning/FeedTheMonsterJS
Length of output: 7158
🏁 Script executed:
Repository: curiouslearning/FeedTheMonsterJS
Length of output: 50388
🏁 Script executed:
Repository: curiouslearning/FeedTheMonsterJS
Length of output: 30316
Wait for the replay scene to clear before reading game state.
waitForGameplayScene()only checks that#canvasand#pause-buttonare visible, whilegetHitboxCenter()reads whatever__ftm.gameStateService.getHitBoxRanges()returns. If#levelEndis still active after Replay, this step can click the stale Level End hitbox. Add the level-end deactivation check before reading hitbox state, or updatewaitForGameplayScene()to enforce it.🤖 Prompt for AI Agents