Merge origin/main into shots-glyphs
# Conflicts: # CHANGELOG.md
This commit is contained in:
commit
ff36fc5aaf
22 changed files with 1101 additions and 110 deletions
|
|
@ -2,12 +2,16 @@
|
|||
// 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 { mkdtempSync, rmSync } from 'node:fs';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { join } from 'node:path';
|
||||
import { fillPage, navClick, navigate, run, safeClick, signInPage } from '../cli/console/fill';
|
||||
import { openAcross, readAccounts, rememberApple, rememberPlay, withAccountIds } from '../cli/console/accounts';
|
||||
import { fillPage, fillSession, navClick, navigate, resumeAt, run, safeClick, signInPage } from '../cli/console/fill';
|
||||
import { type ConsoleBrowser, openConsoleBrowser } from '../cli/console/session';
|
||||
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';
|
||||
import { consoleReached, formDef, FORM_OPENERS, forbiddenControl, hasToken, isSignInText, isSignInUrl, navAllowed, navPlan, playDeveloperId, switchAllowed } 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' },
|
||||
|
|
@ -50,6 +54,18 @@ describe('sign-in and console detection', () => {
|
|||
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);
|
||||
expect(isSignInUrl('https://appstoreconnect.apple.com/login?targetUrl=%2Fapps')).toBe(true);
|
||||
expect(isSignInUrl('https://appstoreconnect.apple.com/loginhelp')).toBe(false);
|
||||
expect(isSignInUrl('https://play.google.com/signin/v2/identifier')).toBe(true);
|
||||
expect(isSignInUrl('https://www.google.com/accounts/ServiceLogin')).toBe(true);
|
||||
expect(isSignInUrl('https://play.google.com/console/u/0/developers')).toBe(false);
|
||||
});
|
||||
test('sign-in texts (whole text; the weak ones only inside a frame)', () => {
|
||||
for (const t of ['Sign in with Passkey', ' Email or Phone Number ', 'Keep me signed in', 'Geçiş Anahtarıyla Giriş Yap', 'E-posta veya Telefon Numarası']) expect(isSignInText(t)).toBe(true);
|
||||
expect(isSignInText('Apple Account')).toBe(false);
|
||||
expect(isSignInText('Apple Account', true)).toBe(true);
|
||||
expect(isSignInText('Apple Hesabı', true)).toBe(true);
|
||||
for (const t of ['Apps', 'New App', 'Email address', 'Contact email', 'Sign in with Passkey to continue later']) expect(isSignInText(t, true)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -157,20 +173,25 @@ 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',
|
||||
'/asc/apps/123/distribution/privacy': 'apple-app-privacy.html', '/play': 'play-apps.html', '/teams/apps': 'asc-teams.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);
|
||||
// a session cookie (no Expires / Max-Age): it must survive a relaunch of storebound's profile
|
||||
if (path === '/session-set') return new Response('<p>set</p>', { headers: { 'content-type': 'text/html', 'set-cookie': 'sbsession=example; Path=/; HttpOnly' } });
|
||||
if (path === '/session-echo') return new Response(`<p id="c">${/(?:^|; )sbsession=example(?:;|$)/.test(req.headers.get('cookie') ?? '') ? 'kept' : 'lost'}</p>`, { headers: { 'content-type': 'text/html' } });
|
||||
const dev = path.match(/^\/playm\/u\/0\/developers(?:\/(\d+)\/app-list)?$/);
|
||||
const name = path.endsWith('/_common.js') ? '_common.js' : dev ? (!dev[1] ? 'play-chooser.html' : dev[1] === '4444' ? 'play-apps.html' : 'play-apps-other.html')
|
||||
: 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(); });
|
||||
afterAll(async () => { server?.stop(true); await browser?.close(); }, 30_000); // closing every context of the run can take a few seconds
|
||||
|
||||
async function open(file: string) {
|
||||
const page = await browser.newPage();
|
||||
|
|
@ -291,6 +312,9 @@ describe.skipIf(!browser)('engine (headless, modeled pages)', () => {
|
|||
const signin = await open('signin.html');
|
||||
expect(await signInPage(signin)).toBe(true);
|
||||
await signin.close();
|
||||
const passkey = await open('signin-passkey.html'); // no password field, unknown host: the texts tell
|
||||
expect(await signInPage(passkey)).toBe(true);
|
||||
await passkey.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);
|
||||
|
|
@ -350,7 +374,7 @@ 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; };
|
||||
const fresh = async () => { const p = await browser.newPage(); await p.goto(base + 'blank.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();
|
||||
|
|
@ -435,3 +459,216 @@ describe.skipIf(!browser)('navigation (headless, modeled pages)', () => {
|
|||
await page.close();
|
||||
});
|
||||
});
|
||||
|
||||
// ---- sign-in during navigation, watching after the fallback, the session kept across relaunches ----
|
||||
|
||||
/** A browser context whose console hosts (appstoreconnect / idmsa / play.google.com) are served from the fixtures. */
|
||||
async function consoleBrowser(map: (u: URL, cookie: string) => string | null): Promise<ConsoleBrowser> {
|
||||
const ctx = await browser.newContext();
|
||||
await ctx.route(/^https?:\/\/(?!127\.0\.0\.1)/, async (route: any) => {
|
||||
const u = new URL(route.request().url());
|
||||
const cookie: string = (await route.request().headerValue('cookie')) ?? '';
|
||||
const name = u.pathname.endsWith('/_common.js') ? '_common.js' : map(u, cookie);
|
||||
if (!name) return route.abort(); // nothing leaves the machine
|
||||
return route.fulfill({ path: join(FIX, name), contentType: name.endsWith('.js') ? 'text/javascript' : 'text/html' });
|
||||
});
|
||||
const page = await ctx.newPage();
|
||||
let closed = false;
|
||||
const done = new Promise<void>(r => ctx.on('close', () => { closed = true; r(); }));
|
||||
return { mode: 'profile', context: ctx, page, pages: () => ctx.pages(), closed: done, isClosed: () => closed, close: () => ctx.close(), cleanup: () => {} };
|
||||
}
|
||||
const until = async (what: string, fn: () => boolean | Promise<boolean>, ms = 20_000, said?: string[]) => {
|
||||
const end = Date.now() + ms;
|
||||
while (Date.now() < end) { if (await fn()) return; await Bun.sleep(50); }
|
||||
throw new Error(`timed out waiting for: ${what}${said ? `\n${said.join("\n")}` : ""}`);
|
||||
};
|
||||
const tmpAccounts = () => join(mkdtempSync(join(tmpdir(), 'storebound-accounts-')), 'console-accounts.json');
|
||||
const fast = (said: string[]) => ({ say: (m: string) => { said.push(m); }, tickMs: 100, navTimeoutMs: 1500, signInWaitMs: 30_000, accountsFile: tmpAccounts(), env: {} });
|
||||
|
||||
describe.skipIf(!browser)('sign-in and watching (headless, modeled pages on the real console hosts, routed locally)', () => {
|
||||
test('ASC /login with an idmsa frame and no password field: detected mid-navigation, never touched; after sign-in navigation restarts at step 1', async () => {
|
||||
const b = await consoleBrowser((u, cookie) => u.hostname === 'idmsa.apple.com' ? 'idmsa-signin.html'
|
||||
: u.hostname !== 'appstoreconnect.apple.com' ? null
|
||||
: u.pathname === '/login' ? 'asc-login.html' : u.pathname === '/apps' ? (cookie.includes('myacinfo=') ? 'asc-apps.html' : 'asc-shell.html') : null);
|
||||
const said: string[] = [];
|
||||
const run = fillSession(b, { form: 'apple-app-record', config, ...fast(said) });
|
||||
await until('the sign-in hint', () => said.some(m => m.startsWith('sign in in the browser window')));
|
||||
expect(said.some(m => /^a sign-in page appeared at step/.test(m))).toBe(true); // the shell looked signed in, then /login
|
||||
expect(said.some(m => m.includes('Keep me signed in'))).toBe(true);
|
||||
expect(new URL(b.page.url()).pathname).toBe('/login');
|
||||
expect(await signInPage(b.page)).toBe(true);
|
||||
const frame = b.page.frames().find((f: any) => f.url().startsWith('https://idmsa.apple.com/'));
|
||||
expect(await frame.evaluate(() => (window as any).__clicks)).toEqual([]); // nothing clicked on the sign-in form
|
||||
expect(await frame.locator('#acc').inputValue()).toBe(''); // nothing typed
|
||||
await b.page.evaluate(() => (window as any).__signIn()); // the owner signs in
|
||||
await until('the New App dialog filled', () => said.some(m => /^New App: filled \d+/.test(m)), 20_000, said);
|
||||
expect(said).toContain('signed in: opening the form again from step 1');
|
||||
expect(await b.page.getByRole('textbox', { name: 'Name', exact: true }).inputValue()).toBe('Example Game');
|
||||
expect(await clicks(b.page)).toEqual(['+']); // never Create / Submit for Review
|
||||
await b.context.close();
|
||||
expect((await run).filled).toBeGreaterThan(0);
|
||||
}, 40_000);
|
||||
|
||||
test('after the printed steps storebound keeps watching: the owner opens Apps by hand, navigation resumes at step 2 and fills', async () => {
|
||||
const b = await consoleBrowser(u => u.hostname === 'appstoreconnect.apple.com' && u.pathname === '/apps' ? (u.search.includes('owner') ? 'asc-apps.html' : 'asc-apps-noplus.html') : null);
|
||||
const said: string[] = [];
|
||||
const run = fillSession(b, { form: 'apple-app-record', config, ...fast(said) });
|
||||
await until('the printed steps', () => said.some(m => m.startsWith('open the form: Apps')));
|
||||
expect(await clicks(b.page)).toEqual([]);
|
||||
await b.page.evaluate(() => { location.href = '/apps?owner=1'; }); // the owner navigates
|
||||
await until('the New App dialog filled', () => said.some(m => /^New App: filled \d+/.test(m)), 20_000, said);
|
||||
expect(said).toContain('the page changed: storebound opens the form from step 2/4');
|
||||
expect(await b.page.evaluate(() => (window as any).__navClicks())).toEqual(['Add Apps', 'New App']);
|
||||
expect(await clicks(b.page)).toEqual(['+']);
|
||||
await b.context.close();
|
||||
await run;
|
||||
}, 40_000);
|
||||
|
||||
test('after the printed steps: the owner opens the dialog by hand, storebound sees it and fills it', async () => {
|
||||
const b = await consoleBrowser(u => u.hostname === 'appstoreconnect.apple.com' && u.pathname === '/apps' ? (u.search.includes('dialog') ? 'apple-app-record.html' : 'asc-apps-noplus.html') : null);
|
||||
const said: string[] = [];
|
||||
const run = fillSession(b, { form: 'apple-app-record', config, ...fast(said) });
|
||||
await until('the printed steps', () => said.some(m => m.startsWith('open the form: Apps')));
|
||||
await b.page.evaluate(() => { location.href = '/apps?dialog=1'; });
|
||||
await until('the New App dialog filled', () => said.some(m => /^New App: filled \d+/.test(m)), 20_000, said);
|
||||
expect(await clicks(b.page)).toEqual([]); // not even + : the dialog was open
|
||||
await b.context.close();
|
||||
await run;
|
||||
}, 40_000);
|
||||
|
||||
test('resumeAt: the furthest step visible now, never the initial page load', async () => {
|
||||
const page = await open('asc-apps.html');
|
||||
const plan = navPlan('apple-app-record', config, bases());
|
||||
expect(await resumeAt(page, plan)).toBe(1);
|
||||
await page.getByRole('button', { name: 'Add Apps' }).click();
|
||||
expect(await resumeAt(page, plan)).toBe(2);
|
||||
await page.goto(base + 'asc-apps-noplus.html');
|
||||
expect(await resumeAt(page, plan)).toBeNull();
|
||||
await page.close();
|
||||
});
|
||||
|
||||
for (const store of ['apple', 'play'] as const) {
|
||||
test(`${store}: a session cookie survives closing and relaunching storebound's own profile`, async () => {
|
||||
const dir = mkdtempSync(join(tmpdir(), `storebound-profile-${store}-`));
|
||||
const root = join(import.meta.dir, '..');
|
||||
try {
|
||||
const opts = { store, profileDir: dir, fresh: true, headless: true, say: () => {} };
|
||||
let b = await openConsoleBrowser(root, opts);
|
||||
await b.page.goto(base + 'session-set');
|
||||
await b.close(); // graceful: Chromium writes its cookie store
|
||||
await b.closed;
|
||||
b = await openConsoleBrowser(root, opts);
|
||||
expect(b.pages()).toHaveLength(1); // the restored tab was closed again
|
||||
await b.page.goto(base + 'session-echo');
|
||||
expect(await b.page.textContent('#c')).toBe('kept');
|
||||
await b.close();
|
||||
await b.closed;
|
||||
} finally { rmSync(dir, { recursive: true, force: true }); }
|
||||
}, 60_000);
|
||||
}
|
||||
});
|
||||
|
||||
// ---- one login, several developer accounts / teams ----
|
||||
|
||||
describe('accounts (pure)', () => {
|
||||
test('cache: ids only, malformed entries dropped, atomic rewrite', async () => {
|
||||
const f = tmpAccounts();
|
||||
expect(readAccounts(f)).toEqual({ version: 1, play: {}, apple: {} });
|
||||
rememberPlay('com.example.game', { developerId: '4444', account: 'Example Games Ltd' }, f);
|
||||
rememberApple('com.example.game', { team: 'Example Games Ltd', teamId: 'ABCDE12345' }, f);
|
||||
const c = readAccounts(f);
|
||||
expect(c.play['com.example.game']).toMatchObject({ developerId: '4444', account: 'Example Games Ltd' });
|
||||
expect(c.apple['com.example.game']).toMatchObject({ team: 'Example Games Ltd', teamId: 'ABCDE12345' });
|
||||
expect(JSON.stringify(c)).not.toMatch(/cookie|myacinfo|session/i);
|
||||
await Bun.write(f, JSON.stringify({ play: { 'com.x': { developerId: 'abc' }, '../bad': { developerId: '1' } }, apple: { 'com.y': { team: '' } } }));
|
||||
expect(readAccounts(f)).toEqual({ version: 1, play: {}, apple: {} });
|
||||
});
|
||||
test('play developer ids, env ids from a workspace account, and the switch gate', () => {
|
||||
expect(playDeveloperId('https://play.google.com/console/u/0/developers/4444/app-list')).toBe('4444');
|
||||
expect(playDeveloperId('https://play.google.com/console/u/0/developers')).toBeNull();
|
||||
expect(navPlan('play-content-rating', { ...config, play: { ...config.play!, developerId: '4444' } } as ShipConfig)[0])
|
||||
.toMatchObject({ kind: 'goto', url: 'https://play.google.com/console/u/0/developers/4444/app-list' });
|
||||
expect(withAccountIds(config, { STOREBOUND_PLAY_DEVELOPER_ID: '4444', STOREBOUND_APPLE_TEAM_ID: 'ABCDE12345' })).toMatchObject({ play: { developerId: '4444' }, apple: { teamId: 'ABCDE12345' } });
|
||||
expect(withAccountIds(config, { STOREBOUND_PLAY_DEVELOPER_ID: 'x' }).play?.developerId).toBeUndefined();
|
||||
expect(validateExtras({ play: { packageName: 'com.example.game', developerId: 'abc' } })).toContain('play.developerId: the digits of play.google.com/console/u/0/developers/<id>');
|
||||
const listed = ['Studio One', 'Example Games Ltd', 'Next Level Games', 'Sign Out'];
|
||||
expect(switchAllowed('Example Games Ltd', 'menuitemradio', listed)).toBe(true);
|
||||
expect(switchAllowed('Example Games Ltd', 'link', listed)).toBe(true);
|
||||
expect(switchAllowed('Other Studio', 'menuitemradio', listed)).toBe(false); // not read from the list
|
||||
expect(switchAllowed('Sign Out', 'menuitem', listed)).toBe(false);
|
||||
expect(switchAllowed('Next Level Games', 'menuitemradio', listed)).toBe(false); // the click gate stays absolute
|
||||
expect(switchAllowed('Edit Profile', 'menuitem', ['Edit Profile'])).toBe(false);
|
||||
expect(switchAllowed('Example Games Ltd', 'textbox', listed)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe.skipIf(!browser)('accounts (headless, modeled pages)', () => {
|
||||
const navClicks = (page: any): Promise<string[]> => page.evaluate(() => (window as any).__navClicks());
|
||||
const fresh = async () => { const p = await browser.newPage(); await p.goto(base + 'blank.html'); await p.evaluate(() => sessionStorage.clear()); return p; };
|
||||
const DENIED = ['Sign Out', 'Edit Profile', 'Create', 'Submit for Review', 'Create app', 'Create developer account', 'Save', 'Publish'];
|
||||
|
||||
test('App Store Connect, 3 teams, the bundle id in the 2nd: switched through the account menu, remembered, then picked first', async () => {
|
||||
const file = tmpAccounts(), said: string[] = [];
|
||||
let page = await fresh();
|
||||
await page.goto(base + 'teams/apps');
|
||||
const tb = { asc: base + 'teams', play: base + 'play' };
|
||||
const r = await openAcross(page, { form: 'apple-app-record', config, say: m => { said.push(m); }, bases: tb, navMs: 1500, file, env: {} });
|
||||
expect(r.nav.ok).toBe(true);
|
||||
expect(said).toContain('this Apple Account is in 3 teams: looking for com.example.game in each');
|
||||
expect(readAccounts(file).apple['com.example.game']?.team).toBe('Example Games Ltd');
|
||||
expect(await page.evaluate(() => document.cookie)).toContain('team=Example%20Games%20Ltd');
|
||||
const names = await navClicks(page);
|
||||
expect(names).toContain('Example Games Ltd');
|
||||
for (const n of DENIED) expect(names).not.toContain(n);
|
||||
expect(await clicks(page)).toEqual(['+']); // in the right team: + only, never Create
|
||||
const s = await fillPage(page, formDef('apple-app-record', pageAnswers('apple-app-record')), pageAnswers('apple-app-record'));
|
||||
expect(s.filled).toContain('bundleId');
|
||||
await page.close();
|
||||
// the next run tries the remembered team first
|
||||
const said2: string[] = [];
|
||||
page = await fresh();
|
||||
await page.goto(base + 'teams/apps');
|
||||
expect((await openAcross(page, { form: 'apple-app-record', config, say: m => { said2.push(m); }, bases: tb, navMs: 1500, file, env: {} })).nav.ok).toBe(true);
|
||||
expect(said2).toContain('team 1/3: Example Games Ltd');
|
||||
for (const n of DENIED) expect(await navClicks(page)).not.toContain(n);
|
||||
await page.close();
|
||||
}, 60_000);
|
||||
|
||||
test('Play, one login in 5 developer accounts, the app in the 4th: found by package name, remembered, then opened directly', async () => {
|
||||
const file = tmpAccounts(), said: string[] = [];
|
||||
const pb = { asc: base + 'asc', play: base + 'playm' };
|
||||
let page = await fresh();
|
||||
const r = await openAcross(page, { form: 'play-content-rating', config, say: m => { said.push(m); }, bases: pb, navMs: 1500, file, env: {} });
|
||||
expect(r.nav.ok).toBe(true);
|
||||
expect(said).toContain('this Google login sees 5 developer accounts: looking for com.example.game in each');
|
||||
expect(said).toContain('developer account 4/5: Example Games Ltd');
|
||||
expect(readAccounts(file).play['com.example.game']).toMatchObject({ developerId: '4444', account: 'Example Games Ltd' });
|
||||
expect(await navClicks(page)).toEqual(['Example Game', 'Policy and programs', 'App content', 'Start']);
|
||||
expect(await clicks(page)).toEqual([]);
|
||||
await page.close();
|
||||
// remembered: straight to that account's app list, no chooser
|
||||
const said2: string[] = [];
|
||||
page = await fresh();
|
||||
expect((await openAcross(page, { form: 'play-content-rating', config, say: m => { said2.push(m); }, bases: pb, navMs: 1500, file, env: {} })).nav.ok).toBe(true);
|
||||
expect(said2.some(m => m.includes('developer accounts'))).toBe(false);
|
||||
expect(said2).toContain('opening the form, step 1/6: open the app list of the developer account');
|
||||
await page.close();
|
||||
// play.developerId from a workspace account (env): no chooser either, nothing cached needed
|
||||
const said3: string[] = [];
|
||||
page = await fresh();
|
||||
expect((await openAcross(page, { form: 'play-target-audience', config, say: m => { said3.push(m); }, bases: pb, navMs: 1500, file: tmpAccounts(), env: { STOREBOUND_PLAY_DEVELOPER_ID: '4444' } })).nav.ok).toBe(true);
|
||||
expect(said3.some(m => m.includes('developer accounts'))).toBe(false);
|
||||
await page.close();
|
||||
}, 60_000);
|
||||
|
||||
test('Play: a package in none of the developer accounts is said plainly; nothing deny-listed clicked', async () => {
|
||||
const page = await fresh();
|
||||
const absent = { ...config, play: { packageName: 'com.example.absent' } } as ShipConfig;
|
||||
const r = await openAcross(page, { form: 'play-content-rating', config: absent, say: () => {}, bases: { asc: base + 'asc', play: base + 'playm' }, navMs: 800, file: tmpAccounts(), env: {} });
|
||||
expect(r.nav).toMatchObject({ ok: false, failed: 'the developer account' });
|
||||
expect(r.nav.why).toContain('com.example.absent is in none of the 5 developer accounts');
|
||||
expect(await clicks(page)).toEqual([]);
|
||||
for (const n of DENIED) expect(await navClicks(page)).not.toContain(n);
|
||||
await page.close();
|
||||
}, 60_000);
|
||||
});
|
||||
|
|
|
|||
2
tests/fixtures/console/_common.js
vendored
2
tests/fixtures/console/_common.js
vendored
|
|
@ -6,7 +6,7 @@ window.__clicks = [];
|
|||
const navLog = () => { try { return JSON.parse(sessionStorage.getItem('navClicks') || '[]'); } catch { return []; } };
|
||||
window.__navClicks = navLog;
|
||||
document.addEventListener('click', e => {
|
||||
const b = e.target.closest('button, a, [role="button"], [role="menuitem"], [role="link"], [role="row"], tr');
|
||||
const b = e.target.closest('button, a, [role="button"], [role="menuitem"], [role="menuitemradio"], [role="option"], [role="link"], [role="row"], tr');
|
||||
if (!b) return;
|
||||
const name = (b.getAttribute('aria-label') || b.textContent).trim().replace(/\s+/g, ' ');
|
||||
if (b.matches('button')) window.__clicks.push(b.textContent.trim());
|
||||
|
|
|
|||
11
tests/fixtures/console/asc-login.html
vendored
Normal file
11
tests/fixtures/console/asc-login.html
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!doctype html>
|
||||
<!-- MODELED, not recorded: App Store Connect at /login. Apple's sign-in form lives in a frame from idmsa.apple.com and
|
||||
starts with no password field (Email or Phone Number > Continue > passkey or password). window.__signIn() acts as
|
||||
the owner finishing sign-in: a session cookie (no expiry), then the app shell at /apps. Placeholder data only. -->
|
||||
<html lang="en"><head><meta charset="utf-8"><title>App Store Connect</title><script src="/_common.js"></script></head>
|
||||
<body>
|
||||
<iframe title="Sign In with your Apple Account" src="https://idmsa.apple.com/appleauth/auth/signin?widgetKey=example" width="480" height="360"></iframe>
|
||||
<script>
|
||||
window.__signIn = () => { document.cookie = 'myacinfo=example-session; path=/'; location.href = '/apps'; };
|
||||
</script>
|
||||
</body></html>
|
||||
9
tests/fixtures/console/asc-shell.html
vendored
Normal file
9
tests/fixtures/console/asc-shell.html
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<!doctype html>
|
||||
<!-- MODELED, not recorded: App Store Connect's app shell at /apps without a session: it loads at the console URL (it
|
||||
looks signed in for a moment), then the app sends the browser to /login. The real-console case from a run whose
|
||||
session had expired. -->
|
||||
<html lang="en"><head><meta charset="utf-8"><title>App Store Connect</title><script src="/_common.js"></script></head>
|
||||
<body>
|
||||
<p>Loading</p>
|
||||
<script>setTimeout(() => location.replace('/login'), 700);</script>
|
||||
</body></html>
|
||||
58
tests/fixtures/console/asc-teams.html
vendored
Normal file
58
tests/fixtures/console/asc-teams.html
vendored
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<!doctype html>
|
||||
<!-- MODELED, not recorded: App Store Connect > Apps for an Apple Account in three teams. The account menu at the top
|
||||
right lists the teams (Apple's help "Switch between teams"); picking one reloads the console in that team (here: a
|
||||
cookie). The New App dialog's Bundle ID list holds only the current team's bundle ids: com.example.game is in the
|
||||
2nd team. Sign Out, Edit Profile, Create and Submit for Review must never be clicked. Placeholder data only. -->
|
||||
<html lang="en"><head><meta charset="utf-8"><title>Apps - App Store Connect</title><script src="/_common.js"></script></head>
|
||||
<body>
|
||||
<header>
|
||||
<button type="button" id="acct" aria-label="Account" aria-haspopup="menu">Example Owner</button>
|
||||
<div role="menu" id="acctmenu" aria-label="Account" hidden></div>
|
||||
</header>
|
||||
<h1>Apps</h1>
|
||||
<button type="button" id="plus" aria-label="Add Apps" aria-haspopup="menu">+</button>
|
||||
<div role="menu" id="menu" hidden>
|
||||
<div role="menuitem" tabindex="0" id="newapp">New App</div>
|
||||
<div role="menuitem" tabindex="0">New App Bundle</div>
|
||||
</div>
|
||||
<button type="button">Submit for Review</button>
|
||||
<div role="dialog" aria-labelledby="t" id="dlg" hidden>
|
||||
<h2 id="t">New App</h2>
|
||||
<fieldset><legend>Platforms</legend>
|
||||
<label><input type="checkbox"> iOS</label> <label><input type="checkbox"> macOS</label>
|
||||
</fieldset>
|
||||
<p><label>Name <input type="text" maxlength="30"></label></p>
|
||||
<p><label>Primary Language <select><option value="">Choose</option><option>English (U.K.)</option><option>English (U.S.)</option></select></label></p>
|
||||
<p><label>Bundle ID <select id="bundle"><option value="">Choose</option></select></label></p>
|
||||
<p><label>SKU <input type="text"></label></p>
|
||||
<fieldset><legend>User Access</legend>
|
||||
<label><input type="radio" name="access"> Limited Access</label> <label><input type="radio" name="access"> Full Access</label>
|
||||
</fieldset>
|
||||
<button type="button" id="cancel">Cancel</button> <button type="button">Create</button>
|
||||
</div>
|
||||
<script>
|
||||
const TEAMS = { 'Alpha Studio': 'com.example.other', 'Example Games Ltd': 'com.example.game', 'Gamma Apps': 'com.example.gamma' };
|
||||
const team = (document.cookie.match(/(?:^|; )team=([^;]+)/) || [])[1];
|
||||
const current = team ? decodeURIComponent(team) : 'Alpha Studio';
|
||||
const menu = document.getElementById('acctmenu');
|
||||
for (const name of [...Object.keys(TEAMS), 'Edit Profile', 'Sign Out']) {
|
||||
const it = document.createElement('div');
|
||||
it.tabIndex = 0;
|
||||
it.textContent = name;
|
||||
if (TEAMS[name]) {
|
||||
it.setAttribute('role', 'menuitemradio');
|
||||
it.setAttribute('aria-checked', String(name === current));
|
||||
it.addEventListener('click', () => { document.cookie = 'team=' + encodeURIComponent(name) + '; path=/'; location.reload(); });
|
||||
} else it.setAttribute('role', 'menuitem');
|
||||
menu.appendChild(it);
|
||||
}
|
||||
document.getElementById('acct').addEventListener('click', () => { menu.hidden = !menu.hidden; });
|
||||
document.addEventListener('keydown', e => { if (e.key === 'Escape') menu.hidden = true; });
|
||||
const opt = document.createElement('option');
|
||||
opt.textContent = 'App - ' + TEAMS[current];
|
||||
document.getElementById('bundle').appendChild(opt);
|
||||
document.getElementById('plus').addEventListener('click', () => { document.getElementById('menu').hidden = false; });
|
||||
document.getElementById('newapp').addEventListener('click', () => { document.getElementById('menu').hidden = true; document.getElementById('dlg').hidden = false; });
|
||||
document.getElementById('cancel').addEventListener('click', () => { document.getElementById('dlg').hidden = true; });
|
||||
</script>
|
||||
</body></html>
|
||||
3
tests/fixtures/console/blank.html
vendored
Normal file
3
tests/fixtures/console/blank.html
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<!doctype html>
|
||||
<!-- An empty page on the fixture origin: navigation tests start here (clean click log, no sign-in page). -->
|
||||
<html lang="en"><head><meta charset="utf-8"><title>Start</title></head><body></body></html>
|
||||
11
tests/fixtures/console/idmsa-signin.html
vendored
Normal file
11
tests/fixtures/console/idmsa-signin.html
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!doctype html>
|
||||
<!-- MODELED, not recorded: the first page of Apple's sign-in form (the idmsa.apple.com frame): no password field yet.
|
||||
storebound must detect it, never type into it and never click anything in it. -->
|
||||
<html lang="en"><head><meta charset="utf-8"><title>Sign In</title><script src="/_common.js"></script></head>
|
||||
<body>
|
||||
<h1>Sign in to App Store Connect</h1>
|
||||
<p><label for="acc">Email or Phone Number</label> <input id="acc" type="text"></p>
|
||||
<p><label><input type="checkbox"> Keep me signed in</label></p>
|
||||
<button type="button">Continue</button>
|
||||
<button type="button">Sign in with Passkey</button>
|
||||
</body></html>
|
||||
13
tests/fixtures/console/play-apps-other.html
vendored
Normal file
13
tests/fixtures/console/play-apps-other.html
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<!doctype html>
|
||||
<!-- MODELED, not recorded: Play Console > All apps of a developer account that does not have com.example.game (one
|
||||
app of the same studio family, a different package). Create app must never be clicked. Placeholder data only. -->
|
||||
<html lang="en"><head><meta charset="utf-8"><title>All apps - Play Console</title><script src="/_common.js"></script></head>
|
||||
<body>
|
||||
<h1>All apps</h1>
|
||||
<label>Search apps <input type="search"></label>
|
||||
<button type="button">Create app</button>
|
||||
<table>
|
||||
<tr><th>App</th><th>Package</th></tr>
|
||||
<tr><td><a href="/play-dashboard.html">Other App</a></td><td>com.example.other</td></tr>
|
||||
</table>
|
||||
</body></html>
|
||||
16
tests/fixtures/console/play-chooser.html
vendored
Normal file
16
tests/fixtures/console/play-chooser.html
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<!doctype html>
|
||||
<!-- MODELED, not recorded: Play Console's "Choose a developer account" page for one Google login that is an admin of
|
||||
five developer accounts. Each entry links to that account (/developers/<id>/app-list). The app com.example.game
|
||||
is in the 4th account (4444). Create developer account must never be clicked. Placeholder data only. -->
|
||||
<html lang="en"><head><meta charset="utf-8"><title>Choose a developer account - Play Console</title><script src="/_common.js"></script></head>
|
||||
<body>
|
||||
<h1>Choose a developer account</h1>
|
||||
<ul>
|
||||
<li><a href="./developers/1111/app-list">Studio One</a></li>
|
||||
<li><a href="./developers/2222/app-list">Studio Two</a></li>
|
||||
<li><a href="./developers/3333/app-list">Studio Three</a></li>
|
||||
<li><a href="./developers/4444/app-list">Example Games Ltd</a></li>
|
||||
<li><a href="./developers/5555/app-list">Studio Five</a></li>
|
||||
</ul>
|
||||
<button type="button">Create developer account</button>
|
||||
</body></html>
|
||||
5
tests/fixtures/console/signin-passkey.html
vendored
Normal file
5
tests/fixtures/console/signin-passkey.html
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<!doctype html>
|
||||
<!-- MODELED, not recorded: a sign-in form on a host storebound does not know, with no password field: only the texts
|
||||
tell it is a sign-in page. -->
|
||||
<html lang="en"><head><meta charset="utf-8"><title>Sign in</title></head>
|
||||
<body><p><input type="text" placeholder="Email or Phone Number"></p> <button type="button">Sign in with Passkey</button></body></html>
|
||||
|
|
@ -128,6 +128,12 @@ describe('pairing (the desktop rules, shared)', () => {
|
|||
expect(Object.keys(e.env).sort()).toEqual(['ASC_ISSUER_ID', 'ASC_KEY_ID', 'ASC_P8', 'PLAY_SERVICE_ACCOUNT', 'STOREBOUND_PROFILE']);
|
||||
expect(e.env.STOREBOUND_PROFILE).toBe('');
|
||||
expect(e.env.ASC_P8).toBe(join(creds, 'keys', 'acme.p8')); // relative to the profile folder
|
||||
// the console ids of the studio's accounts (not secrets) reach console fill as env
|
||||
const withIds = { ...l.ws, studios: l.ws.studios!.map(s => ({ ...s, accounts: s.accounts?.map(a => (a.store === 'play' ? { ...a, developerId: '4444' } : { ...a, teamId: 'ABCDE12345' })) })) };
|
||||
const e2 = appEnv(blocks.unified, accountsOf(withIds));
|
||||
expect([e2.env.STOREBOUND_PLAY_DEVELOPER_ID, e2.env.STOREBOUND_APPLE_TEAM_ID]).toEqual(['4444', 'ABCDE12345']);
|
||||
expect(checkWorkspace(withIds)).toEqual([]);
|
||||
expect(checkWorkspace({ accounts: [{ store: 'apple', profile: 'x', developerId: '1' }] }).join()).toContain('developerId');
|
||||
// an unpair keeps them apart
|
||||
const split = workspaceApps({ ...l, ws: { ...l.ws, overrides: { unpairs: [{ ios: blocks.unified.ios!.key, android: blocks.unified.android!.key }] } } }, summaries);
|
||||
expect(split.apps.filter(a => a.name === 'Blocks').map(a => a.unified.pairing)).toEqual(['single', 'single']);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue