Skip to content
Merged
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
2 changes: 1 addition & 1 deletion e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0",
"private": true,
"type": "module",
"description": "Playwright UI-smoke parity tests run against every framework template.",
"description": "Playwright e2e UI tests",
"scripts": {
"test": "playwright test"
},
Expand Down
16 changes: 10 additions & 6 deletions e2e/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,25 @@ import { existsSync, readdirSync } from "node:fs"
import { dirname, resolve } from "node:path"
import { fileURLToPath } from "node:url"

// Self-adapting target list, so the same suite works in both lifecycle states
// without `init` having to rewrite this file:
// - Post-init (user project): only the instantiated `app/` exists → 1 target.
// - Contributor view (UI monorepo): one target per `templates/<framework>/`.
// The shared, framework-agnostic specs then run against whichever targets exist,
// which is what enforces feature parity between templates.
const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..")

type Target = { name: string; cwd: string; port: number }

// These tests run in both a generated Scaffold project (which has an `app`
// dir) and in the Scaffold UI monorepo (which has a `templates` dir). They are
// how the Scaffold team maintains parity and behavior for all of their
// templates, and they are also useful as a starting point for app developers
// who use Scaffold to initialize projects.
//
// If you used Scaffold to generate this project, feel free to simplify this
// function to remove the `templates` logic.
function resolveTargets(): Target[] {
// generated Scaffold project
const appDir = resolve(repoRoot, "app")
if (existsSync(appDir)) {
return [{ name: "app", cwd: appDir, port: 5180 }]
}
// the Scaffold UI monorepo (feel free to remove)
const templatesDir = resolve(repoRoot, "templates")
const frameworks = existsSync(templatesDir)
? readdirSync(templatesDir, { withFileTypes: true })
Expand Down
9 changes: 0 additions & 9 deletions e2e/tests/guess-the-number.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,6 @@ import { Keypair, xdr } from "@stellar/stellar-sdk"
import { connectFakeFreighter, DECLINED } from "../util/fake-freighter"
import { CONTRACT_ERROR, stubRpc } from "../util/stub-rpc"

// Guess the Number, from typing a guess to the result the player sees. The
// wallet and the RPC are stand-ins (see `../util`), so these run the same
// against every target and network with no chain, extension or funded account.
//
// Regression guard for stellar-scaffold/ui#285: a guess must reach the
// contract call and the wallet, the contract's answer must reach the player,
// and a failure along the way (declined signature, simulation or contract
// error) must not read as a wrong guess.

const guesser = Keypair.random()
const INCORRECT = "Incorrect guess. Try again!"
const CORRECT = "You got it!"
Expand Down
5 changes: 0 additions & 5 deletions e2e/tests/smoke.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import { test, expect } from "@playwright/test"

// UI-smoke parity: framework-agnostic assertions that must hold for every
// target (each framework template in the monorepo, or the single `app/` after
// init). These guard the shared-util/component/style refactor against dropped
// features and broken imports — no chain or wallet interaction required.

test("home page mounts", async ({ page }) => {
const response = await page.goto("/")
expect(response?.ok()).toBeTruthy()
Expand Down
9 changes: 6 additions & 3 deletions e2e/tests/visual.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { test, expect } from "@playwright/test"

// Visual guard for the styles centralization. Per-project baselines (one per
// framework) are committed; the smoke specs assert behavior, these assert
// appearance. During the styles refactor an intended change shows up as a diff
// Visual guard for the styles centralization. Saves png snapshots of current
// UI and compares against previous run's png.
//
// During a style refactor an intended change shows up as a diff
// to review + re-baseline (`--update-snapshots`); an unintended one fails.
//
// First run fails, generating an initial png.

test("home page visual", async ({ page }) => {
await page.goto("/")
Expand Down
Loading