chore: starter template
This commit is contained in:
6
e2e/tests/cucumber.mjs
Normal file
6
e2e/tests/cucumber.mjs
Normal file
@@ -0,0 +1,6 @@
|
||||
export default {
|
||||
require: ['tests/support/**/*.ts', 'tests/steps/**/*.ts'],
|
||||
paths: ['tests/features/**/*.feature'],
|
||||
format: ['progress'],
|
||||
forceExit: true,
|
||||
}
|
||||
8
e2e/tests/features/auth.feature
Normal file
8
e2e/tests/features/auth.feature
Normal file
@@ -0,0 +1,8 @@
|
||||
@auth @smoke
|
||||
Feature: Authentication
|
||||
Users sign in with email + password; the session is cookie-based.
|
||||
|
||||
Scenario: a registered user signs in through the login form
|
||||
Given a test account exists
|
||||
When "the user" signs in through the login form
|
||||
Then they land on the app
|
||||
10
e2e/tests/features/pages.feature
Normal file
10
e2e/tests/features/pages.feature
Normal file
@@ -0,0 +1,10 @@
|
||||
@pages @smoke
|
||||
Feature: Every page loads
|
||||
Signed in, every static route must render without an HTTP error, a failed or
|
||||
5xx app API call, an uncaught exception, or a console error. This is the
|
||||
baseline reliability gate — extend it with per-domain behaviour features as
|
||||
the app grows (create/edit/list flows, permissions, etc.).
|
||||
|
||||
Scenario: all pages load cleanly when signed in
|
||||
Given "the user" is signed in
|
||||
Then every page loads without errors
|
||||
28
e2e/tests/support/register.ts
Normal file
28
e2e/tests/support/register.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import {
|
||||
Given,
|
||||
When,
|
||||
Then,
|
||||
Before,
|
||||
After,
|
||||
defineParameterType,
|
||||
setDefaultTimeout,
|
||||
} from '@cucumber/cucumber'
|
||||
import { registerBrowserSteps, registerBrowserHooks } from '@pikku/cucumber/browser'
|
||||
|
||||
// The shared browser vocabulary ({actor} grammar, form/click/see steps, the
|
||||
// "every page loads without errors" sweep) and the browser lifecycle hooks.
|
||||
// Per-domain business steps belong in ../steps/*.steps.ts.
|
||||
registerBrowserSteps({ Given, When, Then, defineParameterType })
|
||||
registerBrowserHooks({ Before, After, setDefaultTimeout })
|
||||
|
||||
// The page-load sweep visits every route in one step, so give scenarios plenty
|
||||
// of room. Per-action waits are still bounded by the package's config.timeout.
|
||||
setDefaultTimeout(Number(process.env.E2E_SCENARIO_TIMEOUT ?? 300_000))
|
||||
|
||||
// Don't start a scenario while the dev server is mid-restart (it 5xx's /api
|
||||
// for a few seconds on boot / file change) — that race reads as a phantom
|
||||
// failure. Server orchestration itself stays outside these tests.
|
||||
Before(async function (this: import('./world.js').AppWorld) {
|
||||
const actor = await this.actor(undefined)
|
||||
await actor.waitForServerReady()
|
||||
})
|
||||
15
e2e/tests/support/world.ts
Normal file
15
e2e/tests/support/world.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { setWorldConstructor } from '@cucumber/cucumber'
|
||||
import { BrowserWorld } from '@pikku/cucumber/browser'
|
||||
|
||||
/**
|
||||
* AppWorld — the app's cucumber world, built on @pikku/cucumber/browser.
|
||||
*
|
||||
* The package owns the browser lifecycle, the actor grammar ("the user",
|
||||
* "the admin", they) and the generic step vocabulary. Extend this class for
|
||||
* app-specific needs: override createClients() to expose the generated
|
||||
* PikkuRPC/PikkuFetch on actors, override resetAppData() to call the app's
|
||||
* reset RPC, or add helpers for per-domain *.steps.ts files.
|
||||
*/
|
||||
export class AppWorld extends BrowserWorld {}
|
||||
|
||||
setWorldConstructor(AppWorld)
|
||||
Reference in New Issue
Block a user