Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions scripts/smoke-secondary-journeys.js
Original file line number Diff line number Diff line change
Expand Up @@ -2440,11 +2440,7 @@ async function smokeLevel(session, route, sceneName, exceptions, {
scene?.levelStarted ||
scene?.gameStarted
),
mobileControls: Boolean(
scene?.mobileControls ||
scene?.platformerMobileControls ||
scene?.mobileControlElements?.length
),
mobileControls: scene?.platformerControlsVisible === true,
interactiveCount: scene?.input?._list?.length || 0,
displayCount: scene?.children?.list?.length || 0,
enemyCount: scene?.enemies?.getChildren?.()
Expand Down Expand Up @@ -2772,6 +2768,9 @@ async function smokeLevel(session, route, sceneName, exceptions, {
if (!state.entryAccepted) {
throw new Error(`${sceneName} did not accept entry input: ${JSON.stringify(state)}`);
}
if (!state.mobileControls) {
throw new Error(`${sceneName} entered gameplay without touch controls: ${JSON.stringify(state)}`);
}
if (!state.canvasWidth || !state.canvasHeight) {
throw new Error(`${sceneName} rendered a blank-sized canvas`);
}
Expand Down
37 changes: 33 additions & 4 deletions src/__tests__/ExpeditionControlLifecycle.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,34 @@ const LEVEL_FILES = [
'FinalVoidLevel.js'
];

const readLevel = fileName => fs.readFileSync(
path.join(__dirname, '../scenes/levels', fileName),
'utf8'
);

describe('expedition control lifecycle', () => {
test.each(LEVEL_FILES)(
'%s restores touch controls after its entry overlay',
(fileName) => {
const source = fs.readFileSync(
path.join(__dirname, '../scenes/levels', fileName),
'utf8'
);
const source = readLevel(fileName);

expect(source).toContain('this.showPlatformerMobileControls()');
}
);

test.each(LEVEL_FILES)(
'%s exposes touch controls in its direct boss QA route',
(fileName) => {
const source = readLevel(fileName);
const methodStart = source.indexOf('startTestMode() {');
const methodEnd = source.indexOf('\n }', methodStart);
const method = source.slice(methodStart, methodEnd);

expect(methodStart).toBeGreaterThan(-1);
expect(method).toContain('this.showPlatformerMobileControls()');
}
);

test('local level-entry previews can force the real touch-control layout', () => {
const gameSource = fs.readFileSync(
path.join(__dirname, '../game.js'),
Expand Down Expand Up @@ -63,4 +78,18 @@ describe('expedition control lifecycle', () => {
/hidePauseMenu\(\)[\s\S]*this\.showPlatformerMobileControls\(\)/
);
});

test('release interaction smoke requires visible touch controls in every level', () => {
const smokeSource = fs.readFileSync(
path.join(__dirname, '../../scripts/smoke-secondary-journeys.js'),
'utf8'
);

expect(smokeSource).toContain(
'mobileControls: scene?.platformerControlsVisible === true'
);
expect(smokeSource).toContain(
'entered gameplay without touch controls'
);
});
});
2 changes: 2 additions & 0 deletions src/scenes/levels/CrystalCavesLevel.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,8 @@ class CrystalCavesLevel extends PlatformerLevelScene {
this.player.setPosition(this.levelWidth - 900, this.levelHeight - 200);
}

this.showPlatformerMobileControls();

this.time.delayedCall(300, () => {
this.crystalCoreFound = true;
this.startBossFight();
Expand Down
2 changes: 2 additions & 0 deletions src/scenes/levels/FinalVoidLevel.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,8 @@ class FinalVoidLevel extends PlatformerLevelScene {
);
}

this.showPlatformerMobileControls();

this.time.delayedCall(500, () => this.startBossFight());

if (this.highPowerPreview) {
Expand Down
2 changes: 2 additions & 0 deletions src/scenes/levels/ReefLevel.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,8 @@ class ReefLevel extends PlatformerLevelScene {
this.player.setPosition(this.levelWidth - 900, this.levelHeight - 200);
}

this.showPlatformerMobileControls();

this.time.delayedCall(300, () => {
this.startBossFight();
});
Expand Down