375bcfb0fa
Copies Playwright e2e tests (58 specs, 300+ tests) designed for cross-app testing. Adapts API mocks to match real Aeroflot dictionary format (title objects with multilingual keys), adds board/schedule/days endpoint mocks, and provides Angular-specific Playwright config on port 4203.
73 lines
2.6 KiB
TypeScript
73 lines
2.6 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
|
|
test.describe('SEO & Meta Tags (US-9)', () => {
|
|
test('should have correct title and meta tags for ru-ru', async ({ page }) => {
|
|
await page.goto('http://localhost:3000/ru-ru/onlineboard');
|
|
|
|
const title = await page.title();
|
|
expect(title).toBeTruthy();
|
|
expect(title.length).toBeGreaterThan(0);
|
|
|
|
const description = await page.locator('meta[name="description"]').getAttribute('content');
|
|
expect(description).toBeTruthy();
|
|
});
|
|
|
|
test('should have correct title and meta tags for en-us', async ({ page }) => {
|
|
await page.goto('http://localhost:3000/en-us/onlineboard');
|
|
|
|
const title = await page.title();
|
|
expect(title).toBeTruthy();
|
|
expect(title.length).toBeGreaterThan(0);
|
|
});
|
|
|
|
test('should have OpenGraph tags on all pages', async ({ page }) => {
|
|
await page.goto('http://localhost:3000/ru-ru/onlineboard');
|
|
|
|
const ogTitle = await page.locator('meta[property="og:title"]').count();
|
|
expect(ogTitle).toBeGreaterThan(0);
|
|
|
|
const ogDescription = await page.locator('meta[property="og:description"]').count();
|
|
expect(ogDescription).toBeGreaterThan(0);
|
|
});
|
|
|
|
test('should have canonical link', async ({ page }) => {
|
|
await page.goto('http://localhost:3000/ru-ru/onlineboard');
|
|
|
|
const canonical = await page.locator('link[rel="canonical"]').count();
|
|
expect(canonical).toBeGreaterThan(0);
|
|
});
|
|
|
|
test('should have viewport meta tag', async ({ page }) => {
|
|
await page.goto('http://localhost:3000/ru-ru/onlineboard');
|
|
|
|
const viewport = await page.locator('meta[name="viewport"]').getAttribute('content');
|
|
expect(viewport).toContain('width=device-width');
|
|
});
|
|
|
|
test('should have correct language attribute', async ({ page }) => {
|
|
await page.goto('http://localhost:3000/ru-ru/onlineboard');
|
|
|
|
const lang = await page.locator('html').getAttribute('lang');
|
|
expect(lang).toBeTruthy();
|
|
});
|
|
|
|
test('should update lang attribute when changing locale', async ({ page }) => {
|
|
await page.goto('http://localhost:3000/ru-ru/onlineboard');
|
|
|
|
let lang = await page.locator('html').getAttribute('lang');
|
|
expect(lang).toBeTruthy();
|
|
|
|
// Switch to English
|
|
await page.goto('http://localhost:3000/en-us/onlineboard');
|
|
lang = await page.locator('html').getAttribute('lang');
|
|
expect(lang).toBeTruthy();
|
|
});
|
|
|
|
test('should have JSON-LD structured data', async ({ page }) => {
|
|
await page.goto('http://localhost:3000/ru-ru/onlineboard');
|
|
|
|
const jsonLd = await page.locator('script[type="application/ld+json"]').count();
|
|
expect(jsonLd).toBeGreaterThan(0);
|
|
});
|
|
});
|