diff --git a/features/schema_builtin_view.feature b/features/schema_builtin_view.feature new file mode 100644 index 0000000..5f57d98 --- /dev/null +++ b/features/schema_builtin_view.feature @@ -0,0 +1,171 @@ +Feature: Read-only view of a built-in content type + As an owner or admin + I want to open a built-in type from the Schema list and read its fields + So that I can see the rules RenewCMS applies without being able to change them + + Background: + Given the SPA calls the API with relative URLs under /v1 and the "jwt" HttpOnly cookie + And GET /v1/builtin-type returns [{key, name, fields}] for owners and admins only + And each field is {key, label, type, required, unique, default, min, max, options} + And API errors are plain text + And the route /schema/:key has meta auth "verified" and title "Schema" + And the contentTypes store already exposes builtinItems, builtinStatus and load({builtin: true}) + And the view takes its data from builtinItems, matched on the route key, and never calls GET /v1/builtin-type/{key} + And only owners and admins can use Schema; the SPA decides from the session role, the API still enforces it + And a session whose role is neither owner nor admin is a test double for the forbidden states + And the built-in types are articles ("Articles"), authors, sites, media and users with 5, 5, 8, 6 and 6 fields in the sample data + + Scenario: A built-in row of the Schema list is a link + Given the Schema list is Populated + When the user looks at the five built-in rows + Then each row is a single link to /schema/ whose accessible name is the type name + And the row keeps its lock icon, name, "Built-in" badge, key, field count and a chevron-right at the end + And on desktop its "Last updated" cell reads "Managed by RenewCMS" + And below 640 px the card of a built-in type shows " · fields" with no "Updated" text and a chevron-right + And custom rows are not links and show no chevron + + Scenario: Opening a built-in type from the list + Given the Schema list is Populated + When the user activates the "Articles" row + Then the router navigates to /schema/articles + And GET /v1/builtin-type is not called a second time + + Scenario: Read-only view of a built-in type (design state 6, desktop) + Given an owner or admin is signed in + And GET /v1/builtin-type returns the type "articles" named "Articles" with the fields + | label | key | type | required | unique | min | max | default | + | Title | title | text | true | false | | 200 | | + | Slug | slug | text | true | true | | | | + | Body | body | richtext | false | false | | 10000 | | + | Online | online | boolean | false | false | | | false | + | Published on | published_on | date | false | false | | | | + When they open /schema/articles + Then the breadcrumb is "Schema" (a link to /schema) then "Articles" + And the h1 "Articles" is shown with a lock icon and a "Built-in" badge + And an info alert titled "Managed by RenewCMS" says "Articles is a built-in type. You can read its fields here, but you can't edit it, delete it or add fields." + And a table has the columns "Label", "Key", "Type", "Rules" + And the rows are, in this order + | Label | Key | Type | Rules | + | Title | title | Text | Required · up to 200 characters | + | Slug | slug | Text | Required · unique | + | Body | body | Rich text | Up to 10,000 characters | + | Online | online | Yes or no | Off by default | + | Published on | published_on | Date | – | + And each row starts with the icon of its type + And the note "Entries of built-in types are managed from their own screens, like Articles and Authors." is shown under the table + And there is no "New content type", edit, delete, add field, save or discard action + And the keys are shown in the mono style + And GET /v1/content-type and GET /v1/builtin-type are each called once + + Scenario: Read-only view of a built-in type on mobile + Given the same data and a 390 px wide viewport + When they open /schema/articles + Then the topbar shows an arrow-left and the title "Articles" + And the fields are cards in order, each with the icon box of its type, the label, and the key in mono followed by " · " and the rules + And the Type column is not shown + And the "Built-in" badge, the alert and the note are shown + + Scenario Outline: Field types show their label and icon + Given a built-in field of type "" + Then the Type cell reads "