Skip to content

test(e2e): migrate to playwright and implement mocked voting power tests#301

Open
atomauro wants to merge 10 commits into
mainfrom
feat/vp-e2e-tests
Open

test(e2e): migrate to playwright and implement mocked voting power tests#301
atomauro wants to merge 10 commits into
mainfrom
feat/vp-e2e-tests

Conversation

@atomauro

@atomauro atomauro commented Mar 14, 2026

Copy link
Copy Markdown
Contributor

Description

Migrates our E2E testing framework from Cypress to Playwright to improve Next.js compatibility and adds robust tests to ensure Voting Power (VP) renders correctly across the application.

Changes

  • Testing Migration: Replaced legacy Cypress configuration with Playwright.
  • E2E Mocking Engine: Intercepted /api/delegates/*, api.near.social, and **/rpc/* to decouple Playwright from flaky network conditions and prevent Next.js dev server timeout hangs during headless execution.
  • Delegate Table & Grid: Added strict tests to verify VP formatting for large balances (whales), zero balances (dust), and null edge cases (where components gracefully fallback to 0 or -).
  • Delegate Profile: Added testing for Exact Address search bar navigation and accurate Voting Power rendering.
  • SSR Build Fixes: Fixed a Next.js build issue caused by @uiw/react-markdown-preview and isomorphic-dompurify. Created MarkdownClient.tsx to ensure Markdown is dynamically imported client-side only, fixing production Vercel builds.

Playwright Test Results

image

@vercel

vercel Bot commented Mar 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hos-agora-near Ready Ready Preview, Comment Apr 5, 2026 8:24pm

Request Review

@atomauro atomauro changed the title e2e VP tests <> e2e Playwright setup test(e2e): migrate to Playwright and implement VP tests Mar 14, 2026
@atomauro atomauro self-assigned this Mar 14, 2026
@atomauro atomauro added the enhancement New feature or request label Mar 14, 2026
@atomauro atomauro force-pushed the feat/vp-e2e-tests branch from ed7bca1 to eb89468 Compare March 14, 2026 01:17
@atomauro atomauro changed the title test(e2e): migrate to Playwright and implement VP tests test(e2e): migrate to playwright and implement voting power tests Mar 14, 2026
@github-actions

github-actions Bot commented Mar 14, 2026

Copy link
Copy Markdown

📊 Test Coverage Report

Overall Coverage

Metric Coverage Threshold
Lines 8.82% 🔴
Functions 31.28% 🔴
Branches 47.31% 🔴
Statements 8.82% 🔴

📁 Detailed Coverage by File

File Lines Functions Branches Statements
src/app/Web3Provider.tsx 0% 100% 100% 0%
src/app/error.tsx 0% 100% 100% 0%
src/app/analytics/page.tsx 0% 100% 100% 0%
src/app/api-docs/page.tsx 0% 100% 100% 0%
src/app/api/images/og/delegate/route.tsx 0% 100% 100% 0%
src/app/api/images/og/delegates/route.tsx 0% 100% 100% 0%
src/app/api/images/og/generic/route.tsx 0% 100% 100% 0%
src/app/api/images/og/proposals/route.tsx 0% 100% 100% 0%
src/app/assets/non-liquid-staking/page.tsx 0% 100% 100% 0%
src/app/info/page.tsx 0% 100% 100% 0%
src/app/info/components/GovernanceProcess.tsx 0% 100% 100% 0%
src/app/info/components/InfoHero.tsx 0% 100% 100% 0%
src/app/info/components/InfoRoadmap.tsx 0% 100% 100% 0%
src/app/info/components/InfoScopeAndParams.tsx 0% 100% 100% 0%
src/app/info/components/InfoVideos.tsx 0% 100% 100% 0%
src/app/near/NearDebug.tsx 0% 100% 100% 0%
src/app/near/VeNearDebugCards.tsx 0% 100% 100% 0%
src/app/terms-of-service/page.tsx 0% 100% 100% 0%
src/components/Footer.tsx 0% 100% 100% 0%
src/components/InfoBanner.tsx 0% 100% 100% 0%
📋 Show 171 more files...
File Lines Functions Branches Statements
src/components/Analytics/AnalyticsListener.tsx 0% 100% 100% 0%
src/components/Analytics/DelegationDistributionCard.tsx 0% 100% 100% 0%
src/components/Analytics/DelegatorRelationshipsCard.tsx 0% 100% 100% 0%
src/components/Analytics/DistributionPieChart.tsx 0% 100% 100% 0%
src/components/Analytics/GovernanceHealthChart.tsx 0% 100% 100% 0%
src/components/Analytics/MixpanelProvider.tsx 0% 100% 100% 0%
src/components/Analytics/NotFoundTracker.tsx 0% 100% 100% 0%
src/components/Analytics/ProposalAnalyticDropdown.tsx 0% 100% 100% 0%
src/components/Analytics/ProposalVotersList.tsx 0% 100% 100% 0%
src/components/Analytics/VoterEngagementCard.tsx 0% 100% 100% 0%
src/components/Analytics/VotingActivityCard.tsx 0% 100% 100% 0%
src/components/ApiKeys/ApiKeyList.tsx 0% 100% 100% 0%
src/components/ApiKeys/ApiKeysEmptyState.tsx 0% 100% 100% 0%
src/components/ApiKeys/ApiKeysManager.tsx 0% 100% 100% 0%
src/components/ApiKeys/CreateApiKeyForm.tsx 0% 100% 100% 0%
src/components/ApiKeys/types.ts 100% 100% 100% 100%
src/components/Assets/AnimatedStars.tsx 0% 100% 100% 0%
src/components/Assets/AssetsHome.tsx 0% 100% 100% 0%
src/components/Assets/AssetsLandingPage.tsx 0% 100% 100% 0%
src/components/Assets/DelegationSummaryCard.tsx 0% 100% 100% 0%
src/components/Assets/LockTokensCard.tsx 0% 100% 100% 0%
src/components/Assets/MobileAssetRow.tsx 0% 100% 100% 0%
src/components/Assets/StakeEncouragementBanner.tsx 0% 100% 100% 0%
src/components/Assets/StakingRewardsCard.tsx 0% 100% 100% 0%
src/components/Assets/TotalVeNearSupplyChart.tsx 0% 100% 100% 0%
src/components/Assets/VeNearCalculator.tsx 0% 100% 100% 0%
src/components/DelegateStatement/CurrentDelegateStatement.tsx 0% 100% 100% 0%
src/components/DelegateStatement/DelegateStatementBoolSelector.tsx 0% 100% 100% 0%
src/components/DelegateStatement/DelegateStatementForm.tsx 0% 100% 100% 0%
src/components/DelegateStatement/NotificationSelector.tsx 0% 100% 100% 0%
src/components/Delegates/DelegateCard/DelegateActions.tsx 0% 100% 100% 0%
src/components/Delegates/DelegateCard/DelegateAddress.tsx 0% 100% 100% 0%
src/components/Delegates/DelegateCard/DelegateCardEditProfile.tsx 0% 100% 100% 0%
src/components/Delegates/DelegateCard/DelegateCardHeader.tsx 0% 100% 100% 0%
src/components/Delegates/DelegateCardList/DelegateCardList.tsx 0% 100% 100% 0%
src/components/Delegates/DelegateCardList/DelegateCardWrapper.tsx 0% 100% 100% 0%
src/components/Delegates/DelegateCardList/DelegateContent.tsx 0% 100% 100% 0%
src/components/Delegates/DelegateCardList/DelegateTable.tsx 0% 100% 100% 0%
src/components/Delegates/DelegateCardList/DelegateTableRow.tsx 0% 100% 100% 0%
src/components/Delegates/DelegateProfile/DelegateActions.tsx 0% 100% 100% 0%
src/components/Delegates/DelegateProfile/DelegateProfileContent.tsx 0% 100% 100% 0%
src/components/Delegates/DelegateStatement/DelegateStatementContainer.tsx 0% 100% 100% 0%
src/components/Delegates/DelegateStatement/DelegateStatementWrapper.tsx 0% 100% 100% 0%
src/components/Delegates/DelegateVotes/DelegateVotes.tsx 0% 100% 100% 0%
src/components/Delegates/DelegateVotes/DelegateVotesDetailsContainer.tsx 0% 100% 100% 0%
src/components/Delegates/DelegateVotes/VotesContainer.tsx 0% 100% 100% 0%
src/components/Delegates/DelegateVotes/VotesContainerWrapper.tsx 0% 100% 100% 0%
src/components/Delegates/DelegatesFilter/DelegatesSortFilter.tsx 0% 100% 100% 0%
src/components/Delegates/DelegatesSearch/DelegatesSearch.jsx 0% 100% 100% 0%
src/components/Delegates/DelegatesTabs/DelegatesTabs.tsx 0% 100% 100% 0%
src/components/Delegates/Delegations/DelegationFromRow.tsx 0% 100% 100% 0%
src/components/Delegates/Delegations/DelegationToRow.tsx 0% 100% 100% 0%
src/components/Delegates/Delegations/DelegationsContainer.tsx 0% 100% 100% 0%
src/components/Delegates/Delegations/DelegationsContainerWrapper.tsx 0% 100% 100% 0%
src/components/Dialogs/VoteDialog.tsx 0% 100% 100% 0%
src/components/Dialogs/VoteOptionsDialog.tsx 0% 100% 100% 0%
src/components/Dialogs/DialogProvider/DialogProvider.tsx 0% 100% 100% 0%
src/components/Dialogs/DialogProvider/dialogs.tsx 0% 100% 100% 0%
src/components/Dialogs/DialogProvider/types.ts 100% 100% 100% 100%
src/components/Dialogs/LockDialog/AssetSelector.tsx 0% 100% 100% 0%
src/components/Header/ConnectButton.tsx 0% 100% 100% 0%
src/components/Header/DesktopProfileDropDown.tsx 0% 100% 100% 0%
src/components/Header/Header.jsx 0% 100% 100% 0%
src/components/Header/LogoLink.jsx 0% 100% 100% 0%
src/components/Header/MobileConnectButton.tsx 0% 100% 100% 0%
src/components/Header/MobileProfileDropDown.tsx 0% 100% 100% 0%
src/components/Header/Navbar.jsx 0% 100% 100% 0%
src/components/Layout/PageContainer.tsx 0% 100% 100% 0%
src/components/Layout/Stack.tsx 100% 100% 50% 100%
src/components/Metrics/DAOMetricsHeader.jsx 0% 100% 100% 0%
src/components/Notifications/SubscribeDialog.tsx 0% 100% 100% 0%
src/components/Notifications/SubscribeDialogLauncher.tsx 0% 100% 100% 0%
src/components/Proposals/DraftProposal/DraftEditForm.tsx 0% 100% 100% 0%
src/components/Proposals/DraftProposal/DraftProposalPage.tsx 0% 100% 100% 0%
src/components/Proposals/Proposal/PendingProposal.tsx 0% 100% 100% 0%
src/components/Proposals/Proposal/ProposalCountdown.tsx 0% 100% 100% 0%
src/components/Proposals/Proposal/ProposalHome.tsx 0% 100% 100% 0%
src/components/Proposals/Proposal/ProposalVoteBar.tsx 0% 100% 100% 0%
src/components/Proposals/Proposal/ProposalVoteFilter.tsx 0% 100% 100% 0%
src/components/Proposals/Proposal/ProposalVoteResult.tsx 0% 100% 100% 0%
src/components/Proposals/Proposal/ProposalVoteSummary.tsx 0% 100% 100% 0%
src/components/Proposals/Proposal/ProposalVotingActions.tsx 0% 100% 100% 0%
src/components/Proposals/ProposalPage/Charts/TimelineChart.tsx 0% 100% 100% 0%
src/components/Proposals/ProposalPage/ProposalChart/ProposalChart.tsx 0% 100% 100% 0%
src/components/Proposals/ProposalPage/TreeMapChart/TreeMapChart.tsx 0% 100% 100% 0%
src/components/Proposals/Proposals/DraftProposalsList.tsx 0% 100% 100% 0%
src/components/Proposals/Proposals/PendingProposals.tsx 0% 100% 100% 0%
src/components/Proposals/Proposals/ProposalModal.tsx 0% 100% 100% 0%
src/components/Proposals/Proposals/ProposalStatus.tsx 0% 100% 100% 0%
src/components/Proposals/Proposals/ProposalStatusText.tsx 0% 100% 100% 0%
src/components/Proposals/Proposals/ProposalTimeStatus.tsx 0% 100% 100% 0%
src/components/Proposals/Proposals/Proposals.tsx 0% 100% 100% 0%
src/components/common/FilterResetListbox.tsx 0% 100% 100% 0%
src/components/shared/CloseIcon.tsx 0% 100% 100% 0%
src/components/shared/InputBox.tsx 0% 100% 100% 0%
src/components/shared/LinkPreview.tsx 100% 100% 66.66% 100%
src/components/shared/LoadingSpinner.tsx 100% 100% 50% 100%
src/components/shared/NearAvatar.tsx 0% 100% 100% 0%
src/components/shared/Switch.tsx 0% 100% 100% 0%
src/components/shared/Form/TextInputWithTooltip.tsx 0% 100% 100% 0%
src/components/shared/Markdown/MarkdownClient.tsx 0% 100% 100% 0%
src/components/shared/ResourceNotFound/ResourceNotFound.tsx 0% 100% 100% 0%
src/components/ui/Drawer.tsx 0% 100% 100% 0%
src/components/ui/accordion.tsx 0% 100% 100% 0%
src/components/ui/checkbox.tsx 0% 100% 100% 0%
src/components/ui/dropdown-menu.tsx 0% 100% 100% 0%
src/components/ui/hover-card.tsx 0% 100% 100% 0%
src/components/ui/label.tsx 0% 100% 100% 0%
src/components/ui/popover.tsx 0% 100% 100% 0%
src/components/ui/select.tsx 0% 100% 100% 0%
src/components/ui/separator.tsx 0% 100% 100% 0%
src/components/ui/tabs.tsx 0% 100% 100% 0%
src/components/ui/tooltip-with-tap.tsx 0% 100% 100% 0%
src/components/ui/tooltip.tsx 0% 100% 100% 0%
src/contexts/NearContext.tsx 99.11% 0% 100% 99.11%
src/hooks/useAddSearchParam.ts 0% 100% 100% 0%
src/hooks/useAnalytics.ts 55.84% 0% 100% 55.84%
src/hooks/useCastVote.ts 98.66% 100% 90% 98.66%
src/hooks/useCreateProposal.ts 0% 100% 100% 0%
src/hooks/useDelegateAll.ts 99.01% 100% 92.85% 99.01%
src/hooks/useDelegates.ts 100% 100% 100% 100%
src/hooks/useDeleteSearchParam.ts 0% 100% 100% 0%
src/hooks/useDeployLockupAndLockV2.ts 63.92% 100% 45.45% 63.92%
src/hooks/useDraftProposals.ts 0% 100% 100% 0%
src/hooks/useFetchProof.ts 95% 100% 66.66% 95%
src/hooks/useLinkPreview.ts 95.83% 100% 0% 95.83%
src/hooks/useLockNear.ts 98.27% 100% 80% 98.27%
src/hooks/useProposalVotingPower.ts 0% 100% 100% 0%
src/hooks/useReadHOSContract.ts 97.61% 100% 83.33% 97.61%
src/hooks/useRefreshStakingPoolBalance.ts 96% 100% 66.66% 96%
src/hooks/useSelectStakingPool.ts 97.61% 100% 66.66% 97.61%
src/hooks/useStakeNear.ts 69.29% 100% 92.3% 69.29%
src/hooks/useStakedBalance.ts 100% 100% 100% 100%
src/hooks/useUndelegate.ts 98.83% 100% 91.66% 98.83%
src/hooks/useUnlockNear.ts 96.66% 100% 66.66% 96.66%
src/hooks/useUnstakedBalance.ts 100% 100% 100% 100%
src/hooks/useWriteHOSContract.ts 94% 100% 60% 94%
src/icons/HamburgerIcon.tsx 0% 100% 100% 0%
src/lib/constants.ts 99.09% 100% 0% 99.09%
src/lib/contractConstants.ts 46.42% 100% 12.5% 46.42%
src/lib/near-social.ts 95.23% 100% 66.66% 95.23%
src/lib/proposalMetadata.ts 88.09% 100% 50% 88.09%
src/lib/proposalUtils.ts 65.16% 40% 50% 65.16%
src/lib/tokenUtils.ts 83.33% 0% 0% 83.33%
src/lib/utils.ts 19.13% 0% 40% 19.13%
src/lib/analytics/index.ts 49.65% 60% 40% 49.65%
src/lib/analytics/mixpanel.ts 45.07% 25% 33.33% 45.07%
src/lib/api/constants.ts 87.87% 100% 14.28% 87.87%
src/lib/api/fungibleTokens.ts 0% 100% 100% 0%
src/lib/api/delegates/requests.ts 38.46% 0% 100% 38.46%
src/lib/api/delegates/types.ts 0% 100% 100% 0%
src/lib/api/near/types.ts 100% 100% 100% 100%
src/lib/api/nonce/requests.ts 100% 100% 100% 100%
src/lib/api/nonce/types.ts 100% 100% 100% 100%
src/lib/api/proposal/types.ts 0% 100% 100% 0%
src/lib/api/transactions/types.ts 100% 100% 100% 100%
src/lib/contracts/config/methods/lockup.ts 0% 100% 100% 0%
src/lib/contracts/config/methods/venear.ts 0% 100% 100% 0%
src/lib/contracts/config/methods/voting.ts 0% 100% 100% 0%
src/lib/contracts/types/common.ts 100% 100% 100% 100%
src/lib/contracts/types/lockup.ts 100% 100% 100% 100%
src/lib/contracts/types/venear.ts 100% 100% 100% 100%
src/lib/contracts/types/voting.ts 100% 100% 50% 100%
src/lib/nearSocial/index.ts 68.55% 66.66% 62.22% 68.55%
src/lib/nearSocial/types.ts 100% 100% 100% 100%
src/lib/tenant/tenant.ts 56% 27.27% 80% 56%
src/lib/tenant/tenantUI.ts 67.27% 14.28% 60% 67.27%
src/lib/tenant/configs/ui/near.ts 99.55% 100% 0% 99.55%
src/lib/wallets/fireblocks-compat.ts 16.66% 0% 100% 16.66%
src/styles/fonts.ts 0% 100% 100% 0%
src/types/nearClaim.ts 100% 100% 100% 100%

Coverage Thresholds:

  • 🟢 Good: ≥80%
  • 🟡 Moderate: 60-79%
  • 🔴 Needs Improvement: <60%

This report was generated by the Test Coverage workflow.

@pedrohasf pedrohasf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Slack convo

@atomauro atomauro changed the title test(e2e): migrate to playwright and implement voting power tests test(e2e): migrate to playwright and implement mocked voting power tests Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants