@webship-js/django-steps 0.0.0-stage → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,64 @@
1
1
  {
2
2
  "name": "@webship-js/django-steps",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "2.0.0",
4
+ "description": "Cucumber step definitions for the Django admin, a plugin for webship-js (Playwright and Cucumber): the admin login and logout; the index with its apps and models; the change list with its search, filters, sorting, date drill-down, pagination, selection across pages, actions and the \"Delete selected\" confirmation; the add and change forms with their fieldsets, read-only fields, autocomplete and two-list selectors, inline rows, validation errors, messages and save buttons; the delete confirmation with its related objects and the history page; the password change; users and groups; and view-only access.",
5
+ "main": "tests/step-definitions/django-session.steps.js",
6
+ "files": [
7
+ "tests/step-definitions/",
8
+ "tests/features/",
9
+ "README.md",
10
+ "LICENSE"
11
+ ],
12
+ "scripts": {
13
+ "test": "cucumber-js --config cucumber.js",
14
+ "test:dry": "cucumber-js --config cucumber.js --dry-run",
15
+ "test:examples": "node tests/check-examples.js",
16
+ "test:paths": "node tests/check-paths.js",
17
+ "test:must-fail": "node tests/check-must-fail.js",
18
+ "test:chromium": "BROWSER=chromium cucumber-js --config cucumber.js",
19
+ "test:firefox": "BROWSER=firefox cucumber-js --config cucumber.js",
20
+ "test:webkit": "BROWSER=webkit cucumber-js --config cucumber.js",
21
+ "test:headed": "HEADLESS=false cucumber-js --config cucumber.js",
22
+ "generate-reports": "generate-reports",
23
+ "test:fast": "SLOW_MO=0 cucumber-js --config cucumber.js"
24
+ },
25
+ "keywords": [
26
+ "webship-js",
27
+ "django",
28
+ "django-admin",
29
+ "admin",
30
+ "cucumber",
31
+ "cucumber-js",
32
+ "playwright",
33
+ "bdd",
34
+ "testing",
35
+ "e2e",
36
+ "gherkin"
37
+ ],
38
+ "author": "Webship.co",
39
+ "license": "MIT",
40
+ "repository": {
41
+ "type": "git",
42
+ "url": "git+https://github.com/webship/django-steps.git"
43
+ },
44
+ "bugs": {
45
+ "url": "https://github.com/webship/django-steps/issues"
46
+ },
47
+ "homepage": "https://github.com/webship/django-steps#readme",
48
+ "publishConfig": {
49
+ "access": "public"
50
+ },
51
+ "engines": {
52
+ "node": ">= 20.0"
53
+ },
54
+ "peerDependencies": {
55
+ "webship-js": "^2.0.16"
56
+ },
57
+ "devDependencies": {
58
+ "tsx": "^4.23.0",
59
+ "webship-js": "^2.0.16"
60
+ },
61
+ "overrides": {
62
+ "@cucumber/cucumber": "^12"
63
+ }
64
+ }
@@ -0,0 +1,24 @@
1
+ # Features
2
+
3
+ Reference features for the test site that `.github/scripts/build-ddev-site.sh`
4
+ builds (or the Webship Workspace's builder, with `--install --add-users
5
+ --polls`): a plain project with the polls app of the official tutorial,
6
+ registered in the admin, its sample data (5 categories, 4 tags, 24 questions), and
7
+ the three accounts of `cucumber.js` (`administrator`, `editor`, `viewer`). Each
8
+ scenario makes the objects it needs and deletes them after it, so a feature runs
9
+ as it is on any such site.
10
+
11
+ | Feature | Covers |
12
+ | --- | --- |
13
+ | `session` | Each account logging in through the form, a refused login, a visitor sent to the login page, logging out, a session taken over. |
14
+ | `index` | The index as each account sees it, the recent actions, the breadcrumbs, the navigation sidebar, the colour theme. |
15
+ | `change-list` | The columns and cells, a search, sorting both ways, a filter and its counts, the date drill-down, the pages. |
16
+ | `actions` | The selection of rows and across pages, "Delete selected" and going back, an action without rows, the site's own action, a confirmed deletion. |
17
+ | `add-and-change` | The add form's sections and inline rows, every kind of field, the date shortcuts, the save buttons, the autocomplete field, the two-list selector, inline rows, a refused form, a stacked inline. |
18
+ | `delete-and-history` | A deletion with its related objects, going back, a protected category, the history, a deletion in one step. |
19
+ | `password` | The password change and four of its refusals; the password is set back after the scenario. |
20
+ | `users-and-groups` | The accounts' status and groups, the groups' permissions, the users list, a group given its permissions, a name in use, the editor refused the accounts. |
21
+ | `view-only` | The view-only account: its list, its read-only form, its refusals. |
22
+ | `accessibility` | The landmarks of the login page, the index and a list. |
23
+
24
+ The assertions that must fail are in `tests/must-fail/` (`npm run test:must-fail`).
@@ -0,0 +1,21 @@
1
+ @accessibility
2
+ Feature: The landmarks of the admin's pages
3
+ As a person who uses a screen reader or a keyboard
4
+ I want every page of the admin to have its landmarks, its language and one main heading
5
+ So that I move through the admin as easily as anyone
6
+
7
+ Scenario: The login page
8
+ Given I am not logged in
9
+ Then the page should have a main landmark
10
+ And the page should have a skip link
11
+ And the page should declare a language
12
+ And every form field should have an accessible label
13
+
14
+ Scenario: The index and a list
15
+ Given I am a logged in user with the "editor" user
16
+ When I open the admin index
17
+ Then the page should have a main landmark
18
+ And the page should have exactly one h1
19
+ When I open the "Questions" list
20
+ Then the page should have a navigation landmark
21
+ And the page should have exactly one h1
@@ -0,0 +1,81 @@
1
+ @actions
2
+ Feature: Selecting rows of a list and running an action on them
3
+ As an editor
4
+ I want to act on several questions at once
5
+ So that a change to many takes one step, and a deletion asks me first
6
+
7
+ Background:
8
+ Given there is no "Action test question one" in the "Questions" list
9
+ And there is no "Action test question two" in the "Questions" list
10
+ And I am a logged in user with the "editor" user
11
+
12
+ Scenario: The action bar counts the selected rows
13
+ Given I am on the "Questions" list
14
+ When I select "Which river is the longest?" in the list
15
+ And I select "Which season do you like best?" in the list
16
+ Then the selection should read "2 of 10 selected"
17
+ When I unselect "Which season do you like best?" in the list
18
+ Then the selection should read "1 of 10 selected"
19
+
20
+ Scenario: Every row of the list, on all its pages, is selected and the selection cleared
21
+ Given I am on the "Questions" list
22
+ When I select everything in the list
23
+ Then the selection should read "All 24 selected"
24
+ When I clear the selection
25
+ Then the selection should read "0 of 10 selected"
26
+
27
+ Scenario: The deletion of the selected rows asks first, and going back deletes nothing
28
+ Given I am on the "Questions" list
29
+ When I select all rows on the page
30
+ And I run the action "Delete selected questions"
31
+ Then the delete confirmation should count "Questions: 10"
32
+ And the delete confirmation should list "Question: Which river is the longest?"
33
+ And the delete confirmation should list "Choice: The Nile"
34
+ When I cancel the deletion
35
+ Then I should be on the "Questions" list
36
+ And the list should count 24 questions
37
+
38
+ Scenario: An action needs selected rows
39
+ Given I am on the "Questions" list
40
+ When I run the action "Delete selected questions"
41
+ Then I should see the warning message "Items must be selected in order to perform actions on them. No items have been changed."
42
+
43
+ Scenario: The action of the site resets the votes of the selected questions
44
+ Given there is a "Action test question one" in the "Questions" list with:
45
+ | Question text | Action test question one |
46
+ | Date published | 2026-03-01 10:00:00 |
47
+ And there is a "Action test question two" in the "Questions" list with:
48
+ | Question text | Action test question two |
49
+ | Date published | 2026-03-02 10:00:00 |
50
+ When I open "Action test question one" in the "Questions" list
51
+ And I fill in the "Choices" inline:
52
+ | Choice text | Votes |
53
+ | Yes | 5 |
54
+ | No | 3 |
55
+ And I save the form and continue editing
56
+ Then "Total votes" should be read-only and show "8"
57
+ When I open the "Questions" list
58
+ And I search the list for "Action test question"
59
+ And I select "Action test question one" in the list
60
+ And I select "Action test question two" in the list
61
+ And I run the action "Reset the votes of the selected questions"
62
+ Then I should see the success message "The votes of 2 questions were reset."
63
+ When I open "Action test question one" in the "Questions" list
64
+ Then "Total votes" should be read-only and show "0"
65
+
66
+ Scenario: The selected rows are deleted once the deletion is confirmed
67
+ Given there is a "Action test question one" in the "Questions" list with:
68
+ | Question text | Action test question one |
69
+ | Date published | 2026-03-01 10:00:00 |
70
+ And there is a "Action test question two" in the "Questions" list with:
71
+ | Question text | Action test question two |
72
+ | Date published | 2026-03-02 10:00:00 |
73
+ And I am on the "Questions" list
74
+ When I search the list for "Action test question"
75
+ And I select all rows on the page
76
+ And I run the action "Delete selected questions"
77
+ Then the delete confirmation should count "Questions: 2"
78
+ When I confirm the deletion
79
+ Then I should see the success message "Successfully deleted 2 questions."
80
+ And there should be no "Action test question one" in the "Questions" list
81
+ And there should be no "Action test question two" in the "Questions" list
@@ -0,0 +1,154 @@
1
+ @forms
2
+ Feature: Adding and changing an object with every kind of field
3
+ As an editor
4
+ I want the add and change forms to take every kind of value the model has
5
+ So that a question goes in whole: its text, its date, its category, its tags and its choices
6
+
7
+ Background:
8
+ Given there is no "Form test question" in the "Questions" list
9
+ And I am a logged in user with the "editor" user
10
+
11
+ @critical
12
+ Scenario: The add form shows its sections, its read-only field and its inline rows
13
+ When I open the add form of "Questions"
14
+ Then I should see the "Add question" form
15
+ And the form should have the section "Date information"
16
+ And the form should have the section "Classification"
17
+ And the section "Date information" should be closed
18
+ And the section "Classification" should have the field "Category"
19
+ And the section "Classification" should have the field "Tags"
20
+ And "Total votes" should be read-only and show "-"
21
+ And the "Choices" inline should have 3 rows
22
+ When I open the section "Date information"
23
+ Then the section "Date information" should be open
24
+ And the section "Date information" should have the field "Date published"
25
+
26
+ Scenario: A question is added with a date, a category, tags and choices
27
+ When I open the add form of "Questions"
28
+ And I set "Question text" to "Form test question"
29
+ And I set "Date published" to "2026-04-01 09:30:00"
30
+ And I choose "Science" in the "Category" autocomplete
31
+ And I choose "Fun, Serious" in the "Tags" selector
32
+ And I fill in the "Choices" inline:
33
+ | Choice text | Votes |
34
+ | Yes | 4 |
35
+ | No | 3 |
36
+ And I save the form and continue editing
37
+ Then the form should be saved
38
+ And I should see the success message "The question “Form test question” was added successfully. You may edit it again below."
39
+ And I should see the "Change question" form for "Form test question"
40
+ And "Question text" should be set to "Form test question"
41
+ And "Date published" should be set to "2026-04-01 09:30:00"
42
+ And "Category" should be set to "Science"
43
+ And "Tags" should be set to "Fun, Serious"
44
+ And "Total votes" should be read-only and show "7"
45
+ And row 1 of the "Choices" inline should have "Yes" in "Choice text"
46
+ And row 2 of the "Choices" inline should have "3" in "Votes"
47
+
48
+ Scenario: The shortcuts set the date and time to now
49
+ When I open the add form of "Questions"
50
+ And I set "Question text" to "Form test question"
51
+ And I set "Date published" to "now"
52
+ And I save the form
53
+ Then the form should be saved
54
+ And I should be on the "Questions" list
55
+ And the "Form test question" row should show "yes" in the "Published recently?" column
56
+
57
+ Scenario: Save and add another opens a new add form
58
+ When I open the add form of "Questions"
59
+ And I set these fields:
60
+ | Question text | Form test question |
61
+ | Date published | 2026-04-02 10:00:00 |
62
+ And I save the form and add another
63
+ Then I should see the success message "You may add another question below."
64
+ And I should see the "Add question" form
65
+ And "Question text" should be set to ""
66
+
67
+ Scenario: An object is changed and the change is saved
68
+ Given there is a "Form test question" in the "Questions" list with:
69
+ | Question text | Form test question |
70
+ | Date published | 2026-04-03 11:00:00 |
71
+ | Category | Travel |
72
+ When I open "Form test question" in the "Questions" list
73
+ Then "Category" should be set to "Travel"
74
+ When I choose "Food" in the "Category" autocomplete
75
+ And I save the form
76
+ Then I should see the success message "The question “Form test question” was changed successfully."
77
+ When I search the list for "Form test question"
78
+ Then the "Form test question" row should show "Food" in the "Category" column
79
+
80
+ Scenario: The autocomplete field searches as you type
81
+ When I open the add form of "Questions"
82
+ And I type "Tra" in the "Category" autocomplete
83
+ Then the "Category" autocomplete should offer "Travel"
84
+ And the "Category" autocomplete should not offer "Science"
85
+
86
+ Scenario: The two-list selector moves and filters its options
87
+ When I open the add form of "Questions"
88
+ Then the "Tags" selector should have "Fun" available
89
+ When I choose "Fun" in the "Tags" selector
90
+ Then the "Tags" selector should have "Fun" chosen
91
+ And the "Tags" selector should not have "Fun" available
92
+ When I filter the available "Tags" with "Se"
93
+ Then the "Tags" selector should have "Serious" available
94
+ And the "Tags" selector should not have "Long" available
95
+ When I remove "Fun" from the "Tags" selector
96
+ Then the "Tags" selector should not have "Fun" chosen
97
+ When I choose all in the "Tags" selector
98
+ Then "Tags" should be set to "Serious"
99
+
100
+ Scenario: Inline rows are added and removed
101
+ When I open the add form of "Questions"
102
+ Then the "Choices" inline should have 3 rows
103
+ When I add a row to the "Choices" inline
104
+ Then the "Choices" inline should have 4 rows
105
+ When I set "Choice text" to "Maybe" in row 4 of the "Choices" inline
106
+ Then the "Choices" inline should list "Maybe"
107
+ When I remove row 4 of the "Choices" inline
108
+ Then the "Choices" inline should have 3 rows
109
+ And the "Choices" inline should not list "Maybe"
110
+
111
+ Scenario: A saved inline row is deleted with the form
112
+ When I open the add form of "Questions"
113
+ And I set "Question text" to "Form test question"
114
+ And I set "Date published" to "2026-04-04 12:00:00"
115
+ And I fill in the "Choices" inline:
116
+ | Choice text |
117
+ | Keep me |
118
+ | Delete me |
119
+ And I save the form and continue editing
120
+ And I remove row 2 of the "Choices" inline
121
+ Then row 2 of the "Choices" inline should be marked for deletion
122
+ When I save the form and continue editing
123
+ Then the "Choices" inline should list "Keep me"
124
+ And the "Choices" inline should not list "Delete me"
125
+
126
+ Scenario: A refused form says what is missing and keeps what was typed
127
+ When I open the add form of "Questions"
128
+ And I set "Category" to "Music"
129
+ And I save the form
130
+ Then the form should show the error "Please correct the errors below."
131
+ And the field "Question text" should have the error "This field is required."
132
+ And the field "Date published" should have the error "This field is required."
133
+ And the section "Date information" should be open
134
+ And "Category" should be set to "Music"
135
+
136
+ Scenario: A date the form cannot read is refused
137
+ When I open the add form of "Questions"
138
+ And I set "Question text" to "Form test question"
139
+ And I set "Date published" to "2026-13-45 10:00:00"
140
+ And I save the form
141
+ Then the field "Date published" should have the error "Enter a valid date."
142
+ And there should be no "Form test question" in the "Questions" list
143
+
144
+ Scenario: A question is added from its category's page, in a stacked inline row
145
+ Given there is no "Inline test question" in the "Questions" list
146
+ And I open "Music" in the "Categories" list
147
+ Then the "Questions" inline should have 5 rows
148
+ And the "Questions" inline should list "Which instrument would you learn?"
149
+ When I set "Question text" to "Inline test question" in row 5 of the "Questions" inline
150
+ And I set "Date published" to "2026-04-05 09:00:00" in row 5 of the "Questions" inline
151
+ And I save the form and continue editing
152
+ Then the form should be saved
153
+ And the "Questions" inline should list "Inline test question"
154
+ And there should be an "Inline test question" in the "Questions" list
@@ -0,0 +1,78 @@
1
+ @change-list
2
+ Feature: The list of a model: search, filters, sorting, dates and pages
3
+ As an editor
4
+ I want to find the objects I work on in a long list
5
+ So that I open the right one without reading every page
6
+
7
+ The list of questions has the 24 sample questions of the build: 10 a page, in 5 categories, from 2025 and 2026.
8
+
9
+ Background:
10
+ Given I am a logged in user with the "editor" user
11
+ And I am on the "Questions" list
12
+
13
+ @critical
14
+ Scenario: The list shows its columns and counts every row
15
+ Then the list columns should be "Question text", "Date published", "Category", "Published recently?"
16
+ And the list should count 24 questions
17
+ And the list should have 10 rows
18
+ And the "Which river is the longest?" row should show "Science" in the "Category" column
19
+ And the "Which river is the longest?" row should show "no" in the "Published recently?" column
20
+
21
+ Scenario: A search finds the questions with a word
22
+ When I search the list for "train"
23
+ Then the search should find 2 results of 24
24
+ And the list should show "Do you travel by train or by plane?"
25
+ And the list should show "Which train journey is the most beautiful?"
26
+ And the list should not show "What's up?"
27
+
28
+ Scenario: A search that finds nothing
29
+ When I search the list for "no question has these words"
30
+ Then the search should find 0 results of 24
31
+ And the list should count 0 questions
32
+
33
+ Scenario: The list sorts by a column, both ways
34
+ When I sort the list by "Date published"
35
+ Then the list should be sorted by "Date published" in ascending order
36
+ And the first row of the list should be "What's up?"
37
+ And "What's up?" should come before "Which fruit do you eat most?" in the list
38
+ When I sort the list by "Date published" in descending order
39
+ Then the list should be sorted by "Date published" in descending order
40
+ And the first row of the list should be "Which breakfast keeps you going?"
41
+
42
+ Scenario: A filter keeps the questions of one category
43
+ When I choose "Science" in the "By category" filter
44
+ Then the "By category" filter should be set to "Science"
45
+ And the list should count 5 questions
46
+ And the list should show "Which river is the longest?"
47
+ When I clear all filters
48
+ Then the "By category" filter should be set to "All"
49
+ And the list should count 24 questions
50
+
51
+ Scenario: The filter counts say how many rows each value keeps
52
+ When I show the filter counts
53
+ Then the "By category" filter should count 5 for "Science"
54
+ And the "By category" filter should count 4 for "Travel"
55
+ And the "By category" filter should count 2 for "-"
56
+
57
+ Scenario: The date drill-down goes from a year to a month
58
+ Then the date drill-down should offer "2025"
59
+ And the date drill-down should offer "2026"
60
+ When I choose "2025" in the date drill-down
61
+ Then the list should count 12 questions
62
+ And the date drill-down should offer "January 2025"
63
+ When I choose "January 2025" in the date drill-down
64
+ Then the list should count 1 question
65
+ And the list should show "What's up?"
66
+ When I choose "2025" in the date drill-down
67
+ Then the list should count 12 questions
68
+ When I choose "All dates" in the date drill-down
69
+ Then the list should count 24 questions
70
+
71
+ Scenario: The pages of the list
72
+ Then the list should have 3 pages
73
+ And the list should be on page 1
74
+ When I go to page 3 of the list
75
+ Then the list should be on page 3
76
+ And the list should have 4 rows
77
+ When I show all rows of the list
78
+ Then the list should have 24 rows
@@ -0,0 +1,67 @@
1
+ @delete @history
2
+ Feature: Deleting an object, and the history of its changes
3
+ As an editor
4
+ I want the admin to show me what a deletion takes with it, and to keep the history of each object
5
+ So that nothing is deleted by surprise, and every change can be traced to its author
6
+
7
+ Background:
8
+ Given there is no "Delete test question" in the "Questions" list
9
+ And there is no "History test question" in the "Questions" list
10
+ And I am a logged in user with the "editor" user
11
+
12
+ Scenario: The deletion lists the related objects it takes, then deletes them
13
+ When I open the add form of "Questions"
14
+ And I set "Question text" to "Delete test question"
15
+ And I set "Date published" to "2026-05-01 10:00:00"
16
+ And I fill in the "Choices" inline:
17
+ | Choice text |
18
+ | Yes |
19
+ | No |
20
+ And I save the form and continue editing
21
+ And I click "Delete"
22
+ Then the delete confirmation should list "Question: Delete test question"
23
+ And the delete confirmation should list "Choice: Yes"
24
+ And the delete confirmation should list "Choice: No"
25
+ And the delete confirmation should count "Choices: 2"
26
+ When I confirm the deletion
27
+ Then I should see the success message "The question “Delete test question” was deleted successfully."
28
+ And there should be no "Delete test question" in the "Questions" list
29
+
30
+ Scenario: Going back from the deletion deletes nothing
31
+ Given there is a "Delete test question" in the "Questions" list with:
32
+ | Question text | Delete test question |
33
+ | Date published | 2026-05-02 10:00:00 |
34
+ When I open "Delete test question" in the "Questions" list
35
+ And I click "Delete"
36
+ Then the delete confirmation should count "Questions: 1"
37
+ When I cancel the deletion
38
+ Then I should see the "Change question" form for "Delete test question"
39
+ And there should be a "Delete test question" in the "Questions" list
40
+
41
+ Scenario: A category that questions are in cannot be deleted
42
+ Given I am a logged in user with the "administrator" user
43
+ When I open "Science" in the "Categories" list
44
+ And I click "Delete"
45
+ Then the deletion should be refused because of "Question: Which river is the longest?"
46
+ And there should be a "Science" in the "Categories" list
47
+
48
+ Scenario: The history lists who added and who changed an object
49
+ Given there is a "History test question" in the "Questions" list with:
50
+ | Question text | History test question |
51
+ | Date published | 2026-05-03 10:00:00 |
52
+ When I open "History test question" in the "Questions" list
53
+ And I set "Category" to "Sport"
54
+ And I save the form and continue editing
55
+ And I open the history
56
+ Then the history should have 2 entries
57
+ And the history should list "Added." by "administrator"
58
+ And the history should list "Changed Category." by "editor"
59
+ And the history should not list "Deleted"
60
+
61
+ Scenario: An object is deleted from its list in one step
62
+ Given there is a "Delete test question" in the "Questions" list with:
63
+ | Question text | Delete test question |
64
+ | Date published | 2026-05-04 10:00:00 |
65
+ When I delete "Delete test question" from the "Questions" list
66
+ Then I should see the success message "was deleted successfully"
67
+ And there should be no "Delete test question" in the "Questions" list
@@ -0,0 +1,73 @@
1
+ @index
2
+ Feature: The admin index, its navigation and what each account may do
3
+ As a member of the staff
4
+ I want the admin to show me the apps and models I work with, and only those
5
+ So that I find my work, and nobody reaches the data they may not change
6
+
7
+ @critical
8
+ Scenario: The administrator sees every app and model
9
+ Given I am a logged in user with the "administrator" user
10
+ When I open the admin index
11
+ Then the admin index should list the app "Polls"
12
+ And the admin index should list the app "Authentication and Authorization"
13
+ And the app "Polls" should list the model "Questions"
14
+ And the app "Polls" should list the model "Categories"
15
+ And the app "Authentication and Authorization" should list the model "Users"
16
+ And the app "Polls" should not list the model "Choices"
17
+ And I should be able to add "Users"
18
+
19
+ Scenario: The editor sees the polls, not the accounts
20
+ Given I am a logged in user with the "editor" user
21
+ When I open the admin index
22
+ Then the admin index should list the app "Polls"
23
+ And the admin index should not list the app "Authentication and Authorization"
24
+ And I should be able to add "Questions"
25
+ And I should be able to change "Tags"
26
+
27
+ Scenario: The viewer may view the polls and nothing more
28
+ Given I am a logged in user with the "viewer" user
29
+ When I open the admin index
30
+ Then I should be able to view "Questions"
31
+ And I should not be able to add "Questions"
32
+ And I should not be able to change "Questions"
33
+ And the admin index should not list the app "Authentication and Authorization"
34
+
35
+ Scenario: An object the editor adds shows in the recent actions
36
+ Given there is no "Recent action question" in the "Questions" list
37
+ And I am a logged in user with the "editor" user
38
+ When I open the add form of "Questions"
39
+ And I set "Question text" to "Recent action question"
40
+ And I set "Date published" to "now"
41
+ And I save the form
42
+ Then the form should be saved
43
+ And my recent actions should list "Recent action question" as added
44
+
45
+ Scenario: The breadcrumbs lead from a form back to the index
46
+ Given I am a logged in user with the "editor" user
47
+ When I open the add form of "Questions"
48
+ Then the breadcrumbs should read "Home › Polls › Questions › Add question"
49
+ When I follow "Questions" in the breadcrumbs
50
+ Then I should be on the "Questions" list
51
+ And the breadcrumbs should read "Home › Polls › Questions"
52
+ When I follow "Home" in the breadcrumbs
53
+ Then I should see "Site administration"
54
+
55
+ Scenario: The navigation sidebar filters the models
56
+ Given I am a logged in user with the "administrator" user
57
+ And I am on the "Questions" list
58
+ Then the navigation sidebar should show "Users"
59
+ When I filter the navigation sidebar with "tag"
60
+ Then the navigation sidebar should show "Tags"
61
+ And the navigation sidebar should not show "Users"
62
+ When I open "Tags" from the navigation sidebar
63
+ Then I should be on the "Tags" list
64
+
65
+ Scenario: The colour theme is kept from page to page
66
+ Given I am a logged in user with the "viewer" user
67
+ And I am on the "Questions" list
68
+ When I switch the admin theme to "dark"
69
+ Then the admin theme should be "dark"
70
+ When I open the admin index
71
+ Then the admin theme should be "dark"
72
+ When I switch the admin theme to "auto"
73
+ Then the admin theme should be "auto"
@@ -0,0 +1,33 @@
1
+ @password
2
+ Feature: Changing one's own password
3
+ As a member of the staff
4
+ I want to change my password in the admin, and the admin to refuse a weak or mistyped one
5
+ So that my account stays mine
6
+
7
+ A changed password is set back after the scenario: the accounts are configuration.
8
+
9
+ Background:
10
+ Given I am a logged in user with the "editor" user
11
+
12
+ Scenario: A wrong old password is refused
13
+ When I try to change my password with the old password "Not-the-password-1" and the new passwords "Changed-pass-2026!" and "Changed-pass-2026!"
14
+ Then the password change should be refused with "Your old password was entered incorrectly. Please enter it again."
15
+
16
+ Scenario: Two different new passwords are refused
17
+ When I try to change my password with my old password and the new passwords "Changed-pass-2026!" and "Changed-pass-2026?"
18
+ Then the password change should be refused with "The two password fields didn’t match."
19
+
20
+ Scenario: A common password is refused
21
+ When I try to change my password with my old password and the new passwords "password123" and "password123"
22
+ Then the password change should be refused with "This password is too common."
23
+
24
+ Scenario: A password of digits only is refused
25
+ When I try to change my password with my old password and the new passwords "40571368294" and "40571368294"
26
+ Then the password change should be refused with "This password is entirely numeric."
27
+
28
+ Scenario: The password is changed, and the new one logs in
29
+ When I change my password to "Changed-pass-2026!"
30
+ Then my password should be changed
31
+ When I log out
32
+ And I log in with the user name "editor" and the password "Changed-pass-2026!"
33
+ Then I should be logged in as "editor"
@@ -0,0 +1,51 @@
1
+ @session
2
+ Feature: Logging in to the admin and out of it
3
+ As a member of the staff
4
+ I want to log in to the admin with my account and to log out
5
+ So that only the staff works on the site's data, each with their own permissions
6
+
7
+ The accounts are the ones of the users registry in cucumber.js: the build of the site makes them.
8
+
9
+ @critical
10
+ Scenario: The editor logs in with the login form
11
+ Given I am not logged in
12
+ When I log in as "editor" with the login form
13
+ Then I should be logged in as "editor"
14
+ And I should see "Site administration"
15
+
16
+ Scenario Outline: The <account> account logs in
17
+ Given I am not logged in
18
+ When I log in as "<account>" with the login form
19
+ Then I should be logged in as "<account>"
20
+
21
+ Examples:
22
+ | account |
23
+ | administrator |
24
+ | editor |
25
+ | viewer |
26
+
27
+ Scenario: A wrong password is refused
28
+ Given I am not logged in
29
+ When I log in with the user name "nobody at all" and the password "Wrong-password-1"
30
+ Then the login should be refused with "Please enter the correct username and password for a staff account."
31
+ And I should not be logged in
32
+
33
+ Scenario: A visitor who opens the admin is sent to its login page
34
+ Given I am not logged in
35
+ When I open the admin index
36
+ Then I should be on the admin login page
37
+ And I should not be logged in
38
+
39
+ Scenario: Logging out ends the session
40
+ Given I am a logged in user with the "editor" user
41
+ When I log out
42
+ Then I should see "Logged out"
43
+ And I should not be logged in
44
+ When I open the admin index
45
+ Then I should be on the admin login page
46
+
47
+ Scenario: A session opened earlier in the run is taken over
48
+ Given I am a logged in user with the "viewer" user
49
+ Then I should be logged in as "viewer"
50
+ Given I am a logged in user with the "editor" user
51
+ Then I should be logged in as "editor"