From 7b36184b59bb06ba43307a17f31d272c58c4fe72 Mon Sep 17 00:00:00 2001 From: Juan Huerta Date: Wed, 11 Mar 2020 10:00:37 -0700 Subject: [PATCH] Created OnBoarding script --- createAccount_config.js | 4 +- createAccount_spec.js | 183 +++++++++------------------------------- 2 files changed, 45 insertions(+), 142 deletions(-) diff --git a/createAccount_config.js b/createAccount_config.js index 5e1859b..6e0227e 100644 --- a/createAccount_config.js +++ b/createAccount_config.js @@ -25,7 +25,9 @@ exports.config = { }, params: { - username: 'AutomatedTest' + mm + dd + yyyy + hour + minute + '@journeysmap.com' + username: 'AutomatedTest' + mm + dd + yyyy + hour + minute + '@journeysmap.com', + code: 'N0R7Y7RO', + password: '3Dm!nAuto' } /*multiCapabilities: [{ diff --git a/createAccount_spec.js b/createAccount_spec.js index 247e972..ecde20f 100644 --- a/createAccount_spec.js +++ b/createAccount_spec.js @@ -62,6 +62,7 @@ describe('OnBoarding script', function () { //Processing Page var ProcessingPageText = element(by.css('.ng-binding:nth-child(2)')); //What Do you want to explore? (page) + var EC = protractor.ExpectedConditions; var WhatDoYouWantToExplorePage = element(by.css('#divMyProgressBlocker > div:nth-child(3) > div:nth-child(1) > div')); var DiscoverMyInterestButton = element(by.css('.col-xs-10 > div > div:nth-child(1) > .btn')); var LearnMySkillsButton = element(by.css('div:nth-child(2) > .btn')); @@ -199,16 +200,17 @@ describe('OnBoarding script', function () { }); expect(await ConnectionCodeValidationText.getText()).toContain("Hmmm we don't recognize your code, please try again. Please contact help@journeysmap.com."); await ConnectionCodeTextBox.clear().then(function() { - ConnectionCodeTextBox.sendKeys('N0R7Y7RO'); + ConnectionCodeTextBox.sendKeys(browser.params.code); }); await ConnectionCodeNextButton.click().then(function() { - browser.sleep(15000); + browser.sleep(5000); }); /*Processing Page expect(await ProcessingPageText.getText()).toEqual('wtf').then(function() { browser.sleep(20000); });*/ //What do you want to explore? (page) + browser.wait(EC.visibilityOf(WhatDoYouWantToExplorePage)); expect(await WhatDoYouWantToExplorePage.getText()).toEqual('What do you want to explore?'); expect(await DiscoverMyInterestButton.getText()).toEqual('Discover My Interests'); expect(await LearnMySkillsButton.getText()).toEqual('Learn My Skills'); @@ -217,9 +219,8 @@ describe('OnBoarding script', function () { browser.sleep(2500); }); //Dashboard - expect(await JourneysDashboardGreeting.getText()).toEqual('Hi, Jh'); browser.waitForAngular(); - browser.getCurrentUrl(); + expect(await JourneysDashboardGreeting.getText()).toEqual('Hi, Jh'); //Update Security Question await ProfileImageIcon.click().then(function() { browser.sleep(1000); @@ -238,9 +239,8 @@ describe('OnBoarding script', function () { await SecuritySelection.click(); await SecurityAnswer.sendKeys('War Games'); await SecurityQuestionSaveButton.click().then(function() { - browser.sleep(2500); + browser.sleep(5000); }); - expect(await AccountInformation.getText()).toEqual('Account Information'); }); } @@ -256,14 +256,10 @@ function SignOut() { var ProfileImage = element(by.css('.roundCenterBackgroundImage')); var SignOutButton = element(by.css('.dropDownFAEdits:nth-child(5) > .btn')); - browser.waitForAngular().then(function() { - browser.sleep(1000); - }); + browser.waitForAngular(); await ProfileImage.click().then(function() { browser.sleep(1000); }); - browser.waitForAngular(); - browser.getCurrentUrl(); await SignOutButton.click().then(function() { browser.sleep(2500); }); @@ -271,7 +267,7 @@ function SignOut() { } function Login() { - it(': Login; should reset new account password and complete Explore Careers task.', async function () { + it(': Login; should attempt to log in then reset new account password and complete Explore Careers task.', async function () { var LoginPageGreetingText = element(by.css('td > div > div:nth-child(1)')); var UsernameTextBox = element(by.css('#txtUsername')); var PasswordTextBox = element(by.css('#txtPassword')); @@ -390,11 +386,11 @@ function Login() { expect(await ValidationText.getText()).toEqual('Oops. Looks like both passwords not match. Use 1 uppercase letter or 1 number. Please try again.'); await NewPasswordTextBoxOne.clear().then(function() { browser.sleep(1000); - NewPasswordTextBoxOne.sendKeys('3Dm!nAuto'); + NewPasswordTextBoxOne.sendKeys(browser.params.password); }); await NewPasswordTextBoxTwo.clear().then(function() { browser.sleep(1000); - NewPasswordTextBoxTwo.sendKeys('3Dm!nAuto'); + NewPasswordTextBoxTwo.sendKeys(browser.params.password); }); await NextButton.click().then(function() { browser.sleep(5000); @@ -416,9 +412,8 @@ function Login() { }); expect(await WagesLocalStatText.getText()).toEqual('San Diego-Carlsbad, CA'); //Dashboard - expect(await JourneysDashboardGreeting.getText()).toEqual('Hi, Jh'); browser.waitForAngular(); - browser.getCurrentUrl(); + expect(await JourneysDashboardGreeting.getText()).toEqual('Hi, Jh'); }); } @@ -430,37 +425,25 @@ function LoginWithNewPassword() { var LoginPageSubTextOne = element(by.css('div:nth-child(5) > div:nth-child(1)')); var LoginPageSubTextTwo = element(by.css('div:nth-child(5) > div:nth-child(2)')); var NextButton = element(by.css('.btn')); - var ValidationText = element(by.css('.ng-scope:nth-child(5)')); - var PasswordEyeIcon = element(by.css('.fa-eye')); - var ClickHereLinkText = element(by.css('div:nth-child(2) > a')); - //Account Recovery - var PageGreetingText = element(by.css('td .ng-scope > div:nth-child(1)')); - var PageOneValidationText = element(by.css('.ng-scope:nth-child(4)')); - //Select Recovery Option - var PageTwoEmailButton = element(by.css('.btn:nth-child(2)')); - var PageTwoSecurityQuestionButton = element(by.css('.btn:nth-child(1)')); - var SecurityQuestionText = element(by.css('.ng-binding')); - var SecurityAnswerTextBox = element(by.css('#txtSecurityAnswer')); - //Reset Password - var NewPasswordTextBoxOne = element(by.css('#txtNewPassword')); - var NewPasswordTextBoxTwo = element(by.css('#txtNewPassword2')); - //What Do you want to explore? - var WhatDoYouWantToExplorePage = element(by.css('#divMyProgressBlocker > div:nth-child(3) > div:nth-child(1) > div')); - var ExploreCareersButton = element(by.css('div:nth-child(3) > .btn')); - var CareerExplorationPageTitle = element(by.css('.col-sm-12')); - var ClusterCardThreeSelectButton = element(by.xpath('//div[3]/div/career-territory-card/territory-card/div/div/div[4]/territory-card-action-bar/div/button')); - var PathwayCardTwoSelectButton = element(by.xpath('//div[2]/div/career-territory-card/territory-card/div/div/div[4]/territory-card-action-bar/div/button')); - var OccupationCardOneLearnMoreIcon = element(by.xpath('//action-learn-more/i')); - var WagesLocalStatText = element(by.css('g:nth-child(3) > g > text')); + //EDM-1748 + var EC = protractor.ExpectedConditions; + var SecurityQuestion = element(by.css('#secQuestion0')); + var SecuritySelection = element(by.css('option:nth-child(8)')); + var SecurityAnswer = element(by.css('.ng-pristine')); + var SecurityQuestionSaveButton = element(by.css('.col-lg-4 > #photoBtn')); //Journeys Dashboard var JourneysDashboardGreeting = element(by.css('.dropdown')); + var MyProgressWidgetGreeting = element(by.css('tr:nth-child(2) > td > div:nth-child(1)')); + var MyProgressWiegetSubText = element(by.css('td > div:nth-child(2)')); + var VideoIcon = element(by.css('.fa-video')); + var CloseVideoXIcon = element(by.css('.close')); //Navigate to Login page browser.get('https://app-qa.journeysmap.com/Journey/index.html#/login'); browser.sleep(2500); expect(await LoginPageGreetingText.getText()).toEqual('Login and start exploring.'); - await UsernameTextBox.sendKeys('AutomatedTest332020913@edmin.com'); - await PasswordTextBox.sendKeys('edmin123').then(function() { + await UsernameTextBox.sendKeys(browser.params.username); + await PasswordTextBox.sendKeys(browser.params.password).then(function() { browser.sleep(1000); }); expect(await LoginPageSubTextOne.getText()).toEqual("Don't have an account? Creating one is free! Sign up here."); @@ -468,108 +451,26 @@ function LoginWithNewPassword() { await NextButton.click().then(function() { browser.sleep(2500); }); - expect(await ValidationText.getText()).toEqual("Uh oh. Something isn't quite right. Please try again."); - await PasswordEyeIcon.click().then(function() { - browser.sleep(1000); - }); - await PasswordTextBox.clear().then(function() { - PasswordTextBox.sendKeys('EDmin123'); - }); - await NextButton.click().then(function() { - browser.sleep(2500); - }); - expect(await ValidationText.getText()).toEqual("Uh oh. Something isn't quite right. Please try again."); - await ClickHereLinkText.click().then(function() { - browser.sleep(2500); - }); - //Account Recovery - expect(await PageGreetingText.getText()).toEqual("Can't Get Into Your Account?"); - await UsernameTextBox.sendKeys('AutomatedTest332020913@edmin.com'); - await NextButton.click().then(function() { - browser.sleep(2500); - }); - expect(await PageOneValidationText.getText()).toEqual("Oops. Looks like we don't recognize your information. Please try again. Or contact help@journeysmap.com."); - await UsernameTextBox.clear().then(function() { - browser.sleep(1000); - UsernameTextBox.sendKeys(browser.params.username); - }); - await NextButton.click().then(function() { - browser.sleep(2500); - }); - //Select Recovery Option - expect(await PageGreetingText.getText()).toEqual('Awesome. Reset Your Password With Your'); - await PageTwoEmailButton.click().then(function() { - browser.sleep(2500); - }); - expect(await PageGreetingText.getText()).toContain('Woo-Hoo! Your Email Has Been Sent!'); - expect(await PageGreetingText.getText()).toContain('The link will expire in 10 minutes!'); - await NextButton.click().then(function() { - browser.sleep(2500); - }); - await ClickHereLinkText.click().then(function() { - browser.sleep(2500); - }); - expect(await PageGreetingText.getText()).toEqual("Can't Get Into Your Account?"); - await UsernameTextBox.sendKeys(browser.params.username); - await NextButton.click().then(function() { - browser.sleep(2500); - }); - expect(await PageGreetingText.getText()).toEqual('Awesome. Reset Your Password With Your'); - await PageTwoSecurityQuestionButton.click().then(function() { - browser.sleep(2500); - }); - expect(await PageGreetingText.getText()).toEqual('Answer Your Security Questions'); - expect(await SecurityQuestionText.getText()).toEqual('What is your favorite movie?'); - await SecurityAnswerTextBox.sendKeys('2001: A Space Odyssey'); - await NextButton.click().then(function() { - browser.sleep(2500); - }); - expect(await ValidationText.getText()).toEqual("Sorry! Your answers don't match what we have on file. Please contact help@journeysmap.com."); - await SecurityAnswerTextBox.clear().then(function() { - browser.sleep(1000); - SecurityAnswerTextBox.sendKeys('War Games'); - }); - await NextButton.click().then(function() { - browser.sleep(2500); - }); - //Reset Password - expect(await PageGreetingText.getText()).toEqual('Create A New Password!'); - await NewPasswordTextBoxOne.sendKeys('edmin123'); - await NewPasswordTextBoxTwo.sendKeys('EDmin123'); - await NextButton.click().then(function() { - browser.sleep(2500); - }); - expect(await ValidationText.getText()).toEqual('Oops. Looks like both passwords not match. Use 1 uppercase letter or 1 number. Please try again.'); - await NewPasswordTextBoxOne.clear().then(function() { - browser.sleep(1000); - NewPasswordTextBoxOne.sendKeys('3Dm!nAuto'); - }); - await NewPasswordTextBoxTwo.clear().then(function() { - browser.sleep(1000); - NewPasswordTextBoxTwo.sendKeys('3Dm!nAuto'); - }); - await NextButton.click().then(function() { - browser.sleep(5000); - }); - //What do you want to explore? (page) - expect(await WhatDoYouWantToExplorePage.getText()).toEqual('What do you want to explore?'); - await ExploreCareersButton.click().then(function() { - browser.sleep(2500); - }); - expect(await CareerExplorationPageTitle.getText()).toEqual('Career Exploration'); - await ClusterCardThreeSelectButton.click().then(function() { - browser.sleep(2500); - }); - await PathwayCardTwoSelectButton.click().then(function() { - browser.sleep(2500); - }); - await OccupationCardOneLearnMoreIcon.click().then(function() { - browser.sleep(5000); - }); - expect(await WagesLocalStatText.getText()).toEqual('San Diego-Carlsbad, CA'); + //Security Question DIV | EDM-1748 + browser.wait(EC.visibilityOf(SecurityQuestion)); + await SecurityQuestion.click(); + await SecuritySelection.click(); + await SecurityAnswer.sendKeys('War Games'); + await SecurityQuestionSaveButton.click().then(function() { + browser.sleep(5000); + }); //Dashboard - expect(await JourneysDashboardGreeting.getText()).toEqual('Hi, Jh'); browser.waitForAngular(); - browser.getCurrentUrl(); + expect(await JourneysDashboardGreeting.getText()).toEqual('Hi, Jh'); + expect(await MyProgressWidgetGreeting.getText()).toEqual('Hello, Jh!'); + expect(await MyProgressWiegetSubText.getText()).toContain("Do you feel anxious about what you're going to do with your life?"); + expect(await MyProgressWiegetSubText.getText()).toContain('Take a deep breath because Journeys Map is here to help you'); + expect(await MyProgressWiegetSubText.getText()).toContain('find your path in four easy steps.'); + await VideoIcon.click().then(function() { + browser.sleep(5000); + }); + await CloseVideoXIcon.click().then(function() { + browser.sleep(2500); + }); }); } \ No newline at end of file