Tests for store image rules and iPad wiring; skill and README: iPad, sources, checks
This commit is contained in:
parent
aecdcb1c50
commit
df1a757a8b
3 changed files with 271 additions and 6 deletions
|
|
@ -117,7 +117,7 @@ can run in the background with a log (`storebound play images > .storebound/imag
|
||||||
| `mcp` | local | stdio MCP server wrapping the commands |
|
| `mcp` | local | stdio MCP server wrapping the commands |
|
||||||
| `check` | local | validate config, copy limits, data safety, products, files; warns on untranslated release notes |
|
| `check` | local | validate config, copy limits, data safety, products, files; warns on untranslated release notes |
|
||||||
| `check --aso` | local | keyword audit: App Store keyword field rules, Play stuffing / claims (exit 1 on errors) |
|
| `check --aso` | local | keyword audit: App Store keyword field rules, Play stuffing / claims (exit 1 on errors) |
|
||||||
| `validate [--apple] [--play]` | API, read-only | readiness report with ordered blockers; exit 1 while any blocker is left |
|
| `validate [--apple] [--play]` | API, read-only | readiness report with ordered blockers, plus the local renders checks of `shots check` (`--no-local` skips); exit 1 while any blocker is left |
|
||||||
| `whats-new [--since <tag>]` | local | draft player-facing release notes from git log into both listing files |
|
| `whats-new [--since <tag>]` | local | draft player-facing release notes from git log into both listing files |
|
||||||
| `privacy-manifest --ios <path>` | local | PrivacyInfo.xcprivacy, required-reason APIs, SDKs without manifests |
|
| `privacy-manifest --ios <path>` | local | PrivacyInfo.xcprivacy, required-reason APIs, SDKs without manifests |
|
||||||
| `play products` | API | one-time products via `monetization.onetimeproducts`: regional prices from `convertRegionPrices` + your overrides, activate |
|
| `play products` | API | one-time products via `monetization.onetimeproducts`: regional prices from `convertRegionPrices` + your overrides, activate |
|
||||||
|
|
@ -132,7 +132,7 @@ can run in the background with a log (`storebound play images > .storebound/imag
|
||||||
| `apple iap` | API | IAPs, localizations, price schedules (USA base + overrides), availability |
|
| `apple iap` | API | IAPs, localizations, price schedules (USA base + overrides), availability |
|
||||||
| `apple iap-review` | API | IAP review screenshots + states |
|
| `apple iap-review` | API | IAP review screenshots + states |
|
||||||
| `apple listing --version x.y.z [--build N]` | API | version (manual release), the build with exactly that number, name / subtitle / description / keywords / promo per locale |
|
| `apple listing --version x.y.z [--build N]` | API | version (manual release), the build with exactly that number, name / subtitle / description / keywords / promo per locale |
|
||||||
| `apple screenshots` | API | 6.9" + 6.5" screenshots per locale (MD5-idempotent) |
|
| `apple screenshots` | API | 6.9" + 6.5" screenshots per locale, 13" iPad with `apple.ipad` (MD5-idempotent) |
|
||||||
| `apple appinfo` | API | categories, age rating, content rights, Free, all territories |
|
| `apple appinfo` | API | categories, age rating, content rights, Free, all territories |
|
||||||
| `apple review-details` | API | App Review contact + notes |
|
| `apple review-details` | API | App Review contact + notes |
|
||||||
| `apple encryption` | API | export compliance answer for builds, from `apple.usesNonExemptEncryption` (never guessed) |
|
| `apple encryption` | API | export compliance answer for builds, from `apple.usesNonExemptEncryption` (never guessed) |
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,26 @@ iOS Simulator capture needs macOS + Xcode (`xcrun`); Android capture needs `adb`
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
| ios69 | 1320 x 2868 | App Store 6.9" (`APP_IPHONE_67`), required |
|
| ios69 | 1320 x 2868 | App Store 6.9" (`APP_IPHONE_67`), required |
|
||||||
| ios65 | 1284 x 2778 | App Store 6.5" (`APP_IPHONE_65`) |
|
| ios65 | 1284 x 2778 | App Store 6.5" (`APP_IPHONE_65`) |
|
||||||
|
| ipad13 | 2064 x 2752 | App Store 13" iPad (`APP_IPAD_PRO_3GEN_129`), required when the app runs on iPad; only with `apple.ipad: true` |
|
||||||
| play | 1080 x 1920 | Play phone (2-8, ratio at most 2:1) |
|
| play | 1080 x 1920 | Play phone (2-8, ratio at most 2:1) |
|
||||||
| tab7 | 1080 x 1920 | Play 7" tablet (tablet frames) |
|
| tab7 | 1080 x 1920 | Play 7" tablet (tablet frames) |
|
||||||
| tab10 | 1440 x 2560 | Play 10" tablet |
|
| tab10 | 1440 x 2560 | Play 10" tablet |
|
||||||
| feature | 1024 x 500 | Play feature graphic (required) |
|
| feature | 1024 x 500 | Play feature graphic (required) |
|
||||||
|
|
||||||
|
Sources (re-check before a release; Apple renames display classes often):
|
||||||
|
- Apple "Screenshot specifications": https://developer.apple.com/help/app-store-connect/reference/app-information/screenshot-specifications
|
||||||
|
(13" iPad: 2064 x 2752 or 2048 x 2732, landscape too, "Required if app runs on iPad"; 1-10 per size; JPEG / PNG,
|
||||||
|
no alpha or transparency).
|
||||||
|
- ASC API `ScreenshotDisplayType`: https://developer.apple.com/documentation/appstoreconnectapi/screenshotdisplaytype
|
||||||
|
(there is no "13 inch" value: the 13" iPad set is `APP_IPAD_PRO_3GEN_129`).
|
||||||
|
- Play graphics: https://support.google.com/googleplay/android-developer/answer/9866151 (screenshots 320-3840 px, at
|
||||||
|
most 2:1, JPEG or 24-bit PNG, 8 MB; feature graphic 1024 x 500).
|
||||||
|
|
||||||
|
**iPad.** Set `apple.ipad: true` only if the app runs on iPad (iPhone-only apps skip the iPad set). Then the default
|
||||||
|
sizes include `ipad13` (3:4 layout), `apple screenshots` uploads it, `validate` requires it, and tablet frames default
|
||||||
|
to the 13" iPad screen (1032 x 1352 CSS px @2x below a 24 px bar), so an `iPad Pro 13-inch` / `iPad Air 13-inch`
|
||||||
|
simulator screenshot fits after the bar is cropped. Play tablet sizes (tab7 / tab10) reuse the same tablet frames.
|
||||||
|
|
||||||
## Steps
|
## Steps
|
||||||
1. **Game switches.** Give the game URL params for screenshots: language, fixed seed, no ads / analytics / purchase
|
1. **Game switches.** Give the game URL params for screenshots: language, fixed seed, no ads / analytics / purchase
|
||||||
UI, skip tutorial, jump to a level, freeze at a moment. Frames must show real gameplay (store rule).
|
UI, skip tutorial, jump to a level, freeze at a moment. Frames must show real gameplay (store rule).
|
||||||
|
|
@ -30,15 +45,21 @@ iOS Simulator capture needs macOS + Xcode (`xcrun`); Android capture needs `adb`
|
||||||
- `ios-sim` (Unity, Godot, Flutter, native, Capacitor: any Simulator build): `ios.device` (simulator name or UDID,
|
- `ios-sim` (Unity, Godot, Flutter, native, Capacitor: any Simulator build): `ios.device` (simulator name or UDID,
|
||||||
e.g. a 6.9" iPhone), `ios.bundleId`, optional `ios.app` (.app to install), `ios.args`. Per shot: `args` (launch
|
e.g. a 6.9" iPhone), `ios.bundleId`, optional `ios.app` (.app to install), `ios.args`. Per shot: `args` (launch
|
||||||
arguments, read them with UserDefaults / your engine) and / or `url` (deep link). Language goes in as
|
arguments, read them with UserDefaults / your engine) and / or `url` (deep link). Language goes in as
|
||||||
`-AppleLanguages` / `-AppleLocale`; status bar is forced to 9:41, full battery. A simulator storebound boots is
|
`-AppleLanguages` / `-AppleLocale`; status bar is forced to 9:41, full battery. After a cold boot the app is
|
||||||
shut down afterwards (`--keep-booted` keeps it).
|
launched once and given `ios.warmupMs` (default 8000) before the first shot; without it the first frame of a
|
||||||
|
fresh simulator is often blank. A simulator storebound boots is shut down afterwards (`--keep-booted` keeps it).
|
||||||
|
For iPad shots set `ios.devices.tablet` (e.g. "iPad Pro 13-inch (M5)") and `device: 'tablet' | 'both'` per shot.
|
||||||
- `android-emu`: `android.package`, optional `serial`, `activity`, `apk`. Per shot: `url` (VIEW intent) and / or
|
- `android-emu`: `android.package`, optional `serial`, `activity`, `apk`. Per shot: `url` (VIEW intent) and / or
|
||||||
typed `extras`. Demo-mode status bar; per-app language on Android 13+ (older: pass `{lang}` in an extra).
|
typed `extras`. Demo-mode status bar; per-app language on Android 13+ (older: pass `{lang}` in an extra).
|
||||||
Nothing is wiped or rebooted.
|
Nothing is wiped or rebooted.
|
||||||
- `folder`: frames made any other way; `shots capture` (and `shots check`) only verify that every frame the scenes
|
- `folder`: frames made any other way; `shots capture` (and `shots check`) only verify that every frame the scenes
|
||||||
use exists with the right aspect ratio and resolution.
|
use exists with the right aspect ratio and resolution.
|
||||||
`{lang}`, `{locale}`, `{shot}` are replaced in args, extras and URLs. Simulator / emulator screenshots lose
|
`{lang}`, `{locale}`, `{shot}` are replaced in args, extras and URLs. Simulator / emulator screenshots lose
|
||||||
`cropTop` rows (the status bar; default about 5.6 % of the height) so they fit the template.
|
`cropTop` rows (the status bar) so they fit the template: by default the frame's bar share per device class
|
||||||
|
(162 px on a 6.9" iPhone, 48 px on a 13" iPad with `apple.ipad`); set `cropTop: 120` or `{ phone, tablet }` for
|
||||||
|
other devices, and `shots.phone` / `shots.tablet` to that device's screen in points. Capture warns when a frame's
|
||||||
|
aspect does not match. Give the game time to load: `delayMs` (simulator / emulator; 2500 default is short for a
|
||||||
|
cold start) or `waitFor` (web).
|
||||||
3. **Copy.** `store/shots/copy.json`: per language, per scene: `eyebrow`, `title` [white line, gold line], `sub`,
|
3. **Copy.** `store/shots/copy.json`: per language, per scene: `eyebrow`, `title` [white line, gold line], `sub`,
|
||||||
`badges` [[big, small]]. Short and true (only claim what is in the game); about 15 Latin characters per title line.
|
`badges` [[big, small]]. Short and true (only claim what is in the game); about 15 Latin characters per title line.
|
||||||
Natural marketing tone per language, not literal translation; use the game's own terms.
|
Natural marketing tone per language, not literal translation; use the game's own terms.
|
||||||
|
|
@ -49,7 +70,11 @@ iOS Simulator capture needs macOS + Xcode (`xcrun`); Android capture needs `adb`
|
||||||
6. **Render.** `storebound shots render --lang en` first, review `store/renders/en/sheet.png` (contact sheet), then
|
6. **Render.** `storebound shots render --lang en` first, review `store/renders/en/sheet.png` (contact sheet), then
|
||||||
all languages in the background: `storebound shots render > .storebound/render.log 2>&1 &`.
|
all languages in the background: `storebound shots render > .storebound/render.log 2>&1 &`.
|
||||||
7. **JPEG for Play.** `storebound shots jpeg` (q92, about 4x smaller than PNG; App Store stays PNG).
|
7. **JPEG for Play.** `storebound shots jpeg` (q92, about 4x smaller than PNG; App Store stays PNG).
|
||||||
8. **Check.** `storebound shots check` (read-only, exit 1 on errors): sizes, alpha, counts, text overflow.
|
8. **Check.** `storebound shots check` (read-only, exit 1 on errors): pixel sizes (Apple: a listed size, portrait or
|
||||||
|
landscape; Play screenshots 320-3840 px at most 2:1; feature graphic exactly 1024 x 500), alpha, Play JPEG /
|
||||||
|
24-bit PNG and 8 MB, counts per set (Apple 1-10, Play 2-8), text overflow flags (warnings). `--variants` also checks
|
||||||
|
A/B variant folders. `storebound validate` runs the same checks on the renders folder and lists errors as
|
||||||
|
blockers next to the store state (`--no-local` skips them).
|
||||||
9. **Upload.** `storebound play images` and `storebound apple screenshots` (both idempotent, background + log).
|
9. **Upload.** `storebound play images` and `storebound apple screenshots` (both idempotent, background + log).
|
||||||
|
|
||||||
## Gotchas
|
## Gotchas
|
||||||
|
|
|
||||||
240
tests/specs.test.ts
Normal file
240
tests/specs.test.ts
Normal file
|
|
@ -0,0 +1,240 @@
|
||||||
|
// Store image rules (cli/shots/spec.ts) on tiny generated PNG / JPEG buffers, the renders scan, the 13" iPad wiring
|
||||||
|
// (sizes, frame defaults, crop, ASC display types) and the local renders findings of `validate`. No browser, no store.
|
||||||
|
import { describe, expect, test } from 'bun:test';
|
||||||
|
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
|
||||||
|
import { tmpdir } from 'node:os';
|
||||||
|
import { join } from 'node:path';
|
||||||
|
import { DISPLAY, displaySets, IPAD_DISPLAY, requiredDisplayTypes } from '../cli/apple/screenshots';
|
||||||
|
import { type ShipConfig, validateConfig } from '../cli/lib/config';
|
||||||
|
import { type AppleSnapshot, appleRules, type PlaySnapshot, playRules, rendersFindings } from '../cli/lib/validate-rules';
|
||||||
|
import { rendersCheck } from '../cli/shots/check';
|
||||||
|
import { cropTopFor, validateCapture } from '../cli/shots/devices';
|
||||||
|
import { DEFAULT_IPAD, DEFAULT_PHONE, DEFAULT_TABLET, defaultSizes, frameDims, SIZES } from '../cli/shots/lib';
|
||||||
|
import { allIssues, requiredSets, scanRenders } from '../cli/shots/report';
|
||||||
|
import { checkCount, checkImage, type ImageInfo, IMAGE_SPECS, imageInfo } from '../cli/shots/spec';
|
||||||
|
|
||||||
|
/** PNG header imageInfo reads: signature + IHDR (+ optional tRNS) + IEND, padded to `pad` bytes. */
|
||||||
|
function png(w: number, h: number, o: { colorType?: number; depth?: number; trns?: boolean; pad?: number } = {}): Uint8Array {
|
||||||
|
const chunks = 8 + 25 + (o.trns ? 14 : 0) + 12;
|
||||||
|
const b = new Uint8Array(Math.max(chunks, o.pad ?? 0));
|
||||||
|
b.set([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);
|
||||||
|
const dv = new DataView(b.buffer);
|
||||||
|
dv.setUint32(8, 13); b.set([0x49, 0x48, 0x44, 0x52], 12); dv.setUint32(16, w); dv.setUint32(20, h);
|
||||||
|
b[24] = o.depth ?? 8; b[25] = o.colorType ?? 2;
|
||||||
|
let p = 33;
|
||||||
|
if (o.trns) { dv.setUint32(p, 2); b.set([0x74, 0x52, 0x4e, 0x53], p + 4); p += 14; }
|
||||||
|
dv.setUint32(p, 0); b.set([0x49, 0x45, 0x4e, 0x44], p + 4);
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** JPEG with an APP0 segment and a baseline SOF0 frame header. */
|
||||||
|
function jpeg(w: number, h: number, pad = 0): Uint8Array {
|
||||||
|
const head = [0xff, 0xd8, 0xff, 0xe0, 0, 16, 0x4a, 0x46, 0x49, 0x46, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0,
|
||||||
|
0xff, 0xc0, 0, 17, 8, h >> 8, h & 255, w >> 8, w & 255, 3, 1, 0x22, 0, 2, 0x11, 1, 3, 0x11, 1, 0xff, 0xd9];
|
||||||
|
const b = new Uint8Array(Math.max(head.length, pad));
|
||||||
|
b.set(head);
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
const codes = (i: { code: string }[]) => i.map(x => x.code);
|
||||||
|
|
||||||
|
describe('imageInfo', () => {
|
||||||
|
test('png rgb / rgba / tRNS / palette / 16 bit', () => {
|
||||||
|
expect(imageInfo(png(1320, 2868))).toMatchObject({ format: 'png', w: 1320, h: 2868, alpha: false, palette: false, depth: 8 });
|
||||||
|
expect(imageInfo(png(10, 20, { colorType: 6 })).alpha).toBe(true);
|
||||||
|
expect(imageInfo(png(10, 20, { colorType: 4 })).alpha).toBe(true);
|
||||||
|
expect(imageInfo(png(10, 20, { trns: true })).alpha).toBe(true);
|
||||||
|
expect(imageInfo(png(10, 20, { colorType: 3 })).palette).toBe(true);
|
||||||
|
expect(imageInfo(png(10, 20, { depth: 16 })).depth).toBe(16);
|
||||||
|
});
|
||||||
|
test('jpeg and unknown', () => {
|
||||||
|
expect(imageInfo(jpeg(1080, 1920))).toMatchObject({ format: 'jpeg', w: 1080, h: 1920, alpha: false, depth: 8 });
|
||||||
|
expect(imageInfo(new Uint8Array([1, 2, 3, 4, 5])).format).toBe('unknown');
|
||||||
|
expect(imageInfo(jpeg(1, 1, 1000)).bytes).toBe(1000);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('checkImage', () => {
|
||||||
|
const ok = (b: Uint8Array, k: string) => expect(checkImage(imageInfo(b), k)).toEqual([]);
|
||||||
|
test('apple sizes, portrait and landscape', () => {
|
||||||
|
ok(png(1320, 2868), 'ios69');
|
||||||
|
ok(png(1290, 2796), 'ios69');
|
||||||
|
ok(png(2868, 1320), 'ios69');
|
||||||
|
ok(jpeg(1284, 2778), 'ios65');
|
||||||
|
ok(png(2064, 2752), 'ipad13');
|
||||||
|
ok(png(2048, 2732), 'ipad13');
|
||||||
|
ok(png(2752, 2064), 'ipad13');
|
||||||
|
const e = checkImage(imageInfo(png(1242, 2208)), 'ios69');
|
||||||
|
expect(codes(e)).toEqual(['size']);
|
||||||
|
expect(e[0]!.msg).toContain('1320x2868');
|
||||||
|
expect(codes(checkImage(imageInfo(png(1600, 2480)), 'ipad13'))).toEqual(['size']);
|
||||||
|
});
|
||||||
|
test('alpha is an error on both stores', () => {
|
||||||
|
expect(codes(checkImage(imageInfo(png(1320, 2868, { colorType: 6 })), 'ios69'))).toEqual(['alpha']);
|
||||||
|
expect(codes(checkImage(imageInfo(png(1080, 1920, { trns: true })), 'play'))).toEqual(['alpha']);
|
||||||
|
});
|
||||||
|
test('play: any accepted screenshot size, palette / 16 bit PNG rejected', () => {
|
||||||
|
ok(png(1080, 1920), 'play');
|
||||||
|
ok(jpeg(1440, 2560), 'tab10');
|
||||||
|
ok(png(1242, 2208), 'play');
|
||||||
|
expect(codes(checkImage(imageInfo(png(1000, 2100)), 'play'))).toEqual(['size']); // longer than 2:1
|
||||||
|
expect(codes(checkImage(imageInfo(png(300, 500)), 'play'))).toEqual(['size']); // under 320
|
||||||
|
expect(codes(checkImage(imageInfo(png(2200, 4000)), 'tab10'))).toEqual(['size']); // over 3840
|
||||||
|
expect(codes(checkImage(imageInfo(png(1080, 1920, { colorType: 3 })), 'play'))).toEqual(['format']);
|
||||||
|
expect(codes(checkImage(imageInfo(png(1080, 1920, { depth: 16 })), 'play'))).toEqual(['format']);
|
||||||
|
ok(png(1320, 2868, { depth: 16 }), 'ios69');
|
||||||
|
});
|
||||||
|
test('play 8 MB per screenshot, feature graphic exact', () => {
|
||||||
|
const big = imageInfo(jpeg(1080, 1920, 8 * 1024 * 1024 + 1));
|
||||||
|
expect(codes(checkImage(big, 'play'))).toEqual(['bytes']);
|
||||||
|
expect(checkImage({ ...big, bytes: 8 * 1024 * 1024 }, 'play')).toEqual([]);
|
||||||
|
ok(jpeg(1024, 500), 'feature');
|
||||||
|
expect(codes(checkImage(imageInfo(png(1000, 500)), 'feature'))).toEqual(['size']);
|
||||||
|
expect(codes(checkImage(imageInfo(png(500, 1024)), 'feature'))).toEqual(['size']);
|
||||||
|
expect(codes(checkImage(imageInfo(png(1024, 500, { colorType: 6 })), 'feature'))).toEqual(['alpha']);
|
||||||
|
const info: ImageInfo = { format: 'png', w: 1024, h: 500, alpha: false, palette: false, bytes: 16 * 1024 * 1024, depth: 8 };
|
||||||
|
expect(codes(checkImage(info, 'feature'))).toEqual(['bytes']);
|
||||||
|
});
|
||||||
|
test('not an image, unknown size key', () => {
|
||||||
|
expect(codes(checkImage(imageInfo(new Uint8Array(40)), 'ios69'))).toEqual(['format']);
|
||||||
|
expect(checkImage(imageInfo(png(1, 1)), 'nope')[0]!.msg).toContain('unknown size key');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('checkCount', () => {
|
||||||
|
test('per store', () => {
|
||||||
|
expect(checkCount(0, 'ios69', true)[0]!.level).toBe('error');
|
||||||
|
expect(checkCount(0, 'ios65', false)).toEqual([]);
|
||||||
|
expect(checkCount(10, 'ipad13', true)).toEqual([]);
|
||||||
|
expect(checkCount(11, 'ipad13', true)[0]).toMatchObject({ level: 'error', code: 'count' });
|
||||||
|
expect(checkCount(1, 'play', true)[0]).toMatchObject({ level: 'error', code: 'count' });
|
||||||
|
expect(checkCount(9, 'play', true)[0]).toMatchObject({ level: 'warn', code: 'count' });
|
||||||
|
expect(checkCount(2, 'feature', true)[0]!.level).toBe('warn');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('13" iPad', () => {
|
||||||
|
test('size, spec and ASC display type agree', () => {
|
||||||
|
expect(SIZES.ipad13).toEqual({ w: 2064, h: 2752, device: 'tablet' });
|
||||||
|
expect(IMAGE_SPECS.ipad13!.sizes[0]).toEqual([2064, 2752]);
|
||||||
|
for (const [k, t] of Object.entries({ ...DISPLAY, ...IPAD_DISPLAY })) {
|
||||||
|
expect(IMAGE_SPECS[k]!.type).toBe(t);
|
||||||
|
expect(IMAGE_SPECS[k]!.sizes[0]).toEqual([SIZES[k]!.w, SIZES[k]!.h]);
|
||||||
|
}
|
||||||
|
expect(IPAD_DISPLAY.ipad13).toBe('APP_IPAD_PRO_3GEN_129');
|
||||||
|
});
|
||||||
|
test('only with apple.ipad', () => {
|
||||||
|
expect(displaySets({})).toEqual(DISPLAY);
|
||||||
|
expect(displaySets(undefined)).toEqual(DISPLAY);
|
||||||
|
expect(Object.keys(displaySets({ ipad: true }))).toEqual(['ios69', 'ios65', 'ipad13']);
|
||||||
|
expect(requiredDisplayTypes({})).toEqual(['APP_IPHONE_67']);
|
||||||
|
expect(requiredDisplayTypes({ ipad: true })).toEqual(['APP_IPHONE_67', 'APP_IPAD_PRO_3GEN_129']);
|
||||||
|
expect(requiredDisplayTypes({ ipad: true, screenshotTypes: ['APP_IPHONE_65'] })).toEqual(['APP_IPHONE_65']);
|
||||||
|
expect(defaultSizes({ apple: { bundleId: 'x' } })).not.toContain('ipad13');
|
||||||
|
expect(defaultSizes({ apple: { bundleId: 'x', ipad: true } })).toContain('ipad13');
|
||||||
|
expect(defaultSizes({ play: { packageName: 'x' } } as Pick<ShipConfig, 'apple' | 'play'>)).not.toContain('ipad13');
|
||||||
|
});
|
||||||
|
test('tablet frames follow the 13" iPad with apple.ipad', () => {
|
||||||
|
expect(frameDims({}).tablet).toEqual(DEFAULT_TABLET);
|
||||||
|
expect(frameDims({ apple: { bundleId: 'x', ipad: true } }).tablet).toEqual(DEFAULT_IPAD);
|
||||||
|
expect(DEFAULT_IPAD.w * DEFAULT_IPAD.dpr).toBe(2064);
|
||||||
|
expect((DEFAULT_IPAD.h + DEFAULT_IPAD.bar) * DEFAULT_IPAD.dpr).toBe(2752);
|
||||||
|
const custom = frameDims({ apple: { bundleId: 'x', ipad: true }, shots: { tablet: { w: 834, h: 1170 } } as ShipConfig['shots'] });
|
||||||
|
expect(custom.tablet).toEqual({ w: 834, h: 1170, dpr: 2, bar: 24 });
|
||||||
|
expect(frameDims({}).phone).toEqual(DEFAULT_PHONE);
|
||||||
|
});
|
||||||
|
test('crop per device class', () => {
|
||||||
|
expect(cropTopFor(undefined, 'phone', 2868, DEFAULT_PHONE)).toBe(162);
|
||||||
|
expect(cropTopFor(undefined, 'tablet', 2752, DEFAULT_IPAD)).toBe(48);
|
||||||
|
expect(cropTopFor(undefined, 'tablet', 2560, DEFAULT_TABLET)).toBe(80);
|
||||||
|
expect(cropTopFor(100, 'tablet', 2752, DEFAULT_IPAD)).toBe(100);
|
||||||
|
expect(cropTopFor({ tablet: 60 }, 'tablet', 2752, DEFAULT_IPAD)).toBe(60);
|
||||||
|
expect(cropTopFor({ tablet: 60 }, 'phone', 2868, DEFAULT_PHONE)).toBe(162);
|
||||||
|
const base = { source: 'folder' as const, shots: {} };
|
||||||
|
expect(validateCapture({ ...base, cropTop: { phone: 162, tablet: 48 } })).toEqual([]);
|
||||||
|
expect(validateCapture({ ...base, cropTop: { tablet: -1 } }).join()).toContain('cropTop.tablet');
|
||||||
|
expect(validateCapture({ ...base, cropTop: { watch: 1 } as never }).join()).toContain('cropTop.watch');
|
||||||
|
const ios = { source: 'ios-sim' as const, ios: { device: 'iPhone 17 Pro Max', bundleId: 'com.example.game' }, shots: { a: {} } };
|
||||||
|
expect(validateCapture({ ...ios, ios: { ...ios.ios, warmupMs: 0 } })).toEqual([]);
|
||||||
|
expect(validateCapture({ ...ios, ios: { ...ios.ios, warmupMs: -5 } }).join()).toContain('warmupMs');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('renders scan', () => {
|
||||||
|
const config = {
|
||||||
|
languages: [{ id: 'en', apple: 'en-US', play: 'en-US' }, { id: 'de', play: 'de-DE' }],
|
||||||
|
apple: { bundleId: 'com.example.game', ipad: true }, play: { packageName: 'com.example.game' },
|
||||||
|
} as unknown as ShipConfig;
|
||||||
|
|
||||||
|
test('required sets per language', () => {
|
||||||
|
expect(requiredSets(config)).toEqual({ ios69: true, ipad13: true, play: true, feature: true });
|
||||||
|
expect(requiredSets(config, 'de')).toEqual({ ios69: false, ipad13: false, play: true, feature: true });
|
||||||
|
expect(requiredSets({ ...config, apple: { bundleId: 'x' } } as ShipConfig, 'en').ipad13).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('wrong size, alpha, too many, too large, overflow, missing sets', () => {
|
||||||
|
const dir = mkdtempSync(join(tmpdir(), 'sb-renders-'));
|
||||||
|
const put = (rel: string, b: Uint8Array) => { mkdirSync(join(dir, rel, '..'), { recursive: true }); writeFileSync(join(dir, rel), b); };
|
||||||
|
try {
|
||||||
|
for (let i = 1; i <= 11; i++) put(`en/ios69/${String(i).padStart(2, '0')}.png`, png(1320, 2868));
|
||||||
|
put('en/ios69/03.png', png(1320, 2868, { colorType: 6 }));
|
||||||
|
put('en/ipad13/01.png', png(1600, 2480));
|
||||||
|
put('en/play/01.png', png(1080, 1920));
|
||||||
|
put('en/play/01.jpg', jpeg(1080, 1920, 8 * 1024 * 1024 + 10));
|
||||||
|
put('en/feature/1024x500.png', png(1024, 500, { colorType: 3 }));
|
||||||
|
put('de/play/01.jpg', jpeg(1080, 1920));
|
||||||
|
put('de/play/02.jpg', jpeg(1080, 1920));
|
||||||
|
put('de/feature/1024x500.jpg', jpeg(1024, 500));
|
||||||
|
writeFileSync(join(dir, 'report.json'), JSON.stringify({ 'en/ios69/01.png': { overflow: ['title line 1 shrunk to 60 %'] } }));
|
||||||
|
const scan = scanRenders(dir, { langs: ['en', 'de'], required: lang => requiredSets(config, lang), probe: () => null });
|
||||||
|
const got = allIssues(scan).map(x => `${x.where} ${x.issue.level} ${x.issue.code}`).sort();
|
||||||
|
expect(got).toEqual([
|
||||||
|
'en/feature/1024x500.png error format',
|
||||||
|
'en/ios69 error count',
|
||||||
|
'en/ios69/01.png warn overflow',
|
||||||
|
'en/ios69/03.png error alpha',
|
||||||
|
'en/ipad13/01.png error size',
|
||||||
|
'en/play error count',
|
||||||
|
'en/play/01.jpg error bytes',
|
||||||
|
].sort());
|
||||||
|
|
||||||
|
const local = rendersCheck(config, dir)!;
|
||||||
|
expect(local.apple.issues.map(i => i.where).sort()).toEqual(['en/ios69', 'en/ios69/01.png', 'en/ios69/03.png', 'en/ipad13/01.png']);
|
||||||
|
expect(local.play.issues.length).toBe(3);
|
||||||
|
expect(local.apple.images).toBe(12);
|
||||||
|
expect(rendersCheck(config, join(dir, 'nope'))).toBeNull();
|
||||||
|
|
||||||
|
const f = rendersFindings('apple', local.apple);
|
||||||
|
expect(f.filter(x => x.level === 'blocker').length).toBe(3);
|
||||||
|
expect(f.find(x => x.code === 'renders-overflow')!.level).toBe('warn');
|
||||||
|
expect(f.find(x => x.code === 'renders-alpha')!.fix).toContain('rgb24');
|
||||||
|
} finally { rmSync(dir, { recursive: true, force: true }); }
|
||||||
|
});
|
||||||
|
|
||||||
|
test('clean renders: one ok finding, nothing without a folder', () => {
|
||||||
|
expect(rendersFindings('play', { dir: 'r', images: 4, issues: [] })).toEqual([{ store: 'play', level: 'ok', code: 'renders', msg: expect.stringContaining('4 local store images') }]);
|
||||||
|
expect(rendersFindings('play', undefined)).toEqual([]);
|
||||||
|
expect(rendersFindings('play', { dir: 'r', images: 0, issues: [] })).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('appleRules / playRules carry render blockers', () => {
|
||||||
|
const apple = { version: { versionString: '1.0', state: 'PREPARE_FOR_SUBMISSION' }, build: null, expectedLocales: [], locales: [],
|
||||||
|
requiredDisplayTypes: [], reviewDetail: null, ageRating: null, priceSchedule: true, availability: true, iaps: [], expectedProducts: [],
|
||||||
|
privacyUrl: { url: 'https://example.com/privacy', status: 200 },
|
||||||
|
renders: { dir: 'r', images: 1, issues: [{ where: 'en/ipad13/01.png', level: 'error', code: 'size', msg: '1600x2480' }] } } as AppleSnapshot;
|
||||||
|
const a = appleRules(apple).find(x => x.code === 'renders-size')!;
|
||||||
|
expect(a).toMatchObject({ store: 'apple', level: 'blocker' });
|
||||||
|
expect(a.msg).toContain('en/ipad13/01.png');
|
||||||
|
const play = { defaultLanguage: 'en-US', expectedLanguages: [], listings: [], privacyUrl: { url: 'https://example.com/privacy', status: 200 },
|
||||||
|
website: null, appAds: null, appAdsLines: [], adsLikely: false, tracks: [], products: [], expectedProducts: [],
|
||||||
|
renders: { dir: 'r', images: 1, issues: [{ where: 'en/play/01.jpg', level: 'error', code: 'bytes', msg: '8.1 MB > 8 MB' }] } } as PlaySnapshot;
|
||||||
|
expect(playRules(play).find(x => x.code === 'renders-bytes')).toMatchObject({ store: 'play', level: 'blocker' });
|
||||||
|
});
|
||||||
|
|
||||||
|
test('config accepts per-device cropTop', () => {
|
||||||
|
const c = { app: { name: 'G', privacyPolicyUrl: 'https://example.com/p' }, languages: [{ id: 'en' }],
|
||||||
|
shots: { copy: 'c.json', frames: 'f', out: 'o', scenes: [{ id: 'a', palette: 'fire', frames: [{ src: 'a.png' }] }],
|
||||||
|
capture: { source: 'folder', cropTop: { tablet: 48 }, shots: {} } } } as unknown as ShipConfig;
|
||||||
|
expect(validateConfig(c).filter(e => e.includes('cropTop'))).toEqual([]);
|
||||||
|
});
|
||||||
|
});
|
||||||
Loading…
Add table
Add a link
Reference in a new issue