RecreationBench / web /streamora.example /tests /static /layout.agent_gen.spec.ts
VoyagerXHF's picture
Upload folder using huggingface_hub (part 75)
0e0e768 verified
Raw History Blame Contribute Delete
13.4 kB
import { test, expect } from '@playwright/test';
const BASE = 'http://localhost:8100';
test.describe('Homepage visual layout', () => {
test('homepage has a header at the top of the page', async ({ page }) => {
await page.setViewportSize({ width: 1920, height: 1080 });
await page.goto(`${BASE}/`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const header = page.locator('div').filter({ hasText: /STREAMORA/ }).first();
const box = await header.boundingBox();
expect(box).toBeTruthy();
expect(box!.y).toBeLessThan(200);
});
test('homepage logo image is displayed at reasonable size', async ({ page }) => {
await page.setViewportSize({ width: 1920, height: 1080 });
await page.goto(`${BASE}/`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const logo = page.locator('img[alt="Streamora"]').first();
await expect(logo).toBeVisible();
const box = await logo.boundingBox();
expect(box).toBeTruthy();
expect(box!.width).toBeGreaterThan(20);
expect(box!.height).toBeGreaterThan(10);
});
test('homepage hero section is near the top', async ({ page }) => {
await page.setViewportSize({ width: 1920, height: 1080 });
await page.goto(`${BASE}/`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const heroHeading = page.locator('h2', { hasText: 'CARRY YOUR MEDIA ANYWHERE WITH STREAMORA' });
const box = await heroHeading.boundingBox();
expect(box).toBeTruthy();
expect(box!.y).toBeLessThan(800);
});
test('homepage footer is below the main content', async ({ page }) => {
await page.setViewportSize({ width: 1920, height: 1080 });
await page.goto(`${BASE}/`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const heroH2 = page.locator('h2', { hasText: 'CARRY YOUR MEDIA ANYWHERE' });
const heroBox = await heroH2.boundingBox();
const copyright = page.locator('text=© 2024 Streamora').first();
const footerBox = await copyright.boundingBox();
expect(heroBox).toBeTruthy();
expect(footerBox).toBeTruthy();
expect(footerBox!.y).toBeGreaterThan(heroBox!.y);
});
test('homepage nav items are horizontally arranged at desktop', async ({ page }) => {
await page.setViewportSize({ width: 1920, height: 1080 });
await page.goto(`${BASE}/`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const aboutLink = page.locator('nav a', { hasText: 'ABOUT' });
const downloadLink = page.locator('nav a', { hasText: 'DOWNLOAD' });
const aboutBox = await aboutLink.boundingBox();
const downloadBox = await downloadLink.boundingBox();
expect(aboutBox).toBeTruthy();
expect(downloadBox).toBeTruthy();
expect(Math.abs(aboutBox!.y - downloadBox!.y)).toBeLessThan(30);
});
});
test.describe('About page visual layout', () => {
test('about page hero h1 is prominently displayed', async ({ page }) => {
await page.setViewportSize({ width: 1920, height: 1080 });
await page.goto(`${BASE}/about.html`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const h1 = page.locator('h1', { hasText: 'Your Media, Your Rules' });
await expect(h1).toBeVisible();
const box = await h1.boundingBox();
expect(box).toBeTruthy();
expect(box!.y).toBeLessThan(600);
});
test('about page feature boxes are visible', async ({ page }) => {
await page.setViewportSize({ width: 1920, height: 1080 });
await page.goto(`${BASE}/about.html`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const feature = page.locator('h4', { hasText: 'Your Media, Every Device' });
await expect(feature).toBeVisible();
});
test('about page manage library image is displayed', async ({ page }) => {
await page.setViewportSize({ width: 1920, height: 1080 });
await page.goto(`${BASE}/about.html`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const img = page.locator('img[alt="manage library"]');
if (await img.count() > 0) {
await expect(img).toBeVisible();
const box = await img.boundingBox();
expect(box).toBeTruthy();
expect(box!.width).toBeGreaterThan(100);
expect(box!.height).toBeGreaterThan(100);
}
});
});
test.describe('Download page visual layout', () => {
test('download page has two-column layout with server and apps sections', async ({ page }) => {
await page.setViewportSize({ width: 1920, height: 1080 });
await page.goto(`${BASE}/download.html`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const serverH2 = page.locator('h2').filter({ hasText: 'Streamora Server' }).first();
const appsH2 = page.locator('h2').filter({ hasText: 'Apps' });
const serverBox = await serverH2.boundingBox();
const appsBox = await appsH2.boundingBox();
expect(serverBox).toBeTruthy();
expect(appsBox).toBeTruthy();
});
test('download page h1 is at the top', async ({ page }) => {
await page.setViewportSize({ width: 1920, height: 1080 });
await page.goto(`${BASE}/download.html`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const h1 = page.locator('h1');
const box = await h1.boundingBox();
expect(box).toBeTruthy();
expect(box!.y).toBeLessThan(500);
});
});
test.describe('Premiere page visual layout', () => {
test('premiere page pricing tiers are displayed', async ({ page }) => {
await page.setViewportSize({ width: 1920, height: 1080 });
await page.goto(`${BASE}/premiere.html`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const monthly = page.locator('h3', { hasText: 'Monthly' }).first();
const yearly = page.locator('h3', { hasText: '1 Year' }).first();
const lifetime = page.locator('h3', { hasText: 'Lifetime' }).first();
await expect(monthly).toBeVisible();
await expect(yearly).toBeVisible();
await expect(lifetime).toBeVisible();
});
test('premiere page pricing tiers are arranged side by side', async ({ page }) => {
await page.setViewportSize({ width: 1920, height: 1080 });
await page.goto(`${BASE}/premiere.html`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const monthly = page.locator('h3', { hasText: 'Monthly' }).first();
const lifetime = page.locator('h3', { hasText: 'Lifetime' }).first();
const monthlyBox = await monthly.boundingBox();
const lifetimeBox = await lifetime.boundingBox();
expect(monthlyBox).toBeTruthy();
expect(lifetimeBox).toBeTruthy();
expect(Math.abs(monthlyBox!.y - lifetimeBox!.y)).toBeLessThan(50);
});
test('premiere page checkout images are displayed at reasonable size', async ({ page }) => {
await page.setViewportSize({ width: 1920, height: 1080 });
await page.goto(`${BASE}/premiere.html`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const checkoutImgs = page.locator('img[alt="Check out securely now"]');
const count = await checkoutImgs.count();
expect(count).toBeGreaterThan(0);
const box = await checkoutImgs.first().boundingBox();
expect(box).toBeTruthy();
expect(box!.width).toBeGreaterThan(10);
});
});
test.describe('Community pages visual layout', () => {
test('community forums page has forum sections listed vertically', async ({ page }) => {
await page.setViewportSize({ width: 1920, height: 1080 });
await page.goto(`${BASE}/community/`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const generalSection = page.locator('h2', { hasText: 'General' }).first();
const serverSection = page.locator('h2', { hasText: 'Streamora Server' }).first();
const generalBox = await generalSection.boundingBox();
const serverBox = await serverSection.boundingBox();
expect(generalBox).toBeTruthy();
expect(serverBox).toBeTruthy();
expect(serverBox!.y).toBeGreaterThan(generalBox!.y);
});
test('community blogs page shows blog cards', async ({ page }) => {
await page.setViewportSize({ width: 1920, height: 1080 });
await page.goto(`${BASE}/community/blogs/`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const blogTitles = page.locator('h2');
const count = await blogTitles.count();
expect(count).toBeGreaterThan(5);
});
test('staff page member sections are displayed', async ({ page }) => {
await page.setViewportSize({ width: 1920, height: 1080 });
await page.goto(`${BASE}/community/staff/`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const admins = page.locator('h2', { hasText: 'Administrators' });
await expect(admins).toBeVisible();
const adminBox = await admins.boundingBox();
expect(adminBox).toBeTruthy();
});
});
test.describe('Device pages visual layout', () => {
test('Android TV page has content images displayed', async ({ page }) => {
await page.setViewportSize({ width: 1920, height: 1080 });
await page.goto(`${BASE}/streamora-for-android-tv.html`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const images = page.locator('img');
const count = await images.count();
expect(count).toBeGreaterThan(3);
});
test('Roku page screenshots are displayed at reasonable sizes', async ({ page }) => {
await page.setViewportSize({ width: 1920, height: 1080 });
await page.goto(`${BASE}/streamora-for-roku.html`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const screenshots = page.locator('img[alt="Screenshot"]');
const count = await screenshots.count();
expect(count).toBeGreaterThan(0);
const box = await screenshots.first().boundingBox();
expect(box).toBeTruthy();
expect(box!.width).toBeGreaterThan(50);
});
test('iOS page screenshot gallery images are visible', async ({ page }) => {
await page.setViewportSize({ width: 1920, height: 1080 });
await page.goto(`${BASE}/streamora-for-ios.html`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const images = page.locator('img');
const count = await images.count();
expect(count).toBeGreaterThan(3);
});
});
test.describe('Mobile responsive layout 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 bodyWidth = await page.evaluate(() => document.body.scrollWidth);
expect(bodyWidth).toBeLessThanOrEqual(400);
});
test('about page at mobile width has no horizontal overflow', async ({ page }) => {
await page.setViewportSize({ width: 375, height: 812 });
await page.goto(`${BASE}/about.html`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const bodyWidth = await page.evaluate(() => document.body.scrollWidth);
expect(bodyWidth).toBeLessThanOrEqual(400);
});
test('download page at mobile width has no horizontal overflow', async ({ page }) => {
await page.setViewportSize({ width: 375, height: 812 });
await page.goto(`${BASE}/download.html`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const bodyWidth = await page.evaluate(() => document.body.scrollWidth);
expect(bodyWidth).toBeLessThanOrEqual(400);
});
test('premiere page at mobile width has no horizontal overflow', async ({ page }) => {
await page.setViewportSize({ width: 375, height: 812 });
await page.goto(`${BASE}/premiere.html`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const bodyWidth = await page.evaluate(() => document.body.scrollWidth);
expect(bodyWidth).toBeLessThanOrEqual(400);
});
test('community page at mobile width has no horizontal overflow', async ({ page }) => {
await page.setViewportSize({ width: 375, height: 812 });
await page.goto(`${BASE}/community/`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const bodyWidth = await page.evaluate(() => document.body.scrollWidth);
expect(bodyWidth).toBeLessThanOrEqual(400);
});
test('homepage heading is visible at mobile width', async ({ page }) => {
await page.setViewportSize({ width: 375, height: 812 });
await page.goto(`${BASE}/`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const h1 = page.locator('h1').first();
await expect(h1).toBeVisible();
});
test('support page at mobile width has no horizontal overflow', async ({ page }) => {
await page.setViewportSize({ width: 375, height: 812 });
await page.goto(`${BASE}/support/`);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
const bodyWidth = await page.evaluate(() => document.body.scrollWidth);
expect(bodyWidth).toBeLessThanOrEqual(420);
});
});