Datasets:
Download web/nimbric.example/tests/static/structure.scripted.spec.ts from Qwen/RecreationBench: direct link, hf CLI and curl.
- Browser
- Download file 47.5 kB
-
https://huggingface.co/datasets/Qwen/RecreationBench/resolve/main/web/nimbric.example/tests/static/structure.scripted.spec.ts
- Command line
-
hf download hf://datasets/Qwen/RecreationBench/web/nimbric.example/tests/static/structure.scripted.spec.ts
-
curl -L -o structure.scripted.spec.ts https://huggingface.co/datasets/Qwen/RecreationBench/resolve/main/web/nimbric.example/tests/static/structure.scripted.spec.ts
47.5 kB
| import { test, expect } from '@playwright/test'; | |
| test.describe('Structural - homepage', () => { | |
| test('homepage: reproduces GT semantic landmarks', async ({ page }) => { | |
| await page.goto('/'); | |
| expect(await page.locator('footer, [role="contentinfo"]').first().count(), 'footer landmark present in GT').toBeGreaterThan(0); | |
| }); | |
| test('homepage: heading hierarchy is valid', async ({ page }) => { | |
| await page.goto('/'); | |
| const headingLevels = await page.evaluate(() => { | |
| const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); | |
| return Array.from(headings).map(h => parseInt(h.tagName.substring(1))); | |
| }); | |
| if (headingLevels.length > 1) { | |
| for (let i = 1; i < headingLevels.length; i++) { | |
| const jump = headingLevels[i] - headingLevels[i-1]; | |
| expect(jump).toBeLessThanOrEqual(2); | |
| } | |
| } | |
| }); | |
| test('homepage: no horizontal overflow at 375px', async ({ page }) => { | |
| await page.setViewportSize({ width: 375, height: 812 }); | |
| await page.goto('/'); | |
| await page.waitForTimeout(500); | |
| const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth); | |
| expect(scrollWidth).toBeLessThanOrEqual(385); | |
| }); | |
| }); | |
| test.describe('Structural - blog', () => { | |
| test('blog: reproduces GT semantic landmarks', async ({ page }) => { | |
| await page.goto('/blog/'); | |
| expect(await page.locator('footer, [role="contentinfo"]').first().count(), 'footer landmark present in GT').toBeGreaterThan(0); | |
| }); | |
| test('blog: heading hierarchy is valid', async ({ page }) => { | |
| await page.goto('/blog/'); | |
| const headingLevels = await page.evaluate(() => { | |
| const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); | |
| return Array.from(headings).map(h => parseInt(h.tagName.substring(1))); | |
| }); | |
| if (headingLevels.length > 1) { | |
| for (let i = 1; i < headingLevels.length; i++) { | |
| const jump = headingLevels[i] - headingLevels[i-1]; | |
| expect(jump).toBeLessThanOrEqual(2); | |
| } | |
| } | |
| }); | |
| test('blog: no horizontal overflow at 375px', async ({ page }) => { | |
| await page.setViewportSize({ width: 375, height: 812 }); | |
| await page.goto('/blog/'); | |
| await page.waitForTimeout(500); | |
| const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth); | |
| expect(scrollWidth).toBeLessThanOrEqual(385); | |
| }); | |
| }); | |
| test.describe('Structural - investors', () => { | |
| test('investors: reproduces GT semantic landmarks', async ({ page }) => { | |
| await page.goto('/investors/'); | |
| expect(await page.locator('footer, [role="contentinfo"]').first().count(), 'footer landmark present in GT').toBeGreaterThan(0); | |
| }); | |
| test('investors: heading hierarchy is valid', async ({ page }) => { | |
| await page.goto('/investors/'); | |
| const headingLevels = await page.evaluate(() => { | |
| const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); | |
| return Array.from(headings).map(h => parseInt(h.tagName.substring(1))); | |
| }); | |
| if (headingLevels.length > 1) { | |
| for (let i = 1; i < headingLevels.length; i++) { | |
| const jump = headingLevels[i] - headingLevels[i-1]; | |
| expect(jump).toBeLessThanOrEqual(2); | |
| } | |
| } | |
| }); | |
| test('investors: no horizontal overflow at 375px', async ({ page }) => { | |
| await page.setViewportSize({ width: 375, height: 812 }); | |
| await page.goto('/investors/'); | |
| await page.waitForTimeout(500); | |
| const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth); | |
| expect(scrollWidth).toBeLessThanOrEqual(385); | |
| }); | |
| }); | |
| test.describe('Structural - pricing', () => { | |
| test('pricing: reproduces GT semantic landmarks', async ({ page }) => { | |
| await page.goto('/pricing/'); | |
| expect(await page.locator('footer, [role="contentinfo"]').first().count(), 'footer landmark present in GT').toBeGreaterThan(0); | |
| }); | |
| test('pricing: heading hierarchy is valid', async ({ page }) => { | |
| await page.goto('/pricing/'); | |
| const headingLevels = await page.evaluate(() => { | |
| const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); | |
| return Array.from(headings).map(h => parseInt(h.tagName.substring(1))); | |
| }); | |
| if (headingLevels.length > 1) { | |
| for (let i = 1; i < headingLevels.length; i++) { | |
| const jump = headingLevels[i] - headingLevels[i-1]; | |
| expect(jump).toBeLessThanOrEqual(2); | |
| } | |
| } | |
| }); | |
| test('pricing: no horizontal overflow at 375px', async ({ page }) => { | |
| await page.setViewportSize({ width: 375, height: 812 }); | |
| await page.goto('/pricing/'); | |
| await page.waitForTimeout(500); | |
| const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth); | |
| expect(scrollWidth).toBeLessThanOrEqual(385); | |
| }); | |
| }); | |
| test.describe('Structural - privacy_policy', () => { | |
| test('privacy_policy: reproduces GT semantic landmarks', async ({ page }) => { | |
| await page.goto('/privacy-policy/'); | |
| expect(await page.locator('footer, [role="contentinfo"]').first().count(), 'footer landmark present in GT').toBeGreaterThan(0); | |
| }); | |
| test('privacy_policy: heading hierarchy is valid', async ({ page }) => { | |
| await page.goto('/privacy-policy/'); | |
| const headingLevels = await page.evaluate(() => { | |
| const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); | |
| return Array.from(headings).map(h => parseInt(h.tagName.substring(1))); | |
| }); | |
| if (headingLevels.length > 1) { | |
| for (let i = 1; i < headingLevels.length; i++) { | |
| const jump = headingLevels[i] - headingLevels[i-1]; | |
| expect(jump).toBeLessThanOrEqual(2); | |
| } | |
| } | |
| }); | |
| }); | |
| test.describe('Structural - sign_up', () => { | |
| test('sign_up: reproduces GT semantic landmarks', async ({ page }) => { | |
| await page.goto('/sign-up/'); | |
| expect(await page.locator('footer, [role="contentinfo"]').first().count(), 'footer landmark present in GT').toBeGreaterThan(0); | |
| }); | |
| test('sign_up: no horizontal overflow at 375px', async ({ page }) => { | |
| await page.setViewportSize({ width: 375, height: 812 }); | |
| await page.goto('/sign-up/'); | |
| await page.waitForTimeout(500); | |
| const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth); | |
| expect(scrollWidth).toBeLessThanOrEqual(385); | |
| }); | |
| }); | |
| test.describe('Structural - terms_of_service', () => { | |
| test('terms_of_service: reproduces GT semantic landmarks', async ({ page }) => { | |
| await page.goto('/terms-of-service/'); | |
| expect(await page.locator('footer, [role="contentinfo"]').first().count(), 'footer landmark present in GT').toBeGreaterThan(0); | |
| }); | |
| test('terms_of_service: heading hierarchy is valid', async ({ page }) => { | |
| await page.goto('/terms-of-service/'); | |
| const headingLevels = await page.evaluate(() => { | |
| const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); | |
| return Array.from(headings).map(h => parseInt(h.tagName.substring(1))); | |
| }); | |
| if (headingLevels.length > 1) { | |
| for (let i = 1; i < headingLevels.length; i++) { | |
| const jump = headingLevels[i] - headingLevels[i-1]; | |
| expect(jump).toBeLessThanOrEqual(2); | |
| } | |
| } | |
| }); | |
| test('terms_of_service: no horizontal overflow at 375px', async ({ page }) => { | |
| await page.setViewportSize({ width: 375, height: 812 }); | |
| await page.goto('/terms-of-service/'); | |
| await page.waitForTimeout(500); | |
| const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth); | |
| expect(scrollWidth).toBeLessThanOrEqual(385); | |
| }); | |
| }); | |
| test.describe('Structural - updates', () => { | |
| test('updates: reproduces GT semantic landmarks', async ({ page }) => { | |
| await page.goto('/updates/'); | |
| expect(await page.locator('footer, [role="contentinfo"]').first().count(), 'footer landmark present in GT').toBeGreaterThan(0); | |
| }); | |
| test('updates: heading hierarchy is valid', async ({ page }) => { | |
| await page.goto('/updates/'); | |
| const headingLevels = await page.evaluate(() => { | |
| const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); | |
| return Array.from(headings).map(h => parseInt(h.tagName.substring(1))); | |
| }); | |
| if (headingLevels.length > 1) { | |
| for (let i = 1; i < headingLevels.length; i++) { | |
| const jump = headingLevels[i] - headingLevels[i-1]; | |
| expect(jump).toBeLessThanOrEqual(2); | |
| } | |
| } | |
| }); | |
| test('updates: no horizontal overflow at 375px', async ({ page }) => { | |
| await page.setViewportSize({ width: 375, height: 812 }); | |
| await page.goto('/updates/'); | |
| await page.waitForTimeout(500); | |
| const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth); | |
| expect(scrollWidth).toBeLessThanOrEqual(385); | |
| }); | |
| }); | |
| test.describe('Structural - vs_heroku', () => { | |
| test('vs_heroku: reproduces GT semantic landmarks', async ({ page }) => { | |
| await page.goto('/vs-heroku/'); | |
| expect(await page.locator('footer, [role="contentinfo"]').first().count(), 'footer landmark present in GT').toBeGreaterThan(0); | |
| }); | |
| test('vs_heroku: heading hierarchy is valid', async ({ page }) => { | |
| await page.goto('/vs-heroku/'); | |
| const headingLevels = await page.evaluate(() => { | |
| const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); | |
| return Array.from(headings).map(h => parseInt(h.tagName.substring(1))); | |
| }); | |
| if (headingLevels.length > 1) { | |
| for (let i = 1; i < headingLevels.length; i++) { | |
| const jump = headingLevels[i] - headingLevels[i-1]; | |
| expect(jump).toBeLessThanOrEqual(2); | |
| } | |
| } | |
| }); | |
| test('vs_heroku: no horizontal overflow at 375px', async ({ page }) => { | |
| await page.setViewportSize({ width: 375, height: 812 }); | |
| await page.goto('/vs-heroku/'); | |
| await page.waitForTimeout(500); | |
| const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth); | |
| expect(scrollWidth).toBeLessThanOrEqual(385); | |
| }); | |
| }); | |
| test.describe('Structural - posts_6_command_line_tools_all_experts_know', () => { | |
| test('posts_6_command_line_tools_all_experts_know: reproduces GT semantic landmarks', async ({ page }) => { | |
| await page.goto('/posts/6-command-line-tools-all-experts-know/'); | |
| expect(await page.locator('footer, [role="contentinfo"]').first().count(), 'footer landmark present in GT').toBeGreaterThan(0); | |
| }); | |
| test('posts_6_command_line_tools_all_experts_know: heading hierarchy is valid', async ({ page }) => { | |
| await page.goto('/posts/6-command-line-tools-all-experts-know/'); | |
| const headingLevels = await page.evaluate(() => { | |
| const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); | |
| return Array.from(headings).map(h => parseInt(h.tagName.substring(1))); | |
| }); | |
| if (headingLevels.length > 1) { | |
| for (let i = 1; i < headingLevels.length; i++) { | |
| const jump = headingLevels[i] - headingLevels[i-1]; | |
| expect(jump).toBeLessThanOrEqual(2); | |
| } | |
| } | |
| }); | |
| test('posts_6_command_line_tools_all_experts_know: no horizontal overflow at 375px', async ({ page }) => { | |
| await page.setViewportSize({ width: 375, height: 812 }); | |
| await page.goto('/posts/6-command-line-tools-all-experts-know/'); | |
| await page.waitForTimeout(500); | |
| const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth); | |
| expect(scrollWidth).toBeLessThanOrEqual(385); | |
| }); | |
| }); | |
| test.describe('Structural - posts_aws_budget_alerts_based_on_cost', () => { | |
| test('posts_aws_budget_alerts_based_on_cost: reproduces GT semantic landmarks', async ({ page }) => { | |
| await page.goto('/posts/aws-budget-alerts-based-on-cost/'); | |
| expect(await page.locator('footer, [role="contentinfo"]').first().count(), 'footer landmark present in GT').toBeGreaterThan(0); | |
| }); | |
| test('posts_aws_budget_alerts_based_on_cost: heading hierarchy is valid', async ({ page }) => { | |
| await page.goto('/posts/aws-budget-alerts-based-on-cost/'); | |
| const headingLevels = await page.evaluate(() => { | |
| const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); | |
| return Array.from(headings).map(h => parseInt(h.tagName.substring(1))); | |
| }); | |
| if (headingLevels.length > 1) { | |
| for (let i = 1; i < headingLevels.length; i++) { | |
| const jump = headingLevels[i] - headingLevels[i-1]; | |
| expect(jump).toBeLessThanOrEqual(2); | |
| } | |
| } | |
| }); | |
| test('posts_aws_budget_alerts_based_on_cost: no horizontal overflow at 375px', async ({ page }) => { | |
| await page.setViewportSize({ width: 375, height: 812 }); | |
| await page.goto('/posts/aws-budget-alerts-based-on-cost/'); | |
| await page.waitForTimeout(500); | |
| const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth); | |
| expect(scrollWidth).toBeLessThanOrEqual(385); | |
| }); | |
| }); | |
| test.describe('Structural - posts_aws_s3_why_sometimes_you_should_press_the_100k_dollar_button', () => { | |
| test('posts_aws_s3_why_sometimes_you_should_press_the_100k_dollar_button: reproduces GT semantic landmarks', async ({ page }) => { | |
| await page.goto('/posts/aws-s3-why-sometimes-you-should-press-the-100k-dollar-button/'); | |
| expect(await page.locator('footer, [role="contentinfo"]').first().count(), 'footer landmark present in GT').toBeGreaterThan(0); | |
| }); | |
| test('posts_aws_s3_why_sometimes_you_should_press_the_100k_dollar_button: heading hierarchy is valid', async ({ page }) => { | |
| await page.goto('/posts/aws-s3-why-sometimes-you-should-press-the-100k-dollar-button/'); | |
| const headingLevels = await page.evaluate(() => { | |
| const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); | |
| return Array.from(headings).map(h => parseInt(h.tagName.substring(1))); | |
| }); | |
| if (headingLevels.length > 1) { | |
| for (let i = 1; i < headingLevels.length; i++) { | |
| const jump = headingLevels[i] - headingLevels[i-1]; | |
| expect(jump).toBeLessThanOrEqual(2); | |
| } | |
| } | |
| }); | |
| test('posts_aws_s3_why_sometimes_you_should_press_the_100k_dollar_button: no horizontal overflow at 375px', async ({ page }) => { | |
| await page.setViewportSize({ width: 375, height: 812 }); | |
| await page.goto('/posts/aws-s3-why-sometimes-you-should-press-the-100k-dollar-button/'); | |
| await page.waitForTimeout(500); | |
| const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth); | |
| expect(scrollWidth).toBeLessThanOrEqual(385); | |
| }); | |
| }); | |
| test.describe('Structural - posts_aws_tools_suck', () => { | |
| test('posts_aws_tools_suck: reproduces GT semantic landmarks', async ({ page }) => { | |
| await page.goto('/posts/aws-tools-suck/'); | |
| expect(await page.locator('footer, [role="contentinfo"]').first().count(), 'footer landmark present in GT').toBeGreaterThan(0); | |
| }); | |
| test('posts_aws_tools_suck: heading hierarchy is valid', async ({ page }) => { | |
| await page.goto('/posts/aws-tools-suck/'); | |
| const headingLevels = await page.evaluate(() => { | |
| const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); | |
| return Array.from(headings).map(h => parseInt(h.tagName.substring(1))); | |
| }); | |
| if (headingLevels.length > 1) { | |
| for (let i = 1; i < headingLevels.length; i++) { | |
| const jump = headingLevels[i] - headingLevels[i-1]; | |
| expect(jump).toBeLessThanOrEqual(2); | |
| } | |
| } | |
| }); | |
| test('posts_aws_tools_suck: no horizontal overflow at 375px', async ({ page }) => { | |
| await page.setViewportSize({ width: 375, height: 812 }); | |
| await page.goto('/posts/aws-tools-suck/'); | |
| await page.waitForTimeout(500); | |
| const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth); | |
| expect(scrollWidth).toBeLessThanOrEqual(385); | |
| }); | |
| }); | |
| test.describe('Structural - posts_build_a_linktree_clone_on_nimbric', () => { | |
| test('posts_build_a_linktree_clone_on_nimbric: reproduces GT semantic landmarks', async ({ page }) => { | |
| await page.goto('/posts/build-a-linktree-clone-on-nimbric/'); | |
| expect(await page.locator('footer, [role="contentinfo"]').first().count(), 'footer landmark present in GT').toBeGreaterThan(0); | |
| }); | |
| test('posts_build_a_linktree_clone_on_nimbric: heading hierarchy is valid', async ({ page }) => { | |
| await page.goto('/posts/build-a-linktree-clone-on-nimbric/'); | |
| const headingLevels = await page.evaluate(() => { | |
| const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); | |
| return Array.from(headings).map(h => parseInt(h.tagName.substring(1))); | |
| }); | |
| if (headingLevels.length > 1) { | |
| for (let i = 1; i < headingLevels.length; i++) { | |
| const jump = headingLevels[i] - headingLevels[i-1]; | |
| expect(jump).toBeLessThanOrEqual(2); | |
| } | |
| } | |
| }); | |
| test('posts_build_a_linktree_clone_on_nimbric: no horizontal overflow at 375px', async ({ page }) => { | |
| await page.setViewportSize({ width: 375, height: 812 }); | |
| await page.goto('/posts/build-a-linktree-clone-on-nimbric/'); | |
| await page.waitForTimeout(500); | |
| const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth); | |
| expect(scrollWidth).toBeLessThanOrEqual(385); | |
| }); | |
| }); | |
| test.describe('Structural - posts_common_mistakes_for_first_time_deploy', () => { | |
| test('posts_common_mistakes_for_first_time_deploy: reproduces GT semantic landmarks', async ({ page }) => { | |
| await page.goto('/posts/common-mistakes-for-first-time-deploy/'); | |
| expect(await page.locator('footer, [role="contentinfo"]').first().count(), 'footer landmark present in GT').toBeGreaterThan(0); | |
| }); | |
| test('posts_common_mistakes_for_first_time_deploy: heading hierarchy is valid', async ({ page }) => { | |
| await page.goto('/posts/common-mistakes-for-first-time-deploy/'); | |
| const headingLevels = await page.evaluate(() => { | |
| const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); | |
| return Array.from(headings).map(h => parseInt(h.tagName.substring(1))); | |
| }); | |
| if (headingLevels.length > 1) { | |
| for (let i = 1; i < headingLevels.length; i++) { | |
| const jump = headingLevels[i] - headingLevels[i-1]; | |
| expect(jump).toBeLessThanOrEqual(2); | |
| } | |
| } | |
| }); | |
| test('posts_common_mistakes_for_first_time_deploy: no horizontal overflow at 375px', async ({ page }) => { | |
| await page.setViewportSize({ width: 375, height: 812 }); | |
| await page.goto('/posts/common-mistakes-for-first-time-deploy/'); | |
| await page.waitForTimeout(500); | |
| const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth); | |
| expect(scrollWidth).toBeLessThanOrEqual(385); | |
| }); | |
| }); | |
| test.describe('Structural - posts_considerations_for_serverless_active_active_routing', () => { | |
| test('posts_considerations_for_serverless_active_active_routing: reproduces GT semantic landmarks', async ({ page }) => { | |
| await page.goto('/posts/considerations-for-serverless-active-active-routing/'); | |
| expect(await page.locator('footer, [role="contentinfo"]').first().count(), 'footer landmark present in GT').toBeGreaterThan(0); | |
| }); | |
| test('posts_considerations_for_serverless_active_active_routing: heading hierarchy is valid', async ({ page }) => { | |
| await page.goto('/posts/considerations-for-serverless-active-active-routing/'); | |
| const headingLevels = await page.evaluate(() => { | |
| const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); | |
| return Array.from(headings).map(h => parseInt(h.tagName.substring(1))); | |
| }); | |
| if (headingLevels.length > 1) { | |
| for (let i = 1; i < headingLevels.length; i++) { | |
| const jump = headingLevels[i] - headingLevels[i-1]; | |
| expect(jump).toBeLessThanOrEqual(2); | |
| } | |
| } | |
| }); | |
| }); | |
| test.describe('Structural - posts_nimbric_is_shutting_down', () => { | |
| test('posts_nimbric_is_shutting_down: reproduces GT semantic landmarks', async ({ page }) => { | |
| await page.goto('/posts/nimbric-is-shutting-down/'); | |
| expect(await page.locator('footer, [role="contentinfo"]').first().count(), 'footer landmark present in GT').toBeGreaterThan(0); | |
| }); | |
| test('posts_nimbric_is_shutting_down: heading hierarchy is valid', async ({ page }) => { | |
| await page.goto('/posts/nimbric-is-shutting-down/'); | |
| const headingLevels = await page.evaluate(() => { | |
| const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); | |
| return Array.from(headings).map(h => parseInt(h.tagName.substring(1))); | |
| }); | |
| if (headingLevels.length > 1) { | |
| for (let i = 1; i < headingLevels.length; i++) { | |
| const jump = headingLevels[i] - headingLevels[i-1]; | |
| expect(jump).toBeLessThanOrEqual(2); | |
| } | |
| } | |
| }); | |
| test('posts_nimbric_is_shutting_down: no horizontal overflow at 375px', async ({ page }) => { | |
| await page.setViewportSize({ width: 375, height: 812 }); | |
| await page.goto('/posts/nimbric-is-shutting-down/'); | |
| await page.waitForTimeout(500); | |
| const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth); | |
| expect(scrollWidth).toBeLessThanOrEqual(385); | |
| }); | |
| }); | |
| test.describe('Structural - posts_dads_advice_for_how_to_live', () => { | |
| test('posts_dads_advice_for_how_to_live: reproduces GT semantic landmarks', async ({ page }) => { | |
| await page.goto('/posts/dads-advice-for-how-to-live/'); | |
| expect(await page.locator('footer, [role="contentinfo"]').first().count(), 'footer landmark present in GT').toBeGreaterThan(0); | |
| }); | |
| test('posts_dads_advice_for_how_to_live: heading hierarchy is valid', async ({ page }) => { | |
| await page.goto('/posts/dads-advice-for-how-to-live/'); | |
| const headingLevels = await page.evaluate(() => { | |
| const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); | |
| return Array.from(headings).map(h => parseInt(h.tagName.substring(1))); | |
| }); | |
| if (headingLevels.length > 1) { | |
| for (let i = 1; i < headingLevels.length; i++) { | |
| const jump = headingLevels[i] - headingLevels[i-1]; | |
| expect(jump).toBeLessThanOrEqual(2); | |
| } | |
| } | |
| }); | |
| test('posts_dads_advice_for_how_to_live: no horizontal overflow at 375px', async ({ page }) => { | |
| await page.setViewportSize({ width: 375, height: 812 }); | |
| await page.goto('/posts/dads-advice-for-how-to-live/'); | |
| await page.waitForTimeout(500); | |
| const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth); | |
| expect(scrollWidth).toBeLessThanOrEqual(385); | |
| }); | |
| }); | |
| test.describe('Structural - posts_deploying_static_sites', () => { | |
| test('posts_deploying_static_sites: reproduces GT semantic landmarks', async ({ page }) => { | |
| await page.goto('/posts/deploying-static-sites/'); | |
| expect(await page.locator('footer, [role="contentinfo"]').first().count(), 'footer landmark present in GT').toBeGreaterThan(0); | |
| }); | |
| test('posts_deploying_static_sites: heading hierarchy is valid', async ({ page }) => { | |
| await page.goto('/posts/deploying-static-sites/'); | |
| const headingLevels = await page.evaluate(() => { | |
| const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); | |
| return Array.from(headings).map(h => parseInt(h.tagName.substring(1))); | |
| }); | |
| if (headingLevels.length > 1) { | |
| for (let i = 1; i < headingLevels.length; i++) { | |
| const jump = headingLevels[i] - headingLevels[i-1]; | |
| expect(jump).toBeLessThanOrEqual(2); | |
| } | |
| } | |
| }); | |
| test('posts_deploying_static_sites: no horizontal overflow at 375px', async ({ page }) => { | |
| await page.setViewportSize({ width: 375, height: 812 }); | |
| await page.goto('/posts/deploying-static-sites/'); | |
| await page.waitForTimeout(500); | |
| const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth); | |
| expect(scrollWidth).toBeLessThanOrEqual(385); | |
| }); | |
| }); | |
| test.describe('Structural - posts_how_a_phishing_scampage_works', () => { | |
| test('posts_how_a_phishing_scampage_works: reproduces GT semantic landmarks', async ({ page }) => { | |
| await page.goto('/posts/how-a-phishing-scampage-works/'); | |
| expect(await page.locator('footer, [role="contentinfo"]').first().count(), 'footer landmark present in GT').toBeGreaterThan(0); | |
| }); | |
| test('posts_how_a_phishing_scampage_works: heading hierarchy is valid', async ({ page }) => { | |
| await page.goto('/posts/how-a-phishing-scampage-works/'); | |
| const headingLevels = await page.evaluate(() => { | |
| const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); | |
| return Array.from(headings).map(h => parseInt(h.tagName.substring(1))); | |
| }); | |
| if (headingLevels.length > 1) { | |
| for (let i = 1; i < headingLevels.length; i++) { | |
| const jump = headingLevels[i] - headingLevels[i-1]; | |
| expect(jump).toBeLessThanOrEqual(2); | |
| } | |
| } | |
| }); | |
| test('posts_how_a_phishing_scampage_works: no horizontal overflow at 375px', async ({ page }) => { | |
| await page.setViewportSize({ width: 375, height: 812 }); | |
| await page.goto('/posts/how-a-phishing-scampage-works/'); | |
| await page.waitForTimeout(500); | |
| const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth); | |
| expect(scrollWidth).toBeLessThanOrEqual(385); | |
| }); | |
| }); | |
| test.describe('Structural - posts_how_to_build_a_telegram_bot', () => { | |
| test('posts_how_to_build_a_telegram_bot: reproduces GT semantic landmarks', async ({ page }) => { | |
| await page.goto('/posts/how-to-build-a-telegram-bot/'); | |
| expect(await page.locator('footer, [role="contentinfo"]').first().count(), 'footer landmark present in GT').toBeGreaterThan(0); | |
| }); | |
| test('posts_how_to_build_a_telegram_bot: heading hierarchy is valid', async ({ page }) => { | |
| await page.goto('/posts/how-to-build-a-telegram-bot/'); | |
| const headingLevels = await page.evaluate(() => { | |
| const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); | |
| return Array.from(headings).map(h => parseInt(h.tagName.substring(1))); | |
| }); | |
| if (headingLevels.length > 1) { | |
| for (let i = 1; i < headingLevels.length; i++) { | |
| const jump = headingLevels[i] - headingLevels[i-1]; | |
| expect(jump).toBeLessThanOrEqual(2); | |
| } | |
| } | |
| }); | |
| test('posts_how_to_build_a_telegram_bot: no horizontal overflow at 375px', async ({ page }) => { | |
| await page.setViewportSize({ width: 375, height: 812 }); | |
| await page.goto('/posts/how-to-build-a-telegram-bot/'); | |
| await page.waitForTimeout(500); | |
| const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth); | |
| expect(scrollWidth).toBeLessThanOrEqual(385); | |
| }); | |
| }); | |
| test.describe('Structural - posts_how_to_debug', () => { | |
| test('posts_how_to_debug: reproduces GT semantic landmarks', async ({ page }) => { | |
| await page.goto('/posts/how-to-debug/'); | |
| expect(await page.locator('footer, [role="contentinfo"]').first().count(), 'footer landmark present in GT').toBeGreaterThan(0); | |
| }); | |
| test('posts_how_to_debug: heading hierarchy is valid', async ({ page }) => { | |
| await page.goto('/posts/how-to-debug/'); | |
| const headingLevels = await page.evaluate(() => { | |
| const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); | |
| return Array.from(headings).map(h => parseInt(h.tagName.substring(1))); | |
| }); | |
| if (headingLevels.length > 1) { | |
| for (let i = 1; i < headingLevels.length; i++) { | |
| const jump = headingLevels[i] - headingLevels[i-1]; | |
| expect(jump).toBeLessThanOrEqual(2); | |
| } | |
| } | |
| }); | |
| test('posts_how_to_debug: no horizontal overflow at 375px', async ({ page }) => { | |
| await page.setViewportSize({ width: 375, height: 812 }); | |
| await page.goto('/posts/how-to-debug/'); | |
| await page.waitForTimeout(500); | |
| const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth); | |
| expect(scrollWidth).toBeLessThanOrEqual(385); | |
| }); | |
| }); | |
| test.describe('Structural - posts_how_to_fail_at_serverless_serverless_is_stateless', () => { | |
| test('posts_how_to_fail_at_serverless_serverless_is_stateless: reproduces GT semantic landmarks', async ({ page }) => { | |
| await page.goto('/posts/how-to-fail-at-serverless-serverless-is-stateless/'); | |
| expect(await page.locator('footer, [role="contentinfo"]').first().count(), 'footer landmark present in GT').toBeGreaterThan(0); | |
| }); | |
| test('posts_how_to_fail_at_serverless_serverless_is_stateless: heading hierarchy is valid', async ({ page }) => { | |
| await page.goto('/posts/how-to-fail-at-serverless-serverless-is-stateless/'); | |
| const headingLevels = await page.evaluate(() => { | |
| const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); | |
| return Array.from(headings).map(h => parseInt(h.tagName.substring(1))); | |
| }); | |
| if (headingLevels.length > 1) { | |
| for (let i = 1; i < headingLevels.length; i++) { | |
| const jump = headingLevels[i] - headingLevels[i-1]; | |
| expect(jump).toBeLessThanOrEqual(2); | |
| } | |
| } | |
| }); | |
| test('posts_how_to_fail_at_serverless_serverless_is_stateless: no horizontal overflow at 375px', async ({ page }) => { | |
| await page.setViewportSize({ width: 375, height: 812 }); | |
| await page.goto('/posts/how-to-fail-at-serverless-serverless-is-stateless/'); | |
| await page.waitForTimeout(500); | |
| const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth); | |
| expect(scrollWidth).toBeLessThanOrEqual(385); | |
| }); | |
| }); | |
| test.describe('Structural - posts_how_to_get_your_first_developer_job', () => { | |
| test('posts_how_to_get_your_first_developer_job: reproduces GT semantic landmarks', async ({ page }) => { | |
| await page.goto('/posts/how-to-get-your-first-developer-job/'); | |
| expect(await page.locator('footer, [role="contentinfo"]').first().count(), 'footer landmark present in GT').toBeGreaterThan(0); | |
| }); | |
| test('posts_how_to_get_your_first_developer_job: heading hierarchy is valid', async ({ page }) => { | |
| await page.goto('/posts/how-to-get-your-first-developer-job/'); | |
| const headingLevels = await page.evaluate(() => { | |
| const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); | |
| return Array.from(headings).map(h => parseInt(h.tagName.substring(1))); | |
| }); | |
| if (headingLevels.length > 1) { | |
| for (let i = 1; i < headingLevels.length; i++) { | |
| const jump = headingLevels[i] - headingLevels[i-1]; | |
| expect(jump).toBeLessThanOrEqual(2); | |
| } | |
| } | |
| }); | |
| test('posts_how_to_get_your_first_developer_job: no horizontal overflow at 375px', async ({ page }) => { | |
| await page.setViewportSize({ width: 375, height: 812 }); | |
| await page.goto('/posts/how-to-get-your-first-developer-job/'); | |
| await page.waitForTimeout(500); | |
| const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth); | |
| expect(scrollWidth).toBeLessThanOrEqual(385); | |
| }); | |
| }); | |
| test.describe('Structural - posts_how_to_go_from_0_to_1', () => { | |
| test('posts_how_to_go_from_0_to_1: reproduces GT semantic landmarks', async ({ page }) => { | |
| await page.goto('/posts/how-to-go-from-0-to-1/'); | |
| expect(await page.locator('footer, [role="contentinfo"]').first().count(), 'footer landmark present in GT').toBeGreaterThan(0); | |
| }); | |
| test('posts_how_to_go_from_0_to_1: heading hierarchy is valid', async ({ page }) => { | |
| await page.goto('/posts/how-to-go-from-0-to-1/'); | |
| const headingLevels = await page.evaluate(() => { | |
| const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); | |
| return Array.from(headings).map(h => parseInt(h.tagName.substring(1))); | |
| }); | |
| if (headingLevels.length > 1) { | |
| for (let i = 1; i < headingLevels.length; i++) { | |
| const jump = headingLevels[i] - headingLevels[i-1]; | |
| expect(jump).toBeLessThanOrEqual(2); | |
| } | |
| } | |
| }); | |
| test('posts_how_to_go_from_0_to_1: no horizontal overflow at 375px', async ({ page }) => { | |
| await page.setViewportSize({ width: 375, height: 812 }); | |
| await page.goto('/posts/how-to-go-from-0-to-1/'); | |
| await page.waitForTimeout(500); | |
| const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth); | |
| expect(scrollWidth).toBeLessThanOrEqual(385); | |
| }); | |
| }); | |
| test.describe('Structural - posts_how_to_pass_9_aws_certifications_in_14_months', () => { | |
| test('posts_how_to_pass_9_aws_certifications_in_14_months: reproduces GT semantic landmarks', async ({ page }) => { | |
| await page.goto('/posts/how-to-pass-9-aws-certifications-in-14-months/'); | |
| expect(await page.locator('footer, [role="contentinfo"]').first().count(), 'footer landmark present in GT').toBeGreaterThan(0); | |
| }); | |
| test('posts_how_to_pass_9_aws_certifications_in_14_months: heading hierarchy is valid', async ({ page }) => { | |
| await page.goto('/posts/how-to-pass-9-aws-certifications-in-14-months/'); | |
| const headingLevels = await page.evaluate(() => { | |
| const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); | |
| return Array.from(headings).map(h => parseInt(h.tagName.substring(1))); | |
| }); | |
| if (headingLevels.length > 1) { | |
| for (let i = 1; i < headingLevels.length; i++) { | |
| const jump = headingLevels[i] - headingLevels[i-1]; | |
| expect(jump).toBeLessThanOrEqual(2); | |
| } | |
| } | |
| }); | |
| test('posts_how_to_pass_9_aws_certifications_in_14_months: no horizontal overflow at 375px', async ({ page }) => { | |
| await page.setViewportSize({ width: 375, height: 812 }); | |
| await page.goto('/posts/how-to-pass-9-aws-certifications-in-14-months/'); | |
| await page.waitForTimeout(500); | |
| const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth); | |
| expect(scrollWidth).toBeLessThanOrEqual(385); | |
| }); | |
| }); | |
| test.describe('Structural - posts_its_always_sunny_in_us_east_1', () => { | |
| test('posts_its_always_sunny_in_us_east_1: reproduces GT semantic landmarks', async ({ page }) => { | |
| await page.goto('/posts/its-always-sunny-in-us-east-1/'); | |
| expect(await page.locator('footer, [role="contentinfo"]').first().count(), 'footer landmark present in GT').toBeGreaterThan(0); | |
| }); | |
| test('posts_its_always_sunny_in_us_east_1: heading hierarchy is valid', async ({ page }) => { | |
| await page.goto('/posts/its-always-sunny-in-us-east-1/'); | |
| const headingLevels = await page.evaluate(() => { | |
| const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); | |
| return Array.from(headings).map(h => parseInt(h.tagName.substring(1))); | |
| }); | |
| if (headingLevels.length > 1) { | |
| for (let i = 1; i < headingLevels.length; i++) { | |
| const jump = headingLevels[i] - headingLevels[i-1]; | |
| expect(jump).toBeLessThanOrEqual(2); | |
| } | |
| } | |
| }); | |
| test('posts_its_always_sunny_in_us_east_1: no horizontal overflow at 375px', async ({ page }) => { | |
| await page.setViewportSize({ width: 375, height: 812 }); | |
| await page.goto('/posts/its-always-sunny-in-us-east-1/'); | |
| await page.waitForTimeout(500); | |
| const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth); | |
| expect(scrollWidth).toBeLessThanOrEqual(385); | |
| }); | |
| }); | |
| test.describe('Structural - posts_managing_service_account_credentials_json_files', () => { | |
| test('posts_managing_service_account_credentials_json_files: reproduces GT semantic landmarks', async ({ page }) => { | |
| await page.goto('/posts/managing-service-account-credentials-json-files/'); | |
| expect(await page.locator('footer, [role="contentinfo"]').first().count(), 'footer landmark present in GT').toBeGreaterThan(0); | |
| }); | |
| test('posts_managing_service_account_credentials_json_files: heading hierarchy is valid', async ({ page }) => { | |
| await page.goto('/posts/managing-service-account-credentials-json-files/'); | |
| const headingLevels = await page.evaluate(() => { | |
| const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); | |
| return Array.from(headings).map(h => parseInt(h.tagName.substring(1))); | |
| }); | |
| if (headingLevels.length > 1) { | |
| for (let i = 1; i < headingLevels.length; i++) { | |
| const jump = headingLevels[i] - headingLevels[i-1]; | |
| expect(jump).toBeLessThanOrEqual(2); | |
| } | |
| } | |
| }); | |
| test('posts_managing_service_account_credentials_json_files: no horizontal overflow at 375px', async ({ page }) => { | |
| await page.setViewportSize({ width: 375, height: 812 }); | |
| await page.goto('/posts/managing-service-account-credentials-json-files/'); | |
| await page.waitForTimeout(500); | |
| const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth); | |
| expect(scrollWidth).toBeLessThanOrEqual(385); | |
| }); | |
| }); | |
| test.describe('Structural - posts_take_your_file_system_to_the_cloud', () => { | |
| test('posts_take_your_file_system_to_the_cloud: reproduces GT semantic landmarks', async ({ page }) => { | |
| await page.goto('/posts/take-your-file-system-to-the-cloud/'); | |
| expect(await page.locator('footer, [role="contentinfo"]').first().count(), 'footer landmark present in GT').toBeGreaterThan(0); | |
| }); | |
| test('posts_take_your_file_system_to_the_cloud: heading hierarchy is valid', async ({ page }) => { | |
| await page.goto('/posts/take-your-file-system-to-the-cloud/'); | |
| const headingLevels = await page.evaluate(() => { | |
| const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); | |
| return Array.from(headings).map(h => parseInt(h.tagName.substring(1))); | |
| }); | |
| if (headingLevels.length > 1) { | |
| for (let i = 1; i < headingLevels.length; i++) { | |
| const jump = headingLevels[i] - headingLevels[i-1]; | |
| expect(jump).toBeLessThanOrEqual(2); | |
| } | |
| } | |
| }); | |
| test('posts_take_your_file_system_to_the_cloud: no horizontal overflow at 375px', async ({ page }) => { | |
| await page.setViewportSize({ width: 375, height: 812 }); | |
| await page.goto('/posts/take-your-file-system-to-the-cloud/'); | |
| await page.waitForTimeout(500); | |
| const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth); | |
| expect(scrollWidth).toBeLessThanOrEqual(385); | |
| }); | |
| }); | |
| test.describe('Structural - posts_technical_debt_a_field_guide', () => { | |
| test('posts_technical_debt_a_field_guide: reproduces GT semantic landmarks', async ({ page }) => { | |
| await page.goto('/posts/technical-debt-a-field-guide/'); | |
| expect(await page.locator('footer, [role="contentinfo"]').first().count(), 'footer landmark present in GT').toBeGreaterThan(0); | |
| }); | |
| test('posts_technical_debt_a_field_guide: no horizontal overflow at 375px', async ({ page }) => { | |
| await page.setViewportSize({ width: 375, height: 812 }); | |
| await page.goto('/posts/technical-debt-a-field-guide/'); | |
| await page.waitForTimeout(500); | |
| const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth); | |
| expect(scrollWidth).toBeLessThanOrEqual(385); | |
| }); | |
| }); | |
| test.describe('Structural - posts_the_unbuilt_software_trap', () => { | |
| test('posts_the_unbuilt_software_trap: reproduces GT semantic landmarks', async ({ page }) => { | |
| await page.goto('/posts/the-unbuilt-software-trap/'); | |
| expect(await page.locator('footer, [role="contentinfo"]').first().count(), 'footer landmark present in GT').toBeGreaterThan(0); | |
| }); | |
| test('posts_the_unbuilt_software_trap: heading hierarchy is valid', async ({ page }) => { | |
| await page.goto('/posts/the-unbuilt-software-trap/'); | |
| const headingLevels = await page.evaluate(() => { | |
| const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); | |
| return Array.from(headings).map(h => parseInt(h.tagName.substring(1))); | |
| }); | |
| if (headingLevels.length > 1) { | |
| for (let i = 1; i < headingLevels.length; i++) { | |
| const jump = headingLevels[i] - headingLevels[i-1]; | |
| expect(jump).toBeLessThanOrEqual(2); | |
| } | |
| } | |
| }); | |
| test('posts_the_unbuilt_software_trap: no horizontal overflow at 375px', async ({ page }) => { | |
| await page.setViewportSize({ width: 375, height: 812 }); | |
| await page.goto('/posts/the-unbuilt-software-trap/'); | |
| await page.waitForTimeout(500); | |
| const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth); | |
| expect(scrollWidth).toBeLessThanOrEqual(385); | |
| }); | |
| }); | |
| test.describe('Structural - posts_the_vc_business_model_and_why_vcs_invest', () => { | |
| test('posts_the_vc_business_model_and_why_vcs_invest: reproduces GT semantic landmarks', async ({ page }) => { | |
| await page.goto('/posts/the-vc-business-model-and-why-vcs-invest/'); | |
| expect(await page.locator('footer, [role="contentinfo"]').first().count(), 'footer landmark present in GT').toBeGreaterThan(0); | |
| }); | |
| test('posts_the_vc_business_model_and_why_vcs_invest: heading hierarchy is valid', async ({ page }) => { | |
| await page.goto('/posts/the-vc-business-model-and-why-vcs-invest/'); | |
| const headingLevels = await page.evaluate(() => { | |
| const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); | |
| return Array.from(headings).map(h => parseInt(h.tagName.substring(1))); | |
| }); | |
| if (headingLevels.length > 1) { | |
| for (let i = 1; i < headingLevels.length; i++) { | |
| const jump = headingLevels[i] - headingLevels[i-1]; | |
| expect(jump).toBeLessThanOrEqual(2); | |
| } | |
| } | |
| }); | |
| test('posts_the_vc_business_model_and_why_vcs_invest: no horizontal overflow at 375px', async ({ page }) => { | |
| await page.setViewportSize({ width: 375, height: 812 }); | |
| await page.goto('/posts/the-vc-business-model-and-why-vcs-invest/'); | |
| await page.waitForTimeout(500); | |
| const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth); | |
| expect(scrollWidth).toBeLessThanOrEqual(385); | |
| }); | |
| }); | |
| test.describe('Structural - posts_users_are_the_best_feature', () => { | |
| test('posts_users_are_the_best_feature: reproduces GT semantic landmarks', async ({ page }) => { | |
| await page.goto('/posts/users-are-the-best-feature/'); | |
| expect(await page.locator('footer, [role="contentinfo"]').first().count(), 'footer landmark present in GT').toBeGreaterThan(0); | |
| }); | |
| test('posts_users_are_the_best_feature: no horizontal overflow at 375px', async ({ page }) => { | |
| await page.setViewportSize({ width: 375, height: 812 }); | |
| await page.goto('/posts/users-are-the-best-feature/'); | |
| await page.waitForTimeout(500); | |
| const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth); | |
| expect(scrollWidth).toBeLessThanOrEqual(385); | |
| }); | |
| }); | |
| test.describe('Structural - posts_we_sound_like_idiots_when_we_talk_about_technical_debt', () => { | |
| test('posts_we_sound_like_idiots_when_we_talk_about_technical_debt: reproduces GT semantic landmarks', async ({ page }) => { | |
| await page.goto('/posts/we-sound-like-idiots-when-we-talk-about-technical-debt/'); | |
| expect(await page.locator('footer, [role="contentinfo"]').first().count(), 'footer landmark present in GT').toBeGreaterThan(0); | |
| }); | |
| test('posts_we_sound_like_idiots_when_we_talk_about_technical_debt: heading hierarchy is valid', async ({ page }) => { | |
| await page.goto('/posts/we-sound-like-idiots-when-we-talk-about-technical-debt/'); | |
| const headingLevels = await page.evaluate(() => { | |
| const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); | |
| return Array.from(headings).map(h => parseInt(h.tagName.substring(1))); | |
| }); | |
| if (headingLevels.length > 1) { | |
| for (let i = 1; i < headingLevels.length; i++) { | |
| const jump = headingLevels[i] - headingLevels[i-1]; | |
| expect(jump).toBeLessThanOrEqual(2); | |
| } | |
| } | |
| }); | |
| test('posts_we_sound_like_idiots_when_we_talk_about_technical_debt: no horizontal overflow at 375px', async ({ page }) => { | |
| await page.setViewportSize({ width: 375, height: 812 }); | |
| await page.goto('/posts/we-sound-like-idiots-when-we-talk-about-technical-debt/'); | |
| await page.waitForTimeout(500); | |
| const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth); | |
| expect(scrollWidth).toBeLessThanOrEqual(385); | |
| }); | |
| }); | |
| test.describe('Structural - posts_why_i_started_nimbric', () => { | |
| test('posts_why_i_started_nimbric: reproduces GT semantic landmarks', async ({ page }) => { | |
| await page.goto('/posts/why-i-started-nimbric/'); | |
| expect(await page.locator('footer, [role="contentinfo"]').first().count(), 'footer landmark present in GT').toBeGreaterThan(0); | |
| }); | |
| test('posts_why_i_started_nimbric: heading hierarchy is valid', async ({ page }) => { | |
| await page.goto('/posts/why-i-started-nimbric/'); | |
| const headingLevels = await page.evaluate(() => { | |
| const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); | |
| return Array.from(headings).map(h => parseInt(h.tagName.substring(1))); | |
| }); | |
| if (headingLevels.length > 1) { | |
| for (let i = 1; i < headingLevels.length; i++) { | |
| const jump = headingLevels[i] - headingLevels[i-1]; | |
| expect(jump).toBeLessThanOrEqual(2); | |
| } | |
| } | |
| }); | |
| test('posts_why_i_started_nimbric: no horizontal overflow at 375px', async ({ page }) => { | |
| await page.setViewportSize({ width: 375, height: 812 }); | |
| await page.goto('/posts/why-i-started-nimbric/'); | |
| await page.waitForTimeout(500); | |
| const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth); | |
| expect(scrollWidth).toBeLessThanOrEqual(385); | |
| }); | |
| }); | |
| test.describe('Structural - posts_write_shitty_code', () => { | |
| test('posts_write_shitty_code: reproduces GT semantic landmarks', async ({ page }) => { | |
| await page.goto('/posts/write-shitty-code/'); | |
| expect(await page.locator('footer, [role="contentinfo"]').first().count(), 'footer landmark present in GT').toBeGreaterThan(0); | |
| }); | |
| test('posts_write_shitty_code: heading hierarchy is valid', async ({ page }) => { | |
| await page.goto('/posts/write-shitty-code/'); | |
| const headingLevels = await page.evaluate(() => { | |
| const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); | |
| return Array.from(headings).map(h => parseInt(h.tagName.substring(1))); | |
| }); | |
| if (headingLevels.length > 1) { | |
| for (let i = 1; i < headingLevels.length; i++) { | |
| const jump = headingLevels[i] - headingLevels[i-1]; | |
| expect(jump).toBeLessThanOrEqual(2); | |
| } | |
| } | |
| }); | |
| test('posts_write_shitty_code: no horizontal overflow at 375px', async ({ page }) => { | |
| await page.setViewportSize({ width: 375, height: 812 }); | |
| await page.goto('/posts/write-shitty-code/'); | |
| await page.waitForTimeout(500); | |
| const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth); | |
| expect(scrollWidth).toBeLessThanOrEqual(385); | |
| }); | |
| }); | |
| test.describe('Structural - Consistency', () => { | |
| test('header links are consistent across pages', async ({ page }) => { | |
| const headerLinksByPage: string[][] = []; | |
| { | |
| await page.goto('/'); | |
| const links = await page.locator('header a, nav a').allTextContents(); | |
| headerLinksByPage.push(links.map(l => l.trim()).filter(l => l.length > 0)); | |
| } | |
| { | |
| await page.goto('/blog/'); | |
| const links = await page.locator('header a, nav a').allTextContents(); | |
| headerLinksByPage.push(links.map(l => l.trim()).filter(l => l.length > 0)); | |
| } | |
| { | |
| await page.goto('/investors/'); | |
| const links = await page.locator('header a, nav a').allTextContents(); | |
| headerLinksByPage.push(links.map(l => l.trim()).filter(l => l.length > 0)); | |
| } | |
| { | |
| await page.goto('/pricing/'); | |
| const links = await page.locator('header a, nav a').allTextContents(); | |
| headerLinksByPage.push(links.map(l => l.trim()).filter(l => l.length > 0)); | |
| } | |
| if (headerLinksByPage.length >= 2 && headerLinksByPage[0].length > 0) { | |
| const first = new Set(headerLinksByPage[0]); | |
| for (let i = 1; i < headerLinksByPage.length; i++) { | |
| const current = new Set(headerLinksByPage[i]); | |
| const overlap = [...first].filter(l => current.has(l)); | |
| if (first.size > 0) { | |
| expect(overlap.length / first.size).toBeGreaterThanOrEqual(0.5); | |
| } | |
| } | |
| } | |
| }); | |
| }); | |