Allow returning to the safe trainer start
This commit is contained in:
1 parent
ba25b64190
commit
ba074df4ec
10 files changed
+102
-48
No files matched your search
@@ -32,6 +32,7 @@ async function checkTransitions(page, expectedExit) {
|
||||
for (const grid of ['scene-grid','map-grid']) {
|
||||
assert.deepEqual(await cellIds(page.locator(`#${grid} .entrance button`)),[0]);
|
||||
assert.deepEqual(await cellIds(page.locator(`#${grid} .exit button`)),[exit]);
|
||||
assert.deepEqual(await cellIds(page.locator(`#${grid} .transition button`)),[exit]);
|
||||
assert.equal(await page.locator(`#${grid} .transition.available`).count(),0);
|
||||
}
|
||||
return exit;
|
||||
@@ -41,7 +42,7 @@ async function assertEntranceLevel(page, value, current = true) {
|
||||
for (const grid of ['scene-grid','map-grid']) {
|
||||
const entrance = page.locator(`#${grid} .entrance button[data-id="0"]`);
|
||||
assert.equal(await valueText(entrance,'.cell-value'),value === null ? '↥' : `↥ ${value}`);
|
||||
assert.equal(await entrance.getAttribute('aria-label'),`x1 y1: вход${value === null ? '' : `, опасностей рядом: ${value}`}${current ? ', персонаж здесь' : ''}`);
|
||||
assert.equal(await entrance.getAttribute('aria-label'),`x1 y1: стартовая клетка${value === null ? '' : `, опасностей рядом: ${value}`}${current ? ', персонаж здесь' : ''}`);
|
||||
assert.equal(await page.locator(`#${grid} .entrance.opened`).count(),0);
|
||||
}
|
||||
assert.equal(await valueText(page.locator('#scene-grid .entrance button'),'.cell-coord'),'x1 y1');
|
||||
@@ -104,7 +105,7 @@ async function run() {
|
||||
}
|
||||
};
|
||||
await noOverflow();
|
||||
assert.match(await scene(0).getAttribute('aria-label'), /^x1 y1: вход, персонаж здесь$/);
|
||||
assert.match(await scene(0).getAttribute('aria-label'), /^x1 y1: стартовая клетка, персонаж здесь$/);
|
||||
await checkTransitions(page,field.exit);
|
||||
assert.equal(await page.locator('input[name="mode"], input[type="radio"], [role="radio"]').count(),0);
|
||||
assert.equal(await page.locator('#touch-actions').isVisible(),compact);
|
||||
@@ -123,7 +124,7 @@ async function run() {
|
||||
assert.equal(await noteButtons.count(),1,'only the map keeps its note button on desktop');
|
||||
assert.equal(await noteButtons.getAttribute('id'),'map-mark');
|
||||
}
|
||||
assert.match(await page.locator('#transition-coordinates').textContent(), /Вход: x1 y1/);
|
||||
assert.match(await page.locator('#transition-coordinates').textContent(), /Старт: x1 y1/);
|
||||
assert((await page.locator('#transition-coordinates').textContent()).includes(`Выход: ${coordinate(field.exit)}`));
|
||||
assert.equal(await page.locator('#scene-grid .hazard').count(),0);
|
||||
assert.equal(await page.locator('#scene-grid .opened').count(),0);
|
||||
@@ -173,7 +174,7 @@ async function run() {
|
||||
const proximity = `Опасностей рядом: ${field.values[first]}.`;
|
||||
assert.equal(await status.textContent(),proximity);
|
||||
assert.equal(await page.locator('#messages li').last().textContent(),`${coordinate(first)} · Звуков нет. ${proximity}`);
|
||||
await assertAvailable([2,10,11,12]);
|
||||
await assertAvailable([0,2,10,11,12]);
|
||||
// Native button keyboard actions and spatial focus; focus is not character position.
|
||||
await scene(first).focus(); await page.keyboard.press('ArrowRight');
|
||||
assert(await scene(second).evaluate(n=>n===document.activeElement));
|
||||
@@ -234,9 +235,10 @@ async function run() {
|
||||
const chooseOnMap = async cell => touch ? cell.tap() : cell.click();
|
||||
for (const id of [0,field.exit]) {
|
||||
await chooseOnMap(map(id));
|
||||
assert(await mapMark.isDisabled());
|
||||
await assertRatingControls(page,{disabled:true});
|
||||
await map(id).press('4');
|
||||
assert.equal(await valueText(map(id),'.cell-rating'),'','cannot rate a transition');
|
||||
assert.equal(await valueText(map(id),'.cell-rating'),'','cannot rate the entrance or exit');
|
||||
}
|
||||
await chooseOnMap(map(ratingCell));
|
||||
assert((await mapSelection.textContent()).includes(coordinate(ratingCell)));
|
||||
@@ -268,7 +270,7 @@ async function run() {
|
||||
assert.deepEqual(await cellIds(page.locator('#scene-grid .rated button')),[ratingCell]);
|
||||
assert.equal(await page.locator('#mark-count').textContent(),'0');
|
||||
assert.equal(await page.locator('#map-grid .marked').count(),0);
|
||||
await assertAvailable([2,10,11,12]);
|
||||
await assertAvailable([0,2,10,11,12]);
|
||||
await assertPosition(first);
|
||||
await project.uncheck();
|
||||
assert.equal(await valueText(scene(ratingCell),'.cell-rating'),'');
|
||||
@@ -371,7 +373,7 @@ async function run() {
|
||||
assert.equal(await page.locator('#scene-grid .opened').count(),0);
|
||||
assert.equal(await page.locator('#history li').count(),0);
|
||||
assert.equal(await page.locator('#timer').textContent(),'00:00');
|
||||
assert.match(await scene(0).getAttribute('aria-label'), /^x1 y1: вход(?:, опасностей рядом: [0-2])?, персонаж здесь$/);
|
||||
assert.match(await scene(0).getAttribute('aria-label'), /^x1 y1: стартовая клетка(?:, опасностей рядом: [0-2])?, персонаж здесь$/);
|
||||
await checkTransitions(page);
|
||||
await assertAvailable([1,10,11]);
|
||||
// Mark and unmark with compact buttons or Shift+Enter without moving the character.
|
||||
@@ -397,8 +399,42 @@ async function run() {
|
||||
assert.match(await history.last().textContent(),/Снята отметка/);
|
||||
await assertPosition(0);
|
||||
if (compact) assert(await jump.isEnabled());
|
||||
// The entrance is safe to revisit, but is not an opened cell.
|
||||
await page.locator('#simple-mode').check();
|
||||
const entranceValue = await valueText(scene(0),'.cell-value');
|
||||
assert.match(entranceValue,/^↥ [0-2]$/);
|
||||
if (compact) await jump.tap();
|
||||
else await scene(first).click();
|
||||
await assertPosition(first);
|
||||
await assertAvailable([0,2,10,11,12]);
|
||||
assert.equal(await valueText(scene(0),'.cell-value'),entranceValue);
|
||||
assert.match(await scene(0).getAttribute('aria-label'), /стартовая клетка, опасностей рядом: [0-2], можно прыгнуть$/);
|
||||
if (compact) {
|
||||
await scene(0).tap();
|
||||
await assertSelection(0,'старт');
|
||||
assert(await jump.isEnabled());
|
||||
assert(await mark.isDisabled());
|
||||
}
|
||||
const progress = await page.locator('#progress').textContent();
|
||||
if (compact) await jump.tap();
|
||||
else await scene(0).click();
|
||||
await assertPosition(0);
|
||||
if (compact) {
|
||||
await assertSelection(0,'вы здесь');
|
||||
assert(await jump.isDisabled());
|
||||
}
|
||||
assert.equal(await page.locator('#progress').textContent(),progress);
|
||||
assert.match(await history.last().textContent(),/^x1 y1 · Повторный прыжок/);
|
||||
assert.match(await status.textContent(),new RegExp(`^Опасностей рядом: ${entranceValue.at(-1)}\\.`));
|
||||
await assertEntranceLevel(page,Number(entranceValue.at(-1)));
|
||||
await assertAvailable([1,10,11]);
|
||||
if (shotDir && (width === 1366 || width === 390)) {
|
||||
const file = `${shotDir}/lu-return-${width}.png`;
|
||||
await page.locator('.location').screenshot({path:file});
|
||||
captures.push(file);
|
||||
}
|
||||
assert.deepEqual(errors,[]);
|
||||
console.log(`PASS ${width}x${height} (${compact ? 'compact' : 'desktop'}): render, adjacent jumps, keyboard/touch controls, map ratings and flags, projection, dialogs, settings, console`);
|
||||
console.log(`PASS ${width}x${height} (${compact ? 'compact' : 'desktop'}): render, adjacent jumps and safe entrance return, keyboard/touch controls, map ratings and flags, projection, dialogs, settings, console`);
|
||||
} finally { await context.close(); }
|
||||
}
|
||||
// Sample all exit buckets without coupling this test to their internal order.
|
||||
|
||||
Reference in new issue
Block a user