Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@
"name": "Chandigarh Engineering College",
"sameAs": [
"https://en.wikipedia.org/wiki/Chandigarh_Engineering_College",
"http://cecmohali.org"
"https://www.cecmohali.org"
],
"logo": "http://cecmohali.org/wp-content/themes/cec-mohali/img/logo.jpg",
"logo": "https://www.cecmohali.org/public/images/cec-logo%20naac.jpg",
"email": "contact@cecmohali.org",
"address": {
"@type": "PostalAddress",
Expand Down Expand Up @@ -133,7 +133,7 @@
"https://github.com/xRahul",
"https://www.facebook.com/xRahulJain",
"https://twitter.com/xRahulJain",
"http://stackoverflow.com/users/1435626/rahul"
"https://stackoverflow.com/users/1435626/rahul"
]
}
</script>
Expand Down
61 changes: 61 additions & 0 deletions tests/seo.spec.ts
Original file line number Diff line number Diff line change
@@ -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'
),
]);
});
33 changes: 33 additions & 0 deletions tests/structured-data.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { test, expect } from '@playwright/test';

test('has valid structured data', async ({ page }) => {
await page.goto('/');

const scriptTag = page.locator('script[type="application/ld+json"]');
await expect(scriptTag).toBeAttached();

const scriptContent = await scriptTag.textContent();
expect(scriptContent).not.toBeNull();

const data = JSON.parse(scriptContent as string);

expect(data['@context']).toBe('http://schema.org');
expect(data['@type']).toBe('Person');
expect(data.name).toBe('Rahul Jain');
expect(data.jobTitle).toBe('Senior Software Engineer');
expect(data.url).toBe('https://rahulja.in');

const expectedSameAs = [
'https://www.linkedin.com/in/xrahuljain',
'https://github.com/xRahul',
'https://www.facebook.com/xRahulJain',
'https://twitter.com/xRahulJain',
'https://stackoverflow.com/users/1435626/rahul',
];

expect(Array.isArray(data.sameAs)).toBe(true);

for (const url of expectedSameAs) {
expect(data.sameAs).toContain(url);
}
});