@webship-js/bbpress-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 +515 -2
- package/package.json +67 -4
- package/tests/features/accessibility.feature +29 -0
- package/tests/features/administration.feature +126 -0
- package/tests/features/forum-index.feature +96 -0
- package/tests/features/forum-roles.feature +88 -0
- package/tests/features/moderation.feature +223 -0
- package/tests/features/notifications.feature +43 -0
- package/tests/features/profiles.feature +71 -0
- package/tests/features/search-and-tags.feature +72 -0
- package/tests/features/subscriptions-and-favorites.feature +67 -0
- package/tests/features/topics.feature +146 -0
- package/tests/step-definitions/README.md +44 -0
- package/tests/step-definitions/bbpress-admin.steps.js +414 -0
- package/tests/step-definitions/bbpress-content.steps.js +179 -0
- package/tests/step-definitions/bbpress-defaults.js +64 -0
- package/tests/step-definitions/bbpress-forums.steps.js +488 -0
- package/tests/step-definitions/bbpress-helpers.js +668 -0
- package/tests/step-definitions/bbpress-mail.steps.js +95 -0
- package/tests/step-definitions/bbpress-moderation.steps.js +413 -0
- package/tests/step-definitions/bbpress-profile.steps.js +402 -0
- package/tests/step-definitions/bbpress-search.steps.js +235 -0
- package/tests/step-definitions/bbpress-topics.steps.js +577 -0
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// The forums in the site's administration: the lists of forums, topics and
|
|
4
|
+
// replies (what they list, the state of a row, the actions of a row), the
|
|
5
|
+
// features of the forums' settings screen, the repair tools, and the forum
|
|
6
|
+
// role of an account on the users screen.
|
|
7
|
+
//
|
|
8
|
+
// The screens themselves open by name through the WordPress pack ("Forums",
|
|
9
|
+
// "Topics", "Replies", "Topic Tags", "Forums settings", "Forum tools"), and
|
|
10
|
+
// its steps read the notices, the menus and a setting by its label. The lists
|
|
11
|
+
// are the site's own list tables: a row is found by the title in its first
|
|
12
|
+
// column, its state is the class the site gives the row (`status-closed`),
|
|
13
|
+
// and an action is the link the row shows on hover, which loads the list
|
|
14
|
+
// again with a notice ("Topic "…" successfully closed.").
|
|
15
|
+
|
|
16
|
+
const { When, Then } = require('@cucumber/cucumber');
|
|
17
|
+
const { friendly } = require('webship-js/tests/step-definitions/webship');
|
|
18
|
+
const {
|
|
19
|
+
resolveUser,
|
|
20
|
+
} = require('@webship-js/wordpress-steps/tests/step-definitions/wordpress-helpers');
|
|
21
|
+
const {
|
|
22
|
+
settle,
|
|
23
|
+
visitAdmin,
|
|
24
|
+
clean,
|
|
25
|
+
listed,
|
|
26
|
+
same,
|
|
27
|
+
holds,
|
|
28
|
+
clickAndLoad,
|
|
29
|
+
} = require('./bbpress-helpers');
|
|
30
|
+
|
|
31
|
+
const LISTS = {
|
|
32
|
+
forums: { type: 'forum', one: 'forum' },
|
|
33
|
+
topics: { type: 'topic', one: 'topic' },
|
|
34
|
+
replies: { type: 'reply', one: 'reply' },
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Open a list of the forums' administration, with a search for a title, in a view: "all" (what is published,
|
|
39
|
+
* closed or pending), "spam" or "trash", as the links above the list name them. A reply
|
|
40
|
+
* has no title of its own (the list titles it "Reply To: <topic>"), so the replies list is not searched: its
|
|
41
|
+
* pages are read one after the other (listRows).
|
|
42
|
+
*/
|
|
43
|
+
async function openList(world, list, title, view) {
|
|
44
|
+
const query = new URLSearchParams({ post_type: LISTS[list].type, post_status: view || 'all' });
|
|
45
|
+
if (title && list !== 'replies') query.set('s', title);
|
|
46
|
+
const status = await visitAdmin(world, `/wp-admin/edit.php?${query.toString()}`);
|
|
47
|
+
if (/\/wp-login\.php/.test(world.page.url()) || status === 403) {
|
|
48
|
+
throw friendly({
|
|
49
|
+
message: `The ${list} list of the administration did not open for this account (${status || ''} ${world.page.url()}).`,
|
|
50
|
+
hint: 'A keymaster manages forums, topics and replies in the administration, a moderator topics and replies; log in as one first.',
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** The rows of the list table on the screen: title, state, the actions the row offers. */
|
|
56
|
+
async function listRows(world) {
|
|
57
|
+
return world.page.evaluate(() => {
|
|
58
|
+
const out = [];
|
|
59
|
+
for (const row of document.querySelectorAll('#the-list tr')) {
|
|
60
|
+
if (row.classList.contains('no-items')) continue;
|
|
61
|
+
const cell = row.querySelector('.column-title');
|
|
62
|
+
if (!cell) continue;
|
|
63
|
+
const strong = cell.querySelector('strong');
|
|
64
|
+
const link = cell.querySelector('a.row-title');
|
|
65
|
+
// In the trash the title is no link, and carries a hidden "(Child of <forum>)"; the state of a topic
|
|
66
|
+
// ("— Closed") follows the title in a span.
|
|
67
|
+
let title = link ? link.textContent : '';
|
|
68
|
+
if (!title && strong) {
|
|
69
|
+
const copy = strong.cloneNode(true);
|
|
70
|
+
copy.querySelectorAll('.post-state, .screen-reader-text').forEach((n) => n.remove());
|
|
71
|
+
title = copy.textContent.replace(/\s+—\s*$/, '');
|
|
72
|
+
}
|
|
73
|
+
out.push({
|
|
74
|
+
id: row.id,
|
|
75
|
+
title: title.replace(/\s+/g, ' ').trim().replace(/^(?:—\s*)+/, ''),
|
|
76
|
+
status: ([...row.classList].find((c) => c.startsWith('status-')) || '').replace('status-', ''),
|
|
77
|
+
sticky: [...cell.querySelectorAll('.row-actions span.stick a')].some((a) => /^unstick/i.test(a.textContent.trim())),
|
|
78
|
+
actions: [...cell.querySelectorAll('.row-actions span')].map((s) => {
|
|
79
|
+
// The first link of an action is the action; "Stick" carries a second one, "(to front)".
|
|
80
|
+
const a = s.querySelector('a');
|
|
81
|
+
return { name: s.className, text: a ? a.textContent.replace(/\s+/g, ' ').trim() : '', href: a ? a.href : '' };
|
|
82
|
+
}).filter((a) => a.href),
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return out;
|
|
86
|
+
}).catch(() => []);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** The row of a title in the list on the screen, or fail with the titles that are there. */
|
|
90
|
+
async function listRow(world, list, title) {
|
|
91
|
+
const rows = await listRows(world);
|
|
92
|
+
const row = rows.find((r) => same(r.title, title));
|
|
93
|
+
if (!row) {
|
|
94
|
+
throw friendly({
|
|
95
|
+
message: `The ${list} list has no ${LISTS[list].one} "${title}". It lists: ${listed(rows.map((r) => r.title))}.`,
|
|
96
|
+
hint: 'The list is searched by the title; a reply is titled "Reply To: <topic>".',
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
return row;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** The notices the administration shows on the screen. */
|
|
103
|
+
async function adminNotices(world) {
|
|
104
|
+
return world.page.evaluate(() => [...document.querySelectorAll('#wpbody-content .notice, #wpbody-content #message')]
|
|
105
|
+
.filter((n) => n.getClientRects().length)
|
|
106
|
+
.map((n) => {
|
|
107
|
+
const copy = n.cloneNode(true);
|
|
108
|
+
copy.querySelectorAll('button, .screen-reader-text').forEach((b) => b.remove());
|
|
109
|
+
return { error: n.classList.contains('error') || n.classList.contains('notice-error'), text: copy.textContent.replace(/\s+/g, ' ').trim() };
|
|
110
|
+
})
|
|
111
|
+
.filter((n) => n.text)).catch(() => []);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// A closed topic carries its status on its row; a closed forum does not (a forum's status is apart from its
|
|
115
|
+
// visibility), so for both the row is closed when it offers "Open".
|
|
116
|
+
const offersOpen = (row) => row.actions.some((a) => /^open$/i.test(a.text));
|
|
117
|
+
const ROW_STATES = {
|
|
118
|
+
open: (row) => row.status !== 'closed' && row.status !== 'trash' && row.status !== 'spam' && row.status !== 'pending' && !offersOpen(row),
|
|
119
|
+
closed: (row) => row.status === 'closed' || offersOpen(row),
|
|
120
|
+
sticky: (row) => row.sticky,
|
|
121
|
+
pending: (row) => row.status === 'pending',
|
|
122
|
+
spam: (row) => row.status === 'spam',
|
|
123
|
+
'in the trash': (row) => row.status === 'trash',
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
// A row action by what a step calls it: the text its link has in the row.
|
|
127
|
+
const ROW_ACTIONS = {
|
|
128
|
+
close: /^close$/i,
|
|
129
|
+
open: /^open$/i,
|
|
130
|
+
stick: /^stick$/i,
|
|
131
|
+
unstick: /^unstick$/i,
|
|
132
|
+
unapprove: /^unapprove$/i,
|
|
133
|
+
approve: /^approve$/i,
|
|
134
|
+
spam: /^spam$/i,
|
|
135
|
+
unspam: /^(not spam|unspam)$/i,
|
|
136
|
+
trash: /^trash$/i,
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
// ---------------------------------------------------------------------------
|
|
140
|
+
// The lists of the administration
|
|
141
|
+
// ---------------------------------------------------------------------------
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Assert the forums, topics or replies list of the administration has (or
|
|
145
|
+
* has not) an item, by its title; the step opens the list, searched for the
|
|
146
|
+
* title, with every item that is not in the trash.
|
|
147
|
+
*
|
|
148
|
+
* Example #1: Then the topics list should include "Welcome to the forums"
|
|
149
|
+
* Example #2: And the forums list should include "General discussion"
|
|
150
|
+
* Example #3: Then the topics list should not include "Webship test topic"
|
|
151
|
+
* Example #4: Then the replies list should include "Reply To: Welcome to the forums"
|
|
152
|
+
* Example #5: And the forums list should not include "Webship test forum"
|
|
153
|
+
*/
|
|
154
|
+
Then(/^the (forums|topics|replies) list should( not)* include "([^"]*)"$/, async function (list, notCase, title) {
|
|
155
|
+
await openList(this, list, title, 'all');
|
|
156
|
+
let rows = await listRows(this);
|
|
157
|
+
// The replies list is not searched: its next pages are read until the title is found.
|
|
158
|
+
for (let page = 1; list === 'replies' && page < 40 && !rows.some((r) => same(r.title, title)); page += 1) {
|
|
159
|
+
const next = await this.page.evaluate(() => (document.querySelector('.tablenav.top a.next-page') || {}).href || '');
|
|
160
|
+
if (!next) break;
|
|
161
|
+
await visitAdmin(this, next);
|
|
162
|
+
rows = rows.concat(await listRows(this));
|
|
163
|
+
}
|
|
164
|
+
if (rows.some((r) => same(r.title, title)) === Boolean(notCase)) {
|
|
165
|
+
throw friendly({
|
|
166
|
+
message: notCase ? `Expected the ${list} list not to include "${title}", but it does.` : `Expected the ${list} list to include "${title}". ${list === 'replies' ? 'It lists' : 'A search for it lists'}: ${listed([...new Set(rows.map((r) => r.title))])}.`,
|
|
167
|
+
hint: 'The list holds what is published, closed or pending; the spam and the trash are views of their own.',
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Assert the state of a topic or a forum in its list of the administration:
|
|
174
|
+
* open, closed, sticky (a topic), pending, spam, or in the trash.
|
|
175
|
+
*
|
|
176
|
+
* Example #1: Then the topic "The spring meetup is over" should be closed in the topics list
|
|
177
|
+
* Example #2: And the topic "Welcome to the forums" should be sticky in the topics list
|
|
178
|
+
* Example #3: Then the forum "Archive" should be closed in the forums list
|
|
179
|
+
* Example #4: Then the topic "Webship test topic" should be in the trash in the topics list
|
|
180
|
+
* Example #5: And the topic "A community garden in spring" should not be closed in the topics list
|
|
181
|
+
*/
|
|
182
|
+
Then(/^the (topic|forum) "([^"]*)" should( not)* be (open|closed|sticky|pending|spam|in the trash) in the (?:topics|forums) list$/, async function (what, title, notCase, state) {
|
|
183
|
+
const list = what === 'topic' ? 'topics' : 'forums';
|
|
184
|
+
// The view the state names first, then the others, to say where the item is when it is elsewhere.
|
|
185
|
+
const first = { 'in the trash': 'trash', spam: 'spam' }[state] || 'all';
|
|
186
|
+
let row;
|
|
187
|
+
for (const view of [first, ...['all', 'spam', 'trash'].filter((v) => v !== first)]) {
|
|
188
|
+
await openList(this, list, title, view);
|
|
189
|
+
row = (await listRows(this)).find((r) => same(r.title, title));
|
|
190
|
+
if (row) break;
|
|
191
|
+
}
|
|
192
|
+
if (!row) {
|
|
193
|
+
throw friendly({ message: `The ${list} list has no ${what} "${title}", in the spam and the trash or out of them.`, hint: 'The list is searched by the title.' });
|
|
194
|
+
}
|
|
195
|
+
if (ROW_STATES[state](row) === Boolean(notCase)) {
|
|
196
|
+
const found = `${row.sticky ? 'sticky, ' : ''}${ROW_STATES.closed(row) ? 'closed' : ({ publish: 'open', private: 'open', hidden: 'open', pending: 'pending', spam: 'spam', trash: 'in the trash' }[row.status] || row.status)}`;
|
|
197
|
+
throw friendly({
|
|
198
|
+
message: notCase ? `Expected the ${what} "${title}" not to be ${state}, but its row says it is.` : `Expected the ${what} "${title}" to be ${state}, but its row says: ${found}.`,
|
|
199
|
+
hint: 'The row carries the status of the item; a sticky topic offers "Unstick" among its actions.',
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Follow an action of a row of the topics or forums list of the
|
|
206
|
+
* administration: close or open, stick or unstick a topic, unapprove or
|
|
207
|
+
* approve it, mark it as spam or not, move it to the trash. The step waits
|
|
208
|
+
* for the list and its notice.
|
|
209
|
+
*
|
|
210
|
+
* Example #1: When I close the topic "Webship test topic" from the topics list
|
|
211
|
+
* Example #2: And I open the topic "Webship test topic" from the topics list
|
|
212
|
+
* Example #3: When I stick the topic "Webship test topic" from the topics list
|
|
213
|
+
* Example #4: When we trash the topic "Webship test topic" from the topics list
|
|
214
|
+
* Example #5: And I close the forum "Showcase" from the forums list
|
|
215
|
+
* Example #6: When I open the forum "Showcase" from the forums list
|
|
216
|
+
*/
|
|
217
|
+
When(/^(I |we )*(close|open|stick|unstick|unapprove|approve|spam|unspam|trash) the (topic|forum) "([^"]*)" from the (?:topics|forums) list$/, async function (pronounCase, action, what, title) {
|
|
218
|
+
const list = what === 'topic' ? 'topics' : 'forums';
|
|
219
|
+
// A spammed topic is in a view of its own: that is where "unspam" finds it.
|
|
220
|
+
await openList(this, list, title, action === 'unspam' ? 'spam' : 'all');
|
|
221
|
+
const row = await listRow(this, list, title);
|
|
222
|
+
const link = row.actions.find((a) => ROW_ACTIONS[action].test(a.text));
|
|
223
|
+
if (!link) {
|
|
224
|
+
throw friendly({
|
|
225
|
+
message: `The row of the ${what} "${title}" offers no "${action}" action. It offers: ${listed(row.actions.map((a) => a.text))}.`,
|
|
226
|
+
hint: 'A row offers the opposite of its state: Open for a closed item, Unstick for a sticky topic, Approve for a pending one. A forum is closed and opened only.',
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
await visitAdmin(this, link.href);
|
|
230
|
+
const errors = (await adminNotices(this)).filter((n) => n.error);
|
|
231
|
+
if (errors.length) {
|
|
232
|
+
throw friendly({ message: `The administration refused to ${action} the ${what} "${title}": ${listed(errors.map((n) => n.text))}.`, hint: 'The account may not have the right to do this.' });
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Restore a topic from the trash of the topics list, or delete it there for
|
|
238
|
+
* good.
|
|
239
|
+
*
|
|
240
|
+
* Example #1: When I restore the topic "Webship test topic" from the topics trash
|
|
241
|
+
* Example #2: And I delete the topic "Webship test topic" from the topics trash
|
|
242
|
+
* Example #3: When we restore the topic "Webship test question" from the topics trash
|
|
243
|
+
* Example #4: When we delete the topic "Webship test question" from the topics trash
|
|
244
|
+
* Example #5: And I restore the topic "Webship test announcement" from the topics trash
|
|
245
|
+
*/
|
|
246
|
+
When(/^(I |we )*(restore|delete) the topic "([^"]*)" from the topics trash$/, async function (pronounCase, action, title) {
|
|
247
|
+
await openList(this, 'topics', title, 'trash');
|
|
248
|
+
const rows = await listRows(this);
|
|
249
|
+
const row = rows.find((r) => same(r.title, title));
|
|
250
|
+
if (!row) {
|
|
251
|
+
throw friendly({ message: `The trash of the topics list has no topic "${title}". It holds: ${listed(rows.map((r) => r.title))}.`, hint: 'Move the topic to the trash first.' });
|
|
252
|
+
}
|
|
253
|
+
const link = row.actions.find((a) => a.name.split(' ').includes(action === 'restore' ? 'untrash' : 'delete'));
|
|
254
|
+
if (!link) {
|
|
255
|
+
throw friendly({ message: `The row of "${title}" in the trash offers no "${action}" action. It offers: ${listed(row.actions.map((a) => a.text))}.`, hint: 'A moderator and a keymaster may restore and delete topics.' });
|
|
256
|
+
}
|
|
257
|
+
await visitAdmin(this, link.href);
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
// ---------------------------------------------------------------------------
|
|
261
|
+
// Settings, tools, users
|
|
262
|
+
// ---------------------------------------------------------------------------
|
|
263
|
+
|
|
264
|
+
/** The checkbox of a feature of the forums' settings screen, by the name of its row. */
|
|
265
|
+
async function featureBox(world, name) {
|
|
266
|
+
const found = await world.page.evaluate((wanted) => {
|
|
267
|
+
const norm = (t) => t.replace(/\s+/g, ' ').trim().toLowerCase();
|
|
268
|
+
const rows = [...document.querySelectorAll('#wpbody-content form .form-table tr')]
|
|
269
|
+
.map((tr) => ({ name: tr.querySelector('th') ? tr.querySelector('th').textContent.replace(/\s+/g, ' ').trim() : '', box: tr.querySelector('td input[type="checkbox"]') }))
|
|
270
|
+
.filter((r) => r.name && r.box);
|
|
271
|
+
const row = rows.find((r) => norm(r.name) === norm(wanted));
|
|
272
|
+
return { id: row ? row.box.id : '', names: rows.map((r) => r.name) };
|
|
273
|
+
}, name).catch(() => ({ id: '', names: [] }));
|
|
274
|
+
if (!found.id) {
|
|
275
|
+
throw friendly({
|
|
276
|
+
message: found.names.length ? `The forums' settings have no feature "${name}". They have: ${listed(found.names)}.` : `The screen is not the forums' settings (${world.page.url()}).`,
|
|
277
|
+
hint: 'Open the screen first: Given I am on the "Forums settings" admin screen. A feature is named as its row is: Favorites, Subscriptions, Topic tags, Search, Revisions, Anonymous, …',
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
return world.page.locator(`#${found.id}`);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Turn a feature of the forums on or off on their settings screen, by the
|
|
285
|
+
* name of its row (Favorites, Subscriptions, Topic tags, Search, Revisions,
|
|
286
|
+
* Reply Threading, Anonymous, Flooding, Editing, …), without saving. Follow
|
|
287
|
+
* it with "I save the settings".
|
|
288
|
+
*
|
|
289
|
+
* Example #1: When I turn the forum feature "Favorites" off
|
|
290
|
+
* Example #2: And I turn the forum feature "Favorites" on
|
|
291
|
+
* Example #3: When we turn the forum feature "Subscriptions" off
|
|
292
|
+
* Example #4: When I turn the forum feature "Search" off
|
|
293
|
+
* Example #5: And we turn the forum feature "Topic tags" on
|
|
294
|
+
*/
|
|
295
|
+
When(/^(I |we )*turn the forum feature "([^"]*)" (on|off)$/, async function (pronounCase, name, state) {
|
|
296
|
+
const box = await featureBox(this, name);
|
|
297
|
+
await box.setChecked(state === 'on');
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Assert a feature of the forums is on (or off) on their settings screen, by
|
|
302
|
+
* the name of its row.
|
|
303
|
+
*
|
|
304
|
+
* Example #1: Then the forum feature "Favorites" should be on
|
|
305
|
+
* Example #2: And the forum feature "Anonymous" should be off
|
|
306
|
+
* Example #3: Then the forum feature "Subscriptions" should be on
|
|
307
|
+
* Example #4: Then the forum feature "Search" should be on
|
|
308
|
+
* Example #5: And the forum feature "Reply Threading" should be off
|
|
309
|
+
*/
|
|
310
|
+
Then(/^the forum feature "([^"]*)" should be (on|off)$/, async function (name, state) {
|
|
311
|
+
const box = await featureBox(this, name);
|
|
312
|
+
const on = await box.isChecked();
|
|
313
|
+
if (on !== (state === 'on')) {
|
|
314
|
+
throw friendly({ message: `Expected the forum feature "${name}" to be ${state}, but it is ${on ? 'on' : 'off'}.`, hint: 'The step reads the checkbox of the feature\'s row on the forums\' settings screen, as it was last saved or changed.' });
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Run a repair tool of the forums by its name on the tools screen, and wait
|
|
320
|
+
* for its answer ("… Complete!").
|
|
321
|
+
*
|
|
322
|
+
* Example #1: When I run the forum repair tool "Recount topics in each forum"
|
|
323
|
+
* Example #2: And I run the forum repair tool "Recount replies in each topic"
|
|
324
|
+
* Example #3: When we run the forum repair tool "Recalculate last activity in each topic and forum"
|
|
325
|
+
* Example #4: When I run the forum repair tool "Recount topics for each user"
|
|
326
|
+
* Example #5: And we run the forum repair tool "Recalculate private and hidden forums"
|
|
327
|
+
*/
|
|
328
|
+
When(/^(I |we )*run the forum repair tool "([^"]*)"$/, async function (pronounCase, name) {
|
|
329
|
+
await visitAdmin(this, '/wp-admin/tools.php?page=bbp-repair');
|
|
330
|
+
const tools = await this.page.evaluate(() => [...document.querySelectorAll('#wpbody-content .wp-list-table tbody tr')].map((tr) => ({
|
|
331
|
+
name: tr.querySelector('td strong') ? tr.querySelector('td strong').textContent.replace(/\s+/g, ' ').trim() : '',
|
|
332
|
+
href: (tr.querySelector('.row-actions .run a') || {}).href || '',
|
|
333
|
+
})).filter((t) => t.name)).catch(() => []);
|
|
334
|
+
const tool = tools.find((t) => same(t.name, name));
|
|
335
|
+
if (!tool || !tool.href) {
|
|
336
|
+
throw friendly({
|
|
337
|
+
message: tools.length ? `The forums have no repair tool "${name}". They have: ${listed(tools.map((t) => t.name))}.` : `The repair tools did not open for this account (${this.page.url()}).`,
|
|
338
|
+
hint: 'The tools are for a keymaster, under Tools > Forums.',
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
await visitAdmin(this, tool.href);
|
|
342
|
+
const notices = await adminNotices(this);
|
|
343
|
+
if (!notices.some((n) => !n.error && /complete/i.test(n.text))) {
|
|
344
|
+
throw friendly({ message: `The repair tool "${name}" did not answer "Complete!". The screen says: ${listed(notices.map((n) => n.text))}.`, hint: 'A tool answers with a notice that names what it did and ends with "Complete!".' });
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
/** The row of an account on the users screen, by its login name. */
|
|
349
|
+
function userRow(world, login) {
|
|
350
|
+
return world.page.locator('#the-list tr').filter({ has: world.page.locator('.column-username strong a', { hasText: new RegExp(`^${login.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}$`) }) }).first();
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Assert the forum role the users screen of the administration shows for an
|
|
355
|
+
* account (a handle of the users registry, or a login name), in its "Forum
|
|
356
|
+
* Role" column.
|
|
357
|
+
*
|
|
358
|
+
* Example #1: Then the users screen should show the forum role "Moderator" for "moderator"
|
|
359
|
+
* Example #2: And the users screen should show the forum role "Keymaster" for "admin"
|
|
360
|
+
* Example #3: Then the users screen should show the forum role "Blocked" for "blocked"
|
|
361
|
+
* Example #4: Then the users screen should show the forum role "Spectator" for "spectator"
|
|
362
|
+
* Example #5: And the users screen should show the forum role "Participant" for "participant"
|
|
363
|
+
*/
|
|
364
|
+
Then(/^the users screen should show the forum role "([^"]*)" for "([^"]*)"$/, async function (role, who) {
|
|
365
|
+
const users = (this.parameters && this.parameters.users) || {};
|
|
366
|
+
const login = users[who] ? resolveUser(this, who).username : who;
|
|
367
|
+
await visitAdmin(this, `/wp-admin/users.php?s=${encodeURIComponent(login)}`);
|
|
368
|
+
const row = userRow(this, login);
|
|
369
|
+
if (!(await row.count())) {
|
|
370
|
+
throw friendly({ message: `The users screen lists no account "${login}" (${this.page.url()}).`, hint: 'The users screen is for an administrator of the site: Given I am a logged in user with the "admin" user.' });
|
|
371
|
+
}
|
|
372
|
+
const cell = row.locator('td.column-bbp_user_role');
|
|
373
|
+
const actual = (await cell.count()) ? clean(await cell.textContent()) : '';
|
|
374
|
+
if (!same(actual, role)) {
|
|
375
|
+
throw friendly({ message: `Expected the forum role "${role}" for "${login}", but the users screen shows "${actual || '(no Forum Role column)'}".`, hint: 'The column comes with the forums plugin; the roles are Keymaster, Moderator, Participant, Spectator and Blocked.' });
|
|
376
|
+
}
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Change the forum role of an account on the users screen of the
|
|
381
|
+
* administration, with "Change forum role to…". Put it back in the same
|
|
382
|
+
* scenario: accounts are configuration.
|
|
383
|
+
*
|
|
384
|
+
* Example #1: When I change the forum role of "spectator" to "Participant"
|
|
385
|
+
* Example #2: And I change the forum role of "spectator" to "Spectator"
|
|
386
|
+
* Example #3: When we change the forum role of "participant" to "Moderator"
|
|
387
|
+
* Example #4: When I change the forum role of "participant" to "Participant"
|
|
388
|
+
* Example #5: And we change the forum role of "blocked" to "Blocked"
|
|
389
|
+
*/
|
|
390
|
+
When(/^(I |we )*change the forum role of "([^"]*)" to "([^"]*)"$/, async function (pronounCase, who, role) {
|
|
391
|
+
const users = (this.parameters && this.parameters.users) || {};
|
|
392
|
+
const login = users[who] ? resolveUser(this, who).username : who;
|
|
393
|
+
await visitAdmin(this, `/wp-admin/users.php?s=${encodeURIComponent(login)}`);
|
|
394
|
+
const row = userRow(this, login);
|
|
395
|
+
if (!(await row.count())) {
|
|
396
|
+
throw friendly({ message: `The users screen lists no account "${login}" (${this.page.url()}).`, hint: 'The users screen is for an administrator of the site: Given I am a logged in user with the "admin" user.' });
|
|
397
|
+
}
|
|
398
|
+
const select = this.page.locator('#bbp-new-role');
|
|
399
|
+
if (!(await select.count())) {
|
|
400
|
+
throw friendly({ message: 'The users screen has no "Change forum role to…" list.', hint: 'It comes with the forums plugin, for an account that may promote users.' });
|
|
401
|
+
}
|
|
402
|
+
const options = await select.locator('option').evaluateAll((all) => all.map((o) => ({ value: o.value, text: o.textContent.trim() })));
|
|
403
|
+
const option = options.find((o) => o.value && same(o.text, role));
|
|
404
|
+
if (!option) throw friendly({ message: `There is no forum role "${role}". The roles: ${listed(options.filter((o) => o.value).map((o) => o.text))}.`, hint: 'Use the role as the list shows it.' });
|
|
405
|
+
await row.locator('input[name="users[]"]').check();
|
|
406
|
+
await select.selectOption(option.value);
|
|
407
|
+
await clickAndLoad(this, this.page.locator('#bbp-change-role'), 'change the forum role', true);
|
|
408
|
+
const after = userRow(this, login).locator('td.column-bbp_user_role');
|
|
409
|
+
const actual = (await after.count()) ? clean(await after.textContent()) : '';
|
|
410
|
+
if (!same(actual, role)) {
|
|
411
|
+
throw friendly({ message: `Changed the forum role of "${login}" to "${role}", but the users screen shows "${actual}".`, hint: 'An account cannot change its own forum role here, and only a keymaster makes another keymaster.' });
|
|
412
|
+
}
|
|
413
|
+
});
|
|
414
|
+
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Test content a scenario starts from, and its removal: a topic posted by
|
|
4
|
+
// the account that owns it, a reply by another account, and no topic of a
|
|
5
|
+
// title (whatever an earlier run left: open, closed, pending, spam or in the
|
|
6
|
+
// trash).
|
|
7
|
+
//
|
|
8
|
+
// The content is made the way a person makes it, in the browser: the account
|
|
9
|
+
// that owns it logs in (once in a run; later steps take its session over),
|
|
10
|
+
// posts through the forums' own forms, and the scenario's session comes back.
|
|
11
|
+
// Removal is the work of the account `worldParameters.forums.moderator` names,
|
|
12
|
+
// in the topics list of the administration: to the trash, then deleted for
|
|
13
|
+
// good, with the replies the topic has. No step here creates or deletes an
|
|
14
|
+
// account.
|
|
15
|
+
|
|
16
|
+
const { Given } = require('@cucumber/cucumber');
|
|
17
|
+
const { friendly } = require('webship-js/tests/step-definitions/webship');
|
|
18
|
+
const {
|
|
19
|
+
FORUMS,
|
|
20
|
+
visitAdmin,
|
|
21
|
+
listed,
|
|
22
|
+
same,
|
|
23
|
+
clickAndLoad,
|
|
24
|
+
contentModerator,
|
|
25
|
+
forumNotices,
|
|
26
|
+
openForum,
|
|
27
|
+
openTopic,
|
|
28
|
+
readingTopic,
|
|
29
|
+
asAccount,
|
|
30
|
+
} = require('./bbpress-helpers');
|
|
31
|
+
|
|
32
|
+
/** The rows of the topics list of the administration whose title is the one given, with their trash and delete links. */
|
|
33
|
+
async function topicRows(world, title, view) {
|
|
34
|
+
const query = new URLSearchParams({ post_type: 'topic', post_status: view, s: title });
|
|
35
|
+
const status = await visitAdmin(world, `/wp-admin/edit.php?${query.toString()}`);
|
|
36
|
+
if (/\/wp-login\.php/.test(world.page.url()) || status === 403) {
|
|
37
|
+
throw friendly({
|
|
38
|
+
message: `The account "${contentModerator(world)}" may not open the topics list of the administration (${status || ''} ${world.page.url()}).`,
|
|
39
|
+
hint: 'worldParameters.forums.moderator in cucumber.js names the account that removes test content: a moderator or a keymaster of the forums.',
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
return world.page.evaluate((wanted) => {
|
|
43
|
+
const norm = (t) => t.replace(/\s+/g, ' ').trim().toLowerCase();
|
|
44
|
+
const out = [];
|
|
45
|
+
for (const row of document.querySelectorAll('#the-list tr')) {
|
|
46
|
+
const cell = row.querySelector('.column-title');
|
|
47
|
+
if (!cell) continue;
|
|
48
|
+
const link = cell.querySelector('a.row-title');
|
|
49
|
+
let title = link ? link.textContent : '';
|
|
50
|
+
if (!title && cell.querySelector('strong')) {
|
|
51
|
+
const copy = cell.querySelector('strong').cloneNode(true);
|
|
52
|
+
copy.querySelectorAll('.post-state, .screen-reader-text').forEach((n) => n.remove());
|
|
53
|
+
title = copy.textContent.replace(/\s+—\s*$/, '');
|
|
54
|
+
}
|
|
55
|
+
if (norm(title) !== norm(wanted)) continue;
|
|
56
|
+
const href = (name) => (cell.querySelector(`.row-actions span.${name} a`) || {}).href || '';
|
|
57
|
+
out.push({ trash: href('trash'), remove: href('delete') });
|
|
58
|
+
}
|
|
59
|
+
return out;
|
|
60
|
+
}, title);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Remove every topic of a title: out of the list and out of the spam (a view of its own) into the trash, then
|
|
65
|
+
* out of the trash for good.
|
|
66
|
+
*/
|
|
67
|
+
async function removeTopics(world, title) {
|
|
68
|
+
for (const view of ['all', 'spam']) {
|
|
69
|
+
for (let round = 0; round < 20; round += 1) {
|
|
70
|
+
const rows = await topicRows(world, title, view);
|
|
71
|
+
if (!rows.length) break;
|
|
72
|
+
if (!rows[0].trash) throw friendly({ message: `The topics list offers "${contentModerator(world)}" no Trash link for the topic "${title}".`, hint: 'The account that removes test content must be a moderator or a keymaster of the forums.' });
|
|
73
|
+
await visitAdmin(world, rows[0].trash);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
for (let round = 0; round < 20; round += 1) {
|
|
77
|
+
const rows = await topicRows(world, title, 'trash');
|
|
78
|
+
if (!rows.length) return;
|
|
79
|
+
if (!rows[0].remove) throw friendly({ message: `The trash of the topics list offers "${contentModerator(world)}" no "Delete Permanently" link for the topic "${title}".`, hint: 'The account that removes test content must be a moderator or a keymaster of the forums.' });
|
|
80
|
+
await visitAdmin(world, rows[0].remove);
|
|
81
|
+
}
|
|
82
|
+
throw friendly({ message: `Could not remove every topic "${title}": the trash still lists it after 20 removals.`, hint: 'Look at the topics list of the administration.' });
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** Post a topic through the forum's own form, as the account that is logged in. */
|
|
86
|
+
async function postTopic(world, title, forum, text) {
|
|
87
|
+
await openForum(world, forum);
|
|
88
|
+
const form = world.page.locator(`${FORUMS} form#new-post`);
|
|
89
|
+
if (!(await form.locator('#bbp_topic_title').count())) {
|
|
90
|
+
const notices = (await forumNotices(world)).filter((n) => n.kind !== 'info').map((n) => n.text);
|
|
91
|
+
throw friendly({
|
|
92
|
+
message: `The forum "${forum}" offers the account no form for a new topic${notices.length ? `: the forums say ${listed(notices)}` : ''}.`,
|
|
93
|
+
hint: 'The account that owns the topic must be allowed to post in that forum.',
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
await form.locator('#bbp_topic_title').fill(title);
|
|
97
|
+
await form.locator('#bbp_topic_content').fill(text);
|
|
98
|
+
await clickAndLoad(world, form.locator('#bbp_topic_submit'), 'post the topic');
|
|
99
|
+
const errors = (await forumNotices(world)).filter((n) => n.kind === 'error').map((n) => n.text);
|
|
100
|
+
if (errors.length) throw friendly({ message: `The forums refused the topic "${title}": ${listed(errors)}.`, hint: 'The forums refuse a post sent right after another when their flood protection is on: the test site turns it off.' });
|
|
101
|
+
await readingTopic(world, title);
|
|
102
|
+
return world.page.url().split('#')[0].split('?')[0];
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Make sure the forums have no topic of a title, whatever state it is in:
|
|
107
|
+
* each goes to the trash and is deleted for good, with its replies. The
|
|
108
|
+
* account `worldParameters.forums.moderator` names does it in the
|
|
109
|
+
* administration; the scenario's own session stays.
|
|
110
|
+
*
|
|
111
|
+
* Example #1: Given there is no topic "Webship test topic"
|
|
112
|
+
* Example #2: And there is no topic "Webship test question"
|
|
113
|
+
* Example #3: Given there is no topic "Webship test split"
|
|
114
|
+
* Example #4: Then there is no topic "Webship test topic"
|
|
115
|
+
* Example #5: And there is no topic "Webship test: moved reply"
|
|
116
|
+
*/
|
|
117
|
+
Given(/^there is no topic "([^"]*)"$/, async function (title) {
|
|
118
|
+
await asAccount(this, contentModerator(this), () => removeTopics(this, title));
|
|
119
|
+
this.forumTopics = this.forumTopics.filter((t) => !same(t.title, title));
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Make sure a forum has one topic of a title, posted by an account (a handle
|
|
124
|
+
* of the users registry) through the forum's own form: a topic an earlier
|
|
125
|
+
* run left under that title is removed first. The doc string is the text of
|
|
126
|
+
* the topic; without one it gets a line that says it is test content.
|
|
127
|
+
*
|
|
128
|
+
* Example #1: Given there is a topic "Webship test topic" in "General discussion" by "participant"
|
|
129
|
+
* Example #2: And there is a topic "Webship test question" in "Help and support" by "participant"
|
|
130
|
+
* Example #3: Given there is a topic "Webship test announcement" in "General discussion" by "moderator"
|
|
131
|
+
* Example #4: Given there is a topic "Webship test destination" in "General discussion" by "moderator"
|
|
132
|
+
* Example #5: And there is a topic "Webship test members topic" in "Members lounge" by "participant"
|
|
133
|
+
*/
|
|
134
|
+
Given(/^there is a topic "([^"]*)" in "([^"]*)" by "([^"]*)"$/, async function (title, forum, author) {
|
|
135
|
+
await asAccount(this, contentModerator(this), () => removeTopics(this, title));
|
|
136
|
+
const url = await asAccount(this, author, () => postTopic(this, title, forum, `Webship test: the first post of "${title}".`));
|
|
137
|
+
this.forumTopics = this.forumTopics.filter((t) => !same(t.title, title)).concat([{ title, url }]);
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* The same, with the text of the topic given as a doc string.
|
|
142
|
+
*
|
|
143
|
+
* Example #1: Given there is a topic "Webship test topic" in "General discussion" by "participant" with:
|
|
144
|
+
* Example #2: And there is a topic "Webship test question" in "Help and support" by "participant" with:
|
|
145
|
+
* Example #3: Given there is a topic "Webship test announcement" in "General discussion" by "moderator" with:
|
|
146
|
+
* Example #4: Given there is a topic "Webship test destination" in "General discussion" by "moderator" with:
|
|
147
|
+
* Example #5: And there is a topic "Webship test members topic" in "Members lounge" by "participant" with:
|
|
148
|
+
*/
|
|
149
|
+
Given(/^there is a topic "([^"]*)" in "([^"]*)" by "([^"]*)" with:$/, async function (title, forum, author, text) {
|
|
150
|
+
await asAccount(this, contentModerator(this), () => removeTopics(this, title));
|
|
151
|
+
const url = await asAccount(this, author, () => postTopic(this, title, forum, String(text)));
|
|
152
|
+
this.forumTopics = this.forumTopics.filter((t) => !same(t.title, title)).concat([{ title, url }]);
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Have an account (a handle of the users registry) reply to a topic through
|
|
157
|
+
* its own reply form: a topic a Given step of the scenario made, or any
|
|
158
|
+
* topic the account finds by its title.
|
|
159
|
+
*
|
|
160
|
+
* Example #1: Given "moderator" replied to the topic "Webship test topic" with "Webship test reply of the moderator."
|
|
161
|
+
* Example #2: And "participant" replied to the topic "Webship test topic" with "Webship test: thank you."
|
|
162
|
+
* Example #3: Given "keymaster" replied to the topic "Webship test question" with "Webship test: see the forum rules."
|
|
163
|
+
* Example #4: Given "moderator" replied to the topic "Webship test question" with "Webship test: open your profile."
|
|
164
|
+
* Example #5: And "participant" replied to the topic "Webship test announcement" with "Webship test: noted."
|
|
165
|
+
*/
|
|
166
|
+
Given(/^"([^"]*)" replied to the topic "([^"]*)" with "([^"]*)"$/, async function (author, title, text) {
|
|
167
|
+
await asAccount(this, author, async () => {
|
|
168
|
+
await openTopic(this, title);
|
|
169
|
+
const area = this.page.locator(`${FORUMS} form#new-post #bbp_reply_content`);
|
|
170
|
+
if (!(await area.count())) {
|
|
171
|
+
const notices = (await forumNotices(this)).filter((n) => n.kind !== 'info').map((n) => n.text);
|
|
172
|
+
throw friendly({ message: `The topic "${title}" offers "${author}" no reply form${notices.length ? `: the forums say ${listed(notices)}` : ''}.`, hint: 'The account must be allowed to reply: a participant in an open topic, a moderator in any.' });
|
|
173
|
+
}
|
|
174
|
+
await area.fill(text);
|
|
175
|
+
await clickAndLoad(this, this.page.locator(`${FORUMS} form#new-post #bbp_reply_submit`), 'post the reply');
|
|
176
|
+
const errors = (await forumNotices(this)).filter((n) => n.kind === 'error').map((n) => n.text);
|
|
177
|
+
if (errors.length) throw friendly({ message: `The forums refused the reply of "${author}": ${listed(errors)}.`, hint: 'The forums refuse the same reply twice in a topic.' });
|
|
178
|
+
});
|
|
179
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// What this pack brings along for every scenario. Not a step file.
|
|
4
|
+
//
|
|
5
|
+
// 1. The WordPress pack's steps. A forum project installs this pack alone:
|
|
6
|
+
// the login by a handle of the users registry, the administration
|
|
7
|
+
// screens, menus and notices, the settings by their labels, the REST API
|
|
8
|
+
// and the feeds come from @webship-js/wordpress-steps, which this package
|
|
9
|
+
// depends on and loads here, so one `require` glob in cucumber.js is
|
|
10
|
+
// enough. A project that lists the WordPress pack's glob as well is fine
|
|
11
|
+
// while npm installed one copy of it (Node loads a file once); a second,
|
|
12
|
+
// nested copy (the project pins another release line of it) registers
|
|
13
|
+
// every WordPress step twice, so drop that glob then (see README).
|
|
14
|
+
//
|
|
15
|
+
// 2. The forums' administration screens, added to the WordPress pack's list
|
|
16
|
+
// of named screens: `Given I am on the "Topics" admin screen` opens the
|
|
17
|
+
// topics of the forums, as `the "Plugins" admin screen` opens the
|
|
18
|
+
// plugins. A name the WordPress pack already has is never changed.
|
|
19
|
+
//
|
|
20
|
+
// 3. Per scenario: the moment it began (a notification step reads only the
|
|
21
|
+
// mail that arrived since then) and the topics its Given steps made
|
|
22
|
+
// (`I open the topic "…"` finds them without a forum).
|
|
23
|
+
|
|
24
|
+
const fs = require('fs');
|
|
25
|
+
const path = require('path');
|
|
26
|
+
const { Before } = require('@cucumber/cucumber');
|
|
27
|
+
|
|
28
|
+
const WORDPRESS_STEPS_DIR = path.join(path.dirname(require.resolve('@webship-js/wordpress-steps/package.json')), 'tests', 'step-definitions');
|
|
29
|
+
for (const file of fs.readdirSync(WORDPRESS_STEPS_DIR).filter((f) => f.endsWith('.js')).sort()) {
|
|
30
|
+
require(path.join(WORDPRESS_STEPS_DIR, file));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const { ADMIN_SCREENS } = require('@webship-js/wordpress-steps/tests/step-definitions/wordpress-helpers');
|
|
34
|
+
|
|
35
|
+
// The screens of the forums' administration, by the name a person reads in
|
|
36
|
+
// the menu or on the screen, lower case.
|
|
37
|
+
const FORUM_ADMIN_SCREENS = {
|
|
38
|
+
'forums': '/wp-admin/edit.php?post_type=forum',
|
|
39
|
+
'all forums': '/wp-admin/edit.php?post_type=forum',
|
|
40
|
+
'create new forum': '/wp-admin/post-new.php?post_type=forum',
|
|
41
|
+
'topics': '/wp-admin/edit.php?post_type=topic',
|
|
42
|
+
'all topics': '/wp-admin/edit.php?post_type=topic',
|
|
43
|
+
'create new topic': '/wp-admin/post-new.php?post_type=topic',
|
|
44
|
+
'topic tags': '/wp-admin/edit-tags.php?taxonomy=topic-tag&post_type=topic',
|
|
45
|
+
'replies': '/wp-admin/edit.php?post_type=reply',
|
|
46
|
+
'all replies': '/wp-admin/edit.php?post_type=reply',
|
|
47
|
+
'create new reply': '/wp-admin/post-new.php?post_type=reply',
|
|
48
|
+
'forums settings': '/wp-admin/options-general.php?page=bbpress',
|
|
49
|
+
'forum tools': '/wp-admin/tools.php?page=bbp-repair',
|
|
50
|
+
'repair forums': '/wp-admin/tools.php?page=bbp-repair',
|
|
51
|
+
'upgrade forums': '/wp-admin/tools.php?page=bbp-upgrade',
|
|
52
|
+
'import forums': '/wp-admin/tools.php?page=bbp-converter',
|
|
53
|
+
'reset forums': '/wp-admin/tools.php?page=bbp-reset',
|
|
54
|
+
};
|
|
55
|
+
for (const [name, screen] of Object.entries(FORUM_ADMIN_SCREENS)) {
|
|
56
|
+
if (!(name in ADMIN_SCREENS)) ADMIN_SCREENS[name] = screen;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
Before(function () {
|
|
60
|
+
this.forumScenarioStartedAt = Date.now();
|
|
61
|
+
this.forumTopics = [];
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
module.exports = { WORDPRESS_STEPS_DIR, FORUM_ADMIN_SCREENS };
|