@bongos/core 1.25.31 → 1.25.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
1
  // tests/welcome_boot_browser.mjs — the welcome in a real browser (tasks 1004785, 1004818).
2
2
  //
3
3
  // WHY. "Once a day", "Skip", "the craft picker does not also open", "Patron only with a seat", the day
4
- // and night paintings and the slow way out are behaviour across the real shell.js, craft-mode.js and
4
+ // and night veils over the city in the clouds and the slow way out are behaviour across the real shell.js, craft-mode.js and
5
5
  // welcome-boot.js together — the shell is what decides which of the two greets a builder — so this
6
- // serves the REAL Home markup, the REAL hall scripts and the REAL paintings from a routed origin
6
+ // serves the REAL Home markup and the REAL hall scripts (the city's painters too) from a routed origin
7
7
  // (localStorage needs one) in the ui-design kit's launcher. Every wait is on DOM state, never on a
8
8
  // flag that flips before the DOM settles (the task 1004780 CI flake). Skips when the machine has no
9
9
  // system Edge or Chrome, as ui_design_kit_fit does.
@@ -33,7 +33,9 @@ const INDEX = fs.readFileSync(path.join(HALL, 'index.html'), 'utf8')
33
33
  .replace(/<script\b[^>]*>[\s\S]*?<\/script>/g, '')
34
34
  .replace(/\{\{[^}]*\}\}/g, '');
35
35
  const STUB = '<script>window.__BRANDING__ = { identity: { worldName: "Harbor" } }; window.BongosClient = { createClient: () => ({ request: async () => ({ ok: false, status: 404, data: null }) }) };</script>';
36
- const SCRIPTS = ['dom-utils.js', 'shell-trail.js', 'craft-mode.js', 'welcome-boot.js', 'shell.js'] // dom-utils first, as on the real page (task 1004876)
36
+ // The city's three painters draw the scene (task 1005308: the city in the clouds, not a painting).
37
+ const PAINTERS = ['sky-time.js', 'city-draw.js', 'home-city-draw.js'];
38
+ const SCRIPTS = ['dom-utils.js', ...PAINTERS, 'shell-trail.js', 'craft-mode.js', 'welcome-boot.js', 'shell.js'] // dom-utils first, as on the real page (task 1004876)
37
39
  .map((f) => `<script src="/builders/${f}"></script>`).join('');
38
40
  const PAGE = INDEX.replace('</body>', STUB + SCRIPTS + '</body>');
39
41
 
@@ -46,7 +48,7 @@ async function hall({ art = true, reducedMotion = 'no-preference', time = null }
46
48
  if (p === '/api/bongos/auth/web/start') return route.fulfill({ contentType: 'text/html', body: '<!doctype html><title>github</title><p id="auth">sign in</p>' });
47
49
  if (p === '/studio' || p === '/city') return route.fulfill({ contentType: 'text/html', body: '<!doctype html><title>room</title><p id="room">' + p + '</p>' });
48
50
  const ext = path.extname(p);
49
- if (ext === '.webp' && !art) return route.fulfill({ status: 404, body: '' });
51
+ if (!art && PAINTERS.includes(path.basename(p))) return route.fulfill({ status: 404, body: '' });
50
52
  const f = path.join(HALL, p.replace(/^\/builders\//, ''));
51
53
  if (p.startsWith('/builders/') && TYPES[ext] && fs.existsSync(f)) return route.fulfill({ contentType: TYPES[ext], body: fs.readFileSync(f) });
52
54
  return route.fulfill({ status: 404, body: '' });
@@ -91,8 +93,8 @@ test('first visit of the day: the welcome, not the craft picker; Skip brings the
91
93
  'the welcome shows, the picker is marked asked and does not stack on it');
92
94
  assert.equal(await page.evaluate(() => document.querySelector('.wb__banner').tagName), 'DIV',
93
95
  'over a signed-in hall the shell keeps the one <header>; the banner is a plain block (task 1005080)');
94
- // The painting loads and its motion is laid over it.
95
- await page.waitForFunction(() => { const i = document.querySelector('#welcome-boot .wb__img'); return i && i.complete && i.naturalWidth === 1024; });
96
+ // The city in the clouds is drawn behind it (task 1005308).
97
+ await page.waitForSelector('#welcome-boot .cloud-scene .cloud-scene__svg path');
96
98
  assert.equal(await page.isVisible('[data-wb-skip]'), true);
97
99
  await page.click('[data-wb-skip]');
98
100
  await done(page);
@@ -227,17 +229,18 @@ test('roles: a seat holder sees Patron; Artisan stays on Home in Artisan', { ski
227
229
  await ctx.close();
228
230
  });
229
231
 
230
- test('no painting: the greeting and the choice still come up, over the sky colour', { skip }, async () => {
232
+ test('no city painters: the greeting and the choice still come up, over the sky colour', { skip }, async () => {
231
233
  const ctx = await hall({ art: false });
232
234
  const { page } = await open(ctx);
233
235
  await signIn(page);
234
236
  await done(page);
235
237
  const s = await page.evaluate(() => ({
236
238
  bare: document.getElementById('welcome-boot').classList.contains('wb--bare'),
237
- img: document.querySelector('#welcome-boot .wb__img').hidden,
239
+ city: !!document.querySelector('#welcome-boot .cloud-scene__svg'),
240
+ sky: !!document.querySelector('#welcome-boot .cloud-scene'),
238
241
  choices: document.querySelectorAll('.wb__choice').length,
239
242
  }));
240
- assert.deepEqual(s, { bare: true, img: true, choices: 2 });
243
+ assert.deepEqual(s, { bare: true, city: false, sky: true, choices: 2 });
241
244
  await ctx.close();
242
245
  });
243
246
 
@@ -256,15 +259,16 @@ const look = (page) => page.evaluate(() => {
256
259
  return {
257
260
  day: r.classList.contains('wb--day'), night: r.classList.contains('wb--night'),
258
261
  veil: getComputedStyle(r.querySelector('.wb__veil')).backgroundColor,
259
- art: r.querySelector('.wb__img').getAttribute('src'),
260
- beacons: r.querySelectorAll('.wb-beacon').length,
262
+ city: !!r.querySelector('.cloud-scene__svg'),
263
+ hour: document.documentElement.getAttribute('data-sky-hour'),
264
+ img: r.querySelectorAll('img:not(.wb__logo)').length,
261
265
  };
262
266
  });
263
267
 
264
- test('by day the day painting opens from a white veil; by night the night one from black, with its lights', { skip }, async () => {
268
+ test('by day the city opens from a white veil, by night from black, in the sky of that hour (task 1005308)', { skip }, async () => {
265
269
  for (const [time, want] of [
266
- [new Date(2026, 9, 23, 10, 0), { day: true, night: false, veil: 'rgb(255, 255, 255)', art: '/builders/welcome-day.webp', beacons: 0 }],
267
- [new Date(2026, 9, 23, 22, 0), { day: false, night: true, veil: 'rgb(0, 0, 0)', art: '/builders/welcome-night.webp', beacons: 0 }], // task 1005087 took the beacons out
270
+ [new Date(2026, 9, 23, 10, 0), { day: true, night: false, veil: 'rgb(255, 255, 255)', city: true, hour: '10', img: 0 }],
271
+ [new Date(2026, 9, 23, 22, 0), { day: false, night: true, veil: 'rgb(0, 0, 0)', city: true, hour: '22', img: 0 }],
268
272
  ]) {
269
273
  const ctx = await hall({ time });
270
274
  const { page } = await open(ctx);
@@ -305,19 +309,21 @@ test('the banner is the animated logo, the motion is laid on, and the drawn towe
305
309
  const ctx = await hall();
306
310
  const { page } = await open(ctx);
307
311
  await signIn(page);
308
- await page.waitForSelector('#welcome-boot.wb--lit .wb-motion');
312
+ await page.waitForSelector('#welcome-boot.wb--lit .cloud-scene__svg');
309
313
  const s = await page.evaluate(() => ({
310
314
  banner: document.querySelector('.wb__banner').textContent,
311
315
  name: document.querySelector('.wb__banner .wb__name').textContent,
312
316
  mark: !!document.querySelector('.wb__banner svg.wb__mark .wb__moonlet'),
313
317
  ringAnim: getComputedStyle(document.querySelector('.wb__ring')).animationName,
314
- pulses: document.querySelectorAll('#wb-fx .wb-pulse').length,
315
- cars: document.querySelectorAll('#wb-fx .wb-car').length,
316
- old: document.querySelectorAll('.wb-floor, .wb-bldg, .wb-person, #wb-scene, #wb-beam, #wb-city').length,
318
+ // anywhere on the page, under any container: the painting's lights must not come back
319
+ pulses: document.querySelectorAll('.wb-pulse, .wb-pulses').length,
320
+ cars: document.querySelectorAll('.wb-car').length,
321
+ // every earlier scene: the drawn tower and city, the painting and its light layer
322
+ old: document.querySelectorAll('.wb-floor, .wb-bldg, .wb-person, #wb-beam, #wb-city, #wb-fx, .wb-motion, .wb-moon, .wb-star, .wb__img').length,
317
323
  }));
318
324
  assert.doesNotMatch(s.banner, /Working on the core of/, 'task 1004953: the banner text is gone');
319
325
  assert.deepEqual({ name: s.name, mark: s.mark, ringAnim: s.ringAnim, pulses: s.pulses, cars: s.cars, old: s.old },
320
- { name: 'Harbor', mark: true, ringAnim: 'wb-ring', pulses: 21, cars: 3, old: 0 });
326
+ { name: 'Harbor', mark: true, ringAnim: 'wb-ring', pulses: 0, cars: 0, old: 0 }, 'the painting\'s lights went with it (task 1005308)');
321
327
  await ctx.close();
322
328
  });
323
329