diff --git a/src/tab-legacy/userSignup.js b/src/tab-legacy/userSignup.js index 517fa2c..cc84cdd 100644 --- a/src/tab-legacy/userSignup.js +++ b/src/tab-legacy/userSignup.js @@ -6,7 +6,9 @@ import { navigateTo, setValue, click, + signUpViaEmailInviteNewHomePage, waitAndClick, + inviteUserFromHomePage, setCause, completeIntroFlow, logOut, @@ -259,6 +261,38 @@ const getUserSignupTests = (getDriver) => { }, testTimeout: testTimeoutdefault, }, + { + description: + 'should successfully email a Referral user in Chrome v4 for teamseas', + test: async () => { + const { + driver, + config: { + mailosaur: { MAILOSAUR_API_KEY, MAILOSAUR_SERVER_ID } = {}, + }, + } = getDriver( + 'Tab: acceptance tests: should successfully email a Referral user in Chrome v4 for teamseas' + ) + try { + const user1 = await EmailClient.build({ + MAILOSAUR_API_KEY, + MAILOSAUR_SERVER_ID, + }) + const user2 = await EmailClient.build({ + MAILOSAUR_API_KEY, + MAILOSAUR_SERVER_ID, + }) + await setCause(driver, '/teamseas') + await signUp(driver, user1.email, user1.password) + await completeIntroFlow(driver, user1) + await inviteUserFromHomePage(driver, user1, user2) + await signUpViaEmailInviteNewHomePage(driver, user2) + } finally { + await driver.quit() + } + }, + testTimeout: testTimeoutdefault, + }, ] return tests } diff --git a/src/utils/driver-mgr.js b/src/utils/driver-mgr.js index 0f6f5cb..86473a4 100644 --- a/src/utils/driver-mgr.js +++ b/src/utils/driver-mgr.js @@ -293,7 +293,43 @@ export const inviteUser = async (driver, invitingUser, invitedUser) => { await waitAndClick(driver, By.xpath(`//span[text()="Send Invite"]`)) await new Promise((res) => setTimeout(() => res(), 1000)) } - +export const inviteUserFromHomePage = async ( + driver, + invitingUser, + invitedUser +) => { + await waitAndClick(driver, By.xpath('//span[text()="Hooray"]')) + await waitForElementExistsByCustomSelector( + driver, + By.xpath(`//div[label[contains(., 'Your name')]]/div/input`) + ) + await setValue( + driver, + By.xpath(`//div[label[contains(., 'Your name')]]/div/input`), + 'test user' + ) + await waitForElementExistsByCustomSelector( + driver, + By.xpath(`//div[label[contains(., 'Recipients')]]/div/input`) + ) + await setValue( + driver, + By.xpath(`//div[label[contains(., 'Recipients')]]/div/input`), + invitedUser.email + ) + await waitForElementExistsByCustomSelector( + driver, + By.xpath(`//div[label[contains(., 'Message')]]/div/textarea`) + ) + await setValue( + driver, + By.xpath(`//div[label[contains(., 'Message')]]/div/textarea`), + 'test Message' + ) + await waitAndClick(driver, By.xpath(`//span[text()="Send Invite"]`)) + await new Promise((res) => setTimeout(() => res(), 1000)) + await driver.navigate().refresh() +} export const createMission = async (driver, invitingUser, invitedUser) => { await waitAndClick( driver, @@ -311,7 +347,27 @@ export const createMission = async (driver, invitingUser, invitedUser) => { await waitAndClick(driver, By.xpath(`//span[text()="next"]`)) await inviteUser(driver, invitingUser, invitedUser) } - +export const signUpViaEmailInviteNewHomePage = async ( + driver, + user, + homepageText = 'The easiest way to save our seas' +) => { + const referralLink = await user.getEmailInvite() + await driver.navigate().to(referralLink) + await waitForElementExistsByCustomSelector( + driver, + By.xpath(`//h1[text()="${homepageText}"]`) + ) + const testUrl = (await driver.getCurrentUrl()) + .toString() + .replace('tab.', 'test-tab2017.') + await driver.navigate().to(testUrl) + await waitAndClick(driver, By.css('button')) + await waitForElementExistsByCustomSelector( + driver, + By.css(`[aria-label='Add to Chrome'`) + ) +} export const signUpViaEmailInvite = async (driver, user) => { const referralLink = await user.getEmailInvite() await driver.navigate().to(referralLink)