Skip to content

Commit

Permalink
feat(explorer): add data-testids to the identity part of the header.
Browse files Browse the repository at this point in the history
  • Loading branch information
telestrial committed Oct 22, 2024
1 parent f368602 commit 9110474
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 18 deletions.
5 changes: 5 additions & 0 deletions .changeset/fuzzy-jeans-camp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'explorer': minor
---

Add test IDs to the app identity section of the header.
15 changes: 6 additions & 9 deletions apps/explorer-e2e/src/specs/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
import { test, expect } from '@playwright/test'
import { fillTextInputByName } from '@siafoundation/e2e'

test('homepage', async ({ page }) => {
await page.goto('/')
await expect(page.getByText('siascan')).toBeVisible()
await expect(page.getByText('zen')).toBeVisible()
await expect(page.getByTestId('explorer-identity-appName')).toBeVisible()
await expect(page.getByTestId('explorer-identity-network')).toBeVisible()
})

test('look up and view a block by block number', async ({ page }) => {
await page.goto('/')
await fillTextInputByName(page, 'query', '3000')
await page.keyboard.press('Enter')
await expect(page.getByRole('link').getByText('3,000')).toBeVisible()
await expect(page.getByText('1 transactions')).toBeVisible()
await expect(page.getByText('000000...647f7f')).toBeVisible()
await page.goto('/block/60000')
await expect(page.getByRole('link').getByText('60,000')).toBeVisible()
await expect(page.getByText('11 transactions')).toBeVisible()
await expect(page.getByText('000000...fa54c1')).toBeVisible()
})
26 changes: 17 additions & 9 deletions apps/explorer/components/Layout/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,32 @@ type Props = {

export function Navbar({ appName, network, homeHref, children }: Props) {
return (
<div className={cx("py-3 z-10 bg-white dark:bg-graydark-50 border-b border-gray-200 dark:border-graydark-200",
network === 'mainnet' ? (
"border-t-4 border-t-green-500 dark:border-t-green-400"
) : '',
network === 'zen' ? (
"border-t-4 border-t-amber-500 dark:border-t-amber-400"
) : '',
)}>
<div
className={cx(
'py-3 z-10 bg-white dark:bg-graydark-50 border-b border-gray-200 dark:border-graydark-200',
network === 'mainnet'
? 'border-t-4 border-t-green-500 dark:border-t-green-400'
: '',
network === 'zen'
? 'border-t-4 border-t-amber-500 dark:border-t-amber-400'
: ''
)}
>
<Container size="4" className="relative">
<div className="flex items-center justify-between gap-2">
<div className="relative z-10 flex">
<Link href={homeHref} underline="none">
<div className="flex items-center gap-1.5 mr-2">
<div
className="flex items-center gap-1.5 mr-2"
data-testid="explorer-identity"
>
<Logo size={35} />
{appName && (
<Heading
font="mono"
size="24"
className="hidden pl-0 pr-px md:block tracking-tight relative -top-px"
data-testid="explorer-identity-appName"
>
{appName}
</Heading>
Expand All @@ -43,6 +50,7 @@ export function Navbar({ appName, network, homeHref, children }: Props) {
<Text
className="bg-amber-500 dark:bg-amber-400 rounded py-0 px-2 hidden sm:flex"
color="lo"
data-testid="explorer-identity-network"
>
{network}
</Text>
Expand Down

0 comments on commit 9110474

Please sign in to comment.