From 01a19f58ee5bcb611463f425f67dd9957c03ee5c Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 19 Mar 2026 07:56:10 +0000 Subject: [PATCH] Add tests for OpenGraph and Twitter meta tags Co-authored-by: xRahul <1639945+xRahul@users.noreply.github.com> --- tests/seo.spec.ts | 61 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 tests/seo.spec.ts diff --git a/tests/seo.spec.ts b/tests/seo.spec.ts new file mode 100644 index 00000000..7758aec9 --- /dev/null +++ b/tests/seo.spec.ts @@ -0,0 +1,61 @@ +import { test, expect } from '@playwright/test'; + +test('has opengraph and twitter meta tags', async ({ page }) => { + await page.goto('/'); + + // Verify OpenGraph tags + await Promise.all([ + expect(page.locator('meta[property="og:title"]')).toHaveAttribute( + 'content', + 'Rahul Jain' + ), + expect(page.locator('meta[property="og:image"]')).toHaveAttribute( + 'content', + 'https://rahulja.in/assets/images/rahul-jain.jpg' + ), + expect(page.locator('meta[property="og:url"]')).toHaveAttribute( + 'content', + 'https://rahulja.in' + ), + expect(page.locator('meta[property="og:description"]')).toHaveAttribute( + 'content', + 'Rahul Jain is a senior software engineer and tech enthusiast living in Singapore' + ), + expect(page.locator('meta[property="og:site_name"]')).toHaveAttribute( + 'content', + 'Rahul Jain' + ), + expect(page.locator('meta[property="og:type"]')).toHaveAttribute( + 'content', + 'website' + ), + ]); + + // Verify Twitter tags + await Promise.all([ + expect(page.locator('meta[name="twitter:card"]')).toHaveAttribute( + 'content', + 'summary' + ), + expect(page.locator('meta[name="twitter:url"]')).toHaveAttribute( + 'content', + 'https://rahulja.in' + ), + expect(page.locator('meta[name="twitter:creator"]')).toHaveAttribute( + 'content', + '@xRahulJain' + ), + expect(page.locator('meta[name="twitter:title"]')).toHaveAttribute( + 'content', + 'Rahul Jain' + ), + expect(page.locator('meta[name="twitter:description"]')).toHaveAttribute( + 'content', + 'Rahul Jain is a senior software engineer and tech enthusiast living in Singapore' + ), + expect(page.locator('meta[name="twitter:image"]')).toHaveAttribute( + 'content', + 'https://rahulja.in/assets/images/rahul-jain.jpg' + ), + ]); +});