-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathtesla-inputs.cy.ts
33 lines (26 loc) · 1.22 KB
/
tesla-inputs.cy.ts
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
describe("Tesla Newsletter Form Inputs", async function () {
const testId = new Date().getTime();
const fake_email = `fake.email.cypress4everything+${testId}@gmail.com`;
it("Newsletter Form: Email is submitted from UI to server!", function () {
cy.visit("https://www.tesla.com/updates");
cy.wait(2000);
cy.get(".tds-modal-close > .tds-icon").click({
force: true,
});
cy.contains("Stay Connected");
cy.get('body input[name="firstName"]').type(`name ${testId}`);
cy.get('body input[name="lastName"]').type(`name ${testId}`);
cy.get('body input[name="email"]').type(fake_email);
cy.get('body input[name="zip"]').type(testId.toString());
cy.get("input[name='productInterested'][value='Model S']").click();
cy.get("input[name='productInterested'][value='Model 3']").click();
cy.get("input[name='productInterested'][value='Model X']").click();
cy.get("input[name='productInterested'][value='Model Y']").click();
cy.get('body button[type="submit"]').within(($button) => {
cy.wrap($button).should("have.text", "Submit");
cy.wrap($button).click();
});
cy.contains("Thank you");
cy.contains("We'll notify you of any product updates, news or events.");
});
});