Neutral sample account names in tests, check scripts and the site's demo UI

The framework moves to 0e344ee.
This commit is contained in:
CRTkafa 2026-10-19 01:02:34 +07:00
parent 83f8c363b4
commit 4c6817ecb5
42 changed files with 136 additions and 136 deletions

View file

@ -31,9 +31,9 @@ check('labelled button: handle, name, sharper picture', JSON.stringify(await pag
await page.setContent(`<body><header>${button(false)}</header></body>`);
await page.addScriptTag({ content: bundle });
check('icon-only button: no name (native keeps the last one)', (await page.evaluate(() => BTAccount.readAccount(document)))?.name === '');
await page.setContent(`<body><div><a data-testid="DashButton_ProfileIcon_Link" href="#"><div data-testid="UserAvatar-Container-playfishies"><img src="${AVATAR}"></div></a></div></body>`);
await page.setContent(`<body><div><a data-testid="DashButton_ProfileIcon_Link" href="#"><div data-testid="UserAvatar-Container-otheraccount"><img src="${AVATAR}"></div></a></div></body>`);
await page.addScriptTag({ content: bundle });
check('narrow layout (background tab, small pane): the drawer avatar button', (await page.evaluate(() => BTAccount.readAccount(document)))?.handle === 'playfishies');
check('narrow layout (background tab, small pane): the drawer avatar button', (await page.evaluate(() => BTAccount.readAccount(document)))?.handle === 'otheraccount');
check('no account button: nothing', await page.evaluate(() => BTAccount.readAccount(new DOMParser().parseFromString('<p>x</p>', 'text/html'))) === null);
// Reports: once per change, signed-out only on X's own sign-in page.
@ -45,13 +45,13 @@ const reports = await page.evaluate(async () => {
await tick();
document.body.innerHTML = '<div data-testid="loginButton">Sign in</div>'; await tick();
document.body.innerHTML = document.body.innerHTML + '<i></i>'; await tick();
document.body.innerHTML = '<button data-testid="SideNav_AccountSwitcher_Button"><div data-testid="UserAvatar-Container-playfishies"></div><span>Fishies</span></button>'; await tick();
document.body.innerHTML = '<button data-testid="SideNav_AccountSwitcher_Button"><div data-testid="UserAvatar-Container-otheraccount"></div><span>Sample</span></button>'; await tick();
document.body.appendChild(document.createElement('b')); await tick();
return sent;
});
check('nothing reported while the page is still empty', !reports.some(([, r]) => r === '{}'));
check('signed-out page reported once', reports.filter(([, r]) => r === '{"signedOut":true}').length === 1, JSON.stringify(reports));
check('then the signed-in account, once', reports.filter(([, r]) => r.includes('"handle":"playfishies"')).length === 1 && reports.every(([command]) => command === 'tab_report'));
check('then the signed-in account, once', reports.filter(([, r]) => r.includes('"handle":"otheraccount"')).length === 1 && reports.every(([command]) => command === 'tab_report'));
// Shell: native tells the switcher who is signed in.
const shell = await browser.newPage({ viewport: { width: 1400, height: 800 } });