diff --git a/.claude-lib/project/rules/e2e.md b/.claude-lib/project/rules/e2e.md index a0aabeff..bd0a097d 100644 --- a/.claude-lib/project/rules/e2e.md +++ b/.claude-lib/project/rules/e2e.md @@ -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 @@ -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 ``` diff --git a/e2e/README.md b/e2e/README.md index 3e6a375b..bc70808e 100644 --- a/e2e/README.md +++ b/e2e/README.md @@ -121,7 +121,7 @@ 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 | |--:|------|:----:| @@ -129,7 +129,7 @@ OAUTH_MODE=google GOOGLE_SESSION_STATE=$(cat e2e/google-session.json) pnpm test: | 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. @@ -137,7 +137,7 @@ MetaMask login is performed in the first test, then personal_sign verifies basic |--:|------|:----:| | 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`. @@ -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`. @@ -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`). @@ -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 diff --git a/e2e/playwright.config.ts b/e2e/playwright.config.ts index 7e4afbb9..ba4bdd86 100644 --- a/e2e/playwright.config.ts +++ b/e2e/playwright.config.ts @@ -41,17 +41,17 @@ export default defineConfig({ projects: [ { name: 'smoke', - testMatch: /smoke\/.*\.spec\.ts/, + testMatch: /specs\/smoke-.*\.spec\.ts/, use: { ...devices['Desktop Chrome'] }, }, { 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, @@ -59,7 +59,7 @@ export default defineConfig({ }, { name: 'line-chromium', - testMatch: /line\/.*\.spec\.ts/, + testMatch: /specs\/line-.*\.spec\.ts/, use: { ...devices['Desktop Chrome'], launchOptions: antiDetectionLaunchOptions, @@ -67,7 +67,7 @@ export default defineConfig({ }, { name: 'eoa-required-chromium', - testMatch: /eoa-required\/.*\.spec\.ts/, + testMatch: /specs\/eoa-required-.*\.spec\.ts/, use: { ...devices['Desktop Chrome'], launchOptions: antiDetectionLaunchOptions, diff --git a/e2e/tests/eoa-required/eoa-required-onboarding.spec.ts b/e2e/specs/eoa-required-onboarding.spec.ts similarity index 97% rename from e2e/tests/eoa-required/eoa-required-onboarding.spec.ts rename to e2e/specs/eoa-required-onboarding.spec.ts index 8adbca02..4956c711 100644 --- a/e2e/tests/eoa-required/eoa-required-onboarding.spec.ts +++ b/e2e/specs/eoa-required-onboarding.spec.ts @@ -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') diff --git a/e2e/tests/eoa/rpc-methods.spec.ts b/e2e/specs/eoa-rpc-methods.spec.ts similarity index 76% rename from e2e/tests/eoa/rpc-methods.spec.ts rename to e2e/specs/eoa-rpc-methods.spec.ts index 2ffe5196..51603688 100644 --- a/e2e/tests/eoa/rpc-methods.spec.ts +++ b/e2e/specs/eoa-rpc-methods.spec.ts @@ -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. */ diff --git a/e2e/tests/google/rpc-methods.spec.ts b/e2e/specs/google-rpc-methods.spec.ts similarity index 94% rename from e2e/tests/google/rpc-methods.spec.ts rename to e2e/specs/google-rpc-methods.spec.ts index 95c7e810..27e575b6 100644 --- a/e2e/tests/google/rpc-methods.spec.ts +++ b/e2e/specs/google-rpc-methods.spec.ts @@ -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. diff --git a/e2e/tests/line/rpc-methods.spec.ts b/e2e/specs/line-rpc-methods.spec.ts similarity index 94% rename from e2e/tests/line/rpc-methods.spec.ts rename to e2e/specs/line-rpc-methods.spec.ts index b2d8f248..b837b7a6 100644 --- a/e2e/tests/line/rpc-methods.spec.ts +++ b/e2e/specs/line-rpc-methods.spec.ts @@ -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. diff --git a/e2e/tests/smoke/dashboard-loads.spec.ts b/e2e/specs/smoke-dashboard-loads.spec.ts similarity index 91% rename from e2e/tests/smoke/dashboard-loads.spec.ts rename to e2e/specs/smoke-dashboard-loads.spec.ts index eb6ca77d..d41b4ee9 100644 --- a/e2e/tests/smoke/dashboard-loads.spec.ts +++ b/e2e/specs/smoke-dashboard-loads.spec.ts @@ -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 }) => {