diff mrjunejune/test/theme_and_webp_test.js @ 262:0f45474c1b1a

Add cyberpunk JRPG blog browser Show the latest posts in the JRPG preview and render the full blog archive and sanitized post details in the Inspect modal. Co-authored-by: Copilot <[email protected]>
author MrJuneJune <mrjunejune@users.noreply.github.com>
date Thu, 06 Aug 2026 04:08:45 -0700
parents b401627fc49e
children ee04e4e69fed
line wrap: on
line diff
--- a/mrjunejune/test/theme_and_webp_test.js	Wed Aug 05 20:38:32 2026 -0700
+++ b/mrjunejune/test/theme_and_webp_test.js	Thu Aug 06 04:08:45 2026 -0700
@@ -734,6 +734,58 @@
   await page.getByRole('button', {
     name: 'Close destination details',
   }).click();
+  await page.locator('.jrpg-preview-dialog dialog').waitFor({ state: 'hidden' });
+
+  await page.getByRole('button', { name: 'Blogs', exact: true }).click();
+  await page.waitForFunction(() =>
+    document.querySelectorAll('[data-latest-blog]').length === 4
+  );
+  assert.match(
+    await page.locator('[data-work-showcase]').textContent(),
+    /Websocket Demystified/,
+  );
+  assert.match(
+    await page.locator('[data-work-showcase]').textContent(),
+    /Creating Network Library in C/,
+  );
+  await page.locator('[data-latest-blog]').first().click();
+  await page.locator('[data-blog-content] h1').waitFor();
+  assert.equal(
+    await page.locator('[data-blog-content] h1').textContent(),
+    'WebSocket Demystified',
+  );
+  assert.equal(
+    await page.locator('[data-preview-link]').getAttribute('href'),
+    '/blog/websocket-demystified',
+  );
+  assert.equal(
+    await page.locator('[data-blog-content]').evaluate(
+      article => getComputedStyle(article).fontFamily,
+    ),
+    '"Pixel Mplus"',
+  );
+  await page.getByRole('button', {
+    name: 'Close destination details',
+  }).click();
+  await page.locator('.jrpg-preview-dialog dialog').waitFor({ state: 'hidden' });
+
+  await page.getByRole('button', { name: /Inspect/ }).click();
+  await page.waitForFunction(() =>
+    document.querySelectorAll('[data-blog-entry]').length === 9
+  );
+  assert.equal(await page.locator('[data-blog-entry]').count(), 9);
+  await page.locator('[data-blog-entry]').nth(1).click();
+  await page.waitForFunction(() =>
+    document.querySelector('[data-blog-content] h1')?.textContent ===
+      'Creating Network Library in C'
+  );
+  assert.equal(
+    await page.locator('[data-preview-link]').getAttribute('href'),
+    '/blog/my-seobeo-journey',
+  );
+  await page.getByRole('button', {
+    name: 'Close destination details',
+  }).click();
 
   await page.evaluate(() => {
     window.__jrpgStreamEvents = [];
@@ -1209,7 +1261,7 @@
     for (const source of [home, dogGame, manifest]) {
       assert.doesNotMatch(source, /\.png(?:["')]|$)/i);
     }
-    assert.match(serviceWorker, /v13-turn-resume/);
+    assert.match(serviceWorker, /v14-blog-browser/);
     assert.match(
       await (
         await fetch(`${baseUrl}/public/pwa-register.js`)