Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
27 changes: 16 additions & 11 deletions .claude-lib/project/rules/e2e.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@

## Test Coverage Strategy

RPC method tests run with **Google OAuth as the primary authentication method**. MetaMask EOA tests verify connectivity only.
RPC method tests run against both LINE OAuth (CI default) and Google OAuth (local only). MetaMask EOA tests verify connectivity only.

| Suite | Auth | Scope | File |
|-------|------|-------|------|
| Google OAuth | Google | All RPC method tests | `tests/google/rpc-methods.spec.ts` |
| MetaMask EOA | MetaMask | Connection + personal_sign | `tests/eoa/rpc-methods.spec.ts` |
| Suite | Auth | Scope | Default | File |
|-------|------|-------|---------|------|
| LINE OAuth | LINE | All RPC method tests | **CI default** | `specs/line-rpc-methods.spec.ts` |
| Google OAuth | Google | All RPC method tests | Local only | `specs/google-rpc-methods.spec.ts` |
| MetaMask EOA | MetaMask | Connection + personal_sign | — | `specs/eoa-rpc-methods.spec.ts` |

When adding a new RPC method test, add it to `tests/google/rpc-methods.spec.ts`.
Only one OAuth suite runs per execution, controlled by the `OAUTH_MODE` environment variable (`'line'` by default, `'google'` for local Google testing).

When adding a new RPC method test, add it to **both** `specs/line-rpc-methods.spec.ts` and `specs/google-rpc-methods.spec.ts`.

## Element Selection

Expand Down Expand Up @@ -64,9 +67,11 @@ Follow the Page Object Model pattern. All page objects are in `e2e/page-objects/
```
e2e/
├── lib/
│ └── constants.ts # ROUTES, CHAIN_IDS, SONEIUM_CHAIN
├── tests/
│ ├── eoa/ # EOA connect + basic signing test
│ ├── google/ # Google OAuth — full RPC method tests
│ └── smoke/ # No-auth smoke tests
│ └── constants.ts # ROUTES, CHAIN_IDS, SONEIUM_CHAIN
├── specs/
│ ├── smoke-dashboard-loads.spec.ts # No-auth smoke tests
│ ├── google-rpc-methods.spec.ts # Google OAuth — full RPC method tests
│ ├── line-rpc-methods.spec.ts # LINE OAuth — full RPC method tests
│ ├── eoa-rpc-methods.spec.ts # EOA connect + basic signing test
│ └── eoa-required-onboarding.spec.ts # EOA Required onboarding lifecycle
```
27 changes: 11 additions & 16 deletions e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,23 +121,23 @@ OAUTH_MODE=google GOOGLE_SESSION_STATE=$(cat e2e/google-session.json) pnpm test:
- `EOA Required` — requires LINE OAuth + MetaMask (EOA wallet linking)
- `No` — no authentication required

### Smoke Tests (`tests/smoke/dashboard-loads.spec.ts`)
### Smoke Tests (`specs/smoke-dashboard-loads.spec.ts`)

| # | Test | Auth |
|--:|------|:----:|
| 1 | dashboard loads with expected sections | No |
| 2 | eth_requestAccounts card is visible | No |
| 3 | wallet_connect card is visible | No |

### EOA RPC Methods (`tests/eoa/rpc-methods.spec.ts`)
### EOA RPC Methods (`specs/eoa-rpc-methods.spec.ts`)

MetaMask login is performed in the first test, then personal_sign verifies basic signing works. Full RPC coverage is handled by the LINE/Google OAuth suite.

| # | Test | Auth |
|--:|------|:----:|
| 4 | personal_sign — sign a message via shortcut | EOA |

### LINE OAuth RPC Methods (`tests/line/rpc-methods.spec.ts`) — CI Default
### LINE OAuth RPC Methods (`specs/line-rpc-methods.spec.ts`) — CI Default

All tests run in serial mode within a single browser context. LINE login is performed once in `beforeAll`, then each test reuses the same authenticated page. Skipped when `OAUTH_MODE=google`.

Expand All @@ -152,7 +152,7 @@ All tests run in serial mode within a single browser context. LINE login is perf
| 11 | eth_getBalance — error on invalid address | LINE |
| 12 | eth_getTransactionCount — error on invalid address | LINE |

### Google OAuth RPC Methods (`tests/google/rpc-methods.spec.ts`) — Local Only
### Google OAuth RPC Methods (`specs/google-rpc-methods.spec.ts`) — Local Only

All tests run in serial mode within a single browser context. Google login is performed once in `beforeAll`. Skipped unless `OAUTH_MODE=google`.

Expand All @@ -167,7 +167,7 @@ All tests run in serial mode within a single browser context. Google login is pe
| 19 | eth_getBalance — error on invalid address | Google |
| 20 | eth_getTransactionCount — error on invalid address | Google |

### EOA Required Onboarding (`tests/eoa-required/eoa-required-onboarding.spec.ts`)
### EOA Required Onboarding (`specs/eoa-required-onboarding.spec.ts`)

Tests the full EOA Required lifecycle: LINE OAuth login, MetaMask wallet linking via Dynamic Auth, address verification, and wallet disconnect. Uses a dedicated `EOA_LINKED_WALLET_SEED` (separate from `WALLET_SEED`).

Expand All @@ -184,17 +184,12 @@ Tests the full EOA Required lifecycle: LINE OAuth login, MetaMask wallet linking

```
e2e/
├── tests/
│ ├── line/
│ │ └── rpc-methods.spec.ts # LINE OAuth + all RPC method tests (CI default)
│ ├── google/
│ │ └── rpc-methods.spec.ts # Google OAuth + all RPC method tests (local only)
│ ├── eoa/
│ │ └── rpc-methods.spec.ts # MetaMask EOA connect + personal_sign
│ ├── eoa-required/
│ │ └── eoa-required-onboarding.spec.ts # EOA Required onboarding lifecycle
│ └── smoke/
│ └── dashboard-loads.spec.ts # Dashboard loads without auth
├── specs/
│ ├── smoke-dashboard-loads.spec.ts # Dashboard loads without auth
│ ├── line-rpc-methods.spec.ts # LINE OAuth + all RPC method tests (CI default)
│ ├── google-rpc-methods.spec.ts # Google OAuth + all RPC method tests (local only)
│ ├── eoa-rpc-methods.spec.ts # MetaMask EOA connect + personal_sign
│ └── eoa-required-onboarding.spec.ts # EOA Required onboarding lifecycle
├── page-objects/
│ ├── dashboardPage.ts # Dashboard section selectors (data-testid)
│ └── rpcMethodCard.ts # RPC method card selectors & actions
Expand Down
10 changes: 5 additions & 5 deletions e2e/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,33 +41,33 @@ export default defineConfig({
projects: [
{
name: 'smoke',
testMatch: /smoke\/.*\.spec\.ts/,
testMatch: /specs\/smoke-.*\.spec\.ts/,
use: { ...devices['Desktop Chrome'] },
Comment thread
JGJP marked this conversation as resolved.
},
{
name: 'eoa-chromium',
testMatch: /eoa\/.*\.spec\.ts/,
testMatch: /specs\/eoa-.*\.spec\.ts/,
use: { ...devices['Desktop Chrome'] },
},
{
name: 'google-chromium',
testMatch: /google\/.*\.spec\.ts/,
testMatch: /specs\/google-.*\.spec\.ts/,
use: {
...devices['Desktop Chrome'],
launchOptions: antiDetectionLaunchOptions,
},
},
{
name: 'line-chromium',
testMatch: /line\/.*\.spec\.ts/,
testMatch: /specs\/line-.*\.spec\.ts/,
use: {
...devices['Desktop Chrome'],
launchOptions: antiDetectionLaunchOptions,
},
},
{
name: 'eoa-required-chromium',
testMatch: /eoa-required\/.*\.spec\.ts/,
testMatch: /specs\/eoa-required-.*\.spec\.ts/,
use: {
...devices['Desktop Chrome'],
launchOptions: antiDetectionLaunchOptions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ import type { BrowserContext, Locator, Page } from '@playwright/test'
import { expect } from '@playwright/test'
import { mnemonicToAccount } from 'viem/accounts'

import { createWalletFixture } from '../../fixtures/wallet.fixture.js'
import { linkEOAWallet } from '../../lib/auth/eoa-required-onboarding.js'
import { loginWithLine } from '../../lib/auth/line-oauth.js'
import { ROUTES, SCW_URL } from '../../lib/constants.js'
import { createWalletFixture } from '../fixtures/wallet.fixture.js'
import { linkEOAWallet } from '../lib/auth/eoa-required-onboarding.js'
import { loginWithLine } from '../lib/auth/line-oauth.js'
import { ROUTES, SCW_URL } from '../lib/constants.js'
import {
type SessionCookie,
isLineDomain,
parseAllLineSessionCookies,
waitForPopup,
} from '../../lib/helpers.js'
import { dashboardPage } from '../../page-objects/dashboardPage.js'
import { rpcMethodCard } from '../../page-objects/rpcMethodCard.js'
} from '../lib/helpers.js'
import { dashboardPage } from '../page-objects/dashboardPage.js'
import { rpcMethodCard } from '../page-objects/rpcMethodCard.js'

const test = createWalletFixture('EOA_LINKED_WALLET_SEED')

Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import type { Page } from '@playwright/test'
import { expect, test } from '../../fixtures/wallet.fixture.js'
import { loginWithMetaMask } from '../../lib/auth/metamask-eoa.js'
import { ROUTES } from '../../lib/constants.js'
import { expect, test } from '../fixtures/wallet.fixture.js'
import { loginWithMetaMask } from '../lib/auth/metamask-eoa.js'
import { ROUTES } from '../lib/constants.js'
import {
triggerAndApproveSDKPopup,
waitForPopup,
waitForPopupClose,
} from '../../lib/helpers.js'
import { dashboardPage } from '../../page-objects/dashboardPage.js'
import { rpcMethodCard } from '../../page-objects/rpcMethodCard.js'
} from '../lib/helpers.js'
import { dashboardPage } from '../page-objects/dashboardPage.js'
import { rpcMethodCard } from '../page-objects/rpcMethodCard.js'

/**
* EOA authentication pathway verification.
*
* Full RPC method coverage runs via Google OAuth (tests/google/).
* Full RPC method coverage runs via Google OAuth (google-rpc-methods.spec.ts).
* This suite only verifies that MetaMask EOA login works and
* can execute a basic signing operation.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ import {
type BrowserContext,
type Page,
} from '@playwright/test'
import { loginWithGoogle } from '../../lib/auth/google-oauth.js'
import { CHAIN_IDS, ROUTES } from '../../lib/constants.js'
import { loginWithGoogle } from '../lib/auth/google-oauth.js'
import { CHAIN_IDS, ROUTES } from '../lib/constants.js'
import {
injectSCWUrl,
parseGoogleSessionCookies,
triggerAndApproveSDKPopup,
waitForPopup,
waitForPopupClose,
} from '../../lib/helpers.js'
import { dashboardPage } from '../../page-objects/dashboardPage.js'
import { rpcMethodCard } from '../../page-objects/rpcMethodCard.js'
} from '../lib/helpers.js'
import { dashboardPage } from '../page-objects/dashboardPage.js'
import { rpcMethodCard } from '../page-objects/rpcMethodCard.js'

/**
* All RPC method tests that require Google OAuth authentication.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ import {
type BrowserContext,
type Page,
} from '@playwright/test'
import { loginWithLine } from '../../lib/auth/line-oauth.js'
import { CHAIN_IDS, ROUTES } from '../../lib/constants.js'
import { loginWithLine } from '../lib/auth/line-oauth.js'
import { CHAIN_IDS, ROUTES } from '../lib/constants.js'
import {
injectSCWUrl,
parseLineSessionCookies,
triggerAndApproveSDKPopup,
waitForPopup,
waitForPopupClose,
} from '../../lib/helpers.js'
import { dashboardPage } from '../../page-objects/dashboardPage.js'
import { rpcMethodCard } from '../../page-objects/rpcMethodCard.js'
} from '../lib/helpers.js'
import { dashboardPage } from '../page-objects/dashboardPage.js'
import { rpcMethodCard } from '../page-objects/rpcMethodCard.js'

/**
* All RPC method tests that require LINE OAuth authentication.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect, test } from '@playwright/test'

import { dashboardPage } from '../../page-objects/dashboardPage.js'
import { dashboardPage } from '../page-objects/dashboardPage.js'

test.describe('Dashboard smoke tests', () => {
test('dashboard loads with expected sections', async ({ page }) => {
Expand Down