Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP Impact Metrics #66

Draft
wants to merge 213 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
213 commits
Select commit Hold shift + click to select a range
1d2a9c3
Add e2e tests
carlbarrdahl Mar 14, 2024
7818006
Update .env.test
carlbarrdahl Mar 14, 2024
d2230e6
Update .env.test
carlbarrdahl Mar 14, 2024
d454a8b
Update test
carlbarrdahl Mar 14, 2024
fb6647c
Merge branch 'allo2' into e2e
carlbarrdahl Mar 14, 2024
19e80ff
Remove playwright-report
carlbarrdahl Mar 14, 2024
5f9a724
Fix #57 update prisma schema
carlbarrdahl Jun 21, 2024
fbe69d8
Fix #59 Select Round type
carlbarrdahl Jun 21, 2024
46fe4e7
Restore linebreak
carlbarrdahl Jun 21, 2024
3a607e3
Merge pull request #67 from gitcoinco/round-type
carlbarrdahl Jun 21, 2024
256df57
Update lockfiles
carlbarrdahl Jun 24, 2024
2e9a2e2
Update Prisma schema
carlbarrdahl Jun 24, 2024
b219a5c
Add OSO api
carlbarrdahl Jun 24, 2024
4f50b12
Add configure metrics to admin
carlbarrdahl Jun 24, 2024
743f0bb
Add OpenSourceObserver Metrics API
carlbarrdahl Jun 24, 2024
e942774
Update lockfile
carlbarrdahl Jun 24, 2024
0efdeb6
Remove tab in env.js
carlbarrdahl Jun 24, 2024
c5b0ed9
Merge pull request #70 from gitcoinco/configure-metrics
carlbarrdahl Jun 24, 2024
9bb0b65
Update lockfile
carlbarrdahl Jun 24, 2024
9fdcd98
Add metrics api to fetch configured metrics for round
carlbarrdahl Jun 24, 2024
bbe3bf1
Update schema to default to empty metrics array
carlbarrdahl Jun 24, 2024
3fcb669
Add Metrics Page
carlbarrdahl Jun 24, 2024
bbcb8a6
Add Metrics Details page
carlbarrdahl Jun 24, 2024
e422a14
Map metrics data
carlbarrdahl Jun 24, 2024
cd2c3ea
Delete pnpm lockfile
carlbarrdahl Jun 24, 2024
73e72ff
Merge pull request #69 from gitcoinco/metrics-api
carlbarrdahl Jun 24, 2024
a01cbd6
Update headers to allow for external api calls
carlbarrdahl Jun 25, 2024
b55b293
Add Prisma model ApiKey
carlbarrdahl Jun 25, 2024
ebd26c8
Add CORS to headers next config
carlbarrdahl Jun 25, 2024
98e2c7f
Update Prisma schema
carlbarrdahl Jun 25, 2024
7170255
Add api keys navigation to admin layout
carlbarrdahl Jun 25, 2024
7e70ff8
Add API keys router
carlbarrdahl Jun 25, 2024
20be995
Add API keys page
carlbarrdahl Jun 25, 2024
56dedb0
Get api key
carlbarrdahl Jun 25, 2024
472b0e2
Remove postinstall from package.json
carlbarrdahl Jun 25, 2024
6e1d12d
feat: added metricsList (#75)
hussedev Jun 25, 2024
7388c8f
Update example
carlbarrdahl Jun 26, 2024
2038e21
Merge pull request #74 from gitcoinco/api-keys
carlbarrdahl Jun 26, 2024
9b27aa9
chore: installed recharts and @radix-ui/react-scroll-area
hussedev Jun 26, 2024
604c5f8
chore: implemented ScrollArea and Text components
hussedev Jun 26, 2024
6d91939
chore: added avatarPlaceholder SVG
hussedev Jun 26, 2024
8180e23
chore: changed availableMetrics object to AvailableMetrics enum in ty…
hussedev Jun 26, 2024
013711c
fix: getting metric id instead of name from api
hussedev Jun 26, 2024
75e5c24
chore: extracted MetricProject type from MetricWithProjects type
hussedev Jun 26, 2024
7915c93
chore: implemented useMetricById hook
hussedev Jun 26, 2024
2d5a641
chore: implemented DistributionChart component
hussedev Jun 26, 2024
c6ca47f
chore: implemented SortButton component
hussedev Jun 26, 2024
4c24fb6
chore: implemented AllocationList and AllocationItem components
hussedev Jun 26, 2024
ca346c3
feat: implemented MetricsSidebar component
hussedev Jun 26, 2024
8c5da28
feat: implemented MetricDetail component
hussedev Jun 26, 2024
26b4b92
refactor: MetricsDetailPage to render MetricDetail and MetricsSidebar
hussedev Jun 26, 2024
82ca050
Add CORS
carlbarrdahl Jun 27, 2024
8a57a4f
Add Projects API
carlbarrdahl Jun 27, 2024
9db409b
feat: implemented Button, AddToBallotButton and ViewCalculationButton
hussedev Jun 28, 2024
37ed84b
feat: moved DistributionChart to MetricsSidebarFolder
hussedev Jun 28, 2024
a803cb5
refactor: changed naming in AllocationList
hussedev Jun 28, 2024
179d026
refactor: changed naming in AllocationList
hussedev Jun 28, 2024
fb172fa
refactor: enhance MetricsSidebar component structure and functionality
hussedev Jun 28, 2024
40d11d2
refactor: MetricDetails component
hussedev Jun 28, 2024
dd6f6d3
refactor: improve MetricsDetailPage component structure and loading s…
hussedev Jun 28, 2024
e068556
refactor: added temporary interactivity to AddToBallotButton component
hussedev Jun 28, 2024
81b9955
chore: added mocked description on fetchMetrics.ts
hussedev Jun 28, 2024
5b5f102
chore: removed Text component
hussedev Jun 28, 2024
2a3b6f0
chore: moved ScrollArea to components/ui folder
hussedev Jun 28, 2024
c0f8697
chore: removed OP Sunny paths from avatarPlaceholder.svg
hussedev Jun 28, 2024
b530e8c
fix: use project.fraction instead of project.amount for metric calcul…
hussedev Jun 28, 2024
6cd535b
chore: added MetricId type
hussedev Jun 28, 2024
593cd0d
chore: implemented useCurrectMetricId() and useCurrentMetric()
hussedev Jun 28, 2024
6f0d533
chore: moved useMetrics.ts to features/metrics/hooks
hussedev Jun 28, 2024
4e0c5b1
refactor: MetricsSidebar is more generic now to be included in Metric…
hussedev Jun 28, 2024
bd9af06
chore: render MetricsSidebar in MetricsLayout
hussedev Jun 28, 2024
067df0a
Merge pull request #76 from gitcoinco/feat/metric-details-page
carlbarrdahl Jul 1, 2024
553eef6
Update admin layout to render metrics or projects link based on round…
carlbarrdahl Jul 1, 2024
e2661b3
Update lockfiles
carlbarrdahl Jul 1, 2024
4a07549
Metrics fixes
carlbarrdahl Jul 1, 2024
4ba34b1
Fix View Projects link
carlbarrdahl Jul 1, 2024
8e08e0a
Add metric to ballot (#80)
carlbarrdahl Jul 1, 2024
e174f98
Ballot metric allocations (#81)
carlbarrdahl Jul 1, 2024
aeec496
chore: remove duplicated button component
hussedev Jul 1, 2024
c296a8b
refactor: created reusable Sidebar component to for Metrics and Distr…
hussedev Jul 1, 2024
03244af
refactor: SidebarWithChart adaptation to receive data in a generic fo…
hussedev Jul 1, 2024
155f66a
Impact Metrics Ballot (#82)
carlbarrdahl Jul 2, 2024
77d786d
Add round type to ballot instead of allocation
carlbarrdahl Jul 2, 2024
39c4248
Merge pull request #77 from gitcoinco/feat/metrics-page
carlbarrdahl Jul 2, 2024
2775add
Add autobalance ballot
carlbarrdahl Jul 3, 2024
ca20f46
Update schema
carlbarrdahl Jul 3, 2024
efdf3a0
Add ballot editor
carlbarrdahl Jul 3, 2024
dd75689
Metric ballot
carlbarrdahl Jul 3, 2024
3028c41
Small fixes
carlbarrdahl Jul 3, 2024
bdd998b
Add Metric descriptions
carlbarrdahl Jul 4, 2024
ed1ceb5
Disable metrics selection in admin if round started
carlbarrdahl Jul 4, 2024
e0c5bb7
Fix metric title
carlbarrdahl Jul 4, 2024
be4b4fa
Fix metric link
carlbarrdahl Jul 4, 2024
e4afcb5
Fix missing isPending
carlbarrdahl Jul 4, 2024
a83bf77
Add metrics api to get metrics for projects
carlbarrdahl Jul 4, 2024
8a7ef96
Add comments
carlbarrdahl Jul 4, 2024
e4ec14b
Use BallotV2 and BallotEditor for Projects
carlbarrdahl Jul 5, 2024
f3bc134
Refactor ballot
carlbarrdahl Jul 5, 2024
4d8c18f
Remove unused file
carlbarrdahl Jul 5, 2024
6a63b39
Rename ballot
carlbarrdahl Jul 5, 2024
1aea743
Update calculations
carlbarrdahl Jul 5, 2024
0a8cbc7
Merge branch 'main' into impact-metrics
carlbarrdahl Jul 5, 2024
a8b4e92
Merge branch 'main' into impact-metrics
carlbarrdahl Jul 5, 2024
a9267ae
Ballot can republish
carlbarrdahl Jul 9, 2024
2a95213
Update lockfile
carlbarrdahl Jul 9, 2024
30d3b05
Remove unused components
carlbarrdahl Jul 9, 2024
d93b14d
Add import/export csv
carlbarrdahl Jul 9, 2024
28dd824
Fix router issue
carlbarrdahl Jul 9, 2024
5bbe4d7
Update text size
carlbarrdahl Jul 9, 2024
b4f83a0
Small fixes
carlbarrdahl Jul 9, 2024
e1c0c4a
fix: disable application button if no application period
hussedev Jul 10, 2024
3506ac9
chore: set ApplicationForm as client component
hussedev Jul 10, 2024
f84e042
fix: render alert if application period has finished
hussedev Jul 10, 2024
df8cb58
Merge pull request #86 from gitcoinco/fix/no-application-form-out-of-…
carlbarrdahl Jul 10, 2024
bcb2d7e
refactor: tRPC server context and procedures
hussedev Jul 12, 2024
124e2a7
refactor: ballot types to avoid type errors
hussedev Jul 12, 2024
b5aa551
refactor: resultsRouter to extend functionality for server side distr…
hussedev Jul 12, 2024
0c002fd
refactor: calculateResults and extended tests
hussedev Jul 12, 2024
9588c5a
refactor: Distributions component to use distribution API
hussedev Jul 12, 2024
daf396e
refactor: CalculationForm component to use totalVoters API
hussedev Jul 12, 2024
ccaf53d
chore: removed console.logs and unused vars
hussedev Jul 12, 2024
4d71c50
Merge pull request #88 from gitcoinco/feat/calculate_distribution_ser…
carlbarrdahl Jul 12, 2024
7757e01
Merge branch 'impact-metrics' into refactor-project-ballot
carlbarrdahl Jul 23, 2024
7a1f830
Merge branch 'refactor-project-ballot' of github.com:gitcoinco/easy-r…
carlbarrdahl Jul 23, 2024
acd6ae9
Clean up items in ballot that doesnt exist
carlbarrdahl Jul 23, 2024
ec34e4f
Remove any ballot items that doesnt exist anymore
carlbarrdahl Jul 23, 2024
fcb5be0
Fix save round
carlbarrdahl Jul 23, 2024
046c7e9
Remove console.log
carlbarrdahl Jul 23, 2024
b55c1e2
Merge pull request #85 from gitcoinco/refactor-project-ballot
carlbarrdahl Jul 23, 2024
c835d47
Merge branch 'impact-metrics' into e2e
carlbarrdahl Jul 24, 2024
4913397
Test wallet connector
carlbarrdahl Jul 24, 2024
4ecec38
Update pnpm-lock
carlbarrdahl Jul 24, 2024
850cd05
Use env flag if e2e test
carlbarrdahl Jul 24, 2024
bf8ed18
Merge pull request #27 from gitcoinco/e2e
carlbarrdahl Jul 24, 2024
b01a47b
Simplify distributions table
carlbarrdahl Jul 25, 2024
0aaf322
Fix connectors
carlbarrdahl Aug 7, 2024
5ffdce1
feat(PAR-183): implemented e2e testing with playwright/synpress (#95)
hussedev Aug 8, 2024
eb6f161
chore: show rainbow connect button on initial pages (#97)
hussedev Aug 14, 2024
22f41e3
refactor: metrics and applications apis and utils (#98)
hussedev Aug 16, 2024
dece7d4
Improve App View Page and Implement Revoke Functionality (#101)
nijoe1 Aug 21, 2024
4f32051
feat: add iconRight functionality to Button component (#103)
hussedev Aug 21, 2024
5ed22f3
feat: metrics from csv (#102)
hussedev Aug 21, 2024
f6695a9
fix: reintroduce projects endpoint in metricsRouter (#105)
hussedev Aug 21, 2024
5b76dd3
refactor: applications, metrics and profile routers (#106)
hussedev Aug 22, 2024
138e54f
feat: new eas schema with uuid (#107)
hussedev Aug 22, 2024
18efddd
feat: view application button after application is approved (#108)
hussedev Aug 23, 2024
04908bb
feat: track which voters have voted in admin (#99)
bhargavaparoksham Aug 23, 2024
78e1aa3
Par 247 implement calculate function (#104)
thelostone-mc Aug 23, 2024
1206b88
fix pool error (#111)
thelostone-mc Aug 23, 2024
49c62e6
feat: updated ApplicationSchema with sunnyAwards data (#112)
hussedev Aug 26, 2024
e3b55b5
chore: removed ApplicationsToApprove component, now using Application…
hussedev Aug 26, 2024
0117413
Refactored contract interactions using wagmi (#110)
nijoe1 Aug 26, 2024
1dc339b
fix: navbar in metrics page based on user (#114)
hussedev Aug 26, 2024
8e5dd36
fixes useEAS when refUID is not defined (#118)
nijoe1 Aug 26, 2024
b0c7f20
feat: application list metadata sunnys (#119)
hussedev Aug 27, 2024
e2ddd50
Multi award (#115)
thelostone-mc Aug 27, 2024
2d6711a
feat: implement download votes for impact rounds (#116)
bhargavaparoksham Aug 27, 2024
e5c9dcf
show ballot only to valid voter (#120)
thelostone-mc Aug 27, 2024
4701cf1
adds a new query procedure to list all approved projects (#121)
nijoe1 Aug 27, 2024
9f02763
feat: application details shows sunny metadata (#123)
hussedev Aug 27, 2024
e3245c1
import-export-csv (#122)
0xKurt Aug 27, 2024
dc624be
fix: admin address list not being rendered (#124)
hussedev Aug 27, 2024
3e57fa0
Fix PAR-287 show rounds user is member of (#126)
carlbarrdahl Aug 28, 2024
906bb61
Fix PAR-288 Add EmptyState to Metrics Page (#127)
carlbarrdahl Aug 28, 2024
f944213
Fix #291 Correct View Ballot link (#128)
carlbarrdahl Aug 28, 2024
2f638d4
update metrics (#129)
thelostone-mc Aug 28, 2024
4384a5f
fix hasVoted query (#130)
thelostone-mc Aug 28, 2024
d15c70d
fix: linkbox icons and incomplete github and twitter urls (#131)
hussedev Aug 28, 2024
330910e
run calculations only if round has applications (#132)
thelostone-mc Aug 28, 2024
b3ba8ca
feat: copy to clipboard for AddressBox (#134)
hussedev Aug 28, 2024
16036f1
Fix PAR-295 application page hydration error (#138)
carlbarrdahl Aug 29, 2024
f6881f5
tweak logic to account only for metrics and projects in award (#135)
thelostone-mc Aug 29, 2024
631f732
fetching distributed events and rendering them in admin/distribute pa…
nijoe1 Aug 30, 2024
6e4a096
Applications Filter (#137)
carlbarrdahl Aug 30, 2024
8133ae5
ensure only published allocations are fetched (#140)
thelostone-mc Aug 30, 2024
e7b8268
API key same request (#141)
carlbarrdahl Sep 3, 2024
e15abde
fix: approve - reject workflow (#139)
hussedev Sep 3, 2024
853c93d
fix: remove voting features if out of voting period (#142)
hussedev Sep 4, 2024
1e8797d
Update OpenSourceObserver error message (#143)
carlbarrdahl Sep 4, 2024
83d4f7c
fix: applicationItem status (#144)
hussedev Sep 4, 2024
eef3b44
update csv (#145)
thelostone-mc Sep 4, 2024
8400b67
Update awards.ts (#147)
thelostone-mc Sep 4, 2024
f59faf9
sunny awards fixes (#148)
thelostone-mc Sep 4, 2024
c46cf93
feat: implemented EnsureCorrectSession wrapper (#151)
hussedev Sep 5, 2024
823b52a
fix: filtering bug (#149)
bhargavaparoksham Sep 5, 2024
fb68275
fix: endpoint for leaderboard (#152)
hussedev Sep 6, 2024
2240874
fix: check session address to know if user is connected (#153)
hussedev Sep 9, 2024
c10697d
returning cursor for pagination (#154)
gnomadic Sep 10, 2024
dd9298f
chore: change listSunnyProjects endpoint to serve only approved proje…
hussedev Sep 10, 2024
ec8769d
fixes/distribution-dialog (#157)
nijoe1 Sep 11, 2024
accd02f
fix: import votes (#158)
hussedev Sep 12, 2024
f2fc7b8
fix: remove ImportCSV_copy.tsx (#159)
hussedev Sep 12, 2024
66f128d
chore: refetch after ballot submission (#160)
hussedev Sep 12, 2024
1d9deb5
fix: pagination page selector (#162)
hussedev Sep 13, 2024
985ae58
fix: temporary gas check removal in useAttest (#163)
hussedev Sep 13, 2024
4874143
feat: added functionality to ignore possible spam application ids (#164)
hussedev Sep 13, 2024
496b03d
chore: updated some spam ids (#165)
hussedev Sep 13, 2024
79b9946
updating metric data (#168)
gnomadic Sep 16, 2024
80ce10a
chore: filter spams from approvedIds + removed mock metric ids (#169)
hussedev Sep 17, 2024
8b9d42a
adding search by id (#166)
gnomadic Sep 17, 2024
b50a709
fix: distribute dialog (#161)
nijoe1 Sep 18, 2024
48dc9ce
chore: the sunnys hardcoded approvals (#170)
hussedev Sep 19, 2024
789be7a
feat: Search (#171)
gnomadic Sep 19, 2024
118c5e9
feat: new batch metrics flow for Sunny leaderboard (#175)
gnomadic Sep 26, 2024
250727c
Feat: Parsing Creator Metrics and using a more creative index (#176)
gnomadic Sep 26, 2024
9313934
Updating Creator Metrics (#177)
gnomadic Oct 1, 2024
e880ba0
10/2 - Metrics and updated creator parsing (#180)
gnomadic Oct 2, 2024
2c6d2cb
chore: fixing csv issue (#182)
gnomadic Oct 2, 2024
17d3b14
new csv (#183)
gnomadic Oct 4, 2024
dce9543
udpating metrics csv (#185)
gnomadic Oct 7, 2024
e036865
chore: update metrics
hussedev Dec 16, 2024
c2a7eec
fix: clean csvs
hussedev Dec 17, 2024
6e660bc
updating a project name (#207)
gnomadic Jan 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,6 @@ NEXT_PUBLIC_STRATEGY_ADDRESS="0xa3c5a2ea8ca2060e00761069b23da5171146a747"
WALLET_PRIVATE_KEY=""


OPENSOURCE_OBSERVER_API="https://opensource-observer.hasura.app/v1/graphql"
NEXT_PUBLIC_POSTHOG_KEY=""
NEXT_PUBLIC_POSTHOG_HOST=https://us.i.posthog.com
NEXT_PUBLIC_POSTHOG_HOST=https://us.i.posthog.com
24 changes: 24 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# ------------------
# TEST CONFIGURATION
# ------------------

# Voting periods
NEXT_PUBLIC_START_DATE=2024-01-01T00:00:00.000Z
NEXT_PUBLIC_REGISTRATION_END_DATE=2024-01-01T00:00:00.000Z
NEXT_PUBLIC_REVIEW_END_DATE=2024-01-01T00:00:00.000Z
NEXT_PUBLIC_VOTING_END_DATE=2026-01-01T00:00:00.000Z
NEXT_PUBLIC_RESULTS_DATE=2026-01-01T00:00:00.000Z


# Set to true to let anyone vote without an approval attestation
NEXT_PUBLIC_SKIP_APPROVED_VOTER_CHECK=true


NEXT_PUBLIC_E2E_TEST=true
NEXT_PUBLIC_TEST_WALLET_PRIVATE_KEY="0xfddf5e311800c2fad48651979111a9600434b34d5646924d377b9a1d22856d61"

### SYNPRESS
TEST_SEED_PHRASE="denial solar address invite flash measure young start traffic rib cash awkward"
TEST_PRIVATE_KEY=318ed94fa9b65cb353b47e4650dd9a849386891e16bf1564cfc892be06607229
TEST_WALLET_PASSWORD=playwright
TEST_WALLET_ADDRESS=0x7c6d34f2b0bfe7dd773ff5da3e0168d40d613304
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,19 @@ yarn-error.log*
# do not commit any .env files to git, except for the .env.example file. https://create.t3.gg/en/usage/env-variables#using-environment-variables
.env
.env*.local
.env.main
.env.impact

# vercel
.vercel

# typescript
*.tsbuildinfo

/playwright-report

/test-results
/playwright-report

.cache-synpress
.env.synpress
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,33 @@ open localhost:3000
- **Server-side caching of requests to EAS and IPFS** - Immediately returns the data without calling EAS and locally serving ipfs cids.
- **SQL database for ballots** - Votes are stored privately in a Postgres database
- **Allo2 for token distribution** - Payouts are calculated based on amount of configured tokens in the pool and the vote calculation

### TESTING Playwright + Synpress

#### Setup Wallet Cache

[Docs](https://synpress.io/docs/guides/wallet-cache)

1. We need to setup envs for metamask, currently having a wallet without funds in .env.test, possible override it with .env.synpress (remove synpress cache folder and run `bun run synpress:wallet-cache` again):

- SEED_PHRASE
- PRIVATE_KEY
- PASSWORD

2. Install playwright browser

```
bun run playwright:browser
```

3. Setup wallets (./test/wallet-setup/\*)

```
bun run synpress:wallet-cache
```

4. Run tests

```
bun run test:e2e
```
Binary file modified bun.lockb
Binary file not shown.
121 changes: 121 additions & 0 deletions e2e/tests/index.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
import { expect, test } from "@playwright/test";
import { privateKeyToAccount } from "viem/accounts";
import { db } from "~/server/db";

const account = privateKeyToAccount(
process.env.NEXT_PUBLIC_TEST_WALLET_PRIVATE_KEY as `0x${string}`,
);

test.beforeEach(async ({ page }) => {
try {
await db.ballot.delete({ where: { voterId: account.address } });
} catch (error) {}
await page.goto("http://localhost:3000/projects");
});

test.afterEach(async () => {
try {
await db.ballot.delete({ where: { voterId: account.address } });
} catch (error) {}
});

test("Submit Ballot flow", async ({ page }) => {
// Make sure page has loaded
await expect(
page.locator("a").filter({ hasText: "Alpha InsidersBringing you" }),
).toBeVisible();

// Connect wallet
await page.waitForSelector(`[data-testid="connect-wallet"]`);
await page.getByTestId("connect-wallet").click();
await page.getByTestId("rk-auth-message-button").click();

await expect(page.getByRole("button", { name: "0x39…dBEC" })).toBeVisible();

await page.waitForTimeout(500);
// Select 2 projects to add to ballot
await page
.locator("a")
.filter({ hasText: "Alpha InsidersBringing you" })
.getByRole("button")
.click();
await page
.locator("a")
.filter({ hasText: "Bankless AcademyBankless" })
.getByRole("button")
.click();

await page.waitForTimeout(1000);
await page.getByRole("button", { name: "Add 2 projects to ballot" }).click();

await page
.locator("a")
.filter({ hasText: "Castle CapitalCastle Capital" })
.click();
await expect(page.getByText("0x516272...82308bEE0")).toBeVisible();
await expect(
page.getByRole("link", { name: "https://www.castlecapital.vc/" }),
).toBeVisible();
await expect(
page.getByRole("heading", { name: "Castle Capital" }),
).toBeVisible();

await page.getByRole("button", { name: "Add to ballot" }).click();
await page.getByLabel("allocation-input").fill("5000");
await page.getByLabel("allocation-input").press("Enter");

await page.getByRole("link", { name: "View ballot", exact: true }).click();

// Ballot page
await page
.getByRole("row", { name: "Alpha Insiders" })
.getByLabel("allocation-input")
.click();
await page
.getByRole("row", { name: "Alpha Insiders" })
.getByLabel("allocation-input")
.fill("5000");
await page
.getByRole("row", { name: "Alpha Insiders" })
.getByLabel("allocation-input")
.press("Tab");
await page
.getByRole("row", { name: "Bankless Academy" })
.getByLabel("allocation-input")
.fill("2000");
await page
.getByRole("row", { name: "Bankless Academy" })
.getByLabel("allocation-input")
.blur();

await page.getByRole("button", { name: "Submit ballot" }).click();
await page.waitForTimeout(500);
await page.getByRole("button", { name: "Submit ballot" }).click();

await expect(
page.getByRole("heading", { name: "Your vote has been received 🥳" }),
).toBeVisible();

/*


- Distribute
- Create profile
- Create pool
-

- Select projects
- Add to ballot
- Edit ballot
- Submit ballot

- Add list to ballot
- Edit list votes

- Create application
- Approve application

- Add voters

*/
});
21 changes: 21 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,27 @@ const config = {
},
],
},

async headers() {
return [
{
source: "/api/:path*",
headers: [
{ key: "Access-Control-Allow-Credentials", value: "true" },
{ key: "Access-Control-Allow-Origin", value: "*" },
{
key: "Access-Control-Allow-Methods",
value: "GET,OPTIONS,PATCH,DELETE,POST,PUT",
},
{
key: "Access-Control-Allow-Headers",
value:
"X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version",
},
],
},
];
},
};

export default config;
22 changes: 20 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,24 @@
"private": true,
"type": "module",
"scripts": {
"build": "next build",
"build": "prisma generate && next build",
"db:push": "prisma db push",
"db:studio": "prisma studio",
"dev": "next dev",
"lint": "next lint",
"start": "next start",
"test": "vitest",
"playwright:browser": "playwright install chromium",
"synpress:wallet-cache": "synpress",
"pretest:e2e": "npm run playwright:browser",
"test:e2e": "playwright test --project=chromium",
"test:server": "node testServer.mjs",
"test:codegen": "playwright codegen",
"eas:registerSchemas": "npx tsx src/lib/eas/registerSchemas"
},
"dependencies": {
"@allo-team/allo-v2-sdk": "^1.0.39",
"@ethereum-attestation-service/eas-contracts": "^1.7.1",
"@ethereum-attestation-service/eas-sdk": "^1.5.0",
"@hookform/resolvers": "^3.3.4",
"@next-auth/prisma-adapter": "^1.0.7",
Expand All @@ -26,6 +33,9 @@
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-popover": "^1.0.7",
"@radix-ui/react-scroll-area": "^1.1.0",
"@radix-ui/react-separator": "^1.1.0",
"@radix-ui/react-tooltip": "^1.1.2",
"@rainbow-me/rainbowkit": "2",
"@rainbow-me/rainbowkit-siwe-next-auth": "^0.3.4",
"@t3-oss/env-nextjs": "^0.8.0",
Expand All @@ -37,14 +47,15 @@
"@trpc/next": "next",
"@trpc/react-query": "next",
"@trpc/server": "next",
"@vercel/analytics": "^1.2.2",
"@vercel/blob": "^0.19.0",
"clsx": "^2.1.0",
"cmdk": "^0.2.0",
"date-fns": "^3.3.1",
"ethers": "^6.11.1",
"formidable": "^3.5.1",
"graphql-request": "^6.1.0",
"lucide-react": "^0.368.0",
"lucide-react": "^0.436.0",
"next": "^14.1.0",
"next-auth": "^4.24.5",
"next-themes": "^0.2.1",
Expand All @@ -57,22 +68,27 @@
"react-day-picker": "^8.10.0",
"react-dom": "18.2.0",
"react-hook-form": "^7.49.3",
"react-icons": "^5.3.0",
"react-markdown": "^9.0.1",
"react-number-format": "^5.3.1",
"react-use": "^17.5.0",
"recharts": "^2.12.7",
"siwe": "^2.1.4",
"slugify": "^1.6.6",
"sonner": "^1.4.0",
"superjson": "^2.2.1",
"tailwind-merge": "^2.2.1",
"tailwind-variants": "^0.1.20",
"url-slug": "^4.0.1",
"uuid": "^10.0.0",
"viem": "2.x",
"wagmi": "2",
"zod": "3.22.4"
},
"devDependencies": {
"@next/eslint-plugin-next": "^14.1.0",
"@playwright/test": "1.44.0",
"@synthetixio/synpress": "4.0.0-alpha.7",
"@tailwindcss/typography": "^0.5.10",
"@testing-library/jest-dom": "^6.3.0",
"@types/eslint": "^8.56.2",
Expand All @@ -82,6 +98,7 @@
"@types/papaparse": "^5.3.14",
"@types/react": "^18.2.48",
"@types/react-dom": "^18.2.18",
"@types/uuid": "^10.0.0",
"@typescript-eslint/eslint-plugin": "^6.19.1",
"@typescript-eslint/parser": "^6.19.1",
"@vitejs/plugin-react": "^4.2.1",
Expand All @@ -99,6 +116,7 @@
"prettier": "^3.2.4",
"prettier-plugin-tailwindcss": "^0.5.11",
"prisma": "^5.8.1",
"serve": "^14.2.3",
"tailwindcss": "^3.4.1",
"typescript": "^5.3.3",
"vite": "^5.0.12",
Expand Down
39 changes: 39 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { defineConfig, devices } from "@playwright/test";
import Dotenv from "dotenv";

Dotenv.config({ path: [".env", ".env.test"], override: true });

export default defineConfig({
testDir: "test/e2e",
timeout: 60 * 1000,
expect: {
timeout: 10000,
},
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 1 : 0,
workers: 1,
reporter: "html",
use: {
actionTimeout: 0,
baseURL: "http://localhost:3000",
trace: "on-first-retry",
headless: false,
},
// start local web server before tests
webServer: [
{
command: "npm run test:server",
url: "http://localhost:3000",
timeout: 60000,
reuseExistingServer: true,
},
],
projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
},
],
outputDir: "test-results",
});
Loading