Datasets:
File size: 15,383 Bytes
0e0e768 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 | import { test, expect } from '@playwright/test';
const BASE = 'http://localhost:8100';
test.describe('Homepage structural tests', () => {
test('homepage has nav element', async ({ page }) => {
await page.goto(`${BASE}/`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const navElements = page.locator('nav');
const count = await navElements.count();
expect(count).toBeGreaterThanOrEqual(1);
});
test('homepage has html lang attribute', async ({ page }) => {
await page.goto(`${BASE}/`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const lang = await page.locator('html').getAttribute('lang');
expect(lang).toBeTruthy();
expect(lang).toContain('en');
});
test('homepage has viewport meta tag', async ({ page }) => {
await page.goto(`${BASE}/`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const viewport = await page.locator('meta[name="viewport"]').getAttribute('content');
expect(viewport).toBeTruthy();
expect(viewport).toContain('width=device-width');
});
test('homepage has meta description', async ({ page }) => {
await page.goto(`${BASE}/`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const desc = await page.locator('meta[name="description"]').getAttribute('content');
expect(desc).toBeTruthy();
expect(desc!.length).toBeGreaterThan(20);
});
test('homepage has OpenGraph meta tags', async ({ page }) => {
await page.goto(`${BASE}/`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const ogTitle = await page.locator('meta[property="og:title"]').getAttribute('content');
expect(ogTitle).toBeTruthy();
const ogType = await page.locator('meta[property="og:type"]').getAttribute('content');
expect(ogType).toBeTruthy();
});
test('homepage h1 appears exactly once', async ({ page }) => {
await page.goto(`${BASE}/`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const h1Count = await page.locator('h1').count();
expect(h1Count).toBe(1);
});
test('homepage has form element for search', async ({ page }) => {
await page.goto(`${BASE}/`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const forms = page.locator('form');
const count = await forms.count();
expect(count).toBeGreaterThanOrEqual(1);
});
test('homepage has unordered lists for navigation', async ({ page }) => {
await page.goto(`${BASE}/`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const navUls = page.locator('nav ul');
const count = await navUls.count();
expect(count).toBeGreaterThanOrEqual(1);
});
});
test.describe('About page structural tests', () => {
test('about page has exactly one h1', async ({ page }) => {
await page.goto(`${BASE}/about.html`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const h1Count = await page.locator('h1').count();
expect(h1Count).toBe(1);
});
test('about page has nav element with menu links', async ({ page }) => {
await page.goto(`${BASE}/about.html`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const navLinks = page.locator('nav a');
const count = await navLinks.count();
expect(count).toBeGreaterThanOrEqual(4);
});
test('about page has h4 headings for feature sections', async ({ page }) => {
await page.goto(`${BASE}/about.html`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const h4Count = await page.locator('h4').count();
expect(h4Count).toBeGreaterThanOrEqual(5);
});
});
test.describe('Support page structural tests', () => {
test('support page uses semantic header element', async ({ page }) => {
await page.goto(`${BASE}/support/`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const headers = page.locator('header');
const count = await headers.count();
expect(count).toBeGreaterThanOrEqual(1);
});
test('support page uses semantic nav element', async ({ page }) => {
await page.goto(`${BASE}/support/`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const navs = page.locator('nav');
const count = await navs.count();
expect(count).toBeGreaterThanOrEqual(1);
});
test('support page uses semantic footer element', async ({ page }) => {
await page.goto(`${BASE}/support/`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const footers = page.locator('footer');
const count = await footers.count();
expect(count).toBeGreaterThanOrEqual(1);
});
test('support page has article element', async ({ page }) => {
await page.goto(`${BASE}/support/`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const articles = page.locator('article');
const count = await articles.count();
expect(count).toBeGreaterThanOrEqual(1);
});
test('support page has role attributes for accessibility', async ({ page }) => {
await page.goto(`${BASE}/support/`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const mainRole = page.locator('[role="main"]');
const count = await mainRole.count();
expect(count).toBeGreaterThanOrEqual(1);
});
});
test.describe('Community page structural tests', () => {
test('community page uses semantic header element', async ({ page }) => {
await page.goto(`${BASE}/community/`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const headers = page.locator('header');
const count = await headers.count();
expect(count).toBeGreaterThanOrEqual(1);
});
test('community page uses semantic nav element', async ({ page }) => {
await page.goto(`${BASE}/community/`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const navs = page.locator('nav');
const count = await navs.count();
expect(count).toBeGreaterThanOrEqual(1);
});
test('community page uses semantic main element', async ({ page }) => {
await page.goto(`${BASE}/community/`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const mains = page.locator('main');
const count = await mains.count();
expect(count).toBeGreaterThanOrEqual(1);
});
test('community page uses semantic footer element', async ({ page }) => {
await page.goto(`${BASE}/community/`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const footers = page.locator('footer');
const count = await footers.count();
expect(count).toBeGreaterThanOrEqual(1);
});
test('community page has section elements', async ({ page }) => {
await page.goto(`${BASE}/community/`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const sections = page.locator('section');
const count = await sections.count();
expect(count).toBeGreaterThanOrEqual(1);
});
test('community page has form elements for login', async ({ page }) => {
await page.goto(`${BASE}/community/`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const forms = page.locator('form');
const count = await forms.count();
expect(count).toBeGreaterThanOrEqual(1);
});
});
test.describe('Cross-page consistent header/footer', () => {
test('homepage and about page share the same nav structure', async ({ page }) => {
await page.goto(`${BASE}/`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const homeNavLinks = await page.locator('nav a[href*="about.html"]').count();
await page.goto(`${BASE}/about.html`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const aboutNavLinks = await page.locator('nav a[href*="about.html"]').count();
expect(homeNavLinks).toBeGreaterThanOrEqual(1);
expect(aboutNavLinks).toBeGreaterThanOrEqual(1);
});
test('marketing pages share footer with terms and privacy links', async ({ page }) => {
const marketingPages = ['/', '/about.html', '/download.html', '/premiere.html'];
for (const path of marketingPages) {
await page.goto(`${BASE}${path}`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const termsLink = await page.locator('a[href*="terms.html"]').count();
const privacyLink = await page.locator('a[href*="privacy.html"]').count();
expect(termsLink).toBeGreaterThanOrEqual(1);
expect(privacyLink).toBeGreaterThanOrEqual(1);
}
});
test('marketing pages share nav with download link', async ({ page }) => {
const pages = ['/', '/about.html', '/premiere.html'];
for (const path of pages) {
await page.goto(`${BASE}${path}`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const downloadLink = await page.locator('nav a[href*="download.html"]').count();
expect(downloadLink).toBeGreaterThanOrEqual(1);
}
});
test('community pages share footer with privacy and terms links', async ({ page }) => {
const communityPages = ['/community/', '/community/blogs/', '/community/staff/'];
for (const path of communityPages) {
await page.goto(`${BASE}${path}`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const privacyLink = await page.locator('a[href*="privacy.html"]').count();
const termsLink = await page.locator('a[href*="terms.html"]').count();
expect(privacyLink).toBeGreaterThanOrEqual(1);
expect(termsLink).toBeGreaterThanOrEqual(1);
}
});
});
test.describe('Device pages structural tests', () => {
test('device pages have exactly one h1', async ({ page }) => {
const devicePages = [
'/streamora-for-android.html',
'/streamora-for-android-tv.html',
'/streamora-for-appletv.html',
'/streamora-for-fire-tv.html',
'/streamora-for-ios.html',
'/streamora-for-roku.html',
];
for (const path of devicePages) {
await page.goto(`${BASE}${path}`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const h1Count = await page.locator('h1').count();
expect(h1Count).toBe(1);
}
});
test('device pages have nav element', async ({ page }) => {
const devicePages = [
'/streamora-for-chromecast.html',
'/streamora-for-lg-smart-tv.html',
'/streamora-for-samsung-smart-tv.html',
];
for (const path of devicePages) {
await page.goto(`${BASE}${path}`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const navCount = await page.locator('nav').count();
expect(navCount).toBeGreaterThanOrEqual(1);
}
});
test('device pages have image elements', async ({ page }) => {
await page.goto(`${BASE}/streamora-for-android-tv.html`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const imgCount = await page.locator('img').count();
expect(imgCount).toBeGreaterThanOrEqual(3);
});
});
test.describe('Responsive structural tests', () => {
test('homepage at mobile width has no horizontal overflow', async ({ page }) => {
await page.setViewportSize({ width: 375, height: 812 });
await page.goto(`${BASE}/`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth);
expect(scrollWidth).toBeLessThanOrEqual(400);
});
test('privacy page at mobile width has no horizontal overflow', async ({ page }) => {
await page.setViewportSize({ width: 375, height: 812 });
await page.goto(`${BASE}/privacy.html`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth);
expect(scrollWidth).toBeLessThanOrEqual(400);
});
test('terms page at mobile width has no horizontal overflow', async ({ page }) => {
await page.setViewportSize({ width: 375, height: 812 });
await page.goto(`${BASE}/terms.html`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth);
expect(scrollWidth).toBeLessThanOrEqual(400);
});
test('connect page at mobile width has no horizontal overflow', async ({ page }) => {
await page.setViewportSize({ width: 375, height: 812 });
await page.goto(`${BASE}/connect.html`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth);
expect(scrollWidth).toBeLessThanOrEqual(400);
});
test('Android TV page at mobile width has no horizontal overflow', async ({ page }) => {
await page.setViewportSize({ width: 375, height: 812 });
await page.goto(`${BASE}/streamora-for-android-tv.html`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth);
expect(scrollWidth).toBeLessThanOrEqual(950);
});
});
test.describe('Heading hierarchy tests', () => {
test('about page has proper h1 to h4 hierarchy', async ({ page }) => {
await page.goto(`${BASE}/about.html`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const h1Count = await page.locator('h1').count();
const h4Count = await page.locator('h4').count();
expect(h1Count).toBeGreaterThanOrEqual(1);
expect(h4Count).toBeGreaterThanOrEqual(1);
});
test('premiere page has h1 and h3 headings', async ({ page }) => {
await page.goto(`${BASE}/premiere.html`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const h1Count = await page.locator('h1').count();
const h3Count = await page.locator('h3').count();
expect(h1Count).toBeGreaterThanOrEqual(1);
expect(h3Count).toBeGreaterThanOrEqual(3);
});
test('privacy page has h1 and h3 sections', async ({ page }) => {
await page.goto(`${BASE}/privacy.html`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const h1Count = await page.locator('h1').count();
const h3Count = await page.locator('h3').count();
expect(h1Count).toBeGreaterThanOrEqual(1);
expect(h3Count).toBeGreaterThanOrEqual(5);
});
test('support page has h1 and h2 headings', async ({ page }) => {
await page.goto(`${BASE}/support/`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const h1Count = await page.locator('h1').count();
const h2Count = await page.locator('h2').count();
expect(h1Count).toBeGreaterThanOrEqual(1);
expect(h2Count).toBeGreaterThanOrEqual(2);
});
});
|