diff --git a/.prettierignore b/.prettierignore index 024bd80..3ecd22e 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,7 +1,6 @@ package-lock.json public/ evidence/ -tests/fixtures/ node_modules/ dist/ .astro/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9b327fc..ceebed9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,7 +6,10 @@ https://docs.dask.org/en/latest/develop.html. For website changes, use Node.js 24, install dependencies with `npm ci`, install Chromium with `npx playwright install --with-deps chromium`, and run -`npm run check`. +`npm run check`. For a focused run, build once with `npm run build`, then use +`npm test -- tests/.spec.mjs`. The runner serves the production build and +a Read the Docs mount on local, ephemeral ports; artifacts from failed tests +are written under `evidence/playwright/`. Keep route data and shared Astro components DRY; use native browser behavior, not Webflow/jQuery libraries. Commit the lockfile with dependency changes. Run `npm run format` before submitting a PR. Include reproducible test evidence diff --git a/README.md b/README.md index 23104c2..2801707 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,9 @@ and legacy HTML. Astro produces `dist/`; generated output, dependencies and test evidence are ignored by Git. The build uses Node.js 24 and npm with a committed lockfile. Automated checks -cover formatting, builds, asset integrity, browser interactions, responsive -layouts, animations and redirects. +cover formatting, static output, responsive layout, browser interactions, +animations, redirects and mounted previews. Playwright specs are organized by +behavior in `tests/`. GitHub Actions CI checks pull requests. The Pages workflow builds and publishes upstream main, with separate build and deployment jobs and main-only manual @@ -27,6 +28,4 @@ closed-survey pages are included. Forms have no submission backend. Dask content and implementation are attributed to Dask core developers. [LICENSE.txt](LICENSE.txt) contains the BSD license; [licenses](licenses/) contains font and renderer notices. Third-party artwork and trademarks retain -their owners' rights. Asset source URLs are recorded in `src/data/assets.json`; -source identities and original animation URLs/hashes are recorded in -`tests/fixtures/provenance.json`. +their owners' rights. diff --git a/package-lock.json b/package-lock.json index 5baceb2..77c80d9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,8 +11,6 @@ }, "devDependencies": { "@playwright/test": "^1.56.0", - "pixelmatch": "^7.1.0", - "pngjs": "^7.0.0", "prettier": "^3.10.1", "prettier-plugin-astro": "^1.1.2" }, @@ -3065,19 +3063,6 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, - "node_modules/pixelmatch": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/pixelmatch/-/pixelmatch-7.2.0.tgz", - "integrity": "sha512-xhcb4yHu9sM/G7foGzoLtXYcC0zHEaOXXjRKhGup0fw78Nf2Tkiapv4EQyMzrbcmQPsllAI7DbFY2UT7PlI9Pg==", - "dev": true, - "license": "ISC", - "dependencies": { - "pngjs": "^7.0.0" - }, - "bin": { - "pixelmatch": "bin/pixelmatch" - } - }, "node_modules/playwright": { "version": "1.65.1", "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.65.1.tgz", @@ -3107,16 +3092,6 @@ "node": ">=20" } }, - "node_modules/pngjs": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-7.0.0.tgz", - "integrity": "sha512-LKWqWJRhstyYo9pGvgor/ivk2w94eSjE3RGVuzLGlr3NmD8bf7RcYGze1mNdEHRP6TRP6rMuDHk5t44hnTRyow==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=14.19.0" - } - }, "node_modules/postcss": { "version": "8.5.33", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.33.tgz", diff --git a/package.json b/package.json index 1369483..7a33c49 100644 --- a/package.json +++ b/package.json @@ -6,14 +6,10 @@ "dev": "astro dev --host 127.0.0.1", "build": "astro build", "preview": "astro preview --host 127.0.0.1", - "test": "node scripts/test.mjs", + "test": "playwright test", "format": "prettier --write .", "format:check": "prettier --check .", - "test:redirects": "node scripts/redirect-checks.mjs", - "test:static": "node scripts/static-checks.mjs", - "check": "npm run format:check && npm run build && npm run test:static && npm test && npm run test:redirects && npm run test:readthedocs && npm run test:lottie", - "test:readthedocs": "node scripts/readthedocs-checks.mjs", - "test:lottie": "node scripts/lottie-checks.mjs" + "check": "npm run format:check && npm run build && npm test" }, "dependencies": { "astro": "^7.4.12", @@ -21,8 +17,6 @@ }, "devDependencies": { "@playwright/test": "^1.56.0", - "pixelmatch": "^7.1.0", - "pngjs": "^7.0.0", "prettier": "^3.10.1", "prettier-plugin-astro": "^1.1.2" }, diff --git a/playwright.config.mjs b/playwright.config.mjs new file mode 100644 index 0000000..aad80f3 --- /dev/null +++ b/playwright.config.mjs @@ -0,0 +1,13 @@ +import { defineConfig } from '@playwright/test'; + +export default defineConfig({ + testDir: './tests', + globalSetup: './tests/support/preview.mjs', + outputDir: './evidence/playwright', + workers: 2, + use: { + reducedMotion: 'reduce', + screenshot: 'only-on-failure', + trace: 'retain-on-failure', + }, +}); diff --git a/scripts/brand-reading-check.mjs b/scripts/brand-reading-check.mjs deleted file mode 100644 index aa8ea41..0000000 --- a/scripts/brand-reading-check.mjs +++ /dev/null @@ -1,29 +0,0 @@ -import { expect } from '@playwright/test'; -/** Current location follows the visible reading midpoint, not the last clicked URL. - * The source-backed bidirectional fixtures live in round14; this shared assertion - * also keeps older direct-navigation regressions honest after their click. */ -export async function expectReadingMarker(page) { - await expect - .poll(() => - page.evaluate(() => { - const links = [...document.querySelectorAll('.brand-sidebar a')]; - const expected = links - .filter((e) => { - const r = document.querySelector(e.hash).getBoundingClientRect(); - return r.top <= innerHeight / 2 && r.bottom >= innerHeight / 2; - }) - .map((e) => e.hash); - const actual = links - .filter((e) => e.hasAttribute('aria-current')) - .map((e) => e.hash); - return JSON.stringify(actual) === JSON.stringify(expected); - }), - ) - .toBe(true); - for (const link of await page - .locator('.brand-sidebar a[aria-current]') - .all()) { - await expect(link).toHaveCSS('background-color', 'rgb(246, 246, 246)'); - await expect(link).toHaveCSS('color', 'rgb(8, 8, 21)'); - } -} diff --git a/scripts/lottie-checks.mjs b/scripts/lottie-checks.mjs deleted file mode 100644 index 7283e22..0000000 --- a/scripts/lottie-checks.mjs +++ /dev/null @@ -1,170 +0,0 @@ -import assert from 'node:assert/strict'; -import { readFile, stat, mkdtemp, rm } from 'node:fs/promises'; -import { createHash } from 'node:crypto'; -import http from 'node:http'; -import path from 'node:path'; -import os from 'node:os'; -import { spawnSync } from 'node:child_process'; -import { chromium, expect } from '@playwright/test'; -const identities = { - 'dask-home': - '76423fcd4c9991490f5a5d09231727324380f874acb76cbfbe3c0f81305ac543', - 'type-gauge': - '6b9e60ae47ddb6c5287e493f29d023cac7044416133d3234121d41e4dee8e8f0', -}; -for (const [name, sha] of Object.entries(identities)) { - const bytes = await readFile(`public/animations/${name}.json`); - assert.equal(createHash('sha256').update(bytes).digest('hex'), sha); - function audit(value) { - if (Array.isArray(value)) value.forEach(audit); - else if (value && typeof value === 'object') - for (const [key, item] of Object.entries(value)) { - assert.ok(!(key === 'x' && typeof item === 'string'), 'no expressions'); - assert.ok( - !( - typeof item === 'string' && /https?:|data:|javascript:/i.test(item) - ), - 'no external/embedded resources', - ); - if (key === 'u') assert.equal(item, '', 'no asset directory'); - audit(item); - } - } - audit(JSON.parse(bytes)); -} -const browser = await chromium.launch(); -const temp = await mkdtemp(path.join(os.tmpdir(), 'dask-lottie-')); -let groups = 0; -try { - for (const mount of process.env.BASE_URL ? [null] : ['/', '/en/59/']) { - let server; - let base = process.env.BASE_URL; - if (mount) { - const output = path.join(temp, mount === '/' ? 'root' : 'rtd'); - const build = spawnSync( - process.execPath, - ['scripts/readthedocs-build.mjs'], - { - env: { - ...process.env, - READTHEDOCS_OUTPUT: output, - READTHEDOCS_CANONICAL_URL: 'https://preview.invalid' + mount, - }, - stdio: 'inherit', - }, - ); - assert.equal(build.status, 0); - const root = path.join(output, 'html'); - server = http.createServer(async (req, res) => { - try { - const url = new URL(req.url, 'http://localhost'); - assert.ok(url.pathname.startsWith(mount)); - let file = path.resolve( - root, - decodeURIComponent(url.pathname.slice(mount.length)), - ); - assert.ok(file === root || file.startsWith(root + path.sep)); - if ((await stat(file)).isDirectory()) - file = path.join(file, 'index.html'); - res.setHeader( - 'Content-Type', - { - '.js': 'text/javascript', - '.css': 'text/css', - '.html': 'text/html', - '.json': 'application/json', - '.png': 'image/png', - '.svg': 'image/svg+xml', - }[path.extname(file)] || 'application/octet-stream', - ); - res.end(await readFile(file)); - } catch { - res.writeHead(404); - res.end(); - } - }); - await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve)); - base = `http://127.0.0.1:${server.address().port}${mount}`; - } - try { - for (const width of [1440, 390]) - for (const reducedMotion of ['no-preference', 'reduce']) { - const page = await browser.newPage({ - viewport: { width, height: 900 }, - reducedMotion, - }); - const errors = [], - external = []; - page.on('pageerror', (error) => errors.push(String(error))); - page.on('request', (req) => { - if (new URL(req.url()).origin !== new URL(base).origin) - external.push(req.url()); - }); - await page.goto(base); - for (const name of Object.keys(identities)) { - const art = page.locator(`[data-lottie="${name}"]`); - await art.scrollIntoViewIfNeeded(); - const poster = art.locator(':scope > img'); - await expect - .poll(() => - poster.evaluate((img) => img.complete && img.naturalWidth > 0), - ) - .toBe(true); - const geometry = await art.boundingBox(); - expect(geometry.width).toBeGreaterThan(100); - if (reducedMotion === 'reduce') { - await page.waitForTimeout(350); - await expect(art).not.toHaveAttribute('data-loaded', 'true'); - await expect(poster).toBeVisible(); - expect(await art.locator('svg').count()).toBe(0); - } else { - await expect(art).toHaveAttribute('data-loaded', 'true'); - await expect(art.locator('svg')).toBeVisible(); - const frame = await art.getAttribute('data-frame'); - const image = await art.screenshot(); - await expect - .poll(() => art.getAttribute('data-frame')) - .not.toBe(frame); - await page.waitForTimeout(650); - assert.ok( - !image.equals(await art.screenshot()), - 'actual rendered SVG pixels advance', - ); - // Offscreen pause, then dynamic reduced-motion switches back to poster. - await page.evaluate(() => - scrollTo(0, document.body.scrollHeight), - ); - await page.waitForTimeout(200); - const paused = await art.getAttribute('data-frame'); - await page.waitForTimeout(200); - expect(await art.getAttribute('data-frame')).toBe(paused); - await page.emulateMedia({ reducedMotion: 'reduce' }); - await art.scrollIntoViewIfNeeded(); - await expect(poster).toBeVisible(); - await page.emulateMedia({ reducedMotion: 'no-preference' }); - } - groups++; - } - expect(errors).toEqual([]); - expect(external).toEqual([]); - await page.close(); - } - // Posters remain available without JavaScript. - const page = await browser.newPage({ javaScriptEnabled: false }); - await page.goto(base); - for (const name of Object.keys(identities)) - await expect( - page.locator(`[data-lottie="${name}"] > img`), - ).toBeVisible(); - await page.close(); - } finally { - if (server) await new Promise((resolve) => server.close(resolve)); - } - } -} finally { - await browser.close(); - await rm(temp, { recursive: true, force: true }); -} -console.log( - `${groups} original-Lottie rendering/lifecycle groups passed; exact byte/resource audit passed.`, -); diff --git a/scripts/readthedocs-checks.mjs b/scripts/readthedocs-checks.mjs deleted file mode 100644 index 4cd7952..0000000 --- a/scripts/readthedocs-checks.mjs +++ /dev/null @@ -1,222 +0,0 @@ -import assert from 'node:assert/strict'; -import { spawnSync } from 'node:child_process'; -import { mkdtemp, readFile, rm, stat } from 'node:fs/promises'; -import http from 'node:http'; -import os from 'node:os'; -import path from 'node:path'; -import { chromium, expect } from '@playwright/test'; - -const temporary = await mkdtemp(path.join(os.tmpdir(), 'dask-rtd-')); -const browser = await chromium.launch(); -const slugs = [ - '', - 'get-started', - 'get-help', - 'powered-by', - 'brand-guide', - 'press-mentions', -]; -let checked = 0; -try { - for (const base of ['/en/59/', '/']) { - const canonical = 'https://preview.example.invalid' + base; - const output = path.join( - temporary, - base === '/' ? 'root output' : 'version output', - ); - const build = spawnSync( - process.execPath, - ['scripts/readthedocs-build.mjs'], - { - env: { - ...process.env, - READTHEDOCS_CANONICAL_URL: canonical, - READTHEDOCS_OUTPUT: output, - }, - stdio: 'inherit', - }, - ); - assert.equal(build.status, 0); - const htmlRoot = path.join(output, 'html'); - const types = { - '.js': 'text/javascript', - '.css': 'text/css', - '.html': 'text/html', - '.svg': 'image/svg+xml', - '.ttf': 'font/ttf', - }; - const server = http.createServer(async (request, response) => { - const pathname = new URL(request.url, 'http://local').pathname; - let file; - if (pathname.startsWith(base)) { - const candidate = path.resolve( - htmlRoot, - decodeURI(pathname.slice(base.length)), - ); - if ( - candidate.startsWith(htmlRoot + path.sep) || - candidate === htmlRoot - ) { - try { - file = (await stat(candidate)).isDirectory() - ? path.join(candidate, 'index.html') - : candidate; - await stat(file); - } catch { - file = null; - } - } - } - response.writeHead(file ? 200 : 404, { - 'content-type': - types[path.extname(file || '404.html')] || 'application/octet-stream', - }); - response.end(await readFile(file || path.join(htmlRoot, '404.html'))); - }); - await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve)); - const origin = 'http://127.0.0.1:' + server.address().port; - const context = await browser.newContext({ - reducedMotion: 'reduce', - viewport: { width: 390, height: 900 }, - }); - const external = [], - failed = []; - await context.route('**/*', async (route) => { - if ( - route - .request() - .url() - .startsWith(origin + '/') - ) - await route.continue(); - else { - external.push(route.request().url()); - await route.fulfill({ - contentType: 'text/html', - body: '

Intercepted external destination

', - }); - } - }); - const page = await context.newPage(); - page.on('pageerror', (error) => failed.push(String(error))); - page.on('response', (response) => { - if (response.status() >= 400) failed.push(response.url()); - }); - try { - for (const slug of slugs) { - await page.goto(origin + base + slug, { waitUntil: 'networkidle' }); - await page.evaluate(() => document.fonts.ready); - await expect(page.locator('main')).toBeVisible(); - await expect(page.locator('link[rel=canonical]')).toHaveAttribute( - 'href', - canonical + (slug ? slug + '/' : ''), - ); - const credit = page.getByRole('link', { - name: 'Hosted by GitHub Pages', - exact: true, - }); - await credit.scrollIntoViewIfNeeded(); - await expect(credit).toBeVisible(); - await expect(credit).toHaveAttribute( - 'href', - 'https://github.com/dask/dask.github.io', - ); - assert.deepEqual( - await page - .locator('img') - .evaluateAll((images) => - images - .filter((i) => !i.complete || !i.naturalWidth) - .map((i) => i.src), - ), - [], - ); - // Every root-relative HTML URL points inside this exact version and to - // a real static output file. External links/fragments stay unchanged. - const urls = await page - .locator('[href], [src]') - .evaluateAll((elements) => - elements - .flatMap((el) => - ['href', 'src'].map((name) => el.getAttribute(name)), - ) - .filter( - (value) => value?.startsWith('/') && !value.startsWith('//'), - ), - ); - for (const url of urls) { - assert.ok(url.startsWith(base), url); - const candidate = path.join( - htmlRoot, - new URL(url, origin).pathname.slice(base.length), - ); - const info = await stat(candidate); - if (info.isDirectory()) - await stat(path.join(candidate, 'index.html')); - } - if (slug === 'brand-guide') { - for (const tab of await page.locator('[data-logo-color]').all()) { - await tab.click(); - await expect - .poll(() => - page - .locator('.logo-showcase img') - .evaluateAll((images) => - images.every((i) => i.complete && i.naturalWidth > 0), - ), - ) - .toBe(true); - } - } - assert.deepEqual(failed, []); - assert.deepEqual(external, []); - checked++; - } - const destination = 'https://blog.dask.org/'; - for (const suffix of [ - 'blog/', - 'events/', - 'archive/2022-news-events/', - 'blog/arbitrary/deep/post?old=yes#section', - 'events/unknown', - ]) { - await page.goto(origin + base + suffix); - await page.waitForURL(destination); - assert.equal(page.url(), destination); - checked++; - } - for (const suffix of [ - 'missing', - 'blogger', - 'archive/2022-news-events/child', - ]) { - const response = await page.goto(origin + base + suffix); - assert.equal(response.status(), 404); - await page.waitForTimeout(100); - assert.equal(page.url(), origin + base + suffix); - checked++; - } - const noJS = await browser.newContext({ javaScriptEnabled: false }); - try { - const staticPage = await noJS.newPage(); - await staticPage.route('https://blog.dask.org/**', (route) => - route.fulfill({ body: 'Blog' }), - ); - await staticPage.goto(origin + base + 'blog/'); - await staticPage.waitForURL(destination); - checked++; - } finally { - await noJS.close(); - } - } finally { - await context.close(); - await new Promise((resolve) => server.close(resolve)); - } - } -} finally { - await browser.close(); - await rm(temporary, { recursive: true, force: true }); -} -console.log( - `${checked} RTD mounted/root route, canonical, asset/link, footer, brand-state and redirect groups passed; dynamic isolated test ports.`, -); diff --git a/scripts/redirect-checks.mjs b/scripts/redirect-checks.mjs deleted file mode 100644 index b3d894a..0000000 --- a/scripts/redirect-checks.mjs +++ /dev/null @@ -1,276 +0,0 @@ -import assert from 'node:assert/strict'; -import fs from 'node:fs/promises'; -import os from 'node:os'; -import path from 'node:path'; -import http from 'node:http'; -import { execFile } from 'node:child_process'; -import { promisify } from 'node:util'; -import { chromium } from '@playwright/test'; - -// A Pages-style static host: real files get 200; missing paths get the build's -// 404 document with status 404 and the original browser URL, never an SPA rewrite. -const target = 'https://blog.dask.org/'; -const evidence = 'evidence/redirects'; -await fs.mkdir(evidence, { recursive: true }); -const temporary = await fs.mkdtemp(path.join(os.tmpdir(), 'dask-redirects-')); -const browser = await chromium.launch(); -const results = []; -const known = ['/blog', '/events', '/archive/2022-news-events']; -const excluded = [ - ...known.flatMap((p) => [p, p + '/', p + '/?from=old#section']), - '/blog/a-real-old-post', - '/blog/a/deep/arbitrary/path/', - '/blog/a%20post?next=https://elsewhere.invalid/path#old', - '/blog/2022/05/story.html', - '/blog/index.html', - '/blog//nested/', - '/events/some-unknown-event', - '/events/2027/a/future-event/?q=anything#fragment', - '/events/index.html', -]; -const unrelated = [ - '/missing', - '/blogger', - '/blog.html', - '/events-old', - '/myevents/a', - '/archive/2022-news-events-old', - '/archive/2022-news-events/child', - '/not-blog/blog/a', - '/Blog/a', - '/Events/a', -]; -const mime = { - '.html': 'text/html', - '.js': 'text/javascript', - '.css': 'text/css', - '.svg': 'image/svg+xml', - '.woff': 'font/woff', - '.woff2': 'font/woff2', -}; -try { - for (const base of ['/', '/dask.org/']) { - const output = path.join(temporary, base === '/' ? 'root' : 'project'); - const { stdout, stderr } = await promisify(execFile)( - process.execPath, - [ - 'node_modules/astro/bin/astro.mjs', - 'build', - '--base', - base, - '--outDir', - output, - ], - { maxBuffer: 2 * 1024 * 1024 }, - ); - await fs.writeFile( - `${evidence}/build-${base === '/' ? 'root' : 'project'}.log`, - stdout + stderr, - ); - for (const source of known) { - const html = await fs.readFile( - path.join(output, source, 'index.html'), - 'utf8', - ); - assert.ok(html.includes(`content="0;url=${target}"`)); - assert.ok(html.includes(` name.includes('[')), - 'no literal wildcard file emitted', - ); - const mount = base.replace(/\/$/, ''); - const server = http.createServer(async (request, response) => { - let pathname; - try { - pathname = decodeURI(new URL(request.url, 'http://local').pathname); - } catch { - response.writeHead(400); - response.end(); - return; - } - let file; - if (!mount || pathname === mount || pathname.startsWith(mount + '/')) { - const local = pathname.slice(mount.length).replace(/^\/+/, ''); - const candidate = path.resolve(output, local); - if (candidate === output || candidate.startsWith(output + path.sep)) { - try { - const stat = await fs.stat(candidate); - file = stat.isDirectory() - ? path.join(candidate, 'index.html') - : candidate; - await fs.access(file); - } catch { - file = null; - } - } - } - response.writeHead(file ? 200 : 404, { - 'content-type': file - ? mime[path.extname(file)] || 'application/octet-stream' - : 'text/html', - }); - response.end(await fs.readFile(file || path.join(output, '404.html'))); - }); - await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve)); - const origin = `http://127.0.0.1:${server.address().port}`; - try { - for (const javaScriptEnabled of [true, false]) { - const context = await browser.newContext({ - javaScriptEnabled, - reducedMotion: 'reduce', - }); - const outbound = []; - await context.route('https://blog.dask.org/**', async (route) => { - outbound.push(route.request().url()); - await route.fulfill({ - contentType: 'text/html', - body: 'Intercepted exact blog target

Local redirect test; no external request sent.

', - }); - }); - const page = await context.newPage(); - for (const source of excluded) { - const isKnown = - known.some( - (k) => source.split(/[?#]/)[0].replace(/\/+$/, '') === k, - ) || source.endsWith('/index.html'); - const shouldRedirect = javaScriptEnabled || isKnown; - const url = origin + mount + source; - const requestsBefore = outbound.length; - const originalResponses = []; - const listener = (r) => { - if (r.request().isNavigationRequest() && r.url().startsWith(origin)) - originalResponses.push(r.status()); - }; - page.on('response', listener); - try { - await page - .goto(url, { waitUntil: 'domcontentloaded' }) - .catch((error) => { - if (!String(error).includes('ERR_ABORTED')) throw error; - }); - if (shouldRedirect) { - await page.waitForURL(target, { timeout: 5000 }); - assert.equal( - page.url(), - target, - 'path, query and fragment all discarded', - ); - assert.ok( - outbound.slice(requestsBefore).every((u) => u === target), - ); - assert.ok( - outbound.length > requestsBefore, - 'actual navigation request observed', - ); - } else { - await page.waitForTimeout(150); - assert.equal( - page.url(), - url, - 'without JS an arbitrary missing path remains an honest 404', - ); - assert.equal(outbound.length, requestsBefore); - assert.equal( - await page - .getByRole('link', { name: 'Dask blog', exact: true }) - .count(), - 1, - ); - } - assert.ok( - originalResponses.includes(isKnown ? 200 : 404), - 'known document or genuine host 404', - ); - results.push({ - base, - javaScriptEnabled, - source, - passed: true, - redirect: shouldRedirect, - initialStatuses: originalResponses, - finalURL: page.url().replace(origin, ''), - }); - } finally { - page.off('response', listener); - } - } - for (const source of [ - ...unrelated, - ...(mount - ? ['/outside-mount/events/a', '/dask.org.evil/blog/a'] - : []), - ]) { - const url = - origin + - (source.startsWith('/outside-mount') || - source.startsWith('/dask.org.evil') - ? '' - : mount) + - source; - const before = outbound.length; - const response = await page.goto(url); - await page.waitForTimeout(150); - assert.equal(response.status(), 404); - assert.equal(page.url(), url); - assert.equal( - outbound.length, - before, - 'unrelated missing paths must not redirect', - ); - assert.ok( - !(await page.locator('main').innerText()).match( - /pending|not been selected|guessed/i, - ), - ); - assert.equal( - await page - .getByRole('link', { name: 'Return to Dask home', exact: true }) - .getAttribute('href'), - base, - ); - results.push({ - base, - javaScriptEnabled, - source, - passed: true, - redirect: false, - initialStatus: 404, - }); - } - if (javaScriptEnabled) - await page.screenshot({ - path: `${evidence}/unknown-${mount ? 'project' : 'root'}.png`, - fullPage: true, - }); - await context.close(); - } - } finally { - await new Promise((resolve) => server.close(resolve)); - } - } -} finally { - await browser.close(); - await fs.rm(temporary, { recursive: true, force: true }); - await fs.writeFile( - `${evidence}/checks.json`, - JSON.stringify( - { - target, - passed: results.length, - results, - note: 'No external requests or live site mutations: destination intercepted locally. Arbitrary missing descendants require JavaScript on static Pages; known inventory meta-refresh works without JS.', - }, - null, - 2, - ) + '\n', - ); -} -console.log( - `${results.length} root/project redirect and unrelated-404 browser cases passed (JS on/off); exact target requests intercepted, no network publication.`, -); diff --git a/scripts/round2-checks.mjs b/scripts/round2-checks.mjs deleted file mode 100644 index a6e7faf..0000000 --- a/scripts/round2-checks.mjs +++ /dev/null @@ -1,294 +0,0 @@ -import { expectReadingMarker } from './brand-reading-check.mjs'; -import { chromium, expect } from '@playwright/test'; -import fs from 'node:fs/promises'; -const browser = await chromium.launch(); -const base = process.env.BASE_URL || 'http://127.0.0.1:4321'; -const results = []; -await fs.mkdir('evidence/round2/local', { recursive: true }); -async function check(name, fn) { - try { - await fn(); - results.push({ name, status: 'passed' }); - console.log('PASS', name); - } catch (error) { - results.push({ name, status: 'failed', error: String(error) }); - console.error('FAIL', name, String(error)); - } -} -try { - for (const width of [ - 320, 360, 390, 599, 600, 601, 767, 768, 990, 991, 992, 993, 1099, 1100, - 1101, 1440, 1599, 1600, 1601, - ]) { - for (const slug of [ - '', - 'get-started', - 'get-help', - 'powered-by', - 'brand-guide', - 'press-mentions', - ]) { - const p = await browser.newPage({ - viewport: { width, height: 900 }, - reducedMotion: 'reduce', - }); - await p.goto(base + '/' + slug, { waitUntil: 'networkidle' }); - await check( - `${slug || 'home'} ${width}: intrinsic width and visible primary content`, - async () => { - expect( - await p.evaluate(() => document.documentElement.scrollWidth), - ).toBeLessThanOrEqual(width + 1); - await expect(p.locator('h1')).toBeVisible(); - if (slug === 'press-mentions') { - for (const h of await p.locator('.press-card h2').all()) { - const r = await h.boundingBox(); - expect(r.x + r.width).toBeLessThanOrEqual(width + 1); - } - } - }, - ); - if ( - [320, 390].includes(width) && - ['brand-guide', 'press-mentions'].includes(slug) - ) - await p.screenshot({ - path: `evidence/round2/local/${slug}-${width}.png`, - fullPage: true, - }); - await p.close(); - } - } - for (const width of [1440, 390]) { - const p = await browser.newPage({ - viewport: { width, height: 900 }, - reducedMotion: 'reduce', - }); - await p.goto(base); - for (const [i, label, href] of [ - [0, 'Performance Benchmarks', 'https://docs.coiled.io/blog/tpch.html'], - [ - 1, - 'Process 5,000 files in parallel', - 'https://docs.coiled.io/user_guide/arxiv-matplotlib.html', - ], - [ - 2, - 'Aggregate 250 TB of Water Model Data', - 'https://docs.coiled.io/blog/coiled-xarray.html', - ], - [ - 3, - 'Example: XGBoost Model Training', - 'https://docs.coiled.io/user_guide/xgboost.html', - ], - ]) { - await p.locator('.workload-tabs [role=tab]').nth(i).click(); - await check( - `workload ${i} ${width}: both visible action labels and destinations`, - async () => { - const panel = p.locator('#workload-' + i); - await expect( - panel.getByRole('link', { name: 'Documentation', exact: true }), - ).toHaveAttribute( - 'href', - `https://docs.dask.org/en/stable/${['dataframe', 'futures', 'array', 'ml'][i]}.html`, - ); - await expect( - panel.getByRole('link', { name: label, exact: true }), - ).toBeVisible(); - await expect( - panel.getByRole('link', { name: label, exact: true }), - ).toHaveAttribute( - 'href', - href + '?utm_source=dask.org&utm_medium=homepage', - ); - if (i !== 1) - await expect(panel.locator('.workload-logos')).toBeVisible(); - }, - ); - } - for (const [i, label, href] of [ - [ - 0, - 'Dask deployment video', - 'https://www.youtube.com/watch?v=faFncNrXmIY', - ], - [1, 'Video: Dask in the Cloud', 'https://youtu.be/SfPzmIqMKp0'], - ]) { - await p.locator('.deployment [role=tab]').nth(i).click(); - await check( - `deployment ${i} ${width}: both visible action labels and destinations`, - async () => { - const panel = p.locator('#deploy-' + i); - await expect( - panel.getByRole('link', { name: 'Documentation', exact: true }), - ).toHaveAttribute( - 'href', - i - ? 'https://docs.coiled.io/user_guide/index.html?utm_source=dask.org&utm_medium=homepage' - : 'https://docs.dask.org/en/stable/deploying.html', - ); - await expect( - panel.getByRole('link', { name: label, exact: true }), - ).toBeVisible(); - await expect( - panel.getByRole('link', { name: label, exact: true }), - ).toHaveAttribute('href', href); - await expect(panel.locator('.workload-logos')).toBeVisible(); - }, - ); - } - await check(`homepage inline and hero destinations ${width}`, async () => { - await expect(p.locator('.home-headline .button')).toHaveAttribute( - 'href', - 'https://docs.dask.org/en/stable/', - ); - await expect(p.locator('.home-install .button')).toHaveAttribute( - 'href', - 'https://docs.dask.org/en/latest/install.html', - ); - await expect( - p.getByRole('link', { - name: 'Dask is 50% faster than Spark', - exact: true, - }), - ).toHaveAttribute( - 'href', - 'https://docs.coiled.io/blog/spark-vs-dask.html?utm_source=dask.org&utm_medium=homepage', - ); - await expect( - p.getByRole('link', { name: '$0.10 per TiB', exact: true }), - ).toHaveAttribute( - 'href', - 'https://docs.coiled.io/blog/ten-cents.html?utm_source=dask.org&utm_medium=homepage', - ); - expect(await p.locator('input[type=range]').count()).toBe(0); - }); - await p.goto(base + '/brand-guide'); - await check(`brand palette order and native icons ${width}`, async () => { - expect( - await p - .locator('[data-color]') - .evaluateAll((es) => es.map((e) => e.dataset.color)), - ).toEqual([ - '#FFFFFF', - '#F6F6F6', - '#EBEAEE', - '#FFC11E', - '#FC6E6B', - '#EF1561', - '#61BA92', - '#1F5AFF', - '#183D72', - '#33363D', - '#262326', - '#080815', - ]); - expect(await p.locator('.brand-sidebar svg').count()).toBe(3); - expect(await p.locator('.brand-sidebar img').count()).toBe(1); - if (width < 600) { - const rect = await p.locator('.palette-grid').boundingBox(); - expect(Math.abs(rect.width - 330.75)).toBeLessThan(2); - const logo = await p.locator('.word-mark img').boundingBox(); - expect(logo.width).toBe(156); - } - }); - for (const section of ['colors', 'typography', 'tone', 'logos']) - await check( - `brand rail ${width}: navigate to ${section} without returning to top`, - async () => { - await p.locator(`.brand-sidebar a[href="#${section}"]`).click(); - await p.waitForTimeout(150); - const r = await p.locator('#' + section).boundingBox(); - expect(r.y).toBeGreaterThanOrEqual(width < 600 ? 79 : 0); - expect(r.y).toBeLessThan(width < 600 ? 83 : 27); - await expect(p).toHaveURL(new RegExp('#' + section + '$')); - await expectReadingMarker(p); - const nav = await p.locator('.brand-sidebar').boundingBox(); - expect(nav.y).toBeGreaterThanOrEqual(-1); - const pin = await p - .locator('.brand-sidebar') - .evaluate((e) => parseFloat(getComputedStyle(e).top)); - expect(Math.abs(nav.y - pin)).toBeLessThanOrEqual(1); - await p.screenshot({ - path: `evidence/round2/local/brand-${section}-${width}.png`, - }); - }, - ); - await p.close(); - } - const p = await browser.newPage({ - viewport: { width: 390, height: 900 }, - reducedMotion: 'reduce', - }); - const mutations = []; - await p.route('**/*', (r) => { - if (!['GET', 'HEAD'].includes(r.request().method())) { - mutations.push(r.request().url()); - return r.abort(); - } - return r.continue(); - }); - await p.goto(base + '/press-mentions'); - await p.locator('[data-dialog="press"]').first().click(); - for (const type of ['press', 'event', 'newsletter']) - await check( - `mobile ${type} form layout, safe submit, focus and Escape`, - async () => { - await p.locator(`[data-form="${type}"]`).click(); - const a = await p.locator('[name=first-name]').boundingBox(), - b = await p.locator('[name=last-name]').boundingBox(); - expect(b.y).toBeGreaterThan(a.y + a.height); - const tabs = await p - .locator('.dialog-tabs [role=tab]') - .evaluateAll((es) => es.map((e) => e.getBoundingClientRect().y)); - expect(tabs[1]).toBeGreaterThan(tabs[0] + 24); - expect(tabs[2]).toBeGreaterThan(tabs[1] + 24); - const close = await p.locator('.dialog-close').boundingBox(); - expect(close.x).toBeGreaterThan(300); - await p.screenshot({ - path: `evidence/round2/local/form-${type}-390-empty.png`, - }); - for (const input of await p.locator('dialog input:enabled').all()) { - const name = await input.getAttribute('name'); - await input.fill( - name === 'email' - ? 'test@example.invalid' - : name === 'news-url' - ? 'https://example.invalid/test' - : 'Local test only', - ); - } - for (const input of await p.locator('dialog textarea:enabled').all()) - await input.fill('Local test only'); - await p.screenshot({ - path: `evidence/round2/local/form-${type}-390.png`, - }); - await p.locator('dialog button[type=submit]').click(); - await expect(p.locator('.form-status')).toHaveText( - 'Not sent: this local preview has no submission backend.', - ); - expect(mutations).toEqual([]); - await p.keyboard.press('Escape'); - await expect(p.locator('dialog')).not.toBeVisible(); - await p.locator('[data-dialog="press"]').first().click(); - }, - ); - await p.close(); -} finally { - await browser.close(); - await fs.writeFile( - 'evidence/round2/checks.json', - JSON.stringify( - { - passed: results.filter((r) => r.status === 'passed').length, - failed: results.filter((r) => r.status === 'failed').length, - results, - }, - null, - 2, - ), - ); -} -if (results.some((r) => r.status === 'failed')) process.exitCode = 1; diff --git a/scripts/round3-art-bounds.mjs b/scripts/round3-art-bounds.mjs deleted file mode 100644 index 85066a5..0000000 --- a/scripts/round3-art-bounds.mjs +++ /dev/null @@ -1,61 +0,0 @@ -import { chromium, expect } from '@playwright/test'; -import fs from 'node:fs/promises'; -const b = await chromium.launch(), - rows = [], - base = process.env.BASE_URL || 'http://127.0.0.1:4321'; -try { - for (const width of [ - 320, 390, 479, 480, 599, 600, 601, 767, 768, 991, 992, 1440, - ]) { - const p = await b.newPage({ - viewport: { width, height: 900 }, - reducedMotion: 'reduce', - }); - await p.goto(base + '/powered-by'); - const r = await p.locator('.metrics').evaluate((e) => { - const chart = e.querySelector('.adoption-chart'), - r = chart.getBoundingClientRect(), - box = e.getBoundingClientRect(), - overlap = []; - for (const el of e.querySelectorAll('h2,.metric')) { - const walker = document.createTreeWalker(el, NodeFilter.SHOW_TEXT); - while (walker.nextNode()) { - if (!walker.currentNode.textContent.trim()) continue; - const range = document.createRange(); - range.selectNodeContents(walker.currentNode); - for (const t of range.getClientRects()) - if ( - t.right > r.left && - t.left < r.right && - t.bottom > r.top && - t.top < r.bottom - ) - overlap.push(walker.currentNode.textContent.trim()); - } - } - return { - chart: r.toJSON(), - box: box.toJSON(), - naturalWidth: chart.naturalWidth, - overlap, - }; - }); - rows.push({ width, ...r }); - expect(r.naturalWidth).toBeGreaterThan(0); - expect(r.chart.left).toBeGreaterThanOrEqual(r.box.left); - expect(r.chart.right).toBeLessThanOrEqual(r.box.right + 1); - expect(r.chart.top).toBeGreaterThanOrEqual(r.box.top); - expect(r.chart.bottom).toBeLessThanOrEqual(r.box.bottom + 1); - expect(r.overlap).toEqual([]); - await p.close(); - } -} finally { - await b.close(); - await fs.writeFile( - 'evidence/round3/art-bounds.json', - JSON.stringify(rows, null, 2), - ); -} -console.log( - rows.length + ' loaded artwork bounds/text separation checks passed', -); diff --git a/scripts/round3-checks.mjs b/scripts/round3-checks.mjs deleted file mode 100644 index 891166f..0000000 --- a/scripts/round3-checks.mjs +++ /dev/null @@ -1,166 +0,0 @@ -import { chromium, expect } from '@playwright/test'; -import fs from 'node:fs/promises'; -const browser = await chromium.launch(); -const base = process.env.BASE_URL || 'http://127.0.0.1:4321'; -const rows = []; -await fs.mkdir('evidence/round3/local', { recursive: true }); -for (const width of [ - 320, 390, 479, 480, 599, 600, 601, 767, 768, 991, 992, 1440, -]) - for (const route of [ - '', - 'get-started', - 'get-help', - 'powered-by', - 'brand-guide', - 'press-mentions', - ]) { - const p = await browser.newPage({ - viewport: { width, height: 900 }, - reducedMotion: 'reduce', - }); - await p.goto(base + '/' + route); - await p.evaluate(() => document.fonts.ready); - const data = await p.evaluate(() => { - const h = document.querySelector('h1'), - s = getComputedStyle(h); - const hero = h.closest('section'); - const rect = (e) => e.getBoundingClientRect().toJSON(); - const clipped = []; - for (const e of document - .querySelector('main') - .querySelectorAll('h1,h2,h3,p,.button,time')) { - const r = e.getBoundingClientRect(); - if (!r.width || !r.height) continue; - for ( - let a = e.parentElement; - a && a !== document.body; - a = a.parentElement - ) { - const style = getComputedStyle(a); - if (['hidden', 'clip'].includes(style.overflowY)) { - const ar = a.getBoundingClientRect(); - if (r.bottom > ar.bottom + 2 || r.top < ar.top - 2) - clipped.push({ - text: e.textContent.slice(0, 40), - rect: rect(e), - ancestor: a.className, - bounds: ar.toJSON(), - }); - } - } - } - const collisions = []; - const table = [...document.querySelectorAll('.type-row')]; - for (const e of table) { - const children = [...e.children]; - for (let i = 0; i < children.length - 1; i++) { - const range = document.createRange(); - range.selectNodeContents(children[i]); - for (const r of range.getClientRects()) - if (r.right > children[i + 1].getBoundingClientRect().left + 1) - collisions.push({ - text: children[i].textContent.trim(), - right: r.right, - next: children[i + 1].getBoundingClientRect().left, - }); - } - } - return { - width: innerWidth, - scrollWidth: document.documentElement.scrollWidth, - h1: { font: s.fontSize, line: s.lineHeight, ...rect(h) }, - hero: rect(hero), - brandParagraph: document.querySelector('#logos p') - ? { - font: getComputedStyle(document.querySelector('#logos p')) - .fontSize, - ...rect(document.querySelector('#logos p')), - } - : null, - rail: document.querySelector('.brand-sidebar') - ? rect(document.querySelector('.brand-sidebar')) - : null, - clipped, - collisions, - }; - }); - await p.screenshot({ - path: `evidence/round3/local/${route || 'home'}-${width}.png`, - fullPage: true, - }); - rows.push({ route: route || 'home', width, ...data }); - await p.close(); - } -await browser.close(); -await fs.writeFile( - 'evidence/round3/responsive.json', - JSON.stringify(rows, null, 2), -); -for (const r of rows) - if (r.clipped.length || r.collisions.length || r.scrollWidth > r.width + 1) - console.log( - r.route, - r.width, - JSON.stringify({ - clipped: r.clipped, - collisions: r.collisions, - overflow: r.scrollWidth - r.width, - }), - ); - -const expectedBrandH1 = { - 320: 30.72, - 390: 37.44, - 479: 45.984, - 480: 25.2624, - 599: 31.5254, - 600: 31.578, - 601: 31.6306, - 767: 40.3672, - 768: 40.4198, - 991: 52.1563, - 992: 38.5789, - 1440: 56.0016, -}; -for (const row of rows) { - expect( - row.scrollWidth, - `${row.route} ${row.width} document width`, - ).toBeLessThanOrEqual(row.width + 1); - expect( - row.clipped, - `${row.route} ${row.width} visible text cut off by an ancestor`, - ).toEqual([]); - // Fresh original evidence shows its fixed 40px specimen intentionally reaches - // 6.109375px into the next cell at320 (not a newly introduced collision). - // Keep every other cell strict and compare this one against the source, rather - // than shrinking the actual font to make an inaccurate table pass. - if (row.route === 'brand-guide' && row.width === 320) { - const [sample] = JSON.parse( - await fs.readFile('tests/fixtures/narrow-specimen-reference.json'), - ); - expect(row.collisions.length).toBe(1); - expect(row.collisions[0].text).toBe('Inter'); - expect( - Math.abs( - row.collisions[0].right - - row.collisions[0].next - - (sample.ink.right - sample.next.left), - ), - ).toBeLessThan(0.05); - } else { - expect( - row.collisions, - `${row.route} ${row.width} specimen collision`, - ).toEqual([]); - } - if (row.route === 'brand-guide') { - expect( - Math.abs(parseFloat(row.h1.font) - expectedBrandH1[row.width]), - ).toBeLessThan(0.02); - if (row.width < 768) expect(row.rail.width).toBe(row.width); - else expect(row.rail.width).toBeLessThan(100); - } -} -console.log(`${rows.length} full-page responsive geometry checks passed`); diff --git a/scripts/round3-motion.mjs b/scripts/round3-motion.mjs deleted file mode 100644 index 8eaad4d..0000000 --- a/scripts/round3-motion.mjs +++ /dev/null @@ -1,65 +0,0 @@ -import { chromium, expect } from '@playwright/test'; -import fs from 'node:fs/promises'; -const browser = await chromium.launch(), - base = process.env.BASE_URL || 'http://127.0.0.1:4321', - rows = []; -await fs.mkdir('evidence/round3/motion', { recursive: true }); -async function reveal(p, selector) { - await p.locator(selector).evaluate((e) => - scrollTo({ - top: scrollY + e.getBoundingClientRect().top - 200, - behavior: 'instant', - }), - ); -} -try { - for (const width of [1440, 390]) - for (const reducedMotion of ['no-preference', 'reduce']) { - const p = await browser.newPage({ - viewport: { width, height: 900 }, - reducedMotion, - }); - await p.goto(base); - await reveal(p, '.human-code'); - const terminal = p.locator('.human-code [data-loop-codes]'); - if (reducedMotion === 'no-preference') - await terminal.evaluate( - (e) => - new Promise((resolve, reject) => { - const t = setTimeout( - () => reject(Error('typing timed out')), - 20000, - ); - const o = new MutationObserver(() => { - if (e.getAttribute('data-typing') === 'complete') { - clearTimeout(t); - o.disconnect(); - resolve(true); - } - }); - o.observe(e, { attributes: true }); - }), - ); - const code = await terminal.locator('code').evaluate((e) => ({ - spans: e.querySelectorAll('span').length, - text: e.textContent, - whiteSpace: getComputedStyle(e).whiteSpace, - })); - expect(code.spans).toBeGreaterThan(2); - expect(code.text).toContain('\n'); - rows.push({ - name: 'terminal-full-transition', - width, - reducedMotion, - ...code, - }); - await p.close(); - } -} finally { - await browser.close(); - await fs.writeFile( - 'evidence/round3/motion/results.json', - JSON.stringify(rows, null, 2), - ); -} -console.log(rows.length + ' motion assertions passed'); diff --git a/scripts/round6-checks.mjs b/scripts/round6-checks.mjs deleted file mode 100644 index 0c929d1..0000000 --- a/scripts/round6-checks.mjs +++ /dev/null @@ -1,204 +0,0 @@ -import { chromium, expect } from '@playwright/test'; -import fs from 'node:fs/promises'; -await fs.mkdir('evidence/round6', { recursive: true }); -const browser = await chromium.launch(); -const base = process.env.BASE_URL || 'http://127.0.0.1:4321'; -const rows = []; -try { - const p = await browser.newPage({ reducedMotion: 'reduce' }); - for (const width of [ - 320, 390, 479, 480, 601, 767, 768, 769, 991, 992, 1440, - ]) { - await p.setViewportSize({ width, height: 1000 }); - await p.goto(base + '/'); - await p.evaluate(() => document.fonts.ready); - const home = await p.evaluate(() => { - const height = (s) => - document.querySelector(s).getBoundingClientRect().height; - return { - testimonials: height('.testimonials'), - cases: height('.use-cases'), - quotes: [...document.querySelectorAll('.quote')].map((e) => ({ - height: e.getBoundingClientRect().height, - logo: e.querySelector('.quote-logo').getBoundingClientRect().height, - author: parseFloat( - getComputedStyle(e.querySelector('figcaption')).fontSize, - ), - })), - grayscale: [...document.querySelectorAll('.quote-logo')].every( - (e) => getComputedStyle(e).filter === 'grayscale(1)', - ), - benefits: [...document.querySelectorAll('.quote-benefits li')].map( - (e) => e.textContent.trim(), - ), - overflow: document.documentElement.scrollWidth > innerWidth, - }; - }); - expect(home.quotes).toHaveLength(9); - expect(home.grayscale).toBe(true); - expect(home.benefits).toEqual([ - 'It’s easy', - 'It’s massive', - 'It solved my problem', - ]); - expect(home.overflow).toBe(false); - if (width === 390) { - expect(Math.abs(home.testimonials - 3206.15625)).toBeLessThan(0.1); - expect(Math.abs(home.cases - 2823.15625)).toBeLessThan(0.4); - expect(Math.abs(home.quotes[0].height - 265.125)).toBeLessThan(0.1); - expect(home.quotes[0].logo).toBeCloseTo(35.1, 0); - expect(home.quotes[0].author).toBeCloseTo(16.64, 2); - } - if (width === 768) { - expect(Math.abs(home.testimonials - 2145.21875)).toBeLessThan(0.1); - expect(Math.abs(home.cases - 1140.1875)).toBeLessThan(1.5); - } - if (width === 1440) { - expect(Math.abs(home.testimonials - 1826.203125)).toBeLessThan(0.25); - expect(Math.abs(home.cases - 1215.59375)).toBeLessThan(0.1); - } - await p.goto(base + '/brand-guide'); - await p.evaluate(() => document.fonts.ready); - const brand = await p.evaluate(() => { - const e = document.querySelector('.accessible-colors'); - const section = document.querySelector('#tone'); - return { - emphasis: [...e.querySelectorAll('strong')].map((s) => ({ - text: s.textContent, - weight: getComputedStyle(s).fontWeight, - })), - weight: getComputedStyle(e).fontWeight, - emphasizedFont: parseFloat( - getComputedStyle(section.querySelector('.tone-emphasis')).fontSize, - ), - bodyFont: parseFloat( - getComputedStyle(section.querySelector('p')).fontSize, - ), - breaks: section.querySelectorAll('br').length, - toneHeight: section.getBoundingClientRect().height, - iconSizes: [...document.querySelectorAll('.brand-sidebar svg')].map( - (e) => e.getBoundingClientRect().width, - ), - railTrack: getComputedStyle(document.querySelector('.brand-body')) - .backgroundImage, - background: getComputedStyle(document.querySelector('#logos')) - .backgroundSize, - }; - }); - expect(brand.emphasis).toHaveLength(3); - expect(brand.weight).toBe('400'); - expect( - brand.emphasis.every( - (e) => e.weight === '600' && /^#[0-9A-F]{6}$/.test(e.text), - ), - ).toBe(true); - // Original trailing
nodes do not create content; preserve the six internal example breaks. - expect(brand.breaks).toBe(6); - expect(brand.emphasizedFont / brand.bodyFont).toBeCloseTo(1.125, 2); - expect(brand.iconSizes).toHaveLength(3); - expect(brand.iconSizes.every((n) => n > 10 && n < 40)).toBe(true); - if (width === 390) - expect(Math.abs(brand.toneHeight - 1938.671875)).toBeLessThan(1); - if (width >= 768) { - expect(brand.background).toBe(`${width}px auto`); - expect(brand.railTrack).toContain('linear-gradient'); - expect(brand.railTrack).toContain('rgb(239, 21, 97)'); - } else expect(brand.railTrack).toBe('none'); - for (const color of ['#1F5AFF', '#FFC11E', '#FC6E6B']) { - await p.locator(`[data-color="${color}"]`).click(); - const dynamic = await p.locator('.accessible-colors').evaluate((e) => ({ - strong: e.querySelectorAll('strong').length, - text: e.textContent, - html: e.querySelectorAll('script,img,iframe').length, - })); - expect(dynamic.strong).toBeGreaterThan(0); - expect(dynamic.html).toBe(0); - expect(dynamic.text).toMatch(/\(AAA?\)/); - } - const foot = await p.locator('footer').evaluate((e) => { - const r = e.getBoundingClientRect(); - return Object.fromEntries( - ['.copyright', '.socials', '.footer-nav h2'].map((s) => { - let z = e.querySelector(s).getBoundingClientRect(); - return [ - s, - { x: z.x, y: z.y - r.y, width: z.width, height: z.height }, - ]; - }), - ); - }); - if (width === 390) { - expect(Math.abs(foot['.copyright'].y - 991.09375)).toBeLessThan(0.1); - expect(foot['.copyright'].width).toBe(281.75); - } - if (width === 768) { - expect(Math.abs(foot['.footer-nav h2'].y - 179.8125)).toBeLessThan(0.1); - expect(Math.abs(foot['.socials'].y - 449.3125)).toBeLessThan(0.3); - expect(Math.abs(foot['.copyright'].y - 551.3125)).toBeLessThan(0.3); - } - await p.goto(base + '/press-mentions'); - await p.evaluate(() => document.fonts.ready); - if (width === 390) { - const press = await p.locator('.press-section').evaluate((e) => ({ - height: e.getBoundingClientRect().height, - times: [...e.querySelectorAll('time')].map( - (t) => getComputedStyle(t).display, - ), - lastMargin: getComputedStyle(e.querySelector('.press-card:last-child')) - .marginBottom, - })); - expect(press.times).toHaveLength(9); - expect(press.times.every((x) => x === 'block')).toBe(true); - expect(press.lastMargin).toBe('19.5px'); - } - rows.push({ width, home, brand, foot }); - } - for (const [route, selector, name] of [ - ['/', '.performance', 'vector-grid'], - ['/', '.use-cases', 'vector-grid-white-bg'], - ['/powered-by', '.sponsors', 'vector-grid-white-bg'], - ['/powered-by', '.metrics', 'vector-grid'], - ['/brand-guide', '.palette-section', 'vector-grid'], - ['/get-started', '.learn-section', 'vector-grid'], - ['/get-started', '.explore-section', 'vector-grid-white-bg'], - ]) { - await p.setViewportSize({ width: 1440, height: 1000 }); - await p.goto(base + route); - expect( - await p - .locator(selector) - .evaluate((e) => getComputedStyle(e).backgroundImage), - ).toContain(`/assets/${name}.svg`); - } - await p.goto(base + '/get-started'); - expect( - await p - .locator('.get-started-intro') - .evaluate((e) => getComputedStyle(e).backgroundImage), - ).toContain('vector-grid.svg'); - expect( - await p - .locator('.install-section') - .evaluate((e) => getComputedStyle(e).backgroundImage), - ).toBe('none'); - expect( - await p - .locator('.deeper') - .evaluate((e) => getComputedStyle(e).backgroundImage), - ).toContain('grid-half-get-st.svg'); - await p.goto(base + '/'); - expect( - await p - .locator('.laptop-note') - .evaluate((e) => getComputedStyle(e).backgroundImage), - ).toContain('grid-half-home.svg'); - console.log( - `${rows.length} round6 responsive component groups plus 11 grid-role/continuity assertions passed`, - ); -} finally { - await browser.close(); - await fs.writeFile( - 'evidence/round6/checks.json', - JSON.stringify(rows, null, 2) + '\n', - ); -} diff --git a/scripts/static-checks.mjs b/scripts/static-checks.mjs deleted file mode 100644 index 56ca63b..0000000 --- a/scripts/static-checks.mjs +++ /dev/null @@ -1,66 +0,0 @@ -import assert from 'node:assert/strict'; -import { readFile, readdir } from 'node:fs/promises'; -import { createHash } from 'node:crypto'; - -const manifest = JSON.parse( - await readFile('tests/fixtures/provenance.json', 'utf8'), -); -const hash = (data) => createHash('sha256').update(data).digest('hex'); -let unchanged = 0; -for (const [file, expected] of Object.entries(manifest.imported)) { - if (manifest.intentionalChanges.includes(file)) continue; - assert.equal( - hash(await readFile(file)), - expected, - `approved source identity: ${file}`, - ); - unchanged++; -} -for (const [file, expected] of Object.entries(manifest.legacy)) { - assert.equal(hash(await readFile('public/' + file)), expected, file); - assert.equal( - hash(await readFile('dist/' + file)), - expected, - 'built legacy ' + file, - ); -} -const origin = 'https://dask.org'; -for (const slug of [ - '', - 'get-started', - 'get-help', - 'powered-by', - 'brand-guide', - 'press-mentions', -]) { - const html = await readFile( - `dist/${slug ? slug + '/' : ''}index.html`, - 'utf8', - ); - assert.ok( - html.includes( - `rel="canonical" href="${new URL('/' + (slug ? slug + '/' : ''), origin).href}"`, - ), - 'canonical ' + slug, - ); - assert.ok(html.includes('Hosted by GitHub Pages'), 'hosting credit ' + slug); - assert.ok( - !/webflow\.js|jquery|cdn\.prod\.website-files/i.test(html), - 'native runtime ' + slug, - ); -} -assert.ok( - !(await readdir('dist')).includes('CNAME'), - 'no premature custom domain', -); -const mappings = JSON.parse(await readFile('src/data/redirects.json', 'utf8')); -assert.equal(mappings.length, 5); -assert.ok( - mappings.every( - (m) => - m.destination === 'https://blog.dask.org/' && m.status === 'resolved', - ), -); -console.log( - `${unchanged} unchanged source/asset identities, 3 legacy documents, 6 root canonicals/credits, native runtime, domain and redirect integrity passed.`, -); diff --git a/scripts/test.mjs b/scripts/test.mjs deleted file mode 100644 index 2736df3..0000000 --- a/scripts/test.mjs +++ /dev/null @@ -1,331 +0,0 @@ -import { chromium, expect } from '@playwright/test'; -import { spawn, execFile } from 'node:child_process'; -import { promisify } from 'node:util'; -import fs from 'node:fs/promises'; -const base = process.env.BASE_URL || 'http://127.0.0.1:4322'; -let server; -if (!process.env.BASE_URL) { - server = spawn( - process.execPath, - [ - 'node_modules/astro/bin/astro.mjs', - 'preview', - '--host', - '127.0.0.1', - '--port', - '4322', - ], - { stdio: 'pipe' }, - ); - let ready = false; - for (let i = 0; i < 100; i++) { - try { - const r = await fetch(base); - if (r.ok) { - ready = true; - break; - } - } catch {} - await new Promise((r) => setTimeout(r, 100)); - } - if (!ready) { - server.kill(); - throw Error('Preview did not start; run npm run build first.'); - } -} -const browser = await chromium.launch(); -const results = []; -let passed = 0; -const errors = []; -await fs.mkdir('evidence/tests', { recursive: true }); -async function check(name, fn) { - try { - await fn(); - results.push({ name, status: 'passed' }); - passed++; - console.log('PASS', name); - } catch (error) { - results.push({ name, status: 'failed', error: String(error) }); - errors.push(name); - console.error('FAIL', name, String(error)); - } -} -try { - for (const width of [1440, 768, 390]) - for (const slug of [ - '', - 'get-started', - 'get-help', - 'powered-by', - 'brand-guide', - 'press-mentions', - ]) { - const page = await browser.newPage({ - viewport: { width, height: 900 }, - reducedMotion: 'reduce', - }); - page.setDefaultTimeout(10000); - const pageErrors = []; - const external = []; - page.on('pageerror', (e) => pageErrors.push(String(e))); - page.on('request', (r) => { - if (!r.url().startsWith(base)) external.push(r.url()); - }); - await page.goto(base + '/' + slug, { waitUntil: 'networkidle' }); - await page.evaluate(() => document.fonts.ready); - await check( - `${slug || 'home'} ${width}: semantic page, local assets, no JS errors`, - async () => { - await expect(page.locator('main')).toBeVisible(); - await expect(page.locator('h1').first()).toBeVisible(); - expect(pageErrors).toEqual([]); - expect(external).toEqual([]); - expect( - await page - .locator('img') - .evaluateAll((images) => - images - .filter((i) => !i.complete || !i.naturalWidth) - .map((i) => i.src), - ), - ).toEqual([]); - }, - ); - await check( - `${slug || 'home'} ${width}: no horizontal overflow`, - async () => { - expect( - await page.evaluate( - () => document.documentElement.scrollWidth <= innerWidth + 1, - ), - ).toBe(true); - }, - ); - await check(`${slug || 'home'} ${width}: navigation`, async () => { - if (width < 992) { - const toggle = page.locator('.menu-toggle'); - await toggle.click(); - await expect(toggle).toHaveAttribute('aria-expanded', 'true'); - await expect( - page - .getByRole('navigation', { name: 'Main navigation' }) - .getByRole('link', { name: 'Get Help', exact: true }), - ).toBeVisible(); - await page.screenshot({ - path: `evidence/tests/${slug || 'home'}-${width}-nav.png`, - }); - await page.keyboard.press('Escape'); - await expect(toggle).toHaveAttribute('aria-expanded', 'false'); - } else { - const toggle = page.getByRole('button', { - name: 'Community', - exact: true, - }); - await toggle.click(); - await expect(page.locator('#community-links')).toBeVisible(); - await page.keyboard.press('Escape'); - await expect(toggle).toHaveAttribute('aria-expanded', 'false'); - } - }); - await check( - `${slug || 'home'} ${width}: shared hosting credit`, - async () => { - const copyright = page.locator('.copyright > span'); - const credit = page.getByRole('link', { - name: 'Hosted by GitHub Pages', - exact: true, - }); - await credit.scrollIntoViewIfNeeded(); - await expect(credit).toBeVisible(); - await expect(copyright).toHaveText( - `Copyright © ${new Date().getFullYear()} Dask core developers. New-BSD Licensed`, - ); - await expect(credit).toHaveAttribute( - 'href', - 'https://github.com/dask/dask.github.io', - ); - expect( - await copyright.evaluate((el) => - el.nextElementSibling?.classList.contains('hosting-credit'), - ), - ).toBe(true); - const a = await copyright.boundingBox(), - b = await credit.boundingBox(); - expect(b.y).toBeGreaterThanOrEqual(a.y + a.height - 1); - expect(b.y - a.y - a.height).toBeLessThan(2); - expect( - await credit.evaluate((el) => { - const r = el.getBoundingClientRect(); - const hit = document.elementFromPoint( - r.x + r.width / 2, - r.y + r.height / 2, - ); - return hit === el || el.contains(hit); - }), - ).toBe(true); - }, - ); - await page.close(); - } - const page = await browser.newPage({ - viewport: { width: 1440, height: 1000 }, - }); - page.setDefaultTimeout(10000); - for (const slug of ['', 'get-started']) { - await page.goto(base + '/' + slug); - await check(`${slug || 'home'}: all native tabs + keyboard`, async () => { - for (const group of await page.locator('[data-tabs]').all()) { - const tabs = group.locator(':scope > [role=tablist] > [role=tab]'); - for (let i = 0; i < (await tabs.count()); i++) { - const tab = tabs.nth(i); - await tab.click(); - await expect(tab).toHaveAttribute('aria-selected', 'true'); - const id = await tab.getAttribute('aria-controls'); - await expect(page.locator('#' + id)).toBeVisible(); - } - await tabs.last().focus(); - await page.keyboard.press('Home'); - await expect(tabs.first()).toHaveAttribute('aria-selected', 'true'); - await page.keyboard.press('ArrowRight'); - await expect(tabs.nth(1)).toHaveAttribute('aria-selected', 'true'); - } - }); - } - await page.goto(base + '/brand-guide'); - await check( - 'brand: four logo variants and twelve palette choices', - async () => { - for (const tab of await page.locator('[data-logo-color]').all()) { - await tab.click(); - await expect(tab).toHaveAttribute('aria-selected', 'true'); - await expect - .poll(() => - page - .locator('.logo-showcase img') - .evaluateAll((imgs) => - imgs.every((i) => i.complete && i.naturalWidth > 0), - ), - ) - .toBe(true); - } - for (const button of await page.locator('[data-color]').all()) { - await button.click(); - await expect(page.locator('.color-hex')).toHaveText( - await button.getAttribute('data-color'), - ); - await expect(button).toHaveAttribute('aria-pressed', 'true'); - } - await page - .context() - .grantPermissions(['clipboard-read', 'clipboard-write']); - await page.getByRole('button', { name: 'Copy Hex Code' }).click(); - await expect(page.getByRole('button', { name: 'Copied!' })).toBeVisible(); - expect(await page.evaluate(() => navigator.clipboard.readText())).toBe( - '#080815', - ); - }, - ); - await page.goto(base + '/press-mentions'); - await check( - 'submission: dialog, all form types, native focus, no network mutation', - async () => { - let mutations = []; - page.on('request', (r) => { - if (!['GET', 'HEAD'].includes(r.method())) mutations.push(r.url()); - }); - await page.getByRole('button', { name: 'Add a press mention' }).click(); - await expect(page.getByRole('dialog')).toBeVisible(); - for (const type of ['event', 'newsletter', 'press']) { - await page.locator(`[data-form=${type}]`).click(); - await expect(page.locator(`.${type}-fields`)).toBeVisible(); - } - await page - .getByPlaceholder('First Name', { exact: true }) - .fill('Preview'); - await page.getByPlaceholder('Last Name', { exact: true }).fill('Test'); - await page - .getByPlaceholder('Email Address', { exact: true }) - .fill('preview@example.invalid'); - await page - .getByPlaceholder('URL of News Post', { exact: true }) - .fill('https://example.invalid/test'); - await page.getByRole('button', { name: 'Submit', exact: true }).click(); - await expect(page.locator('.form-status')).toHaveText( - 'Not sent: this local preview has no submission backend.', - ); - expect(mutations).toEqual([]); - await page.screenshot({ path: 'evidence/tests/press-dialog.png' }); - await page.keyboard.press('Escape'); - await expect(page.getByRole('dialog')).not.toBeVisible(); - }, - ); - await page.goto(base + '/'); - await check( - 'native counter: static representative frame in reduced motion', - async () => { - await expect(page.locator('#rows-value')).toHaveText( - '1 0 0 0 0 0 0 0 0 0 0 0', - ); - await expect(page.locator('#cost-value')).toHaveText('1.07'); - expect(await page.locator('input[type=range]').count()).toBe(0); - }, - ); - await check( - 'excluded redirects use the authorized exact blog homepage', - async () => { - const mappings = JSON.parse( - await fs.readFile('src/data/redirects.json', 'utf8'), - ); - expect(mappings.length).toBeGreaterThan(0); - expect( - mappings.every( - (m) => - m.status === 'resolved' && - m.destination === 'https://blog.dask.org/', - ), - ).toBe(true); - }, - ); - await page.close(); - await check( - 'independent-review regression suite (see evidence/round2/checks.json)', - async () => { - const { stdout } = await promisify(execFile)( - process.execPath, - ['scripts/round2-checks.mjs'], - { - env: { ...process.env, BASE_URL: base }, - maxBuffer: 1024 * 1024, - }, - ); - console.log(stdout.trim()); - }, - ); - for (const script of [ - 'round3-checks.mjs', - 'round3-motion.mjs', - 'round3-art-bounds.mjs', - 'round6-checks.mjs', - ]) { - await check(`${script}: production-preview regression`, async () => { - const { stdout } = await promisify(execFile)( - process.execPath, - ['scripts/' + script], - { - env: { ...process.env, BASE_URL: base }, - maxBuffer: 1024 * 1024, - }, - ); - console.log(stdout.trim()); - }); - } -} finally { - await browser.close(); - server?.kill(); - await fs.writeFile( - 'evidence/tests/results.json', - JSON.stringify({ passed, failed: errors.length, results }, null, 2) + '\n', - ); -} -console.log(`${passed} passed; ${errors.length} failed`); -if (errors.length) process.exitCode = 1; diff --git a/tests/brand-guide.spec.mjs b/tests/brand-guide.spec.mjs new file mode 100644 index 0000000..fd11871 --- /dev/null +++ b/tests/brand-guide.spec.mjs @@ -0,0 +1,109 @@ +import { expect, expectLoadedImages, test } from './support/site.mjs'; + +for (const width of [390, 1440]) { + test.describe(`Brand guide rail at ${width}px`, () => { + test.use({ viewport: { width, height: 900 } }); + + test('navigates to sections and follows the reading position in both directions', async ({ + page, + }) => { + await page.goto('./brand-guide'); + const rail = page.getByRole('navigation', { name: 'Brand sections' }); + const sections = ['logos', 'colors', 'typography', 'tone']; + + for (const section of sections) { + const link = rail.locator(`a[href="#${section}"]`); + await expect(link).toBeInViewport(); + await link.press('Enter'); + await expect(page).toHaveURL(new RegExp(`#${section}$`)); + await expect(page.locator(`#${section} h2`)).toBeInViewport(); + await expect(link).toHaveAttribute('aria-current', 'location'); + } + + // Scroll independently of the URL hash, up and then back down. + for (const section of [ + 'typography', + 'colors', + 'logos', + 'colors', + 'tone', + ]) { + await page.locator('#' + section).evaluate((el) => { + const box = el.getBoundingClientRect(); + scrollTo( + 0, + scrollY + + box.top + + Math.min(box.height, innerHeight) / 2 - + innerHeight / 2, + ); + }); + const current = rail.locator('[aria-current="location"]'); + await expect(current).toHaveAttribute('href', '#' + section); + await expect(current).toBeInViewport(); + } + await page.getByRole('contentinfo').scrollIntoViewIfNeeded(); + await expect(rail.locator('[aria-current]')).toHaveCount(0); + }); + }); +} + +test('logo variants can be selected by pointer and keyboard and load live artwork', async ({ + page, +}) => { + await page.goto('./brand-guide'); + const tabs = page.locator('[data-logo-color]'); + const images = page.locator('.logo-showcase img'); + expect(await tabs.count()).toBeGreaterThan(1); + + async function expectVariant(tab) { + await expect(tab).toHaveAttribute('aria-selected', 'true'); + await expect( + page.locator('[data-logo-color][aria-selected=true]'), + ).toHaveCount(1); + const variant = await tab.getAttribute('data-variant'); + for (const image of await images.all()) { + const source = await image.getAttribute('data-' + variant); + expect(source).toBeTruthy(); + await expect(image).toHaveAttribute('src', source); + } + await expectLoadedImages(images); + } + + for (const tab of await tabs.all()) { + await tab.click(); + await expectVariant(tab); + } + await page.keyboard.press('ArrowRight'); + await expect(tabs.first()).toBeFocused(); + await expectVariant(tabs.first()); +}); + +test('palette selection updates contrast choices and copies the selected hex value', async ({ + page, + context, +}) => { + await page.goto('./brand-guide'); + await context.grantPermissions(['clipboard-read', 'clipboard-write']); + const colors = page.locator('[data-color]'); + expect(await colors.count()).toBeGreaterThan(1); + const contrast = page.locator('.accessible-colors'); + const contrasts = new Set(); + for (const color of await colors.all()) { + await color.click(); + const hex = await color.getAttribute('data-color'); + await expect(page.locator('.color-hex')).toHaveText(hex); + await expect(color).toHaveAttribute('aria-pressed', 'true'); + await expect(page.locator('[data-color][aria-pressed=true]')).toHaveCount( + 1, + ); + await expect(contrast).toContainText(/\bAA(?:18)?\b/); + contrasts.add(await contrast.textContent()); + } + expect(contrasts.size).toBeGreaterThan(1); + const hex = await colors.last().getAttribute('data-color'); + await page.getByRole('button', { name: /copy hex/i }).press('Enter'); + await expect + .poll(() => page.evaluate(() => navigator.clipboard.readText())) + .toBe(hex); +}); diff --git a/tests/fixtures/narrow-specimen-reference.json b/tests/fixtures/narrow-specimen-reference.json deleted file mode 100644 index b27b425..0000000 --- a/tests/fixtures/narrow-specimen-reference.json +++ /dev/null @@ -1,52 +0,0 @@ -[ - { - "width": 320, - "sampleFont": "40px", - "ink": { - "x": 34.65625, - "y": 2782, - "width": 92, - "height": 49, - "top": 2782, - "right": 126.65625, - "bottom": 2831, - "left": 34.65625 - }, - "next": { - "x": 120.546875, - "y": 2792.5625, - "width": 85.890625, - "height": 21.109375, - "top": 2792.5625, - "right": 206.4375, - "bottom": 2813.671875, - "left": 120.546875 - }, - "html": "

Inter

" - }, - { - "width": 360, - "sampleFont": "40px", - "ink": { - "x": 39.015625, - "y": 3098.515625, - "width": 92, - "height": 49, - "top": 3098.515625, - "right": 131.015625, - "bottom": 3147.515625, - "left": 39.015625 - }, - "next": { - "x": 135.625, - "y": 3107, - "width": 96.609375, - "height": 23.765625, - "top": 3107, - "right": 232.234375, - "bottom": 3130.765625, - "left": 135.625 - }, - "html": "

Inter

" - } -] \ No newline at end of file diff --git a/tests/fixtures/provenance.json b/tests/fixtures/provenance.json deleted file mode 100644 index e6e2f44..0000000 --- a/tests/fixtures/provenance.json +++ /dev/null @@ -1,233 +0,0 @@ -{ - "sourceRepository": "dask/dask.org", - "sourceCommit": "b611c2c63cbc11b78805f052ad723d3dbe922d41", - "targetBase": "2e54caa3b0a9660b4a97711117816d134a7daffa", - "imported": { - "public/assets/1586914303741.jpeg": "daf7990ab193293a99aa58c8c58b6ffcb5acd14dad476a34262f794ed4ac0fc1", - "public/assets/Amazon_Web_Services_Logo.svg": "f84939f196140a8d4fc51327a565846c823923068818ba7b87ca6788fbb91187", - "public/assets/Apache-arrow-logo.svg": "8014f2413a11a5a84eebc9e73011570c300a5e38721a6b9271e889995dbf2390", - "public/assets/Capital_One-logo.svg": "c8b6880bf087c15ba959262c3656a6f547c8a45215df4e7e0fa21566ee7a120c", - "public/assets/Dask-Logo-Icon-Primary.svg": "c0e001f44db300a141d9f8f25e84da81c92e5149c42462b721ea6ae66941c547", - "public/assets/Dask-Logo-Icon-White.svg": "6da9a98f057c3fb11fc4977154483fa86fcafa96972123be59afa25bf7a13028", - "public/assets/Dask-Logo-Icon-on-Pink.svg": "f8628e8064a4fa1b8f72a7cf96de2f5432eba924b20e84babad4825dccfa73ac", - "public/assets/Dask-Logo-Lockup-on-Pink.svg": "e20a7647a7d2c0425909ff0eb9e2133e4d5101a61f6dbbfa0ce77001e4ecfae5", - "public/assets/Dask-Logo-Lockup-on-blue.svg": "6b6c8b8b06b7309bbb1713e557f7cbf446f7acb187f55beb6d931a4a5fb92223", - "public/assets/Dask-Logo-Lockup-white.svg": "c0624d539f30e7bde007eb353042f0197f925d6f88518633d92784fa95d7dfbd", - "public/assets/Dask-Logo-lockup-Primary.svg": "a3c6e9e74ad2042102bed0d7b28ed8acc8ce540715a5e94ef7d990d412b7d6ba", - "public/assets/Dask-Logo-lockup-primary.png": "d9a1f272851da9113cce22afb54bd33b65717aa40a83dae4e0646e78f2e65e4b", - "public/assets/Fanatics-logo.svg": "3afbf32458da92cf328ac6fe1260ee283603edd2d30250aef7106b9ac404b06f", - "public/assets/Google_Cloud_logo.svg": "8ce139ca68e21e51e1aa57c083d1ea8bbbb7244a495edb2c96d5c6fd63a9893e", - "public/assets/GrubHub-logo.svg": "d497d63fa143521832db785c748bbb7e21ff81e0c186e273dad3e7f5b5a64f25", - "public/assets/Hugues-Demers.webp": "f2150e381f61c003a3bd5b0e6508126bea74f12a0634d1c6db36fc1af6e3aaa9", - "public/assets/Inconsolata-Regular.ttf": "04bce5eef6ecc84bd9d14bc99143dfdb1949177db54dbd52252c7b6284c2f9d9", - "public/assets/Inter-Bold.ttf": "2ad83f2446566c5ecf7c261cc07884a5d5f71965b5df8fd7bb809f83a42bf470", - "public/assets/Inter-Light.ttf": "26a78cc74894d647a10fa27b92dd849109322cc60e18da46e3968ee128920caa", - "public/assets/Inter-Medium.ttf": "a0b1f949528f7a3a2d2ff3b6df67c6c1b5cb8f62a2eba6eb5e06adff2d5795f3", - "public/assets/Inter-Regular.ttf": "494a9c8817786531126dd245c93f8a85aa6afa405c7b8a2e45b667538470ce7a", - "public/assets/Inter-SemiBold.ttf": "f036a45770ce2ad43dfee7f4eac8f8b3784608a24ff00c63dd56704434e014e8", - "public/assets/Jacqueline-Nolis.webp": "78278f356c39eb80572b233c7697bfb196dec21a4b0710c951c5438fa778ceb8", - "public/assets/John-Renken.webp": "88829b4ee2aa5facba3400cd26516917b4cbca89eed08bf9f8a8359d2b98375c", - "public/assets/Kubernetes_logo.svg": "625ee4a4c85bb42f31f8043e0cf1b5d4e7840f0227d9efb09fd06f79770c07d1", - "public/assets/Meenakshi-Sharma.webp": "fc3815b8c6ab62804be551d8899acdccd26709a59dbb211b8a06802141ac1ad0", - "public/assets/Microsoft_Azure_Logo.svg": "7cd03e4a1bee2b985ba1517f6e5a092cf3b988005370d572647d2d3de31981c8", - "public/assets/NumPy-logo.svg": "b8f96481ddac6cd19b1b40bacb86444f4b885a0496f486ad52a7e88332d27903", - "public/assets/Paige-Martin.webp": "9650502082cdf21fa499c26a39393dfe773211a0a18d093718df405af4c29d10", - "public/assets/Pandas-logo.webp": "f7ae099df0b9c2db79100fe184c3e8c8a97992974d510be6c5222c6f87a35b82", - "public/assets/Pandas_logo-color.svg": "5a2dbb218525973760e4c25ba016d7ea0649ad77ed3235ed7e31569b20c6e5d3", - "public/assets/Pandas_logo-gray.svg": "dec76ba8f680b191f3d9fb1d066395e7048d421981f45f0ded316b4312d90dc4", - "public/assets/Parquet_logo.svg": "ce6e3bee77878567b5522c145003cddb5799186bc2ab4e8e858d8536874198e3", - "public/assets/PyTorch_logo_black-1.svg": "c302db3c06bfe1104a2243551ba484aea02fb706cb1cd47f9d35baf44d1128ed", - "public/assets/Quansight-01-01.svg": "4c1bf6a32a0432af0cd45df2190334b6b627fac297d7b8a114725873166fb4ae", - "public/assets/Ryan-Abernathy.webp": "600d343def8bc8fa0641e2ffa6ed4584b6c46a94a395f92d5f8b3b875379165a", - "public/assets/Ryan-McEntee.webp": "a74bd05bb607b3e7ca466b45f68216e485cbed1d9aa70697257f35607f584469", - "public/assets/Slurm_logo.svg": "8b58d8db385a325c8d0fc96758e55d2cff06427c9ede757a8736abd5812849af", - "public/assets/TPC-logo.webp": "6b377a2b72cd4b6c31c23bd15a1c6d73d98501142c91e9b84c27c56fee4dbae7", - "public/assets/Waters-technology-logo.png": "39001c84f116d5f0f73ac1c3c11d5ad8aa32f4ed1a6dd447bed3b13ea5cf0da9", - "public/assets/Wayfair-logo.svg": "463cfc97be94b23a295b26529cd628c6812c0dc4af7a4be543c4d21bb4203d0d", - "public/assets/Wes-McKinney.webp": "acf9ca6df148fc9e31e106cb6f95730caaafef6e49d478232382be192d075098", - "public/assets/Xarray-Logo.svg": "4a930ac8bbf038008a1bba1d3ae82983181f7bea83cf48e6473b8d033d3d2119", - "public/assets/Xarray-Spatial.png": "184e43a8c512ecb0d9ae4df4880760d1fa803ff15d0430e4f4dbb7821a24e5b3", - "public/assets/Xarray-logo.webp": "e6ff38ef2bbb4a70c4830f69dec23f7b0c8a23d9a92039634fe1e1f37fb5cd05", - "public/assets/Yarn-logo-kitten.svg": "cee3c6569bc23ee73c9f5392910003c9aa5fcb64c8a48c51258d8b59b9ac7d6b", - "public/assets/anaconda.png": "f7d46f0018d5310e9fd4918fd50bc716a1e27cdaa88e302a88d2f0b9caf4ff37", - "public/assets/arm-logo.svg": "6a834deb3c6ed16162a22edb0cb291605ce9fd0f4ffe972ebbcb1827096dc0c7", - "public/assets/barclays.png": "25c9c0507b2f8cc8f0293f849d35a3b48b83aa698543390921b9e400f77a95f3", - "public/assets/business-wire-vector-logo.png": "2815892f770d18528c2a18efe17ae931abe79b1138dbe53d0349b5dfd58e87e3", - "public/assets/capital-one.png": "cfbe9a01e8e1ee0668db0fa24e16056d7d426d0853bd977307d1e72b5430b564", - "public/assets/cesium.png": "49f57454aa589af2ed6e50a1f59eaf8e0a509f4d0510774319267c25782ddcdf", - "public/assets/chan-zuckerberg-initiative.png": "f71eda4a157891114035408cf5b385ba68d9b1e535aee062dff9cbae389284c5", - "public/assets/chat.svg": "9868710ba6f65b5a995f6fb2bd8ec841c240f1facd85d00dddba0a4b8f9015da", - "public/assets/citi-bank.png": "c6277c0169b15be42832ba9be926ea5496129aca9e2f0ba694967f12ae5b69a5", - "public/assets/coiled-black-logo.png": "31a6d74e72947d0b00fb44ee5872a365fec618e7b0a6c5e6637bf90e90f7fc4b", - "public/assets/contra-force.png": "b554cc518114b790a6dff315a7429d75c7d378641828b30b9be0a947e51ad588", - "public/assets/dask-chart-2.svg": "1a6d2a442f1c2a6588a4ef9dc0521585ac7027a53ce83635dcc392b2589ffd82", - "public/assets/dask-header-logo.svg": "c6691d65b86991e93322ec80ad2e2f80ccc4db43dcfa4db795c3f5f705ef2655", - "public/assets/dask-powered-by.svg": "2d4b7534b49f69ae56b5d7bd9adbfab3bee25189fb59ecba88d1e353c55d3c51", - "public/assets/datanami-logo-2018.png": "deaa12ea81ab5342de8abf1a48a2935e2f26afdd972cab421e8ed3864256c1f9", - "public/assets/dataprep.png": "012279b2b40e9457994de8327deabbf874b7d2fa0670bf1d7c7a16359cca79fe", - "public/assets/datashader.png": "bed3830469aa2feceee14198bbf5790b2e3f67588222440c911aedc7344ea32d", - "public/assets/defense-department.webp": "bc7d8031cf5386448e15922d666b5917ce78e8cb71024bd9271529de42f648f2", - "public/assets/deshaw-co.png": "50c58f3e7902eb023048efe1bd7f3e4d43be5b995adcee298fcdcd84b2b67f2d", - "public/assets/download.png": "62bacc97823ea0205e545b64a0b7bb495a1bbc352cad3f40da0ae91f2e9c1e62", - "public/assets/earthmover-logo.svg": "71e9309e9a9aee04d6b0bb6b184abd278d2deac8f84c05e7da6074397d54cf24", - "public/assets/featuretools.png": "acd0a3eaf0877da6d160724d6da59407116a9c3bab200f1f5c8aa0b2466a1dc1", - "public/assets/git-hub.svg": "04c60cb8fd89f60f4494e4986fcb77b021bc17be30f215fe81e03d852cdd6a77", - "public/assets/grid-half-get-st.svg": "7f238ab3aa36f372966b4c676125cfa982b2de5b2734903ef8700c54d5b201ec", - "public/assets/grid-half-home.svg": "5120c6d3962b45534ac321d44e3a4cb963a069fb6ec009acea2a2869f10713bd", - "public/assets/grubhub.png": "d6add75e4dbde7f62426315c79f57b995b354296b329d7b166aa97823bc50ba7", - "public/assets/illustration-brand-guide-hero.svg": "5aadffaecad95f3e0701d6f1d0224f9f23da71790ed35ea5e5a2dee87a7df318", - "public/assets/illustration-get-started-bottom.svg": "f6abd8bb41731578c8f92ea977685ab14596633baf871e560e45d09274e16dad", - "public/assets/illustration-get-started-middle.svg": "23e89b18339afb8ab64d4b4023e8123c26996a87ef53a791449c673051312666", - "public/assets/illustration-get-started-top.svg": "184d386710c53566050560322eabd0847e3a9b22dbefbdb2a9102fe6b077801b", - "public/assets/illustration-home-stay-connected.svg": "c085038de5e66c8b56416fb8465ae2c651fdadd89a8d857718749f83a4e67101", - "public/assets/infoworld-white-logo.svg": "53962a503835461f384810f569aaced2797d17e2f090783681ce77ff1cba54ab", - "public/assets/intake.png": "47f61bbb3230bc48bf539b3462e71e205301d9aea7fd73299c39e5662ff9a745", - "public/assets/iris.png": "e4cbca45d2e99b2b986928fd639bc8b372f32f644a3278995ab9caba751a80ad", - "public/assets/kartothek.png": "45c241ee0d8fe24eeea53ed74447aad870f0403eb3fa703b62ee1d9537326d06", - "public/assets/landsat-satellite-image-climate-change-GettyImages-1354422915.jpg": "fb0b6f0fa25d7b5dcfde2862ad2b6e721fac297c21f968ef79dce2f23cceadf1", - "public/assets/light-gbm.png": "c7ce37b817992244b9f6e19bd77e2a9c02569103c2520862d8115de966bd9cda", - "public/assets/lsf-logo-svg-vector-2.svg": "ab5543330801843c85225fafd2ab0763c89a656aa1701e3b5bb196568c313f63", - "public/assets/microsoft.png": "ba346f909c64855c5c124089f37e499d192d5717d0436636e0a3d638305c5717", - "public/assets/mit.png": "344e19e7651f16cf04909bd65052dac2da5387edcf938ede4f065ea54c9ed787", - "public/assets/mo-analysis.png": "4dbc76707142383be372cab66fc43556a05645332aebc9ed48b041b7d802abb1", - "public/assets/mobile-blog.svg": "d4c1cb0dcbf1f4635beb70f7c13ab832adf3b305a4878b3e902f39d59735936f", - "public/assets/mobile-community.svg": "9d9222fd18e095e489003f7295d8edf674c7b489a4370e166049d1f83e7d0c56", - "public/assets/mobile-get-started.svg": "a9eb3d6aee6c20ef111ffed20e3f2769e67ada2fed9c87bd1e0e17f20516e1ed", - "public/assets/napari.png": "254b81acb073bd5b2c8d201ad033a8187dd2d886038ad8aa5b86c1d2167ab6ba", - "public/assets/nasa-logo.webp": "b54277cb979f84ab2a3a4c013d826bfd8cb5227fb3456997aa6ae23fabd00959", - "public/assets/nasa.png": "fb818394e585c2e54eb2e89401640dd9e2a1dc2bfebcb3f33ada23992760e431", - "public/assets/nih.png": "9462b91381c10bc65d9a431023371e62a3978a89bfb524ebf66f7c8c6ff15607", - "public/assets/novartis.png": "e46c61825a217947710632e7c1b255d6157d4db24112f0a5c80bc0ddc9b17f8f", - "public/assets/numpy.png": "e867d1ac3130374de25a2502ff6f522fd1fca45685f49967f8382e72d9e17fc2", - "public/assets/nvidia.png": "e1b584e64ea259e78049a39ffbefe4c7cd168ac2d9ebaaa457c2e68b5821eb74", - "public/assets/oak-ridge.png": "37723b42e2b73fe8dadf0ab6b7c263f2b9611ff67f5fb851344a782157f88b0d", - "public/assets/openPBS-logo.svg": "e519d6fd4a4b28f0ef3b9b4b9b790e0b6dc6d7638f82e1e5c5ba8806f05f1040", - "public/assets/optuna-logo.svg": "85fadf89a5023a895a1692ff64420ebcc69350aae3af8aff74238446a6f9033e", - "public/assets/pandas.png": "d8c698acba8cf74715c1957173f4321523a1c6a8b9acbc4b0f85497272b859ee", - "public/assets/pangeo-logo.svg": "3902ca4e2361adc4576b26d5cbce29c177ab279fd6df0a9c8d6428ae333a5050", - "public/assets/pangeo.png": "ff9c49f6cfb8168d83e485157b64be66d3f2e20fca5266390ce10550cab3991c", - "public/assets/prefect-logo.webp": "3f90b105ba6f372b14d0d4dfbc7f772d327f099be7cfe7ab7aab5bdcb503326b", - "public/assets/prefect.png": "8eb7dac4a2f2fa42eb8d102ac25ca8f012d7c27f6bc6622c58f877d078f17d82", - "public/assets/prn_cision_logo_desktop.png": "efc1b56943f822a78573e3abcc164fa499e5d21ae96ea8b43ee76cb02d27ffa4", - "public/assets/rapids.png": "ddddff45c887a268a526ecf72f4e262026782597bbf9992a4be74c89bb51c593", - "public/assets/rebuy_logo.svg": "e6373945f93ecbcb4bc70bfe6f8bd170fea9466dcaab8a1c66ba2902eec72ceb", - "public/assets/satpy.png": "a78423c6b1942b87a2a526c7f0f62a8f9267acfdce02301f1f286d080fa54a91", - "public/assets/saturn-cloud.png": "aeb8d0a58798067cd3b39253077533d338612af3901330b64393178f3528e082", - "public/assets/scikit-allel.png": "5dc233ce8dae4f33628cb6f074d97f3c76ee42936c4f1efec96a9102317cba00", - "public/assets/scikit-image.png": "6858898730015d26ab8c34b282553e65f0eb54ba367c78db6966357f234f56cd", - "public/assets/scikit-learn-logo.svg": "7e02912c26ee7fc6dde376d271b4b46ee7925e3ae3c0390ee47b748e4910011e", - "public/assets/scikit-learn.png": "99749d541df577e9322eea40a3aa6abd5e8369048b8222d7346827ebb1d2d2b2", - "public/assets/shell.png": "5546c65667958214fb4654f208fc2d84781da058306c383299b2265422b41bc9", - "public/assets/simeio-logo.svg": "6eed370c3df2c977b6d9c5b042b37dfdac953bb7dbda951fc81df55df5dd0d34", - "public/assets/skyportal.png": "6ad8f48bb43d6fd64ec159895b6ca6bef870a35e3541bc0dfcdd2562594c4f7c", - "public/assets/snorkel.png": "997ae6d946fd3faf9cc302acda187267b8aea4eb5b9a11e8c6392f9eaee65796", - "public/assets/stack-x.svg": "3ebecb875fbfe4df7bb7614f8d8b55a1212aaa20f6382ff98254c7a521a1e3cd", - "public/assets/stumpy.png": "e49484e60bba3e13d9bf071c788cc997010b52747179000708282023192b0619", - "public/assets/switch-black.svg": "ceed4a4bf3963eda62ca46739d9b5540ce051b60d5228e9dbd812fb30ea85f3d", - "public/assets/tpot.png": "e0e5c355986f5080e20c9e4753a0040cde393ddbee32e3bfa250ce4ce58c1874", - "public/assets/tsfresh.png": "ab38ae3ce5bc1bb2c75b8062cee90d014efe577bbf8ce9803faca51a7922f182", - "public/assets/twitter.svg": "31e66f879782082cbbf43958b079ead5457a6cfd13d50994fac7309ac099a289", - "public/assets/two-sigma-logo.svg": "66bb9813d08346db248c5aa7a43e2a87f8795f7491b78cd344716c13dc9eb8c2", - "public/assets/us-air-force.png": "dbd8d5841ac14f23af70682df66091935a27fab2911d172a91d8a938ef2d91e8", - "public/assets/vector-grid-h.mobile-white-bg.svg": "d452f078d9e98295dd55018e765d76f263c185646583b23f4828911338f19e45", - "public/assets/vector-grid-h.mobile3.svg": "906d6da814e6aef0dc618bfdb251b078ff13ba818475fbdd06fe336d098a040d", - "public/assets/vector-grid-tablet-white-bg.svg": "42ceae0e6eb40587ccdfab73485caf5becff4c2ca59512cb78b088a3448de9c7", - "public/assets/vector-grid-tablet.svg": "aa004986da8ef205c027b72932071f0acc8d3260d16c0578eaf21081ad2f98c5", - "public/assets/vector-grid-v.mobile-white-bg.svg": "13771d2276e18d0c8f9996962eb9d7ea0767bb8a49935bca5022e0756ea91438", - "public/assets/vector-grid-v.mobile.svg": "02f1003699d2a481d060e1717351bca1ad221b532cc3a70e4499119cb2715abe", - "public/assets/vector-grid-white-bg.svg": "2f929ffc00288a68ad09ad40f389396f0b59dfa3228c9a26c33dd1ec78d6540b", - "public/assets/vector-grid.svg": "ce516d8684c8ba65ad55c650b2563af48b802eb794539a6564219288a5bdf2a3", - "public/assets/walmart.png": "dd100c45dc52fd47883a154a6222bc21bc5ee71a6903ccec6c1ee1b61378ec46", - "public/assets/wayfair.png": "a9b32e997e23247d5842e17dda8e71c13bc23f77a02a7a39e92f358f7976784a", - "public/assets/xGBoost-logo.svg": "0ad24e678031d0d4105b42bc8f12584efe9fad91dfd92fae60c30594648ed525", - "public/assets/xGBoost-logo.webp": "645110e63fb248b091afb02889ac00a61694e97c7393cf40c89207b60ce965e5", - "public/assets/xGBoost.png": "a6f712692e64da95c99ada296e1b53244206e332067455e6f98069b84617403c", - "public/assets/xarray.png": "86eb6b3fbceaccf8212b64b613cc5847322bf5711c393f715ef3c9676d28b9c0", - "public/assets/youtube.svg": "f17d4bd7163932ab0fb4708ab4a8c9c386d07a9f2b77124cec4894ba9bcfe014", - "public/assets/zarr-logo.svg": "1616ccc54c86a28cf3e737f7071b0fad5a17a023ead370108f5b5c48c76e7697", - "src/components/BrandNav.astro": "c7092008197c6fe497ef39d86f95d8d6ea1787c21ba0572a2212563953d3aead", - "src/components/ContrastText.astro": "05b895e041f411e5f415ce6a8c482624437c4754073cb88335fa317eef022a88", - "src/components/CostCounter.astro": "127685b4ef8c98406f2bf2f0f037e6470d5c6bbe14fb4c1d8a491f827a37b7f0", - "src/components/Dashboard.astro": "a0ccb3e89f559309f6234ab88319097f07d345e10ac0c32eb486272d06dabf36", - "src/components/Dialogs.astro": "df7409665c86e6f180c2e709116037c262d848393945543c36ae4afe1850b64d", - "src/components/Footer.astro": "43d95565d044362fa2941c813a137accb475450fa016851dc911b3c0456c40bc", - "src/components/Gauges.astro": "9aa7003af2eb27a407b20d097e2a7d6f9884e01fd061c16d273f30ae7c55363d", - "src/components/Header.astro": "1cadcb7f2aefc6164056c90d357562e36b4e1ea8b7074f5ef39f6923c80ad34d", - "src/components/Hero.astro": "d8910e398568552086bf5ff7e6ccf453c8eecaea201bb1f45e3a645330dc6ce7", - "src/components/Icon.astro": "bdc6c30b07662ae9ae90261d2dd8f9ab8f95eca49d37141dc185e20d3c0bf758", - "src/components/Support.astro": "0d7eed6b693d6da734dcd66738b9e8c75d2959f21904aca489cd97c6b8215d55", - "src/components/Terminal.astro": "73bbb70fcbc9de557b045e9983d4701350793f7bde08420872ec6580156b394e", - "src/components/WorkloadPanel.astro": "574d49d5c7eb7e7251f793eed2fe58f8ee7afacb185e4d78439e7e3d072fabbf", - "src/data/assets.json": "4b7d7af8a28fad834703f489d610526c3a16af5df77745c14685898b11f7de3e", - "src/data/cases.json": "fc3f5c11cab0739afb5a646fbc729485b7576e618566deca0d2bd700f990c61a", - "src/data/home.ts": "74b4c46d2ef85f41ac31230d37d2e9488923426354f03750df448ce07a867d1b", - "src/data/press.json": "c185768c91ffdbfe585d6434df3941cbb9d88803b07899308cac39d44cb19530", - "src/data/quotes.json": "fb702254e08bf7b33891ba58eccc2dc8fa65ae49272b92e1cf7e199ab26de433", - "src/data/redirects.json": "be59a35ea0bbb24def4400468d0eef7353b02007bad58db5018d584ce71fc727", - "src/data/site.ts": "60f1b865e69d1c9101c99fe4cb530e9cee70b30a58c47fcdcc5814836125f53c", - "src/layouts/Site.astro": "11edb11869192531691cea10e252918c131b871522c4a4211134f3e14bf50f57", - "src/lib/redirects.ts": "fb323bf070e204ea13a6a4d5089d66351c275361cbf95c7611c185b420aced46", - "src/pages/404.astro": "7108b9133c527eceaf3eed9c6313e0da197b84025b85a50d0e547d2e966f5800", - "src/pages/[...redirect].astro": "afdc7cbc2c4d01659c71289341aa62cf0091a403f8cb1f265bf5baec805df552", - "src/pages/brand-guide.astro": "1bf16c2fafda2af518e7f00548bdf8dc1c343ba87e3e71df6b00a6d9ecd93631", - "src/pages/get-help.astro": "888bd983906719a3f998122851602678d096beea0577518f4046c77f2c0df22b", - "src/pages/get-started.astro": "08f42e49323bff1b0e4f97a5882caddd145520365a785270bcb2bf7df5795697", - "src/pages/index.astro": "c66a86903084c5442bc0fecf32eaef9c38f3725db12003692fa58b981637b5bc", - "src/pages/powered-by.astro": "357a4473430952f2068070f84aff1de03c8179f1afcb69fa13c5e8ddb0c9482b", - "src/pages/press-mentions.astro": "54f5a3a615ec30fb8edcb258960b5305454af4669f0167fc4a9cbd3d6b56db55", - "src/scripts/site.ts": "fd63eb61e7dfbfb2de0789f3a1036cb7c1186c375584addac9d21f37a443d4a4", - "src/styles/brand.css": "6a839bab2913260e4337c37d4e3eab389cc5e0b984c7040ec23264a1e05e3b9c", - "src/styles/cases.css": "5c1e8e02c7f5f764c7dff10432850730b3dcba551473cd73f8c150d4ec12f129", - "src/styles/chrome.css": "8138db07c7b434aa99f228c82b53863edca9be8f309e78462ccc911491e036be", - "src/styles/closing.css": "e2c323c2760a406397ffd3f6e72316d3f0f4fa38fee296486e3a9d889bbc17b4", - "src/styles/copy-papers.css": "8b9ebd3947ef4d603127c28585e29c3ab5a5b965caddb2f0bdffe59bbcb4dbc8", - "src/styles/deeper.css": "548d661a67f49ee1b9c91e823196b04edab85cdb39fff5d1c35ed6ca976cbf55", - "src/styles/deployment.css": "a13f9db2fd9553e73b884449e71e913f0b6cc6d9c258e6333bed39129d586290", - "src/styles/explore.css": "2c5d1a44d4b43c316938a9939cc342380c064baa261773832d4e62ecf0c616a4", - "src/styles/footer-papers.css": "392430ef4e8122caae5d1eb19f3121be59babdf975f6e90f47c0c65bcce538f8", - "src/styles/get-help.css": "d9116751d2b9f5eaea87a0972c5c8dc05c78efd8387d006925472d52862ea424", - "src/styles/get-started.css": "69224c24f3d4c52997ae89bf7c08c779a304188c90697c9931ad0e7bb21ae4d6", - "src/styles/global.css": "5a72f88e982c79b4e230c289b9ee40c3e0651fbb6564026cfcdf613e614d8bb9", - "src/styles/home.css": "be391fc973a5f858813ee1b8bd69b2d94f13f40643a304d5930ca8ddd3fc1429", - "src/styles/illustrations.css": "96fdb481f692ad31a1ab0bda34bf226f6f4bfaca7cbe215fa371b785e338cf82", - "src/styles/learn.css": "e082774e07a8b39d89e9358f298f0f1b1d9940c6d896a098792b8a5c9c90ed73", - "src/styles/organizations.css": "a263981b28a09028302888ffea6766798be3fb5a9b891f6766e4cb177dbff8bd", - "src/styles/performance.css": "8f9989ce8b6a1fd64ddecd4f26b54a99f55643669c8fcb8f3861a805a8a00b01", - "src/styles/powered-by.css": "7cbca01a153889d7ee3c8163812b2d1f2e7944c9728292ba66bfd78c02b8c25e", - "src/styles/press-mentions.css": "7e1e5910b2b1e4a94bb66afab6bfac156d770fc129e844e1a9b7bf45f5f32475", - "src/styles/specimens.css": "cc50512e14ced1ab0e64d7b228fe1d6f4f910758b74733510c1abbd3fcb77c46", - "src/styles/support.css": "2c64ae8a31130e791a4489bffb904e1812bd8fa42d2ab22de4db1a142f2d3064", - "src/styles/testimonials.css": "048da51951281ff0dd9e0bad4c8157d1ff7cecf392c1fc433f22de8bab2929a5", - "src/styles/tone.css": "81bb21fe9242c77be9bc8339905a51f3cd96f49d1157ae0a6d3043a5b19c0cd4", - "src/styles/workloads.css": "c78902b5c9a08d1ec9fc492fb8d90089bf1d83d5e45a5baa5c8c6d6112ac8f9c", - "src/utils/code.ts": "20e85516f662e6ef37b7446f77b87353c30f6fb3c8c205205f050579c7c2bd6c", - "src/utils/contrast.ts": "6e22840d6c31bd83d80e7ec7bd7e9a4433152712f77a9ab666dabe0f43ff6b4d" - }, - "intentionalChanges": [ - "src/components/Footer.astro", - "src/layouts/Site.astro", - "src/styles/footer-papers.css", - "src/components/Dashboard.astro", - "src/components/Gauges.astro", - "src/scripts/site.ts", - "src/styles/illustrations.css", - "src/styles/performance.css" - ], - "legacy": { - "slides.html": "42bd63856cd79a7b4ff8242c9c550c2a343709aad1c1b7ac474d2d13aed6e65e", - "ml-slides.html": "b6d6c426a45f86d324a254559caeaa00ac263ba8a456e41d8ea7df643e42f3de", - "survey.html": "3a761ae5a308b27a0439c505259265c8996b9732dd0a6de2a7d28b7cd69d97b3" - }, - "animations": [ - { - "path": "public/animations/dask-home.json", - "url": "https://cdn.prod.website-files.com/655926fa24195711dbf38624/655926fa24195711dbf388c3_Dask_Home_2_Updates.json", - "sha256": "76423fcd4c9991490f5a5d09231727324380f874acb76cbfbe3c0f81305ac543" - }, - { - "path": "public/animations/type-gauge.json", - "url": "https://cdn.prod.website-files.com/655926fa24195711dbf38624/6633b38bbf5010e99c1329dc_Type-Gauge.json", - "sha256": "6b9e60ae47ddb6c5287e493f29d023cac7044416133d3234121d41e4dee8e8f0" - } - ] -} diff --git a/tests/forms.spec.mjs b/tests/forms.spec.mjs new file mode 100644 index 0000000..510cccc --- /dev/null +++ b/tests/forms.spec.mjs @@ -0,0 +1,89 @@ +import { expect, test } from './support/site.mjs'; + +test.use({ viewport: { width: 390, height: 780 } }); + +for (const [kind, field] of [ + ['press', 'news-url'], + ['event', 'event-date'], + ['newsletter', 'company'], +]) { + test(`mobile ${kind} form is usable and never sends submissions`, async ({ + page, + }) => { + await page.goto('./press-mentions'); + const open = page.getByRole('button', { name: 'Add a press mention' }); + await open.click(); + const dialog = page.getByRole('dialog'); + await expect(dialog).toBeVisible(); + await expect( + dialog.getByRole('button', { name: 'Close dialog' }), + ).toBeFocused(); + if (kind !== 'press') { + await dialog + .getByRole('tab', { selected: true }) + .press(kind === 'event' ? 'ArrowLeft' : 'ArrowRight'); + await expect(dialog.locator(`[data-form=${kind}]`)).toBeFocused(); + } + await expect(dialog.locator(`[data-form=${kind}]`)).toHaveAttribute( + 'aria-selected', + 'true', + ); + await expect(dialog.locator(`[name=${field}]`)).toBeEnabled(); + for (const inactive of ['press', 'event', 'newsletter'].filter( + (name) => name !== kind, + )) { + const section = dialog.locator('.' + inactive + '-fields'); + await expect(section).toBeHidden(); + for (const input of await section.locator('input,textarea').all()) + await expect(input).toBeDisabled(); + } + + const tabBoxes = await Promise.all( + (await dialog.getByRole('tab').all()).map((tab) => tab.boundingBox()), + ); + expect(tabBoxes).toHaveLength(3); + for (let i = 1; i < tabBoxes.length; i++) { + expect(tabBoxes[i].y).toBeGreaterThanOrEqual( + tabBoxes[i - 1].y + tabBoxes[i - 1].height, + ); + } + const first = await dialog.locator('[name=first-name]').boundingBox(); + const last = await dialog.locator('[name=last-name]').boundingBox(); + expect(last.y).toBeGreaterThanOrEqual(first.y + first.height); + expect( + await dialog.evaluate((el) => el.scrollWidth - el.clientWidth), + ).toBeLessThanOrEqual(1); + + const submit = dialog.getByRole('button', { name: 'Submit', exact: true }); + await submit.click(); + await expect(dialog.getByRole('status')).toBeEmpty(); + await expect(dialog.locator('[name=first-name]')).toBeFocused(); + + for (const input of await dialog + .locator('input:enabled,textarea:enabled') + .all()) { + const type = await input.getAttribute('type'); + await input.fill( + type === 'email' + ? 'local@example.invalid' + : type === 'url' + ? 'https://example.invalid/' + : 'Local test', + ); + } + // Observe every request after filling, including GET and beacon submissions, + // and block unexpected calls before they leave the local test environment. + const requests = []; + await page.route('**/*', (route) => { + requests.push(route.request().url()); + return route.abort(); + }); + await submit.click(); + await expect(dialog.getByRole('status')).toContainText(/not sent/i); + await expect(page).toHaveURL(/\/press-mentions\/?$/); + await page.keyboard.press('Escape'); + await expect(dialog).toBeHidden(); + await expect(open).toBeFocused(); + expect(requests).toEqual([]); + }); +} diff --git a/tests/layout.spec.mjs b/tests/layout.spec.mjs new file mode 100644 index 0000000..f084ad3 --- /dev/null +++ b/tests/layout.spec.mjs @@ -0,0 +1,197 @@ +import { + expect, + expectLoadedImages, + pages, + test, + widths, +} from './support/site.mjs'; + +// A CSS breakpoint sweep is useful here, but the assertion is about readability, +// not the values of the site's style tokens or the dimensions of an old screen. +const layoutWidths = [...widths, 479, 480, 599, 600, 767, 991, 992]; + +for (const route of pages) { + test(`${route.name} keeps primary content within the viewport and its clipping containers`, async ({ + page, + }) => { + for (const width of layoutWidths) { + await test.step(`${width}px`, async () => { + await page.setViewportSize({ width, height: 900 }); + await page.goto('./' + route.path); + await page.evaluate(() => document.fonts.ready); + const { overflow, clipped } = await page.evaluate(() => { + const clipped = []; + for (const el of document.querySelectorAll( + 'main :is(h1,h2,h3,p,.button,time)', + )) { + if (!el.getClientRects().length) continue; + // A container may extend beyond a clipped decorative section while + // all of its readable text still fits. Measure the text, not the box. + const text = document.createRange(); + text.selectNodeContents(el); + for (const box of text.getClientRects()) { + if (!box.width || !box.height) continue; + const clippedBy = (by) => + clipped.push({ + element: el.tagName, + text: el.textContent.trim().slice(0, 60), + by, + }); + if (box.left < -1 || box.right > innerWidth + 1) + clippedBy('viewport'); + for ( + let parent = el; + parent && parent !== document.body; + parent = parent.parentElement + ) { + const style = getComputedStyle(parent); + const edge = parent.getBoundingClientRect(); + const clips = (overflow) => + ['hidden', 'clip'].includes(overflow); + if ( + (clips(style.overflowY) && + (box.top < edge.top - 2 || box.bottom > edge.bottom + 2)) || + (clips(style.overflowX) && + (box.left < edge.left - 1 || box.right > edge.right + 1)) + ) { + clippedBy(parent.className); + } + } + } + } + return { + overflow: document.documentElement.scrollWidth - innerWidth, + clipped, + }; + }); + expect(overflow).toBeLessThanOrEqual(1); // Allow subpixel rounding. + expect(clipped).toEqual([]); + }); + } + }); +} + +test('adoption chart stays inside its section and clear of the labels', async ({ + page, +}) => { + for (const width of layoutWidths) { + await test.step(`${width}px`, async () => { + await page.setViewportSize({ width, height: 900 }); + await page.goto('./powered-by'); + await page.evaluate(() => document.fonts.ready); + const metrics = page.locator('.metrics'); + const chart = metrics.locator('.adoption-chart'); + await expect(chart).toBeVisible(); + await expectLoadedImages(chart); + const { contained, overlap } = await metrics.evaluate((section) => { + const bounds = section.getBoundingClientRect(); + const art = section + .querySelector('.adoption-chart') + .getBoundingClientRect(); + const overlap = []; + const walker = document.createTreeWalker(section, NodeFilter.SHOW_TEXT); + while (walker.nextNode()) { + const text = walker.currentNode; + if ( + !text.textContent.trim() || + !text.parentElement.closest('h2,.metric') + ) + continue; + const range = document.createRange(); + range.selectNodeContents(text); + for (const ink of range.getClientRects()) { + if ( + ink.right > art.left && + ink.left < art.right && + ink.bottom > art.top && + ink.top < art.bottom + ) { + overlap.push(text.textContent.trim()); + } + } + } + return { + contained: + art.left >= bounds.left - 1 && + art.right <= bounds.right + 1 && + art.top >= bounds.top - 1 && + art.bottom <= bounds.bottom + 1, + overlap, + }; + }); + expect(contained).toBe(true); + expect(overlap).toEqual([]); + }); + } +}); + +test('Brand Guide specimen labels stay clear of other rendered text', async ({ + page, +}) => { + // Sample the standard phone, tablet and desktop layouts. The 320px + // document/clipping check above is separate: the site's existing typography + // layout at 320px crowds the first label. + for (const width of [390, 768, 1440]) { + await test.step(`${width}px`, async () => { + await page.setViewportSize({ width, height: 900 }); + await page.goto('./brand-guide'); + await page.evaluate(() => document.fonts.ready); + const specimens = page.locator('.type-specimens'); + await expect(specimens).toBeVisible(); + const labels = specimens.locator('.type-label'); + expect(await labels.count()).toBeGreaterThan(0); + for (const label of await labels.all()) await expect(label).toBeVisible(); + + const collisions = await specimens.evaluate((section) => { + const texts = []; + for (const el of section.querySelectorAll( + '.type-label, .type-sample', + )) { + if ( + !el.checkVisibility({ + opacityProperty: true, + visibilityProperty: true, + }) + ) + continue; + const range = document.createRange(); + range.selectNodeContents(el); + texts.push({ + label: el.matches('.type-label'), + text: el.textContent.trim(), + rects: [...range.getClientRects()], + }); + } + + // Compare both dimensions of text fragments, not paragraph or cell + // edges. A decorative sample can extend outside its cell without + // interfering with a label. Ignore sample-on-sample contacts here. + const overlaps = []; + for (const [index, a] of texts.entries()) { + for (const b of texts.slice(index + 1)) { + if (!a.label && !b.label) continue; + for (const first of a.rects) { + for (const second of b.rects) { + const horizontal = + Math.min(first.right, second.right) - + Math.max(first.left, second.left); + const vertical = + Math.min(first.bottom, second.bottom) - + Math.max(first.top, second.top); + // Tolerate subpixel rounding; no fixed visual reference. + if (horizontal > 1 && vertical > 1) { + overlaps.push({ + text: [a.text, b.text], + overlap: { width: horizontal, height: vertical }, + }); + } + } + } + } + } + return overlaps; + }); + expect(collisions).toEqual([]); + }); + } +}); diff --git a/tests/motion.spec.mjs b/tests/motion.spec.mjs new file mode 100644 index 0000000..7d57e82 --- /dev/null +++ b/tests/motion.spec.mjs @@ -0,0 +1,191 @@ +import { readFile } from 'node:fs/promises'; +import { + expect, + expectLoadedImages, + test, + watchPage, +} from './support/site.mjs'; + +const animationNames = ['dask-home', 'type-gauge']; + +for (const name of animationNames) { + test(`${name} animation data does not use expressions or linked/embedded resources`, async () => { + const data = JSON.parse( + await readFile(`public/animations/${name}.json`, 'utf8'), + ); + expect(data.layers.length).toBeGreaterThan(0); + const violations = []; + function audit(value, at = name) { + if (typeof value === 'string') { + if ( + /(?:[a-z][a-z0-9+.-]*:\/\/|^\s*\/\/|\b(?:https?|data|javascript|file|blob):)/i.test( + value, + ) + ) { + violations.push(at + ': external or embedded resource'); + } + } else if (value && typeof value === 'object') { + for (const [key, item] of Object.entries(value)) { + const location = at + '.' + key; + if (key === 'x' && typeof item === 'string') + violations.push(location + ': expression'); + if ((key === 'u' || key === 'fPath') && item) + violations.push(location + ': resource path'); + audit(item, location); + } + } + } + audit(data); + // These are self-contained vector compositions, not image/audio assets. + for (const asset of data.assets ?? []) { + if ('p' in asset || 'e' in asset) + violations.push(asset.id + ': linked or embedded asset'); + } + expect(violations).toEqual([]); + }); + + for (const mode of ['root', 'mounted']) { + test(`${name} plays only when visible and reverts to the poster on ${mode} preview`, async ({ + page, + baseURL, + mountedURL, + }) => { + const base = mode === 'root' ? baseURL : mountedURL; + await page.setViewportSize({ + width: mode === 'root' ? 1440 : 390, + height: 900, + }); + await page.emulateMedia({ reducedMotion: 'no-preference' }); + const problems = await watchPage(page, base); + await page.goto(base); + const art = page.locator(`[data-lottie="${name}"]`); + const poster = art.locator(':scope > img'); + const svg = art.locator('svg'); + await art.scrollIntoViewIfNeeded(); + await expectLoadedImages(poster); + await expect(svg).toBeVisible(); + const frame = await art.getAttribute('data-frame'); + await expect.poll(() => art.getAttribute('data-frame')).not.toBe(frame); + const rendered = await svg.innerHTML(); + await expect.poll(() => svg.innerHTML()).not.toBe(rendered); + + await page.evaluate(() => scrollTo(0, document.body.scrollHeight)); + await expect(art).not.toBeInViewport(); + // Observe over multiple animation frames rather than compare two + // immediate samples, which could both fall between live ticks. + await expect + .poll(() => + art.evaluate(async (el) => { + const before = el.dataset.frame; + await new Promise((resolve) => setTimeout(resolve, 160)); + return el.dataset.frame === before; + }), + ) + .toBe(true); + await art.scrollIntoViewIfNeeded(); + const resumed = await art.getAttribute('data-frame'); + await expect.poll(() => art.getAttribute('data-frame')).not.toBe(resumed); + + await page.emulateMedia({ reducedMotion: 'reduce' }); + await expect(poster).toBeVisible(); + expect(problems).toEqual([]); + }); + } +} + +test('a failed animation download leaves the local poster visible', async ({ + page, +}) => { + await page.emulateMedia({ reducedMotion: 'no-preference' }); + await page.route('**/animations/*.json', (route) => + route.fulfill({ status: 503 }), + ); + const failed = page.waitForResponse( + (response) => + response.status() === 503 && response.url().includes('/animations/'), + ); + await page.goto('./'); + const art = page.locator('[data-lottie="dask-home"]'); + await art.scrollIntoViewIfNeeded(); + await failed; + await expectLoadedImages(art.locator(':scope > img')); + await expect(art.locator(':scope > img')).toBeVisible(); + await expect(art.locator('svg')).toHaveCount(0); +}); + +for (const javaScriptEnabled of [true, false]) { + test.describe(javaScriptEnabled ? 'Reduced motion' : 'No JavaScript', () => { + test.use({ javaScriptEnabled, viewport: { width: 390, height: 900 } }); + + test('homepage illustrations have static posters, terminal and counter', async ({ + page, + }) => { + const downloads = []; + await page.route('**/animations/*.json', (route) => { + downloads.push(route.request().url()); + return route.abort(); + }); + await page.goto('./'); + for (const name of animationNames) { + const art = page.locator(`[data-lottie="${name}"]`); + const poster = art.locator(':scope > img'); + await art.scrollIntoViewIfNeeded(); + await expect(poster).toBeInViewport(); + await expectLoadedImages(poster); + await expect(art.locator('svg')).toHaveCount(0); + } + const terminal = page.locator('.human-code [data-loop-codes]'); + await terminal.scrollIntoViewIfNeeded(); + await expect(terminal.locator('code')).toBeVisible(); + expect(await terminal.locator('code').textContent()).toMatch( + /\S[^\n]*\n[\s\S]*\S/, + ); + await expect(terminal).not.toHaveAttribute('data-typing', /.+/); + const counter = page.locator('[data-illustration="counter"]'); + await counter.scrollIntoViewIfNeeded(); + await expect(counter.locator('#rows-value')).toContainText(/\d/); + await expect(counter.locator('#cost-value')).toContainText(/\d+\.\d{2}/); + await expect(counter).not.toHaveClass(/is-playing/); + expect(downloads).toEqual([]); + }); + }); +} + +test('native terminal types a completed new frame and the counter advances', async ({ + page, +}) => { + await page.setViewportSize({ width: 390, height: 900 }); + await page.emulateMedia({ reducedMotion: 'no-preference' }); + await page.goto('./'); + const terminal = page.locator('.human-code [data-loop-codes]'); + const code = terminal.locator('code'); + const first = await code.textContent(); + await terminal.scrollIntoViewIfNeeded(); + // The animation starts by typing the same frame used by its static fallback. + // Sample completion state and text together to avoid reading a partial frame. + await expect + .poll( + () => + terminal.evaluate((el, original) => { + const code = el.querySelector('code'); + return ( + el.dataset.typing === 'complete' && + code.querySelector('span') !== null && + code.textContent !== original && + /\S[^\n]*\n[\s\S]*\S/.test(code.textContent) + ); + }, first), + { timeout: 15000 }, + ) + .toBe(true); + + const counter = page.locator('[data-illustration="counter"]'); + const rows = counter.locator('#rows-value'); + const cost = counter.locator('#cost-value'); + const initialRows = await rows.textContent(); + const initialCost = await cost.textContent(); + await counter.scrollIntoViewIfNeeded(); + await expect(counter).toHaveClass(/is-playing/); + await expect.poll(() => rows.textContent()).not.toBe(initialRows); + await expect.poll(() => cost.textContent()).not.toBe(initialCost); +}); diff --git a/tests/mounted-preview.spec.mjs b/tests/mounted-preview.spec.mjs new file mode 100644 index 0000000..7c47e24 --- /dev/null +++ b/tests/mounted-preview.spec.mjs @@ -0,0 +1,80 @@ +import { + expect, + expectLoadedImages, + pages, + test, + watchPage, +} from './support/site.mjs'; + +test.use({ viewport: { width: 390, height: 900 } }); + +for (const route of pages) { + test(`${route.name} resolves its canonical, rendered assets and local links under the preview mount`, async ({ + page, + request, + mountedURL, + }) => { + const problems = await watchPage(page, mountedURL); + const response = await page.goto(new URL(route.path, mountedURL).href); + expect(response.status()).toBe(200); + await expect( + page.getByRole('main').getByRole('heading', { level: 1 }), + ).toBeVisible(); + const canonical = new URL( + route.path ? route.path + '/' : '', + process.env.TEST_MOUNTED_CANONICAL, + ); + await expect(page.locator('link[rel=canonical]')).toHaveAttribute( + 'href', + canonical.href, + ); + await page.evaluate(() => document.fonts.ready); + await expectLoadedImages(page.locator('img')); + + const urls = await page + .locator('[href], [src], [poster], [action]') + .evaluateAll((elements) => [ + ...new Set( + elements + .flatMap((el) => + ['href', 'src', 'poster', 'action'].map((attr) => + el.getAttribute(attr), + ), + ) + .filter( + (value) => value?.startsWith('/') && !value.startsWith('//'), + ), + ), + ]); + expect(urls.length).toBeGreaterThan(0); + const mount = new URL(mountedURL).pathname; + for (const path of urls) { + expect(path.startsWith(mount), path).toBe(true); + expect( + ( + await request.get(new URL(path, mountedURL).href, { maxRedirects: 0 }) + ).status(), + path, + ).toBe(200); + } + + const credit = page + .getByRole('contentinfo') + .getByRole('link', { name: /GitHub Pages/i }); + await expect(credit).toHaveAttribute( + 'href', + 'https://github.com/dask/dask.github.io', + ); + + if (route.path === 'brand-guide') { + const tabs = page.locator('[data-logo-color]'); + expect(await tabs.count()).toBeGreaterThan(1); + for (const tab of await tabs.all()) { + await tab.click(); + await expect(tab).toHaveAttribute('aria-selected', 'true'); + await expectLoadedImages(page.locator('.logo-showcase img')); + } + } + expect(problems).toEqual([]); + }); +} diff --git a/tests/navigation-tabs.spec.mjs b/tests/navigation-tabs.spec.mjs new file mode 100644 index 0000000..4e6b70b --- /dev/null +++ b/tests/navigation-tabs.spec.mjs @@ -0,0 +1,111 @@ +import { expect, test } from './support/site.mjs'; + +for (const width of [390, 768, 1440]) { + test.describe(`${width}px navigation`, () => { + test.use({ viewport: { width, height: 900 } }); + + test('menu and Community controls work by keyboard and navigate locally', async ({ + page, + }) => { + await page.goto('./'); + const menu = page.getByRole('button', { name: /^(open|close) menu$/i }); + const nav = page.getByRole('navigation', { name: 'Main navigation' }); + const community = nav.getByRole('button', { name: 'Community' }); + const help = nav.getByRole('link', { name: 'Get Help' }); + + if (width < 992) { + await expect(nav).toBeHidden(); + await menu.press('Enter'); + await expect(menu).toHaveAttribute('aria-expanded', 'true'); + await expect(nav).toBeVisible(); + // Community links are already expanded in the mobile layout. + await expect(help).toBeVisible(); + await page.keyboard.press('Escape'); + await expect(menu).toHaveAttribute('aria-expanded', 'false'); + await expect(nav).toBeHidden(); + await menu.click(); + } else { + await expect(help).toBeHidden(); + await community.press('Space'); + await expect(community).toHaveAttribute('aria-expanded', 'true'); + await expect(help).toBeVisible(); + await page.keyboard.press('Escape'); + await expect(community).toHaveAttribute('aria-expanded', 'false'); + await expect(help).toBeHidden(); + await community.click(); + } + await help.press('Enter'); + await expect(page).toHaveURL(/\/get-help\/?$/); + await expect(page.getByRole('main')).toBeVisible(); + }); + }); +} + +for (const { name, path, group } of [ + { name: 'Workloads', path: '', group: '.workload-tabs' }, + { name: 'Deployment', path: '', group: '.deployment-tabs' }, + { name: 'Explore', path: 'get-started', group: '.explore-tabs' }, +]) { + for (const width of [390, 1440]) { + test.describe(`${name} at ${width}px`, () => { + test.use({ viewport: { width, height: 900 } }); + + test('click and keyboard select one linked panel and keep actions usable', async ({ + page, + }) => { + await page.goto('./' + path); + const widget = page.locator(group); + const tabs = widget.getByRole('tab'); + const count = await tabs.count(); + expect(count).toBeGreaterThan(1); + + async function expectSelected(index) { + const active = tabs.nth(index); + await expect(active).toBeFocused(); + await expect(active).toHaveAttribute('tabindex', '0'); + await expect(widget.getByRole('tab', { selected: true })).toHaveCount( + 1, + ); + await expect(active).toHaveAttribute('aria-selected', 'true'); + const panel = widget.getByRole('tabpanel'); + const id = await active.getAttribute('aria-controls'); + expect(id).toBeTruthy(); + await expect(panel).toHaveId(id); + await expect(panel).toBeVisible(); + const actions = panel.getByRole('link'); + expect(await actions.count()).toBeGreaterThanOrEqual( + group === '.explore-tabs' ? 1 : 2, + ); + for (const action of await actions.all()) { + await expect(action).toBeVisible(); + await expect(action).toHaveAttribute( + 'href', + /^(https:\/\/|\/[^/])/, + ); + } + } + + for (let index = 0; index < count; index++) { + await tabs.nth(index).click(); + await expectSelected(index); + } + for (const [key, index] of [ + ['Home', 0], + ['ArrowRight', 1], + ['End', count - 1], + ['ArrowRight', 0], + ['ArrowLeft', count - 1], + ]) { + await page.keyboard.press(key); + await expectSelected(index); + } + if (group === '.explore-tabs') { + await widget + .getByRole('button', { name: /previous exploration/i }) + .click(); + await expectSelected(count - 2); + } + }); + }); + } +} diff --git a/tests/page-smoke.spec.mjs b/tests/page-smoke.spec.mjs new file mode 100644 index 0000000..ffb908b --- /dev/null +++ b/tests/page-smoke.spec.mjs @@ -0,0 +1,36 @@ +import { + expect, + expectLoadedImages, + pages, + test, + watchPage, + widths, +} from './support/site.mjs'; + +for (const width of widths) { + test.describe(`${width}px viewport`, () => { + test.use({ viewport: { width, height: 900 } }); + for (const route of pages) { + test(`${route.name} loads without broken assets or runtime errors`, async ({ + page, + baseURL, + }) => { + const problems = await watchPage(page, baseURL); + const response = await page.goto('./' + route.path); + expect(response.status()).toBe(200); + const main = page.getByRole('main'); + await expect(main.getByRole('heading', { level: 1 })).toBeVisible(); + for (const section of route.sections) { + await expect(main.locator(section), section).toBeVisible(); + } + await page.evaluate(() => document.fonts.ready); + await expectLoadedImages(page.locator('img')); + const footer = page.getByRole('contentinfo'); + await expect( + footer.getByRole('link', { name: /GitHub Pages/i }), + ).toHaveAttribute('href', 'https://github.com/dask/dask.github.io'); + expect(problems).toEqual([]); + }); + } + }); +} diff --git a/tests/routing.spec.mjs b/tests/routing.spec.mjs new file mode 100644 index 0000000..56870a8 --- /dev/null +++ b/tests/routing.spec.mjs @@ -0,0 +1,144 @@ +import { expect, test } from './support/site.mjs'; + +// Deliberately independent of redirect data: these URLs are public contracts. +const target = 'https://blog.dask.org/'; +const known = ['blog', 'events', 'archive/2022-news-events']; +const staticRoutes = known.flatMap((path) => [ + path, + path + '/', + path + '?old=yes#section', + path + '/?old=yes#section', + path + '/index.html', +]); +const fallbackRoutes = [ + 'blog/a-real-old-post', + 'blog/a/deep/arbitrary/path/', + 'blog/a%20post?next=https://elsewhere.invalid/path#old', + 'blog/2022/05/story.html', + 'blog//nested/', + 'events/some-unknown-event', + 'events/2027/a/future-event/?q=anything#fragment', +]; +const unrelated = [ + 'missing', + 'blogger', + 'blog.html', + 'events-old', + 'myevents/a', + 'archive/2022-news-events-old', + 'archive/2022-news-events/child', + 'not-blog/blog/a', + 'Blog/a', + 'Events/a', +]; + +for (const mode of ['root', 'mounted']) { + for (const javaScriptEnabled of [true, false]) { + test.describe(`${mode} routing with JS ${javaScriptEnabled ? 'on' : 'off'}`, () => { + test.use({ javaScriptEnabled }); + + test('blog, event and archive URLs honor the exact destination and fallback status', async ({ + page, + baseURL, + mountedURL, + }) => { + const base = mode === 'root' ? baseURL : mountedURL; + const origin = new URL(base).origin; + const outbound = []; + const incoming = []; + + await page.route('**/*', (route) => { + const url = route.request().url(); + if (new URL(url).origin === origin) return route.continue(); + outbound.push(url); + return route.fulfill({ + contentType: 'text/html', + body: 'Intercepted destination', + }); + }); + page.on('response', (response) => { + if ( + response.request().isNavigationRequest() && + new URL(response.url()).origin === origin + ) { + incoming.push(response.status()); + } + }); + + for (const [paths, status, redirects] of [ + [staticRoutes, 200, true], + [fallbackRoutes, 404, javaScriptEnabled], + [ + mode === 'root' + ? unrelated + : [ + ...unrelated, + '/outside-mount/events/a', + new URL(base).pathname.replace(/\/$/, '.old/blog/a'), + ], + 404, + false, + ], + ]) { + for (const path of paths) { + await test.step(path, async () => { + // Distinguish a new redirect from the previous case's final URL. + if (redirects) await page.goto('about:blank'); + incoming.length = outbound.length = 0; + const url = new URL(path, base).href; + if (redirects) { + await Promise.all([ + page.waitForURL(target, { timeout: 5000 }), + // The immediate HTML redirect can replace the initial navigation. + page + .goto(url, { waitUntil: 'domcontentloaded' }) + .catch((error) => { + if (!String(error).includes('ERR_ABORTED')) throw error; + }), + ]); + await expect(page).toHaveURL(target); + expect(outbound).toEqual([target]); + } else { + const response = await page.goto(url); + expect(response.status()).toBe(404); + await expect( + page.getByRole('main').getByRole('heading', { level: 1 }), + ).toBeVisible(); + await expect( + page.getByRole('link', { name: /return to dask home/i }), + ).toHaveAttribute('href', new URL(base).pathname); + if (paths === fallbackRoutes) { + await expect( + page + .getByRole('main') + .getByRole('link', { name: 'Dask blog' }), + ).toHaveAttribute('href', target); + } + await expect(page).toHaveURL(url); + expect(outbound).toEqual([]); + } + expect(incoming).toEqual([status]); + }); + } + } + }); + }); + } +} + +test('known redirect documents offer canonical, meta refresh and fallback link', async ({ + request, + baseURL, + mountedURL, +}) => { + for (const base of [baseURL, mountedURL]) { + for (const path of known) { + const response = await request.get(new URL(path + '/', base).href); + expect(response.status()).toBe(200); + const html = await response.text(); + expect(html).toContain(`rel="canonical" href="${target}"`); + expect(html).toContain(`http-equiv="refresh" content="0;url=${target}"`); + expect(html).toContain(` { + const path = route.path ? route.path + '/' : ''; + const response = await request.get(new URL(path, baseURL).href); + expect(response.status()).toBe(200); + const html = await response.text(); + const canonical = new URL('/' + path, 'https://dask.org').href; + expect(html).toContain(`rel="canonical" href="${canonical}"`); + expect(html).not.toMatch(/webflow\.js|jquery|cdn\.prod\.website-files/i); + }); +} + +test('static output omits domain and wildcard artifacts', async () => { + const files = await readdir('dist', { recursive: true }); + expect(files).not.toContain('CNAME'); + expect(files.filter((file) => file.includes('['))).toEqual([]); +}); + +// The published URLs identify distinct decks. Check the destination rather +// than freezing the redirect documents' bytes or editorial text. +const legacySlides = { + 'slides.html': + 'https://docs.google.com/presentation/d/e/2PACX-1vSTH2kAR0DCR0nw8pFBe5kuYbOk3inZ9cQfZbzOIRjyzQoVaOoMfI2JONGBz-qsvG_P6g050ddHxSXT/pub?start=false&loop=false&delayms=60000', + 'ml-slides.html': + 'https://docs.google.com/presentation/d/e/2PACX-1vSYCry8AWCGv3zMY8ELc_EB1DCsh4sPzMRLDV0NKl1_5xYGKuF6T7NzBMEZ6mm23OgebOVNzBiMPI5Z/pub?start=false&loop=false&delayms=6000', +}; + +for (const mode of ['root', 'mounted']) { + for (const [path, destination] of Object.entries(legacySlides)) { + test(`${mode} ${path} redirects to its published deck`, async ({ + page, + request, + baseURL, + mountedURL, + }) => { + const base = mode === 'root' ? baseURL : mountedURL; + const response = await request.get(new URL(path, base).href, { + maxRedirects: 0, + }); + expect(response.status()).toBe(200); + expect(response.headers()['content-type']).toContain('text/html'); + + // Parse an inert document. The check never visits Google. + const targets = await page.evaluate( + (html) => { + const doc = new DOMParser().parseFromString(html, 'text/html'); + return [ + ...doc.querySelectorAll('head meta[http-equiv="refresh" i]'), + ].map( + (meta) => + meta.content.match(/^\s*0\s*;\s*url\s*=\s*(.*?)\s*$/i)?.[1], + ); + }, + await response.text(), + ); + expect(targets).toEqual([destination]); + }); + } + + test(`${mode} survey URL keeps the closed-survey document`, async ({ + request, + baseURL, + mountedURL, + }) => { + const base = mode === 'root' ? baseURL : mountedURL; + const response = await request.get(new URL('survey.html', base).href, { + maxRedirects: 0, + }); + expect(response.status()).toBe(200); + expect(response.headers()['content-type']).toContain('text/html'); + const html = await response.text(); + expect(html).toContain('https://examples.dask.org'); + expect(html).not.toMatch(/ { + try { + const pathname = decodeURIComponent( + new URL(request.url, 'http://localhost').pathname, + ); + if (pathname.startsWith(mount)) { + let file = path.resolve(root, pathname.slice(mount.length)); + if (file === root || file.startsWith(root + path.sep)) { + if ((await stat(file)).isDirectory()) + file = path.join(file, 'index.html'); + const data = await readFile(file); + response.writeHead(200, { + 'content-type': + types[path.extname(file)] || 'application/octet-stream', + }); + response.end(data); + return; + } + } + } catch { + // A missing file or malformed path gets the built 404 page. + } + response.writeHead(404, { 'content-type': 'text/html' }); + response.end(notFound); + }); + await new Promise((resolve, reject) => { + server.once('error', reject); + server.listen(0, '127.0.0.1', resolve); + }); + return server; +} + +export default async function setup() { + const dist = path.resolve('dist'); + try { + await access(path.join(dist, 'index.html')); + } catch { + throw new Error( + 'Missing dist/index.html; run npm run build before npm test.', + ); + } + const output = await mkdtemp(path.join(tmpdir(), 'dask-site-test-')); + const servers = []; + const cleanup = async () => { + await Promise.all( + servers.map((server) => new Promise((resolve) => server.close(resolve))), + ); + await rm(output, { recursive: true, force: true }); + }; + + try { + const mount = '/en/59/'; + const canonical = 'https://preview.example.invalid' + mount; + await promisify(execFile)( + process.execPath, + ['scripts/readthedocs-build.mjs'], + { + env: { + ...process.env, + READTHEDOCS_CANONICAL_URL: canonical, + READTHEDOCS_OUTPUT: output, + }, + }, + ); + const mounted = path.join(output, 'html'); + for (const [dir, prefix] of [ + [dist, '/'], + [mounted, mount], + ]) { + servers.push(await serve(dir, prefix)); + } + process.env.TEST_SITE_URL = + 'http://127.0.0.1:' + servers[0].address().port + '/'; + process.env.TEST_MOUNTED_URL = + 'http://127.0.0.1:' + servers[1].address().port + mount; + process.env.TEST_MOUNTED_CANONICAL = canonical; + } catch (error) { + await cleanup(); + throw error; + } + return cleanup; +} diff --git a/tests/support/site.mjs b/tests/support/site.mjs new file mode 100644 index 0000000..b5794a6 --- /dev/null +++ b/tests/support/site.mjs @@ -0,0 +1,91 @@ +import { test as base, expect } from '@playwright/test'; + +export const test = base.extend({ + baseURL: async ({}, use) => use(process.env.TEST_SITE_URL), + mountedURL: async ({}, use) => use(process.env.TEST_MOUNTED_URL), +}); + +export { expect }; + +export const pages = [ + { + name: 'Home', + path: '', + sections: [ + '.home-intro', + '.performance', + '.deployment', + '.testimonials', + '.org-band', + '.use-cases', + '.home-install', + ], + }, + { + name: 'Get Started', + path: 'get-started', + sections: [ + '.install-section', + '.learn-section', + '.explore-section', + '.deeper', + ], + }, + { name: 'Get Help', path: 'get-help', sections: ['.help-content'] }, + { + name: 'Powered By', + path: 'powered-by', + sections: [ + '.sponsors', + '.org-section:not(.projects)', + '.projects', + '.metrics', + ], + }, + { + name: 'Brand Guide', + path: 'brand-guide', + sections: ['#logos', '#colors', '#typography', '#tone'], + }, + { + name: 'Press Mentions', + path: 'press-mentions', + sections: ['.press-section', '.press-card:first-child'], + }, +]; + +export const widths = [320, 390, 768, 1440]; + +export async function watchPage(page, baseURL) { + const origin = new URL(baseURL).origin; + const problems = []; + await page.route('**/*', (route) => { + const url = route.request().url(); + if (new URL(url).origin === origin) return route.continue(); + problems.push('Unexpected external request: ' + url); + return route.abort(); + }); + page.on('pageerror', (error) => problems.push(error.message)); + page.on('requestfailed', (request) => { + problems.push(`${request.failure()?.errorText}: ${request.url()}`); + }); + page.on('response', (response) => { + if (response.status() >= 400) { + problems.push(`${response.status()}: ${response.url()}`); + } + }); + return problems; +} + +export async function expectLoadedImages(images) { + expect(await images.count()).toBeGreaterThan(0); + await expect + .poll(() => + images.evaluateAll((elements) => + elements + .filter((img) => !img.complete || !img.naturalWidth) + .map((img) => img.src), + ), + ) + .toEqual([]); +}