storebound/tests/console-fill.test.ts
CRT 1d2978d0bb console fill: opens the form itself and reuses the owner's Chrome sign-in
Navigation after sign-in (navPlan + navigate): App Store Connect Apps > + > New App
(EN/TR), App Privacy by /apps/<appId>/distribution/privacy or the app list, Play app
list by package name > Policy and programs > App content > Start / Manage. Every
navigation click goes through navClick: the click gate stays absolute, only a link
named exactly Start / Manage / Başla / Yönet passes. Each step is logged; a step not
found in time or two matching apps -> the printed steps and wait (no crash).
The TR gate now refuses "uygula" (apply) but not "uygulama" (app).

Browser (cli/console/session.ts): attach to a Chrome with remote debugging (--cdp or
DevToolsActivePort), else on macOS a temporary profile with only Local State and the
profile's Cookies filtered to the console hosts, opened in real Chrome and deleted at
the end, else storebound's own profile (--fresh-profile). Cookies are never printed.
Desktop: fresh_profile option, the dialog says it uses the Chrome sign-in.
Tests: navigation fixtures (ASC EN/TR, Play list, App content, missing step,
duplicates, deny-listed decoys), session file selection, host filter, cleanup, and a
real-Chrome copy-mode test on a throwaway profile and a local site.
2026-10-11 18:21:35 +00:00

437 lines
27 KiB
TypeScript

// storebound console fill: pure answer building (rule 5: only what the config proves is certain), the click gate, the
// sign-in detector, and the engine run headless against MODELED console pages (tests/fixtures/console, written from
// the public help pages, not recorded) served on 127.0.0.1. No network. Browser tests skip when no Chromium launches.
import { afterAll, beforeAll, describe, expect, test } from 'bun:test';
import { join } from 'node:path';
import { fillPage, navClick, navigate, run, safeClick, signInPage } from '../cli/console/fill';
import { parseArgs } from '../cli/lib/args';
import { type ShipConfig, validateExtras } from '../cli/lib/config';
import { AGE_RATING_API, consoleAnswers, consoleResult, fillValue, FORM_IDS, type FormId, formMeta } from '../cli/lib/console-answers';
import { consoleReached, formDef, FORM_OPENERS, forbiddenControl, hasToken, isSignInUrl, navAllowed, navPlan } from '../cli/lib/console-forms';
const config: ShipConfig = {
app: { name: 'Example Game', profile: 'game', privacyPolicyUrl: 'https://example.com/privacy', supportUrl: 'https://example.com/support', website: 'https://example.com', contactEmail: 'support@example.com' },
languages: [{ id: 'en', play: 'en-US', apple: 'en-US' }],
apple: { bundleId: 'com.example.game', primaryLocale: 'en-US' },
play: { packageName: 'com.example.game' },
products: [{ id: 'com.example.game.no_ads', type: 'non_consumable', usd: 2.99, listings: { en: { title: 'No ads', description: 'Removes ads' } } }],
ads: { appAdsTxt: ['example-network.com, pub-0000, DIRECT, abc123'] },
dataSafety: {
collectsData: true, encryptedInTransit: true, deletionRequest: false,
data: { PSL_DEVICE_ID: { shared: true, collect: ['advertising', 'analytics'], share: ['advertising'] }, PSL_CRASH_LOGS: { shared: false, collect: ['analytics'] } },
},
console: { contentRating: { answers: { violence: false } }, targetAudience: { ages: ['13-15', '16-17', '18-over'] } },
} as ShipConfig;
const byId = (id: FormId, c: ShipConfig = config) => new Map(consoleAnswers(id, c).map(a => [a.id, a]));
describe('click gate', () => {
test('refuses save / submit / publish / next and the like, English and Turkish', () => {
for (const n of ['Save', 'Save draft', 'Submit', 'Publish', 'Create', 'Next', 'Send', 'Apply', 'Confirm', 'Done', 'Start rollout', 'Release to production',
'Delete', 'Remove', 'Continue', 'Add for Review', 'Sign in', 'Kaydet', 'KAYDET', 'Gönder', 'Yayınla', 'Oluştur', 'İleri', 'Sonraki', 'Devam et', 'Onayla', 'Tamam', 'Sil', 'Kaldır', 'Başlat', 'Uygula'])
expect(forbiddenControl(n)).toBe(true);
});
test('allows the answers themselves', () => {
for (const n of ['Yes', 'No', 'Evet', 'Hayır', 'iOS', 'Full Access', 'Ages 13-15', 'Purchase History', 'Device ID', 'Third-Party Advertising', 'Help',
'Yes, we collect data from this app', 'No, we do not use Device ID for tracking purposes', 'Yes, my app contains ads', 'Game'])
expect(forbiddenControl(n)).toBe(false);
});
});
describe('sign-in and console detection', () => {
test('urls', () => {
expect(isSignInUrl('https://appleid.apple.com/auth/authorize')).toBe(true);
expect(isSignInUrl('https://idmsa.apple.com/appleauth/auth/signin')).toBe(true);
expect(isSignInUrl('https://accounts.google.com/v3/signin/identifier')).toBe(true);
expect(isSignInUrl('https://appstoreconnect.apple.com/login')).toBe(true);
expect(isSignInUrl('https://appstoreconnect.apple.com/apps')).toBe(false);
expect(consoleReached('apple', 'https://appstoreconnect.apple.com/apps')).toBe(true);
expect(consoleReached('apple', 'https://appstoreconnect.apple.com/login')).toBe(false);
expect(consoleReached('play', 'https://play.google.com/console/u/0/developers')).toBe(true);
expect(consoleReached('play', 'https://accounts.google.com/')).toBe(false);
expect(consoleReached('play', 'http://127.0.0.1:1234/x.html', 'http://127.0.0.1:1234/')).toBe(true);
});
});
describe('answers (only what the config proves is certain)', () => {
test('app record', () => {
const a = byId('apple-app-record');
expect(a.get('name')).toMatchObject({ value: 'Example Game', certain: true });
expect(a.get('language')).toMatchObject({ value: 'English (U.S.)', certain: true });
expect(a.get('bundleId')).toMatchObject({ value: 'com.example.game', certain: true });
expect(a.get('sku')).toMatchObject({ value: null, certain: false });
expect(a.get('access')).toMatchObject({ value: null, certain: false });
});
test('age rating is guide only and lists every API question', () => {
const r = consoleResult('apple-age-rating', config);
expect(r.answers.map(a => a.id)).toEqual(AGE_RATING_API);
expect(AGE_RATING_API).toContain('socialMedia');
expect(r.answers.every(a => !a.certain)).toBe(true);
expect(r.guidance[0]).toContain('storebound apple appinfo');
expect(formDef('apple-age-rating', r.answers).sections).toEqual([]);
const set = consoleResult('apple-age-rating', { ...config, apple: { ...config.apple!, info: { ageRating: { advertising: true } } } });
expect(set.answers.find(a => a.id === 'advertising')).toMatchObject({ value: true, certain: true });
expect(set.answers.find(a => a.id === 'violenceRealistic')).toMatchObject({ value: 'NONE', certain: true });
expect(set.answers.find(a => a.id === 'socialMedia')).toMatchObject({ value: false, certain: true });
});
test('app privacy from dataSafety; linked and tracking are never guessed', () => {
const a = byId('apple-app-privacy');
expect(a.get('collects')).toMatchObject({ value: true, certain: true });
expect(a.get('type:Device ID')).toMatchObject({ value: true, certain: true });
expect(a.get('type:Name')).toMatchObject({ value: false, certain: true });
expect(a.get('type:Advertising Data')).toMatchObject({ value: null, certain: false });
expect(a.get('purpose:Device ID:Third-Party Advertising')?.value).toBe(true);
expect(a.get('purpose:Device ID:Analytics')?.value).toBe(true);
expect(a.get('purpose:Device ID:App Functionality')?.value).toBe(false);
expect(a.get('linked:Device ID')).toMatchObject({ value: null, certain: false });
expect(a.get('tracking:Crash Data')).toMatchObject({ value: null, certain: false });
const none = consoleAnswers('apple-app-privacy', { ...config, dataSafety: undefined });
expect(none).toHaveLength(1);
expect(none[0]!.certain).toBe(false);
});
test('content rating: purchases from products, owner answers, the rest asked; email masked in output', () => {
const a = byId('play-content-rating');
expect(a.get('email')?.value).toBe('s***@example.com');
expect(fillValue('play-content-rating', a.get('email')!, config)).toBe('support@example.com');
expect(a.get('category')).toMatchObject({ value: 'Game', certain: true });
expect(a.get('q:digitalPurchases')).toMatchObject({ value: true, certain: true });
expect(a.get('q:violence')).toMatchObject({ value: false, certain: true });
expect(a.get('q:lootBoxes')).toMatchObject({ value: null, certain: false });
const noProfile = byId('play-content-rating', { ...config, app: { ...config.app, profile: undefined } });
expect(noProfile.get('category')?.certain).toBe(false);
});
test('target audience', () => {
const a = byId('play-target-audience');
expect(a.get('age:13-15')).toMatchObject({ value: true, certain: true });
expect(a.get('age:6-8')).toMatchObject({ value: false, certain: true });
expect(a.get('appeal')).toMatchObject({ value: null, certain: false });
expect(a.get('ads')).toMatchObject({ value: true, certain: true, source: 'ads.appAdsTxt' });
const bare = byId('play-target-audience', { ...config, console: undefined, ads: undefined });
expect([...bare.values()].every(x => !x.certain)).toBe(true);
});
test('every answer of a fillable form has a field', () => {
for (const f of FORM_IDS) {
const ans = consoleAnswers(f, config);
const ids = new Set(formDef(f, ans).sections.flatMap(s => s.fields.map(x => x.id)));
if (f !== 'apple-age-rating') for (const a of ans) expect(ids.has(a.id)).toBe(true);
}
});
test('config validation', () => {
expect(validateExtras({ console: { contentRating: { category: 'game', answers: { violence: false } }, targetAudience: { ages: ['13-15'] } } })).toEqual([]);
const e = validateExtras({ console: { appRecord: { sku: 'a b', userAccess: 'some' as 'full' }, contentRating: { category: 'x' as 'game', answers: { nope: true } as never },
targetAudience: { ages: ['3-4' as '6-8'], containsAds: 'yes' as unknown as boolean } } }).join('\n');
for (const k of ['appRecord.sku', 'appRecord.userAccess', 'contentRating.category', 'answers.nope', 'targetAudience.ages', 'containsAds']) expect(e).toContain(k);
});
});
describe('--dry --json', () => {
test('prints exactly one result and opens no browser', async () => {
const out: string[] = [];
const orig = console.log;
console.log = (s: string) => { out.push(s); };
try {
await run({ loaded: { config, root: '/tmp/none', path: '', resolve: p => p }, args: parseArgs(['play-target-audience', '--dry', '--json']) });
} finally { console.log = orig; }
expect(out).toHaveLength(1);
const r = JSON.parse(out[0]!);
expect(Object.keys(r)).toEqual(['form', 'store', 'title', 'url', 'answers', 'uncertain', 'guidance']);
expect(r).toMatchObject({ form: 'play-target-audience', store: 'play', uncertain: 1 });
expect(r.answers[0]).toMatchObject({ id: 'age:5-under', certain: true, source: 'console.targetAudience.ages' });
expect(r.guidance.at(-1)).toContain('press Save yourself');
await expect(run({ loaded: { config, root: '/tmp/none', path: '', resolve: p => p }, args: parseArgs(['play-target-audience', '--store', 'apple', '--dry']) })).rejects.toThrow('play form');
});
});
// ---- the engine against the modeled pages ----
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let browser: any = null;
let skipWhy = '';
try {
const { chromium } = await import('playwright');
try { browser = await chromium.launch({ headless: true }); } catch { browser = await chromium.launch({ headless: true, channel: 'chrome' }); }
} catch (e) { skipWhy = (e as Error).message.split('\n')[0]!; }
if (!browser) console.warn(`console-fill browser tests skipped: no Chromium could launch (${skipWhy}). Run \`bunx playwright install chromium\`.`);
const FIX = join(import.meta.dir, 'fixtures', 'console');
/** Console URLs of the navigation plans -> modeled pages (bases: asc = <base>asc, play = <base>play). */
const ROUTES: Record<string, string> = {
'/asc/apps': 'asc-apps.html', '/asc-tr/apps': 'asc-apps-tr.html', '/asc-noplus/apps': 'asc-apps-noplus.html', '/asc-dup/apps': 'asc-apps-dup.html',
'/asc/apps/123/distribution/privacy': 'apple-app-privacy.html', '/play': 'play-apps.html',
};
let server: ReturnType<typeof Bun.serve> | null = null;
let base = '';
beforeAll(() => {
server = Bun.serve({ hostname: '127.0.0.1', port: 0, fetch: req => {
const path = new URL(req.url).pathname;
const name = path.endsWith('/_common.js') ? '_common.js' : ROUTES[path] ?? path.slice(1);
if (!/^[a-z_-]+\.(html|js)$/.test(name)) return new Response('not found', { status: 404 });
return new Response(Bun.file(join(FIX, name)));
} });
base = `http://127.0.0.1:${server.port}/`;
});
afterAll(async () => { server?.stop(true); await browser?.close(); });
async function open(file: string) {
const page = await browser.newPage();
await page.goto(base + file);
return page;
}
const pageAnswers = (f: FormId) => consoleAnswers(f, config).map(a => ({ ...a, value: fillValue(f, a, config) }));
const checked = (page: any, name: string | RegExp, role = 'checkbox') => page.getByRole(role, { name, exact: typeof name === 'string' }).filter({ visible: true }).isChecked();
const flagged = (page: any) => page.evaluate(() => document.querySelectorAll('[data-storebound-label]').length);
const clicks = (page: any) => page.evaluate(() => (window as any).__clicks);
describe.skipIf(!browser)('engine (headless, modeled pages)', () => {
test('app record: certain fields filled, uncertain empty + highlighted, Create never clicked', async () => {
const page = await open('apple-app-record.html');
const def = formDef('apple-app-record', pageAnswers('apple-app-record'));
const s = await fillPage(page, def, pageAnswers('apple-app-record'));
expect(s.fallback).toBe(false);
expect(s.filled.sort()).toEqual(['bundleId', 'language', 'name', 'platform:ios']);
expect(s.highlighted.sort()).toEqual(['access', 'sku']);
expect(await page.getByRole('textbox', { name: 'Name', exact: true }).inputValue()).toBe('Example Game');
expect(await page.getByRole('textbox', { name: 'SKU', exact: true }).inputValue()).toBe('');
expect(await page.getByRole('combobox', { name: 'Bundle ID' }).evaluate((e: HTMLSelectElement) => e.selectedOptions[0]!.textContent)).toBe('Example Game - com.example.game');
expect(await page.getByRole('combobox', { name: 'Primary Language' }).evaluate((e: HTMLSelectElement) => e.value)).toBe('English (U.S.)');
expect(await checked(page, 'iOS')).toBe(true);
expect(await checked(page, 'macOS')).toBe(false);
expect(await checked(page, 'Full Access', 'radio')).toBe(false);
expect(await flagged(page)).toBe(2); // SKU + the User Access group
expect(await clicks(page)).toEqual([]);
// the next poll finds nothing left to do
expect((await fillPage(page, def, pageAnswers('apple-app-record'), new Set([0]))).section).toBeNull();
await page.close();
});
test('a renamed label stops filling and falls back to guidance', async () => {
const page = await open('apple-app-record-renamed.html');
const s = await fillPage(page, formDef('apple-app-record', pageAnswers('apple-app-record')), pageAnswers('apple-app-record'));
expect(s.fallback).toBe(true);
expect(s.missing).toEqual(['name']);
expect(s.filled).toEqual([]);
expect(await checked(page, 'iOS')).toBe(false);
expect(await clicks(page)).toEqual([]);
expect(consoleResult('apple-app-record', config).guidance).toContain('Name: Example Game');
await page.close();
});
test('app privacy: section by section as the owner moves on; Next / Save / Publish never clicked', async () => {
const page = await open('apple-app-privacy.html');
const ans = pageAnswers('apple-app-privacy');
const def = formDef('apple-app-privacy', ans);
const done = new Set<number>();
let s = await fillPage(page, def, ans, done);
expect(s).toMatchObject({ section: 0, filled: ['collects'], fallback: false });
expect(await checked(page, /^Yes, we collect data/, 'radio')).toBe(true);
expect((await fillPage(page, def, ans, done)).section).toBeNull(); // waits for the owner
await page.evaluate(() => (window as any).__next());
s = await fillPage(page, def, ans, done);
expect(s.section).toBe(1);
expect(await checked(page, 'Device ID')).toBe(true);
expect(await checked(page, 'Crash Data')).toBe(true);
expect(await checked(page, 'Purchase History')).toBe(false);
expect(s.highlighted).toContain('type:Advertising Data');
expect(await checked(page, 'Advertising Data')).toBe(false);
await page.evaluate(() => (window as any).__next());
s = await fillPage(page, def, ans, done);
expect(s.title).toBe('Device ID');
expect(s.fallback).toBe(false);
expect(await checked(page, 'Third-Party Advertising')).toBe(true);
expect(await checked(page, 'App Functionality')).toBe(false);
expect(s.highlighted.sort()).toEqual(['linked:Device ID', 'tracking:Device ID']);
expect(await page.getByRole('radio').filter({ visible: true }).evaluateAll((els: HTMLInputElement[]) => els.filter(e => e.checked).length)).toBe(0);
await page.evaluate(() => (window as any).__type('Crash Data'));
s = await fillPage(page, def, ans, done);
expect(s.title).toBe('Crash Data');
expect(done.size).toBe(def.sections.length);
expect(await clicks(page)).toEqual([]);
await page.close();
});
test('content rating: full email in the page, Game, purchases yes, the rest empty + highlighted', async () => {
const page = await open('play-content-rating.html');
const ans = pageAnswers('play-content-rating');
const def = formDef('play-content-rating', ans);
const done = new Set<number>();
let s = await fillPage(page, def, ans, done);
expect(s.filled.sort()).toEqual(['category', 'email']);
expect(await page.getByRole('textbox', { name: 'Email address' }).inputValue()).toBe('support@example.com');
expect(await checked(page, 'Game', 'radio')).toBe(true);
await page.evaluate(() => (window as any).__next());
s = await fillPage(page, def, ans, done);
expect(s.fallback).toBe(false);
expect(s.filled.sort()).toEqual(['q:digitalPurchases', 'q:violence']);
expect(s.highlighted).toHaveLength(11);
const yes = await page.getByRole('radiogroup', { name: /purchase digital goods/ }).getByRole('radio', { name: 'Yes' }).isChecked();
expect(yes).toBe(true);
expect(await page.getByRole('radiogroup', { name: /loot boxes/ }).getByRole('radio').evaluateAll((els: HTMLInputElement[]) => els.some(e => e.checked))).toBe(false);
expect(await clicks(page)).toEqual([]);
await page.close();
});
test('target audience: ages, appeal highlighted, ads yes', async () => {
const page = await open('play-target-audience.html');
const ans = pageAnswers('play-target-audience');
const def = formDef('play-target-audience', ans);
const done = new Set<number>();
expect((await fillPage(page, def, ans, done)).filled).toHaveLength(6);
expect(await checked(page, 'Ages 13-15')).toBe(true);
expect(await checked(page, 'Ages 9-12')).toBe(false);
await page.evaluate(() => (window as any).__next());
expect((await fillPage(page, def, ans, done)).highlighted).toEqual(['appeal']);
await page.evaluate(() => (window as any).__next());
expect((await fillPage(page, def, ans, done)).filled).toEqual(['ads']);
expect(await checked(page, /^Yes, my app contains ads/, 'radio')).toBe(true);
expect(await clicks(page)).toEqual([]);
await page.close();
});
test('sign-in detector and safeClick', async () => {
const signin = await open('signin.html');
expect(await signInPage(signin)).toBe(true);
await signin.close();
const page = await open('apple-app-record.html');
expect(await signInPage(page)).toBe(false);
expect(await safeClick(page.getByRole('button', { name: 'Create' }), 'Create')).toBe(false);
expect(await safeClick(page.getByRole('button', { name: 'Cancel' }), 'Cancel')).toBe(true);
expect(await clicks(page)).toEqual(['Cancel']);
await page.close();
});
});
// ---- navigation to the form after sign-in ----
const bases = (asc = 'asc') => ({ asc: base + asc, play: base + 'play' });
describe('navigation plan (pure)', () => {
test('apple-app-record: Apps > + > New App > the dialog', () => {
const p = navPlan('apple-app-record', config);
expect(p.map(s => s.kind)).toEqual(['goto', 'click', 'click', 'wait']);
expect(p[0]).toMatchObject({ url: 'https://appstoreconnect.apple.com/apps' });
});
test('apple-app-privacy: deep link with apple.appId, else the app list by name / bundle id', () => {
const withId = { ...config, apple: { ...config.apple!, appId: '123' } } as ShipConfig;
const deep = navPlan('apple-app-privacy', withId);
expect(deep[0]).toMatchObject({ kind: 'goto', url: 'https://appstoreconnect.apple.com/apps/123/distribution/privacy' });
expect(deep).toHaveLength(2);
expect(formMeta('apple-app-privacy', withId).url).toBe('https://appstoreconnect.apple.com/apps/123/distribution/privacy');
expect(navPlan('apple-app-privacy', config)[1]).toMatchObject({ kind: 'pickApp', tokens: ['com.example.game'], name: 'Example Game' });
});
test('play forms: app list by package name > App content > Start / Manage', () => {
for (const f of ['play-content-rating', 'play-target-audience'] as const) {
const p = navPlan(f, config);
expect(p.map(s => s.kind)).toEqual(['goto', 'pickApp', 'click', 'click', 'formLink', 'wait']);
expect(p[1]).toMatchObject({ tokens: ['com.example.game'] });
}
expect(navPlan('apple-age-rating', config)).toEqual([]);
});
test('no navigation step names a deny-listed control; Start / Manage pass only as links', () => {
const withId = { ...config, apple: { ...config.apple!, appId: '123' } } as ShipConfig;
for (const f of FORM_IDS) for (const s of [...navPlan(f, withId), ...navPlan(f, config)]) {
if (s.kind !== 'click') continue;
for (const n of s.names) if (typeof n === 'string') expect(forbiddenControl(n)).toBe(false);
}
for (const n of FORM_OPENERS) { expect(navAllowed(n, 'link')).toBe(true); expect(navAllowed(n, 'button')).toBe(false); }
for (const n of ['Save', 'Submit for Review', 'Publish', 'Create', 'Create app', 'Send 2 changes for review', 'Next', 'Kaydet', 'Gönder', 'Yayınla', 'Oluştur',
'İleri', 'İncelemeye Gönder', 'Start rollout to Production', 'Start new release', 'Başlat', ''])
for (const role of ['link', 'button', 'menuitem', 'row']) expect(navAllowed(n, role)).toBe(false);
for (const n of ['+', 'Add Apps', 'New App', 'Yeni Uygulama', 'Uygulama Ekle', 'App content', 'Uygulama içeriği', 'App Privacy', 'Policy and programs', 'Example Game'])
expect(navAllowed(n, 'button')).toBe(true);
for (const n of ['Uygula', 'Değişiklikleri uygula', 'Uygulandı']) expect(forbiddenControl(n)).toBe(true);
for (const n of ['Uygulama Ekle', 'Yeni Uygulama', 'Uygulama içeriği', 'Uygulamalar']) expect(forbiddenControl(n)).toBe(false);
expect(hasToken('Example Game com.example.game', 'com.example.game')).toBe(true);
expect(hasToken('Example Game Pro com.example.gamepro', 'com.example.game')).toBe(false);
expect(hasToken('com.example.game.beta', 'com.example.game')).toBe(false);
});
});
describe.skipIf(!browser)('navigation (headless, modeled pages)', () => {
const quiet = { timeoutMs: 1500, say: () => {} };
const navClicks = (page: any): Promise<string[]> => page.evaluate(() => (window as any).__navClicks());
const noneDenied = (names: string[]) => { for (const n of names) expect(navAllowed(n, 'link')).toBe(true); };
const fresh = async () => { const p = await browser.newPage(); await p.goto(base + 'signin.html'); await p.evaluate(() => sessionStorage.clear()); return p; };
test('App Store Connect (EN): + > New App opens the dialog and it is filled; Create and Submit for Review never clicked', async () => {
const page = await fresh();
const r = await navigate(page, navPlan('apple-app-record', config, bases()), quiet);
expect(r).toMatchObject({ ok: true, steps: ['open Apps', 'the add button (+)', 'New App in the menu', 'the New App dialog'] });
expect(await navClicks(page)).toEqual(['Add Apps', 'New App']);
const s = await fillPage(page, formDef('apple-app-record', pageAnswers('apple-app-record')), pageAnswers('apple-app-record'));
expect(s.fallback).toBe(false);
expect(s.filled).toContain('name');
expect(await clicks(page)).toEqual(['+']); // the + button only, never Create / Submit for Review
await page.close();
});
test('App Store Connect (TR): Uygulama Ekle > Yeni Uygulama; Oluştur and İncelemeye Gönder never clicked', async () => {
const page = await fresh();
const r = await navigate(page, navPlan('apple-app-record', config, bases('asc-tr')), quiet);
expect(r.ok).toBe(true);
expect(await navClicks(page)).toEqual(['Uygulama Ekle', 'Yeni Uygulama']);
expect(await clicks(page)).toEqual(['+']);
await page.close();
});
test('a missing step stops navigation, names the step and clicks nothing', async () => {
const page = await fresh();
const said: string[] = [];
const r = await navigate(page, navPlan('apple-app-record', config, bases('asc-noplus')), { timeoutMs: 800, say: m => said.push(m) });
expect(r).toMatchObject({ ok: false, failed: 'the add button (+)', why: 'not found', steps: ['open Apps'] });
expect(said.some(m => m.includes('step 2/4: the add button (+)'))).toBe(true);
expect(await navClicks(page)).toEqual([]);
expect(formMeta('apple-app-record', config).open[0]).toContain('New App');
await page.close();
});
test('App Privacy: appId deep link, or app list > the app > App Privacy; two apps of one name -> stop and list', async () => {
let page = await fresh();
let r = await navigate(page, navPlan('apple-app-privacy', { ...config, apple: { ...config.apple!, appId: '123' } } as ShipConfig, bases()), quiet);
expect(r).toMatchObject({ ok: true, steps: ['open App Privacy of the app (apple.appId)', 'the App Privacy page'] });
await page.close();
page = await fresh();
r = await navigate(page, navPlan('apple-app-privacy', config, bases()), quiet);
expect(r.ok).toBe(true);
expect(await navClicks(page)).toEqual(['Example Game', 'App Privacy']);
expect(await clicks(page)).toEqual([]); // Publish on that page never clicked
await page.close();
page = await fresh();
r = await navigate(page, navPlan('apple-app-privacy', config, bases('asc-dup')), quiet);
expect(r).toMatchObject({ ok: false, failed: 'the app in the list', candidates: ['Example Game', 'Example Game'] });
expect(await navClicks(page)).toEqual([]);
await page.close();
});
test('Play: the app by package name > Policy and programs > App content > Start / Manage; nothing deny-listed clicked', async () => {
for (const [form, link, heading] of [['play-content-rating', 'Start', 'Content rating'], ['play-target-audience', 'Manage', 'Target audience and content']] as const) {
const page = await fresh();
const r = await navigate(page, navPlan(form, config, bases()), quiet);
expect(r.ok).toBe(true);
const names = await navClicks(page);
expect(names).toEqual(['Example Game', 'Policy and programs', 'App content', link]);
noneDenied(names);
expect(await page.getByRole('heading', { level: 1 }).textContent()).toBe(heading);
await page.close();
}
});
test('navClick refuses a Start button, Start rollout, Save and Publish even when pointed at them', async () => {
const page = await open('play-app-content.html');
expect((await navClick(page.getByRole('button', { name: 'Start' }))).clicked).toBe(false);
expect((await navClick(page.getByRole('button', { name: 'Save' }))).clicked).toBe(false);
expect(await clicks(page)).toEqual([]);
await page.goto(base + 'play-dashboard.html');
expect((await navClick(page.getByRole('link', { name: /Start rollout/ }))).clicked).toBe(false);
expect((await navClick(page.getByRole('button', { name: 'Publish' }))).clicked).toBe(false);
expect(await clicks(page)).toEqual([]);
await page.close();
});
test('already on the form: nothing is clicked', async () => {
const page = await open('play-content-rating.html');
const r = await navigate(page, navPlan('play-content-rating', config, bases()), quiet);
expect(r).toMatchObject({ ok: true, steps: ['already open'] });
expect(await clicks(page)).toEqual([]);
await page.close();
});
});