Skip to content

Commit 90efe3e

Browse files
committed
Adding some e2e tests
1 parent 37c411e commit 90efe3e

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

tests/e2e/config/setup-test-framework.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,27 @@ async function runAxeTestsForBlockEditor() {
202202
} );
203203
}
204204

205+
async function createUser(username, email, password, role = 'author') {
206+
await visitAdminPage('user-new.php');
207+
208+
await page.$eval('#user_login', el => el.value = username);
209+
await page.$eval('#email', el => el.value = email);
210+
await page.$eval('#pass1', el => el.value = password);
211+
212+
const weakPasswordCheckbox = await page.$('input[name="pw_weak"]');
213+
214+
weakPasswordCheckbox.click();
215+
216+
await page.select('#role', role);
217+
218+
const createUserForm = await page.$('#createuser');
219+
await createUserForm.evaluate(form => form.submit());
220+
}
221+
222+
createUser('author1', '[email protected]', 'author1');
223+
createUser('author2', '[email protected]', 'author2');
224+
createUser('editor1', '[email protected]', 'editor1');
225+
205226
// Before every test suite run, delete all content created by the test. This ensures
206227
// other posts/comments/etc. aren't dirtying tests and tests don't depend on
207228
// each other's side-effects.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* WordPress dependencies
3+
*/
4+
5+
import { visitAdminPage, switchUserToAdmin, createNewPost } from "@wordpress/e2e-test-utils";
6+
7+
8+
describe("Post User Notifications Signup", () => {
9+
beforeAll( async () => {
10+
visitAdminPage('user-new.php');
11+
});
12+
13+
beforeEach( async () => {
14+
await createNewPost();
15+
} );
16+
17+
it("the plugin settings page loads", async () => {
18+
const editFlow = await page.$(".edit-flow-admin h2");
19+
const html = await page.evaluate(body => body.innerHTML, editFlow);
20+
21+
expect(html).toEqual("Edit Flow");
22+
});
23+
});

0 commit comments

Comments
 (0)