synor/apps/explorer-web/e2e/blocks.spec.ts
Gulshan Yadav 48949ebb3f Initial commit: Synor blockchain monorepo
A complete blockchain implementation featuring:
- synord: Full node with GHOSTDAG consensus
- explorer-web: Modern React blockchain explorer with 3D DAG visualization
- CLI wallet and tools
- Smart contract SDK and example contracts (DEX, NFT, token)
- WASM crypto library for browser/mobile
2026-01-08 05:22:17 +05:30

61 lines
2 KiB
TypeScript

import { test, expect } from '@playwright/test';
test.describe('Blocks Page', () => {
test.beforeEach(async ({ page }) => {
await page.goto('/blocks');
});
test('displays blocks list with pagination', async ({ page }) => {
// Check page title
await expect(page.getByRole('heading', { name: 'Blocks' })).toBeVisible();
// Check blocks count is shown
await expect(page.getByText(/total blocks/i)).toBeVisible();
// Check block table/list has entries
const blockLinks = page.locator('a[href^="/block/"]');
await expect(blockLinks.first()).toBeVisible();
});
test('view mode toggle works', async ({ page }) => {
// Find the view toggle buttons
const pagesButton = page.getByRole('button', { name: /pages/i });
const scrollButton = page.getByRole('button', { name: /scroll/i });
// Both should be visible
await expect(pagesButton).toBeVisible();
await expect(scrollButton).toBeVisible();
// Switch to scroll view
await scrollButton.click();
// Switch back to paginated view
await pagesButton.click();
});
test('pagination navigation works', async ({ page }) => {
// Find pagination controls
const nextButton = page.getByRole('button', { name: /next page/i });
const prevButton = page.getByRole('button', { name: /previous page/i });
// Previous should be disabled on first page
await expect(prevButton).toBeDisabled();
// Click next if available
if (await nextButton.isEnabled()) {
await nextButton.click();
// Previous should now be enabled
await expect(prevButton).toBeEnabled();
}
});
test('clicking a block navigates to block detail', async ({ page }) => {
// Click first block link
const firstBlock = page.locator('a[href^="/block/"]').first();
await firstBlock.click();
// Should be on block detail page
await expect(page).toHaveURL(/\/block\//);
await expect(page.getByRole('heading', { name: /block details/i })).toBeVisible();
});
});