Something went wrong. Try again.
My website. cameron.stream
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849// Optional Playwright test. Candidate assets are intercepted locally; the server is read-only.import assert from 'node:assert/strict';import { readFile } from 'node:fs/promises';import { pathToFileURL } from 'node:url';const { chromium } = await import(pathToFileURL(process.env.TIDE_PLAYWRIGHT).href);const source = await readFile(new URL('../public/tide-pool.js', import.meta.url), 'utf8');const world = await readFile(new URL('../public/tide-pool-world.js', import.meta.url), 'utf8');const browser = await chromium.launch({ headless: true, executablePath: process.env.TIDE_CHROMIUM, args: ['--enable-unsafe-swiftshader'] });try { for (const mode of ['ordinary-mobile', 'ordinary-desktop', 'baseline', 'minimal', 'no-post', 'no-waves', 'no-caustics', 'no-shadows']) { const mobile = mode !== 'ordinary-desktop', ordinary = mode.startsWith('ordinary-'); const page = await browser.newPage({ viewport: { width: 393, height: 852 }, hasTouch: mobile, isMobile: mobile, reducedMotion: 'reduce' }); await page.addInitScript(() => { window.__bloomShaders = 0; const original = WebGL2RenderingContext.prototype.shaderSource; WebGL2RenderingContext.prototype.shaderSource = function(shader, source) { if (source.includes('uniform sampler2D tBright;')) window.__bloomShaders++; return original.call(this, shader, source); }; }); const errors = []; page.on('pageerror', e => errors.push(String(e))); page.on('console', m => { if (m.type() === 'error') errors.push(m.text()); }); await page.route('**/public/tide-pool.js?*', r => r.fulfill({ contentType: 'text/javascript', body: source })); await page.route('**/public/tide-pool-world.js?*', r => r.fulfill({ contentType: 'text/javascript', body: world })); await page.goto(`${process.argv[2] || 'http://localhost:3097'}/tide-pool?shelf=41${ordinary ? '' : `&graphics=${mode}`}`); await page.waitForFunction(() => window.__tidePool, null, { timeout: 60000 }); await page.evaluate(() => window.__tidePool.watch(.1)); assert.deepEqual(errors, []); const expectPost = mode !== 'ordinary-mobile' && mode !== 'minimal' && mode !== 'no-post'; assert.equal(await page.evaluate(() => window.__bloomShaders > 0), expectPost); if (ordinary) { assert.equal(await page.locator('#tide-graphics-diagnostics').count(), 0); await page.screenshot({ path: `/tmp/tide-${mode}.png` }); } else { const diagnostics = JSON.parse(await page.locator('#tide-graphics-diagnostics').textContent()); assert.equal(diagnostics.mode, mode); assert.equal(diagnostics.losses, 0); } console.log(`${mode}: passed`); if (mode === 'minimal') { await page.evaluate(() => document.querySelector('#tide-canvas').getContext('webgl2').getExtension('WEBGL_lose_context').loseContext()); await page.waitForFunction(() => JSON.parse(document.querySelector('#tide-graphics-diagnostics').textContent).losses === 1); console.log('context-loss diagnostics: passed'); } await page.close(); }} finally { await browser.close(); }