-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add gmail-tester and prepare S3 config
- Loading branch information
1 parent
54ff17b
commit 563d462
Showing
7 changed files
with
330 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
describe("Tesla Newsletter Form", async function () { | ||
const test_id = new Date().getTime(); | ||
const fake_email = `fake.email.cypress4everything+${test_id}@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 ${test_id}`); | ||
cy.get('body input[name="/lastName"]').type(`name ${test_id}`); | ||
|
||
cy.get('body input[name="/email"]').type(fake_email); | ||
|
||
cy.get('body input[name="/zip"]').type(test_id.toString()); | ||
|
||
cy.get("fieldset input[id='/productInterested_Model S']").click(); | ||
cy.get("fieldset input[id='/productInterested_Model 3']").click(); | ||
cy.get("fieldset input[id='/productInterested_Model X']").click(); | ||
cy.get("fieldset input[id='/productInterested_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."); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const path = require("path"); | ||
const gmail = require("gmail-tester"); | ||
|
||
export interface GmailCheckParam { | ||
from: string; | ||
to: string; | ||
subject: string; | ||
} | ||
|
||
// node ..\..\node_modules\gmail-tester\init.js ./credentials.json token.json [email protected] | ||
|
||
export const gmailCheck = async ({ | ||
from, | ||
to, | ||
subject, | ||
}: GmailCheckParam): Promise<void> => { | ||
const email = await gmail.check_inbox( | ||
path.resolve(__dirname, "credentials.json"), // credentials.json is inside plugins/ directory. | ||
path.resolve(__dirname, "token.json"), // token.json is inside plugins/ directory. | ||
{ | ||
subject: subject, | ||
from: from, | ||
to: to, | ||
wait_time_sec: 5, // Poll interval (in seconds). | ||
max_wait_time_sec: 30, // Maximum poll time (in seconds), after which we'll giveup. | ||
include_body: true, | ||
} | ||
); | ||
return email; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.