Skip to content
Merged
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
30 changes: 22 additions & 8 deletions website/tests/visual/communities.spec.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
import { test, expect } from '@playwright/test';
import { auditPage } from './_helpers';
import { auditPage, hideDynamic } from './_helpers';
import { stubSupabase } from './fixtures';

test('communities listing', async ({ page }, info) => {
await auditPage(page, info, '/communities/');
});

test('communities search filters cards', async ({ page }) => {
test('communities filter narrows cards', async ({ page }) => {
// Serve the fixed fixture (2 Bengaluru + 1 Mumbai community) so the
// filtered result can't drift with live prod data — the same stub every
// other visual spec uses via auditPage. Must be set up before navigation.
await stubSupabase(page);
await page.goto('/communities/', { waitUntil: 'networkidle' });
const search = page.locator('input[type="search"], input[placeholder*="Search" i]').first();
if (await search.count()) {
await search.fill('bengaluru');
await page.waitForTimeout(500);
await expect(page).toHaveScreenshot('communities-search-bengaluru.png', { fullPage: true });
}

// Whole fixture renders first.
await expect(page.locator('.community-card')).toHaveCount(3);

// Use the city dropdown, which filters by exact match (deterministic),
// rather than the fuzzy search box. Selecting Bengaluru narrows to the
// 2 Bengaluru communities. toHaveCount auto-retries until the grid
// re-renders, replacing the old brittle fixed 500 ms sleep.
await page.selectOption('#cityFilter', 'Bengaluru');
await expect(page.locator('.community-card')).toHaveCount(2);

// Settle non-deterministic regions (chatbot, animations) before the shot.
await hideDynamic(page);
await page.evaluate(() => (document as any).fonts?.ready);
await expect(page).toHaveScreenshot('communities-filter-bengaluru.png', { fullPage: true });
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading