This repository has no description
1import { test, expect } from '@playwright/test';
2
3const HANDLE = 'alice.bsky.social';
4const BASE = `/profile/${HANDLE}`;
5
6test.describe('Profile tab navigation', () => {
7 test.beforeEach(async ({ page }) => {
8 const response = await page.goto(BASE);
9 expect(response?.status()).toBe(200);
10
11 // Wait for the tab bar to be present
12 await expect(page.getByRole('tab', { name: /Profile/ })).toBeVisible();
13 });
14
15 test('Profile tab is active by default', async ({ page }) => {
16 const profileTab = page.getByRole('tab', { name: /Profile/ });
17 await expect(profileTab).toHaveAttribute('data-active', 'true');
18 await expect(page).toHaveURL(new RegExp(`${BASE}$`));
19 });
20
21 test('can navigate to Cards tab', async ({ page }) => {
22 const tab = page.getByRole('tab', { name: /Cards/ });
23 await tab.click();
24
25 await expect(page).toHaveURL(`${BASE}/cards`);
26 await expect(tab).toHaveAttribute('data-active', 'true');
27 });
28
29 test('can navigate to Collections tab', async ({ page }) => {
30 const tab = page.getByRole('tab', { name: /Collections/ });
31 await tab.click();
32
33 await expect(page).toHaveURL(`${BASE}/collections`);
34 await expect(tab).toHaveAttribute('data-active', 'true');
35 });
36
37 test('can navigate to Connections tab', async ({ page }) => {
38 const tab = page.getByRole('tab', { name: /Connections/ });
39 await tab.click();
40
41 await expect(page).toHaveURL(`${BASE}/connections`);
42 await expect(tab).toHaveAttribute('data-active', 'true');
43 });
44
45 test('can navigate to Network tab', async ({ page }) => {
46 const tab = page.getByRole('tab', { name: /Network/ });
47 await tab.click();
48
49 await expect(page).toHaveURL(`${BASE}/network`);
50 await expect(tab).toHaveAttribute('data-active', 'true');
51 });
52
53 test('tabs do not redirect to /login (profile is public)', async ({
54 page,
55 }) => {
56 const tabRoutes = ['cards', 'collections', 'connections', 'network'];
57
58 for (const route of tabRoutes) {
59 const response = await page.goto(`${BASE}/${route}`);
60 expect(response?.status()).toBe(200);
61 await expect(page).toHaveURL(`${BASE}/${route}`);
62 }
63 });
64});