-
Notifications
You must be signed in to change notification settings - Fork 254
/
wp-basic-tests.spec.js
38 lines (33 loc) · 1.12 KB
/
wp-basic-tests.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
describe("WordPress REST API", () => {
it("archives should work", () => {
cy.visit("http://localhost:3001?name=wp-basic-tests");
cy.get("[data-test-id='1']").contains("/hello-world");
});
it("posts should work", () => {
cy.visit("http://localhost:3001/hello-world?name=wp-basic-tests");
cy.get("[data-test-id='post']").contains("Hello world");
});
});
describe("WordPress plugins", () => {
before(() => {
cy.task("installPlugin", { name: "code-snippets" });
cy.task("loadDatabase", {
path: "./wp-data/wp-basic-tests/code-snippets.sql",
});
});
after(() => {
cy.task("resetDatabase");
cy.task("removeAllPlugins");
});
it("should have a text injected by the Code Snippets plugin", () => {
cy.visit("http://localhost:8080/");
cy.get("[data-test-id='code-snippet']").contains(
"Hello from WordPress plugin"
);
});
it("dummy test, otherwise the previous test doesn't run", () => {
// I'm not sure why, but if I remove this test, the previous one doesn't run
// and if it fails, Cypress does not complain. I guess it is a bug in
// Cypress.
});
});