@webship-js/mediawiki-steps 0.0.0-stage → 2.0.1
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/LICENSE +21 -0
- package/README.md +550 -2
- package/package.json +63 -4
- package/tests/features/README.md +26 -0
- package/tests/features/accessibility.feature +16 -0
- package/tests/features/account-creation.feature +28 -0
- package/tests/features/administration.feature +49 -0
- package/tests/features/categories.feature +28 -0
- package/tests/features/edit-conflict.feature +15 -0
- package/tests/features/history.feature +30 -0
- package/tests/features/preferences.feature +15 -0
- package/tests/features/reading.feature +84 -0
- package/tests/features/search.feature +34 -0
- package/tests/features/session.feature +43 -0
- package/tests/features/source-editor.feature +42 -0
- package/tests/features/talk-page.feature +19 -0
- package/tests/features/upload.feature +20 -0
- package/tests/features/visual-editor.feature +18 -0
- package/tests/features/watchlist.feature +24 -0
- package/tests/fixtures/blue-square.png +0 -0
- package/tests/step-definitions/README.md +41 -0
- package/tests/step-definitions/mediawiki-admin.steps.js +241 -0
- package/tests/step-definitions/mediawiki-editing.steps.js +413 -0
- package/tests/step-definitions/mediawiki-files.steps.js +93 -0
- package/tests/step-definitions/mediawiki-helpers.js +768 -0
- package/tests/step-definitions/mediawiki-history.steps.js +135 -0
- package/tests/step-definitions/mediawiki-pages.steps.js +710 -0
- package/tests/step-definitions/mediawiki-search.steps.js +234 -0
- package/tests/step-definitions/mediawiki-session.steps.js +287 -0
- package/tests/step-definitions/mediawiki-watchlist.steps.js +265 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
@accessibility
|
|
2
|
+
Feature: The pages of the wiki to assistive technology
|
|
3
|
+
As a reader who uses a screen reader or a keyboard
|
|
4
|
+
I want the wiki's pages to have their landmarks, a skip link and one main heading
|
|
5
|
+
So that I can find my way through a page
|
|
6
|
+
|
|
7
|
+
# The webship-js accessibility steps, on the wiki's pages.
|
|
8
|
+
|
|
9
|
+
Scenario: A page has a main landmark, a skip link, one main heading and a language
|
|
10
|
+
Given the page "Accessibility test page" has the text "A page for the accessibility checks."
|
|
11
|
+
And I am an anonymous user
|
|
12
|
+
When I open the page "Accessibility test page"
|
|
13
|
+
Then the page should have a main landmark
|
|
14
|
+
And the page should have a skip link
|
|
15
|
+
And the page should have exactly one h1
|
|
16
|
+
And the page should declare a language
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
@account-creation
|
|
2
|
+
Feature: The account creation form refuses what it must
|
|
3
|
+
As the owner of the wiki
|
|
4
|
+
I want the account creation form to refuse a name in use and passwords that do not do
|
|
5
|
+
So that nobody takes another person's name or a weak password
|
|
6
|
+
|
|
7
|
+
# A suite never creates an account: the step sends the form only when the wiki will refuse it.
|
|
8
|
+
|
|
9
|
+
Scenario: Two different passwords are refused
|
|
10
|
+
Given I am an anonymous user
|
|
11
|
+
When I try to create the account "Never created account" with the password "Unique-pass-2026-x" and the confirmation "Unique-pass-2026-y"
|
|
12
|
+
Then the account creation should be refused with "The passwords you entered do not match."
|
|
13
|
+
And nobody should be logged in
|
|
14
|
+
|
|
15
|
+
Scenario: A name in use is refused
|
|
16
|
+
Given I am an anonymous user
|
|
17
|
+
When I try to create the account "editor" with the password "Unique-pass-2026-x" and the confirmation "Unique-pass-2026-x"
|
|
18
|
+
Then the account creation should be refused with "Username entered already in use. Please choose a different name."
|
|
19
|
+
|
|
20
|
+
Scenario: A short password is refused
|
|
21
|
+
Given I am an anonymous user
|
|
22
|
+
When I try to create the account "Never created account" with the password "abc" and the confirmation "abc"
|
|
23
|
+
Then the account creation should be refused with "Passwords must be at least 8 characters."
|
|
24
|
+
|
|
25
|
+
Scenario: A common password is refused
|
|
26
|
+
Given I am an anonymous user
|
|
27
|
+
When I try to create the account "Never created account" with the password "password1234" and the confirmation "password1234"
|
|
28
|
+
Then the account creation should be refused with "The password entered is in a list of very commonly used passwords."
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
@administration
|
|
2
|
+
Feature: The administrator's pages
|
|
3
|
+
As an administrator of the wiki
|
|
4
|
+
I want to protect, delete and restore pages, and to block an account
|
|
5
|
+
So that I can stop damage and repair it
|
|
6
|
+
|
|
7
|
+
Scenario: A page protected for autoconfirmed users: the new account is refused, the confirmed editor is not
|
|
8
|
+
Given the page "Protection test page" has the text "A page to protect."
|
|
9
|
+
And I am a logged in user with the "administrator" user
|
|
10
|
+
When I protect the page "Protection test page" so that only autoconfirmed users can edit it
|
|
11
|
+
Then the page "Protection test page" should be protected so that only autoconfirmed users can edit it
|
|
12
|
+
Given I am a logged in user with the "reader" user
|
|
13
|
+
Then editing the page "Protection test page" should be refused with "This page has been protected to prevent editing or other actions."
|
|
14
|
+
Given I am a logged in user with the "editor" user
|
|
15
|
+
When I edit the page "Protection test page"
|
|
16
|
+
And I add the wikitext "A line from a confirmed account."
|
|
17
|
+
And I save the page with the summary "Edit of a protected page"
|
|
18
|
+
Then the edit should be saved
|
|
19
|
+
|
|
20
|
+
Scenario: A page protected for administrators refuses the editor, until the protection is removed
|
|
21
|
+
Given the page "Protection test page" has the text "A page only administrators edit."
|
|
22
|
+
And the page "Protection test page" is protected so that only administrators can edit it
|
|
23
|
+
And I am a logged in user with the "editor" user
|
|
24
|
+
Then editing the page "Protection test page" should be refused with "This page has been protected to prevent editing or other actions."
|
|
25
|
+
Given I am a logged in user with the "administrator" user
|
|
26
|
+
When I remove the protection of the page "Protection test page"
|
|
27
|
+
Then the page "Protection test page" should not be protected
|
|
28
|
+
|
|
29
|
+
Scenario: A page deleted and restored
|
|
30
|
+
Given the page "Deletion test page" has the text "A page to delete and restore."
|
|
31
|
+
And I am a logged in user with the "administrator" user
|
|
32
|
+
When I delete the page "Deletion test page" with the reason "A test of the deletion"
|
|
33
|
+
Then the page "Deletion test page" should not exist
|
|
34
|
+
When I restore the page "Deletion test page" with the reason "A test of the restore"
|
|
35
|
+
Then the page "Deletion test page" should exist
|
|
36
|
+
When I open the page "Deletion test page"
|
|
37
|
+
Then the page text should contain "A page to delete and restore."
|
|
38
|
+
|
|
39
|
+
Scenario: A blocked account is refused editing until it is unblocked
|
|
40
|
+
Given the page "Block test page" has the text "A page the blocked account tries to edit."
|
|
41
|
+
And the account "reader" is not blocked
|
|
42
|
+
And I am a logged in user with the "administrator" user
|
|
43
|
+
When I block the account "reader" for "1 day" with the reason "A test of the block"
|
|
44
|
+
Then the account "reader" should be blocked
|
|
45
|
+
Given I am a logged in user with the "reader" user
|
|
46
|
+
Then editing the page "Block test page" should be refused with "Your username or IP address has been blocked."
|
|
47
|
+
Given I am a logged in user with the "administrator" user
|
|
48
|
+
When I unblock the account "reader" with the reason "The test is over"
|
|
49
|
+
Then the account "reader" should not be blocked
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
@categories
|
|
2
|
+
Feature: Categories and the category tree
|
|
3
|
+
As a reader of the wiki
|
|
4
|
+
I want the page of a category to list its pages and to open its subcategories in place
|
|
5
|
+
So that I browse a subject from the general to the particular
|
|
6
|
+
|
|
7
|
+
Background:
|
|
8
|
+
Given the page "Category:Test pages" has the text "The pages of the test wiki."
|
|
9
|
+
And the page "Category:Test guides" has the text "Guides of the test wiki. [[Category:Test pages]]"
|
|
10
|
+
And the page "Category:Editing guides" has the text "Guides about editing. [[Category:Test guides]]"
|
|
11
|
+
And the page "Categorised test page" has the text "A page in a category. [[Category:Test guides]]"
|
|
12
|
+
|
|
13
|
+
Scenario: A category lists its pages and subcategories
|
|
14
|
+
Given I am an anonymous user
|
|
15
|
+
When I open the page "Category:Test guides"
|
|
16
|
+
Then the category should list the page "Categorised test page"
|
|
17
|
+
And the category should list the subcategory "Editing guides"
|
|
18
|
+
And the page should be in the category "Test pages"
|
|
19
|
+
|
|
20
|
+
Scenario: The category tree opens a subcategory in place
|
|
21
|
+
Given I am an anonymous user
|
|
22
|
+
When I open the page "Category:Test pages"
|
|
23
|
+
Then the category should list the subcategory "Test guides"
|
|
24
|
+
And the category tree should not show "Editing guides" under "Test guides"
|
|
25
|
+
When I expand the category "Test guides" in the category tree
|
|
26
|
+
Then the category tree should show "Editing guides" under "Test guides"
|
|
27
|
+
When I collapse the category "Test guides" in the category tree
|
|
28
|
+
Then the category tree should not show "Editing guides" under "Test guides"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
@edit-conflict
|
|
2
|
+
Feature: An edit conflict
|
|
3
|
+
As an editor of the wiki
|
|
4
|
+
I want the wiki to stop my save when someone else changed the same lines meanwhile
|
|
5
|
+
So that I never overwrite another person's work without seeing it
|
|
6
|
+
|
|
7
|
+
Scenario: Another account changes the same line while the editor writes
|
|
8
|
+
Given the page "Conflict test page" has the text "The first line."
|
|
9
|
+
And I am a logged in user with the "editor" user
|
|
10
|
+
When I edit the page "Conflict test page"
|
|
11
|
+
And I set the wikitext to "My own first line."
|
|
12
|
+
And another account saves the page "Conflict test page" with the text "Changed by another account."
|
|
13
|
+
And I save the page with the summary "My change"
|
|
14
|
+
Then I should see an edit conflict
|
|
15
|
+
And the edit conflict should keep my text "My own first line."
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
@history
|
|
2
|
+
Feature: The history of a page
|
|
3
|
+
As an editor of the wiki
|
|
4
|
+
I want to compare two revisions of a page and undo a change
|
|
5
|
+
So that a wrong change is found and taken back
|
|
6
|
+
|
|
7
|
+
Background:
|
|
8
|
+
Given the page "History test page" has the text "First version of the page." with the summary "First version"
|
|
9
|
+
And the page "History test page" has the text "Second version of the page." with the summary "Second version"
|
|
10
|
+
|
|
11
|
+
Scenario: Two revisions compared
|
|
12
|
+
Given I am a logged in user with the "editor" user
|
|
13
|
+
When I open the history of the page "History test page"
|
|
14
|
+
Then the history should list 2 revisions
|
|
15
|
+
And the history should list the revision "Second version" by "administrator"
|
|
16
|
+
When I compare the revisions "First version" and "Second version"
|
|
17
|
+
Then the changes should show "Second version of the page." added
|
|
18
|
+
And the changes should show "First version of the page." removed
|
|
19
|
+
|
|
20
|
+
Scenario: A change undone
|
|
21
|
+
Given I am a logged in user with the "editor" user
|
|
22
|
+
When I open the history of the page "History test page"
|
|
23
|
+
And I undo the revision "Second version"
|
|
24
|
+
And I save the page with the summary "Back to the first version"
|
|
25
|
+
Then the edit should be saved
|
|
26
|
+
And the page text should contain "First version of the page."
|
|
27
|
+
And the page text should not contain "Second version of the page."
|
|
28
|
+
When I open the history of the page "History test page"
|
|
29
|
+
Then the history should list 3 revisions
|
|
30
|
+
And the history should list the revision "Back to the first version" by "editor"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
@preferences
|
|
2
|
+
Feature: The preferences of an account
|
|
3
|
+
As an editor of the wiki
|
|
4
|
+
I want to change my preferences and find them kept
|
|
5
|
+
So that the wiki works the way I edit
|
|
6
|
+
|
|
7
|
+
Scenario: A preference ticked, saved, then put back
|
|
8
|
+
Given I am a logged in user with the "editor" user
|
|
9
|
+
When I open my preferences
|
|
10
|
+
And I tick the preference "Mark all edits minor by default"
|
|
11
|
+
And I save my preferences
|
|
12
|
+
Then the preference "Mark all edits minor by default" should be ticked
|
|
13
|
+
When I untick the preference "Mark all edits minor by default"
|
|
14
|
+
And I save my preferences
|
|
15
|
+
Then the preference "Mark all edits minor by default" should not be ticked
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
@reading
|
|
2
|
+
Feature: Reading a page
|
|
3
|
+
As a reader of the wiki
|
|
4
|
+
I want a page with its title, contents list, sections, links, references and categories
|
|
5
|
+
So that I find my way through a long page and to the pages around it
|
|
6
|
+
|
|
7
|
+
Background:
|
|
8
|
+
Given the page "Category:Test guides" has the text "Guides of the test wiki."
|
|
9
|
+
And the page "Second test page" has the text "A page the reading page links to."
|
|
10
|
+
And the page "Reading test page" has the text:
|
|
11
|
+
"""
|
|
12
|
+
This page is the '''reading page''' of the test wiki. It has sections, a contents list, links and a reference.
|
|
13
|
+
|
|
14
|
+
== Overview ==
|
|
15
|
+
A wiki is a website that its readers edit together.<ref>Every page keeps its history.</ref>
|
|
16
|
+
|
|
17
|
+
== Editing ==
|
|
18
|
+
=== Source editing ===
|
|
19
|
+
The source editor shows the wikitext of a page.
|
|
20
|
+
|
|
21
|
+
=== Visual editing ===
|
|
22
|
+
The visual editor shows the page as it looks.
|
|
23
|
+
|
|
24
|
+
== Links ==
|
|
25
|
+
* A page of the wiki: [[Second test page]]
|
|
26
|
+
* A page that does not exist yet: [[Page not written yet]]
|
|
27
|
+
* An external site: [https://example.org Example site]
|
|
28
|
+
|
|
29
|
+
== References ==
|
|
30
|
+
<references />
|
|
31
|
+
|
|
32
|
+
[[Category:Test guides]]
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
@critical
|
|
36
|
+
Scenario: A visitor reads the page with its sections in order
|
|
37
|
+
Given I am an anonymous user
|
|
38
|
+
When I open the page "Reading test page"
|
|
39
|
+
Then I should see the page "Reading test page"
|
|
40
|
+
And the page text should contain "A wiki is a website that its readers edit together."
|
|
41
|
+
And the page should have these sections in order:
|
|
42
|
+
| section | level |
|
|
43
|
+
| Overview | 2 |
|
|
44
|
+
| Editing | 2 |
|
|
45
|
+
| Source editing | 3 |
|
|
46
|
+
| Visual editing | 3 |
|
|
47
|
+
| Links | 2 |
|
|
48
|
+
| References | 2 |
|
|
49
|
+
And the page should not have the section "History"
|
|
50
|
+
And the scripts of the page should all load
|
|
51
|
+
|
|
52
|
+
Scenario: The contents list leads to a section
|
|
53
|
+
Given I am an anonymous user
|
|
54
|
+
When I open the page "Reading test page"
|
|
55
|
+
Then the contents list should list "Source editing"
|
|
56
|
+
And the contents list should not list "History"
|
|
57
|
+
When I follow "Links" in the contents list
|
|
58
|
+
Then I should be at the section "Links"
|
|
59
|
+
|
|
60
|
+
Scenario: The links of the page: a page, a page not written yet, an external site
|
|
61
|
+
Given I am an anonymous user
|
|
62
|
+
When I open the page "Reading test page"
|
|
63
|
+
Then the page should link to the page "Second test page"
|
|
64
|
+
And the page should link to the missing page "Page not written yet"
|
|
65
|
+
And the page should not link to the page "Page not written yet"
|
|
66
|
+
And the page should link to the external site "https://example.org"
|
|
67
|
+
When I follow the link to the page "Second test page"
|
|
68
|
+
Then I should see the page "Second test page"
|
|
69
|
+
And the page text should contain "A page the reading page links to."
|
|
70
|
+
|
|
71
|
+
Scenario: A reference leads to its note
|
|
72
|
+
Given I am an anonymous user
|
|
73
|
+
When I open the page "Reading test page"
|
|
74
|
+
Then the reference "1" should read "Every page keeps its history."
|
|
75
|
+
|
|
76
|
+
Scenario: The page lists its category, which lists the page
|
|
77
|
+
Given I am an anonymous user
|
|
78
|
+
When I open the page "Reading test page"
|
|
79
|
+
Then the page should be in the category "Test guides"
|
|
80
|
+
And the page should not be in the category "Drafts"
|
|
81
|
+
When I follow the category "Test guides"
|
|
82
|
+
Then I should see the page "Category:Test guides"
|
|
83
|
+
And the category should list the page "Reading test page"
|
|
84
|
+
And the category should not list the page "Second test page"
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
@search
|
|
2
|
+
Feature: Searching the wiki
|
|
3
|
+
As a reader of the wiki
|
|
4
|
+
I want the search box to suggest pages while I type, and to find pages by their words
|
|
5
|
+
So that I reach a page without knowing where it is linked from
|
|
6
|
+
|
|
7
|
+
Background:
|
|
8
|
+
Given the page "Searching test page" has the text "Lighthouses guide ships along rocky coasts at night."
|
|
9
|
+
And the page "Second searching page" has the text "A page about harbours, without the word of the other one."
|
|
10
|
+
|
|
11
|
+
@critical
|
|
12
|
+
Scenario: The search box suggests a page while typing, and opens it
|
|
13
|
+
Given I am an anonymous user
|
|
14
|
+
And I am on the page "Main Page"
|
|
15
|
+
When I type "Searching te" in the search box
|
|
16
|
+
Then the search suggestions should list "Searching test page"
|
|
17
|
+
And the search suggestions should not list "Second searching page"
|
|
18
|
+
When I choose the suggestion "Searching test page"
|
|
19
|
+
Then I should see the page "Searching test page"
|
|
20
|
+
|
|
21
|
+
Scenario: A search for a word lists the page that has it
|
|
22
|
+
Given I am an anonymous user
|
|
23
|
+
And I am on the page "Main Page"
|
|
24
|
+
When I search for "lighthouses"
|
|
25
|
+
Then the search should find 1 page
|
|
26
|
+
And the search results should list the page "Searching test page"
|
|
27
|
+
And the search results should not list the page "Second searching page"
|
|
28
|
+
And the search result "Searching test page" should mention "lighthouses"
|
|
29
|
+
|
|
30
|
+
Scenario: A search for a word no page has finds nothing
|
|
31
|
+
Given I am an anonymous user
|
|
32
|
+
And I am on the page "Main Page"
|
|
33
|
+
When I search for "zzqqnothingatall"
|
|
34
|
+
Then the search should find no page
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
@session
|
|
2
|
+
Feature: Logging in and out
|
|
3
|
+
As a person with an account on the wiki
|
|
4
|
+
I want to log in, see who I am, and log out
|
|
5
|
+
So that my edits carry my name and nobody else uses my session
|
|
6
|
+
|
|
7
|
+
# The accounts are the users registry of cucumber.js (administrator, editor, reader), made by the
|
|
8
|
+
# build of the wiki; a scenario names an account by its handle and never writes a password.
|
|
9
|
+
|
|
10
|
+
@critical
|
|
11
|
+
Scenario Outline: The <account> account logs in through the login form
|
|
12
|
+
Given I am an anonymous user
|
|
13
|
+
When I log in as "<account>" with the login form
|
|
14
|
+
Then I should be logged in as "<account>"
|
|
15
|
+
|
|
16
|
+
Examples:
|
|
17
|
+
| account |
|
|
18
|
+
| administrator |
|
|
19
|
+
| editor |
|
|
20
|
+
| reader |
|
|
21
|
+
|
|
22
|
+
Scenario: An account that logged in before takes its session over
|
|
23
|
+
Given I am a logged in user with the "editor" user
|
|
24
|
+
When I open the page "Main Page"
|
|
25
|
+
Then I should be logged in as "editor"
|
|
26
|
+
And I should not be logged in as "reader"
|
|
27
|
+
|
|
28
|
+
Scenario: Keep me logged in
|
|
29
|
+
Given I am an anonymous user
|
|
30
|
+
When I log in as "reader" with the login form and ask to be kept logged in
|
|
31
|
+
Then I should be logged in as "reader"
|
|
32
|
+
|
|
33
|
+
Scenario: A wrong password is refused, with the message the wiki gives an unknown account too
|
|
34
|
+
Given I am an anonymous user
|
|
35
|
+
When I log in with the user name "No such account here" and the password "Wrong-password-1"
|
|
36
|
+
Then the login should be refused with "Incorrect username or password entered. Please try again."
|
|
37
|
+
And nobody should be logged in
|
|
38
|
+
|
|
39
|
+
Scenario: Logging out ends the session
|
|
40
|
+
Given I am a logged in user with the "reader" user
|
|
41
|
+
When I log out
|
|
42
|
+
Then I should not be logged in
|
|
43
|
+
And I should see "You are now logged out."
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
@source-editor
|
|
2
|
+
Feature: The source editor
|
|
3
|
+
As an editor of the wiki
|
|
4
|
+
I want to write wikitext, preview it, see my changes and save them with a summary
|
|
5
|
+
So that every change is checked before it is saved and explained in the history
|
|
6
|
+
|
|
7
|
+
@critical
|
|
8
|
+
Scenario: An editor makes a page, previews it and saves it with a summary
|
|
9
|
+
Given the page "Page made in the source editor" does not exist
|
|
10
|
+
And I am a logged in user with the "editor" user
|
|
11
|
+
When I edit the page "Page made in the source editor"
|
|
12
|
+
And I set the wikitext to:
|
|
13
|
+
"""
|
|
14
|
+
A page made in the source editor.
|
|
15
|
+
|
|
16
|
+
== A section ==
|
|
17
|
+
Its text.
|
|
18
|
+
"""
|
|
19
|
+
And I preview the page
|
|
20
|
+
Then the preview should show "A page made in the source editor."
|
|
21
|
+
And the preview should not show "== A section =="
|
|
22
|
+
When I save the page with the summary "First version"
|
|
23
|
+
Then the page should be created
|
|
24
|
+
And I should see the page "Page made in the source editor"
|
|
25
|
+
And the page should have the section "A section"
|
|
26
|
+
When I open the history of the page "Page made in the source editor"
|
|
27
|
+
Then the history should list the revision "First version" by "editor"
|
|
28
|
+
|
|
29
|
+
Scenario: An editor sees the changes before saving a minor edit
|
|
30
|
+
Given the page "Editing test page" has the text "Words to change."
|
|
31
|
+
And I am a logged in user with the "editor" user
|
|
32
|
+
When I edit the page "Editing test page"
|
|
33
|
+
And I set the wikitext to "Words changed in the source editor."
|
|
34
|
+
And I show my changes
|
|
35
|
+
Then the changes should show "Words changed in the source editor." added
|
|
36
|
+
And the changes should show "Words to change." removed
|
|
37
|
+
When I save the page as a minor edit with the summary "A clearer sentence"
|
|
38
|
+
Then the edit should be saved
|
|
39
|
+
And the page text should contain "Words changed in the source editor."
|
|
40
|
+
And the page text should not contain "Words to change."
|
|
41
|
+
When I open the history of the page "Editing test page"
|
|
42
|
+
Then the history should list the revision "A clearer sentence" by "editor"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
@talk-page
|
|
2
|
+
Feature: The talk page of a page
|
|
3
|
+
As an editor of the wiki
|
|
4
|
+
I want to ask about a page on its talk page
|
|
5
|
+
So that questions about the page stay out of the page itself
|
|
6
|
+
|
|
7
|
+
Scenario: An editor adds a topic to the talk page of a page
|
|
8
|
+
Given the page "Talk test page" has the text "A page to talk about."
|
|
9
|
+
And the page "Talk:Talk test page" does not exist
|
|
10
|
+
And I am a logged in user with the "editor" user
|
|
11
|
+
When I open the page "Talk test page"
|
|
12
|
+
And I open the talk page
|
|
13
|
+
And I add the topic "A question about this page" with the text "Is this page complete?"
|
|
14
|
+
Then I should see the page "Talk:Talk test page"
|
|
15
|
+
And the talk page should have the topic "A question about this page"
|
|
16
|
+
And the page text should contain "Is this page complete?"
|
|
17
|
+
When I add the topic "A second question" with the text "Who wrote the overview?"
|
|
18
|
+
Then the talk page should have the topic "A second question"
|
|
19
|
+
And the talk page should have the topic "A question about this page"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
@upload
|
|
2
|
+
Feature: Uploading a file
|
|
3
|
+
As an editor of the wiki
|
|
4
|
+
I want to upload an image and be warned about a file the wiki has already
|
|
5
|
+
So that pages can show images, without the same image twice
|
|
6
|
+
|
|
7
|
+
Scenario: An editor uploads an image
|
|
8
|
+
Given the page "File:Test square.png" does not exist
|
|
9
|
+
And I am a logged in user with the "editor" user
|
|
10
|
+
When I upload the file "tests/fixtures/blue-square.png" as "Test square.png" with the summary "A blue square" ignoring warnings
|
|
11
|
+
Then I should see the file "Test square.png"
|
|
12
|
+
And the page text should contain "A blue square"
|
|
13
|
+
|
|
14
|
+
Scenario: The same image under another name is held back as a duplicate
|
|
15
|
+
Given the file "Duplicate source square.png" is uploaded from "tests/fixtures/blue-square.png"
|
|
16
|
+
And the page "File:Duplicate square.png" does not exist
|
|
17
|
+
And I am a logged in user with the "editor" user
|
|
18
|
+
When I upload the file "tests/fixtures/blue-square.png" as "Duplicate square.png"
|
|
19
|
+
Then the upload should be held back with the warning "This file is a duplicate of the following file"
|
|
20
|
+
And the page "File:Duplicate square.png" should not exist
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
@visual-editor
|
|
2
|
+
Feature: The visual editor
|
|
3
|
+
As an editor of the wiki
|
|
4
|
+
I want to change a page as it looks, without wikitext
|
|
5
|
+
So that I can edit without learning the markup
|
|
6
|
+
|
|
7
|
+
Scenario: An editor types in the visual editor and saves with a summary
|
|
8
|
+
Given the page "Visual editor test page" has the text "A page to change in the visual editor."
|
|
9
|
+
And I am a logged in user with the "editor" user
|
|
10
|
+
When I edit the page "Visual editor test page" in the visual editor
|
|
11
|
+
Then the visual editor should be open
|
|
12
|
+
When I type " Typed in the visual editor." in the visual editor
|
|
13
|
+
And I save the page with the summary "A sentence in the visual editor"
|
|
14
|
+
Then the visual editor should not be open
|
|
15
|
+
And the edit should be saved
|
|
16
|
+
And the page text should contain "Typed in the visual editor."
|
|
17
|
+
When I open the history of the page "Visual editor test page"
|
|
18
|
+
Then the history should list the revision "A sentence in the visual editor" by "editor"
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
@watchlist
|
|
2
|
+
Feature: The watchlist and recent changes
|
|
3
|
+
As an editor of the wiki
|
|
4
|
+
I want to watch pages and see their changes
|
|
5
|
+
So that I notice what happens to the pages I care about
|
|
6
|
+
|
|
7
|
+
Background:
|
|
8
|
+
Given the page "Watched test page" has the text "A page to watch." with the summary "A page to watch"
|
|
9
|
+
|
|
10
|
+
Scenario: An editor watches a page and finds it on the watchlist
|
|
11
|
+
Given I am a logged in user with the "editor" user
|
|
12
|
+
When I open the page "Watched test page"
|
|
13
|
+
And I watch the page
|
|
14
|
+
Then I should be watching the page
|
|
15
|
+
And my watchlist should list the page "Watched test page"
|
|
16
|
+
And the watchlist should show a change to "Watched test page" with the summary "A page to watch"
|
|
17
|
+
When I open the page "Watched test page"
|
|
18
|
+
And I stop watching the page
|
|
19
|
+
Then I should not be watching the page
|
|
20
|
+
And my watchlist should not list the page "Watched test page"
|
|
21
|
+
|
|
22
|
+
Scenario: Recent changes show a new page with its summary and author
|
|
23
|
+
Given I am an anonymous user
|
|
24
|
+
Then the recent changes should show a change to "Watched test page" with the summary "A page to watch" by "administrator"
|
|
Binary file
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Step definitions
|
|
2
|
+
|
|
3
|
+
| File | Covers |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| `mediawiki-session.steps.js` | The session: logging in by a handle of the users registry (a session taken over when the account has one) or through the login form, a refused login, logging out, who is signed in, the refusals of the account creation form. |
|
|
6
|
+
| `mediawiki-pages.steps.js` | Test pages and files made and deleted through the wiki's API (and the cleanup after a scenario), opening a page, its title and text, its sections and contents list, its links, references and categories, the category tree, the talk page, the page's scripts. |
|
|
7
|
+
| `mediawiki-search.steps.js` | The search box and its suggestions, choosing one, a full search and its results page. |
|
|
8
|
+
| `mediawiki-editing.steps.js` | The source editor, the visual editor, edit conflicts, the refusal of a page the account may not edit. |
|
|
9
|
+
| `mediawiki-history.steps.js` | The history: its revisions, comparing two, undoing one. |
|
|
10
|
+
| `mediawiki-watchlist.steps.js` | The watch star, the watchlist, recent changes, the preferences. |
|
|
11
|
+
| `mediawiki-files.steps.js` | The upload form, its warnings, the page of a file. |
|
|
12
|
+
| `mediawiki-admin.steps.js` | Protecting a page, deleting and restoring it, blocking and unblocking an account. |
|
|
13
|
+
| `mediawiki-helpers.js` | Shared plumbing: the addresses of the wiki, the waits on its module loader, its hooks and its job queue, the users registry and the session cache, the messages of a page, the request the browser cut, the client of the wiki's API for the test data. It registers no step. |
|
|
14
|
+
|
|
15
|
+
## Rules for a new step
|
|
16
|
+
|
|
17
|
+
- Check `node_modules/webship-js/tests/step-definitions/` first: a step that the
|
|
18
|
+
generic click, fill and see vocabulary already covers is not added here.
|
|
19
|
+
- No step phrase names the platform. A name appears only as an
|
|
20
|
+
argument a step asserts.
|
|
21
|
+
- The regular expression starts with the pronoun group `(I |we )*` where a
|
|
22
|
+
person acts, and an assertion takes `should( not)*`, so one definition reads
|
|
23
|
+
both polarities.
|
|
24
|
+
- A JSDoc block above the step holds at least five `Example #N:` lines. Run
|
|
25
|
+
`npm run test:examples`: every example must match its own step and no step of
|
|
26
|
+
webship-js.
|
|
27
|
+
- Find things the way a person does: a label, a role, a text. The stable hooks
|
|
28
|
+
of the pages (`mw.config`, the ids of the wiki's forms, the classes of its
|
|
29
|
+
messages) are the fallback.
|
|
30
|
+
- Wait on the wiki, never on a fixed time: on the locator, on the navigation a
|
|
31
|
+
form or a link starts, on the module loader (`mw.loader.using()`), on the
|
|
32
|
+
wiki's hooks (`mw.hook`), on the request a widget sends, on the job queue.
|
|
33
|
+
- Fail with `friendly({ message, hint })`: what was expected, what was found
|
|
34
|
+
and where to look.
|
|
35
|
+
- A step never creates or deletes a user: accounts are configuration, named in
|
|
36
|
+
the `users` registry of `cucumber.js` and created by the build of the wiki.
|
|
37
|
+
A page or a file a scenario makes is deleted after it.
|
|
38
|
+
- Open the page in a real browser before writing or changing its step, and
|
|
39
|
+
write the step from what is there: the roles and names of the accessibility
|
|
40
|
+
tree, the stable attributes, what the page does while it loads or saves.
|
|
41
|
+
- Give every assertion a scenario in `tests/must-fail/` that makes it fail.
|