Skip to content

Commit 34d8c61

Browse files
Add E2E tests
1 parent d67fe0b commit 34d8c61

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+3749
-458
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
### Description
2+
3+
<!-- Please describe your change and its motivation. -->
4+
5+
### Test Plan
6+
7+
<!-- Please provide us with clear details for verifying that your changes work. -->
8+
9+
### Related Links
10+
11+
<!-- Please link to any relevant issues or pull requests! -->

.github/workflows/run-checks.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Run Checks
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
run-all-checks:
11+
name: Run All Checks
12+
runs-on: ubuntu-latest-16-core
13+
steps:
14+
- name: Checkout Repo
15+
uses: actions/checkout@v4
16+
17+
- name: Setup pnpm 10.6.5
18+
uses: pnpm/action-setup@v4
19+
with:
20+
version: 10.6.5
21+
22+
- name: Setup Node.js 22.x
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: 22.x
26+
27+
- name: Install Dependencies
28+
run: pnpm i
29+
30+
- name: Install Playwright
31+
run: pnpx playwright install --with-deps chromium
32+
33+
- name: Run End-to-End Tests
34+
run: pnpm test:e2e
35+
shell: bash

apps/web/.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
NEXT_PUBLIC_ENABLE_REACT_SCAN=1
22
NEXT_PUBLIC_APTOS_MAINNET_API_KEY=<api_key>
33
NEXT_PUBLIC_APTOS_TESTNET_API_KEY=<api_key>
4+
5+
CI=false

apps/web/.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,12 @@ yarn-error.log*
3737
# typescript
3838
*.tsbuildinfo
3939
next-env.d.ts
40+
41+
# Playwright
42+
node_modules/
43+
/test-results/
44+
/playwright-report/
45+
/blob-report/
46+
/playwright/.cache/
47+
/tests/lib/injection/build
48+
/tests/**/temp

apps/web/app/(authenticated)/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export default function Home() {
8383
animate={{ opacity: 1, y: 0 }}
8484
transition={{ duration: 0.3, delay: vaults.length * 0.1 }}
8585
>
86-
<Button asChild variant="secondary">
86+
<Button asChild variant="secondary" data-testid="authenticated-create-vault-button">
8787
<Link href="/onboarding" className="w-full">
8888
Create Vault
8989
</Link>

apps/web/app/(authenticated)/vault/[vaultId]/(dashboard)/layout.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ export default function VaultLayout({ children }: PropsWithChildren) {
8585
className="px-6"
8686
onClick={() => setIsSendCoinsModalOpen(true)}
8787
disabled={!isOwner}
88+
data-testid="send-coins-button"
8889
>
8990
Send <ArrowTopRightIcon className="w-6 h-6" />
9091
</Button>
@@ -116,6 +117,7 @@ export default function VaultLayout({ children }: PropsWithChildren) {
116117
? "text-primary cursor-default"
117118
: "hover:opacity-80 active:opacity-60 cursor-pointer"
118119
)}
120+
data-testid={`home-tab-item-${tab.id}`}
119121
>
120122
<VerticalCutReveal transition={{ delay: i * 0.05 }}>
121123
{tab.label}

apps/web/app/(authenticated)/vault/[vaultId]/proposal/create/page.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ export default function CreateProposalPage() {
204204
<Button
205205
disabled={!simulation.data?.success || !isFormValid.value}
206206
onClick={() => setPage("confirm")}
207+
data-testid="create-proposal-confirm-draft-button"
207208
>
208209
{!isSimulationError ? "Confirm Draft" : "Simulation Errors Found"}
209210
</Button>
@@ -371,6 +372,7 @@ export default function CreateProposalPage() {
371372
<Button
372373
onClick={createProposal}
373374
isLoading={isCreatingProposal}
375+
data-testid="create-proposal-create-proposal-button"
374376
>
375377
Create Proposal
376378
</Button>

apps/web/app/(authenticated)/vault/[vaultId]/proposal/pending/[sequenceNumber]/page.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import SimulationCoinRow from "@/components/SimulationCoinRow";
3939
import { PendingTransactionRow } from "@/components/PendingTransactionRow";
4040
import { useRouter } from "next/navigation";
4141
import { jsonStringify } from "@/lib/storage";
42+
import Link from "next/link";
4243

4344
export default function ProposalPage() {
4445
const queryClient = useQueryClient();
@@ -329,6 +330,7 @@ export default function ProposalPage() {
329330
className="flex-1"
330331
isLoading={isSecondaryActionLoading}
331332
onClick={() => handleSecondaryAction(false)}
333+
data-testid="reject-transaction-button"
332334
>
333335
Reject
334336
</Button>
@@ -340,6 +342,7 @@ export default function ProposalPage() {
340342
className="flex-1"
341343
isLoading={isSecondaryActionLoading}
342344
onClick={() => handleSecondaryAction(true)}
345+
data-testid="approve-transaction-button"
343346
>
344347
Approve
345348
</Button>
@@ -352,6 +355,7 @@ export default function ProposalPage() {
352355
disabled={!canExecute.data || !isNext}
353356
isLoading={isPrimaryActionLoading}
354357
onClick={() => handlePrimaryAction("execute")}
358+
data-testid="execute-transaction-button"
355359
>
356360
Execute Transaction
357361
</Button>
@@ -361,6 +365,7 @@ export default function ProposalPage() {
361365
disabled={!isNext || !hasEnoughRejections}
362366
isLoading={isPrimaryActionLoading}
363367
onClick={() => handlePrimaryAction("remove")}
368+
data-testid="remove-transaction-button"
364369
>
365370
Remove Transaction
366371
</Button>
@@ -436,7 +441,7 @@ export default function ProposalPage() {
436441
{pendingTransactionsAhead?.map((transaction, i) => {
437442
const sequenceNumber = latestSequenceNumber + i + 1;
438443
return (
439-
<a
444+
<Link
440445
key={transaction.payloadHash}
441446
href={`/vault/${id}/proposal/pending/${sequenceNumber}`}
442447
>
@@ -446,7 +451,7 @@ export default function ProposalPage() {
446451
sequenceNumber={sequenceNumber}
447452
showSequenceNumber={false}
448453
/>
449-
</a>
454+
</Link>
450455
);
451456
})}
452457
</CardContent>

apps/web/app/(authenticated)/vault/[vaultId]/proposal/publish-contract/page.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ export default function PublishContractPage() {
197197
!file || !jsonData || !isSimulationSuccess || !isOwner
198198
}
199199
onClick={() => setPage("confirm")}
200+
data-testid="publish-contract-confirm-draft-button"
200201
>
201202
Confirm Draft
202203
</Button>
@@ -348,6 +349,7 @@ export default function PublishContractPage() {
348349
<Button
349350
onClick={createProposal}
350351
isLoading={isCreatingProposal}
352+
data-testid="publish-contract-create-proposal-button"
351353
>
352354
Create Proposal
353355
</Button>

apps/web/app/(authenticated)/vault/[vaultId]/settings/export/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export default function ExportSettingsPage() {
4545
</div>
4646
<br />
4747
<div className="flex gap-2">
48-
<Button asChild>
48+
<Button asChild data-testid="export-vaults-button">
4949
<a
5050
href={`data:text/json;charset=utf-8,${exportVaultsJSON}`}
5151
download="petra-vaults-export.json"

0 commit comments

Comments
 (0)