Skip to content

Tests landing page#1797

Merged
tanya-bitfly merged 3 commits intostagingfrom
tests-landing-page
Oct 31, 2025
Merged

Tests landing page#1797
tanya-bitfly merged 3 commits intostagingfrom
tests-landing-page

Conversation

@tanya-bitfly
Copy link
Contributor

No description provided.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Oct 30, 2025

Deploying beaconchain with  Cloudflare Pages  Cloudflare Pages

Latest commit: f017cde
Status: ✅  Deploy successful!
Preview URL: https://48635b16.beaconchain.pages.dev
Branch Preview URL: https://tests-landing-page.beaconchain.pages.dev

View logs

Copy link
Contributor

@enzo-bitfly enzo-bitfly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's great to see the semantic role selectors being used in the tests 🌟

workflow_dispatch:
inputs:
environment:
description: "Choose environment"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: 'Staging environments' perhaps


await expect(page.getByText('© 2025 beaconcha.in. All rights reserved')).toBeVisible()
})
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: our Playwright tests should focus on key user flows, not component behaviour. This should be tested in unit/component tests (which we don't have atm but will write later™)

Think for example of the repeated navigations and goBacks using real browser APIs. This is too expensive.

For particularly important links like 'Privacy policy' you can simply make sure they're there and then have a test that checks that all these links work just by requesting them, without using the navigation, for example:

 test('privacy policy link is reachable', async ({ request }) => {
    const response = await request.get('https://storage.googleapis.com/legal.beaconcha.in/privacy.pdf')
    expect(response.status()).toBe(200)
    expect(response.headers()['content-type']).toContain('pdf')
  })

Comment on lines +29 to +49
test('click on Login Button and verify user redirects to Sign In page', async ({
page,
}) => {
const loginBtn = page.getByRole('button', { name: 'Log in' })
await loginBtn.focus()
await page.keyboard.press('Enter')
await expect(page.getByRole('heading', { name: 'Sign in to beaconcha.in' })).toBeVisible()
await LoginPage.email(page).fill(email)
await LoginPage.password(page).fill(password)
await page.waitForLoadState('networkidle')
await LoginPage.loginBtn(page).click()
await expect(page).toHaveURL('/products#stacking-hub')
await expect(page.getByText('Seamless access to blockchain data on')).toBeVisible()
await expect(page.getByRole('button', { name: 'Open user menu' })).toBeVisible()
const userMenuBtn = page.getByRole('button', { name: 'Open user menu' })
await userMenuBtn.focus()
await page.keyboard.press('Enter')
await expect(page).toHaveURL('/user/settings')
await expect(page.getByText('Account Settings')).toBeVisible()
})
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

praise: this is the type of e2e tests we need 👍

await options.nth(0).click()
await expect(page).toHaveURL(
/beaconcha\.in\/address\/0x4838b106fce9647bdf1e7877bf73ce8b0bad5f97/i,
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

await search.fill(txHash)
await expect(page.getByRole('button', { name: /^Addresses$/ })).toBeVisible()
await expect(page.getByRole('button', { name: /^All$/ })).toBeVisible()
await expect(page.getByRole('button', { name: /^Tx Hashes$/ })).toBeVisible()
Copy link
Contributor

@enzo-bitfly enzo-bitfly Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: These buttons are checked for in many tests - this make the tests more expensive and their intent less clear. Each filtering test will need to use the corresponding filter button to click on it, and that should be enough verification.

Comment on lines +90 to +92
const resultsRoot = page.locator('div[id^="reka-combobox-content-"]').filter({
has: page.locator('div[role="group"][id^="reka-combobox-group-"]'),
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: mentioning internals of a component library in tests makes them flaky, as these attributes may change for example with an update of reka-ui. But maybe you had no choice, which brought to my attention that the groups are not correctly labeled here. I fixed this now and you should be able to find the groups by role and name in https://hoodi-staging.beaconcha.in/products

await expect(page.getByRole('heading', { name: 'Staking & Multi-EVM Data Made' })).toBeVisible()
await expect(page.getByText('Access validator stats, rewards, and onchain data with one powerful API.')).toBeVisible()
await expect(page.getByRole('link', { name: 'Get your API Key' })).toBeVisible()
await expect(page.getByRole('link', { name: 'Compare Plans' })).toBeVisible()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: like mentioned before, e2e tests should focus on core user flows and not in details like this. If you want to ensure that the expected elements are there, maybe screenshot tests could be a better idea.

@tanya-bitfly tanya-bitfly merged commit 84fdbb9 into staging Oct 31, 2025
2 checks passed
@tanya-bitfly tanya-bitfly deleted the tests-landing-page branch October 31, 2025 12:08
@peterbitfly peterbitfly restored the tests-landing-page branch November 3, 2025 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants