describe("The MadLibs Main Form", () => {
it("loads successfully", () => {
// @ : ARRANGE
cy.visit("http://localhost:3000");
// @ : ACT
// None: Loading only
// @ : ASSERT
// ! : Navbar
cy.get("nav")
.should("be.visible")
.within(() => {
cy.get("h1").should("contain.text", "My Cool MadLibs");
cy.get("a").should("be.visible").should("contain.text", "Exit Site");
});
// ! : Form
cy.get("h2").should("contain.text", "Enter Your Choices!");
cy.get("table").should("be.visible");
cy.get("tr").should("have.length", 10);
cy.get("button").should("contain.text", "Complete").should("be.disabled");
});
it("activates the button when the form is filled in", () => {
//ACT
cy.get("input#animal").type("platypus");
cy.get("input#action").type("caressing");
cy.get("input#object").type("vacuum cleaner");
cy.get("input#food").type("popcorn");
cy.get("input#name").type("FLANJESUA THE ADORABLE");
cy.get("input#drink").type("chocolate milk");
cy.get("input#number").type("8");
cy.get("input#adjective").type("flowery");
cy.get("input#city").type("Copenhagen");
cy.get("input#mood").type("inconsolable");
//ASSERT
cy.get("button").should("be.enabled");
});
});
TypeScript
복사