Skip to content

Commit 1c46f29

Browse files
committed
feat(user-signup): [next-ts-middle-out] 🔴 add e2e test for form
1 parent 3a7dd8a commit 1c46f29

File tree

1 file changed

+18
-6
lines changed
  • exercises/user_signup/solutions/codely_next-typescript-middle-out/tests/pages

1 file changed

+18
-6
lines changed
Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
1-
describe("The Home Page", () => {
2-
it("works", () => {
3-
4-
cy.visit("/")
5-
.contains("User Signup")
6-
.should("exist");
1+
describe("The sign up user form", () => {
2+
it("displays success message on form submission", () => {
3+
cy.visit("/");
4+
const name = "Jane Doe";
5+
const email = "jane@gmail.com";
6+
7+
cy.find
8+
cy.findByLabelText(/name/i)
9+
.type(name);
10+
cy.findByLabelText(/email/i)
11+
.type(email);
12+
13+
cy.findByRole("button", { name: /submit/i })
14+
.click()
15+
16+
const successMessage = cy.findByText(/thank you/i)
17+
18+
successMessage.should("exist");
719
});
820
});

0 commit comments

Comments
 (0)