diff --git a/createAccount_config.js b/createAccount_config.js index 24ab709..30b67e0 100644 --- a/createAccount_config.js +++ b/createAccount_config.js @@ -28,8 +28,9 @@ exports.config = { params: { signup: 'https://app-qa.journeysmap.com/Journey/index.html#/signup', login: 'https://app-qa.journeysmap.com/Journey/index.html#/login', + nonAngularURL: 'https://app-qa.journeysmap.com/UI/User/Profile', code: 'N0R7Y7RO', //QA N0R7Y7RO //PROD 0W3SNBQ7 - createUsername: 'AutomatedTest' + mm + dd + yyyy + hour + minute + '@journeysmap.com', + createdUsername: 'AutomatedTest' + mm + dd + yyyy + hour + minute + '@journeysmap.com', password: '3Dm!nAuto' } diff --git a/createAccount_spec.js b/createAccount_spec.js index 14a4ce1..46eeb58 100644 --- a/createAccount_spec.js +++ b/createAccount_spec.js @@ -1,6 +1,11 @@ //createAccount_spec.js describe('Create Account script', function () { + //login-journeysmap landing page + var FirstNameTextBox = element(by.css('#txtFirstName')); + var LastNameTextBox = element(by.css('#txtLastName')); + var EmailTextBox = element(by.css('#txtEmail')); + var UserNameTextBox = element(by.css('#txtUsername')); //Open browser browser.get(browser.params.signup); @@ -9,15 +14,14 @@ describe('Create Account script', function () { await expect(browser.getTitle()).toEqual('Sign up'); }); - var FirstNameTextBox = element(by.css('#txtFirstName')); - var LastNameTextBox = element(by.css('#txtLastName')); - var EmailTextBox = element(by.css('#txtEmail')); - var UsernameTextBox = element(by.css('#txtUsername')); - //Sign Up - SignUp(FirstNameTextBox, LastNameTextBox, EmailTextBox, UsernameTextBox); + SignUp(FirstNameTextBox, LastNameTextBox, EmailTextBox, UserNameTextBox); - function SignUp(FirstNameTextBox, LastNameTextBox, EmailTextBox, UsernameTextBox) { + it('should have a title', async function () { + await expect(browser.getTitle()).toEqual('Home | Journeys'); + }); + + function SignUp(FirstNameTextBox, LastNameTextBox, EmailTextBox, UserNameTextBox) { it('OnBoarding; should complete the OnBoarding process and create a new account.', async function () { //Page 1 - First & Last Name var EC = protractor.ExpectedConditions; @@ -50,7 +54,6 @@ describe('Create Account script', function () { var DOBYear = element(by.css('#txtDobYear')); var today = new Date(); var yyyy = today.getFullYear()-5; - //var Under13 = today.getFullYear()-5;delete var PageFourValidationText = element(by.css('div:nth-child(5) > .jmLoginMsg > .ng-binding')); var PermissionButton = element(by.css('div:nth-child(1) > div:nth-child(1) > .btn')); //Page 5 Connection Code @@ -70,15 +73,24 @@ describe('Create Account script', function () { var CloseXIcon = element(by.css('.fas')); //Journeys Dashboard var JourneysDashboardGreeting = element(by.css('.dropdown')); + var MyProgressWidgetGreeting = element(by.css('td > div:nth-child(2)')); + var MyProgressWiegetSubText = element(by.css('td > div:nth-child(3)')); + var FindMyPathButton = element(by.css('.btn-md')); //Update Security Question - var ProfileImageIcon = element(by.css('.roundCenterBackgroundImage')); + var ProfileImageIcon = element(by.css('.roundCenterBackground:nth-child(4)')); var ProfileLinkText = element(by.linkText('Profile')); - var AccountInformation = element(by.css('.view-title')); - var ManageSecurityQuestionsButton = element(by.css('.btn:nth-child(15)')); - 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')); + //Account Information Page + var PageTitle = element(by.css('#title')); + var PersonalInformationTitle = element(by.css('div > .col-12 > h4')); + //Edit Profile + var EditSecurityQuestionTile = element(by.css('.col-md-3:nth-child(4) tr:nth-child(1) > td')); + var SelectASecurityQuestionHeader = element(by.css('.col-lg-8 > div:nth-child(1) > .text-muted')); + var AnswerSecurityQuestionHeader = element(by.css('div:nth-child(2) > .text-muted')); + var AnswerSecurityAnswerTextBox = element(by.name('Answer')); + var CancelButton = element(by.css('.btn-outline-primary')); + var SaveButton = element(by.css('.btn:nth-child(2)')); + var ResetProfileImage = element(by.css('.dropdown-toggle > .jmRoundCenterImage')); + var ResetSignOutButton = element(by.css('li > .btn')); //Page 1 - First & Last Name browser.wait(EC.elementToBeClickable(PageCloseXIcon)); @@ -122,7 +134,7 @@ describe('Create Account script', function () { browser.sleep(1000); }); expect(await PageTwoAltGreetingText.getText()).toEqual("Let's make a username!"); - await UsernameTextBox.sendKeys('JHZ').then(function() { + await UserNameTextBox.sendKeys('JHZ').then(function() { browser.sleep(1000); }); expect(await PageTwoAltSubText.getText()).toEqual('Create an account with your email instead.'); @@ -133,7 +145,7 @@ describe('Create Account script', function () { await EmailLinkText.click().then(function() { browser.sleep(1000); }); - await EmailTextBox.sendKeys(browser.params.createUsername).then(function() { + await EmailTextBox.sendKeys(browser.params.createdUsername).then(function() { browser.sleep(1000); }); await PageTwoNextButton.click().then(function() { @@ -208,7 +220,7 @@ describe('Create Account script', function () { browser.sleep(5000); }); //What do you want to explore? (page) - browser.wait(EC.visibilityOf(WhatDoYouWantToExplorePage)).then(function() { + browser.wait(EC.visibilityOf(WhatDoYouWantToExplorePage), 30000).then(function() { browser.sleep(2500); }); expect(await WhatDoYouWantToExplorePage.getText()).toEqual('What do you want to explore?'); @@ -216,12 +228,18 @@ describe('Create Account script', function () { expect(await LearnMySkillsButton.getText()).toEqual('Learn My Skills'); expect(await ExploreCareersButton.getText()).toEqual('Explore Careers'); await CloseXIcon.click().then(function() { - browser.sleep(5000); + browser.sleep(10000); }); //Dashboard - browser.waitForAngular(); - expect(await JourneysDashboardGreeting.getText()).toContain('Hi, '); - expect(await JourneysDashboardGreeting.getText()).toContain('_Automated'); + expect(await JourneysDashboardGreeting.getText()).toEqual('Hi, Jh'); + browser.wait(EC.visibilityOf(MyProgressWiegetSubText), 60000).then(function() { + browser.sleep(2500); + }); + 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.'); + expect(await FindMyPathButton.getText()).toContain('Find My Path'); //Update Security Question await ProfileImageIcon.click().then(function() { browser.sleep(2500); @@ -232,45 +250,55 @@ describe('Create Account script', function () { await ProfileLinkText.click().then(function() { browser.sleep(1500); }); - expect(await AccountInformation.getText()).toEqual('Account Information'); - await ManageSecurityQuestionsButton.click().then(function() { + browser.waitForAngularEnabled(false); + browser.get(browser.params.nonAngularURL); + //Account Information Page + expect(await PageTitle.getText()).toEqual('Account Information'); + //Personal Information block + expect(await PersonalInformationTitle.getText()).toEqual('Personal Information'); + //Edit Security Question + expect(await EditSecurityQuestionTile.getText()).toContain('EDIT'); + expect(await EditSecurityQuestionTile.getText()).toContain('SECURITY'); + expect(await EditSecurityQuestionTile.getText()).toContain('QUESTION'); + await EditSecurityQuestionTile.click().then(function() { browser.sleep(2500); }); - await SecurityQuestion.click(); - await SecuritySelection.click(); - await SecurityAnswer.sendKeys('War Games'); - await SecurityQuestionSaveButton.click().then(function() { - browser.sleep(5000); + expect(await SelectASecurityQuestionHeader.getText()).toContain('Select a Security Question'); + element(by.cssContainingText('option', 'What is your favorite movie?')).click().then(function() { + browser.sleep(1500); + }); + expect(await AnswerSecurityQuestionHeader.getText()).toContain('Answer Security Question'); + await AnswerSecurityAnswerTextBox.sendKeys('War Games').then(function() { + browser.sleep(1500); + }); + expect(await CancelButton.getText()).toContain('CANCEL'); + expect(await SaveButton.getText()).toContain('SAVE'); + await SaveButton.click().then(function() { + browser.sleep(1500); + var alertDialog = browser.switchTo().alert(); + expect(alertDialog.getText()).toEqual('Security questions is updated.'); + browser.switchTo().alert().accept(); + browser.sleep(1500); + }); + await ResetProfileImage.click().then(function() { + browser.sleep(2500); + }); + await ResetSignOutButton.click().then(function() { + browser.sleep(2500); }); }); } - //Action Calls - SignOut(); Login(); SignOut(); LoginWithNewPassword(); + SignOut(); }); -function SignOut() { - it(': SignOut; should log out of journeysmap.', async function () { - var ProfileImage = element(by.css('.roundCenterBackgroundImage')); - var SignOutButton = element(by.css('.dropDownFAEdits:nth-child(5) > .btn')); - - browser.waitForAngular(); - await ProfileImage.click().then(function() { - browser.sleep(1000); - }); - await SignOutButton.click().then(function() { - browser.sleep(2500); - }); - }); -} - function Login() { - it(': Login; should attempt to log in then 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('.jmLoginTitle > .ng-scope')); - var UsernameTextBoxOne = element(by.css('#txtU')); + var UserNameTextBoxOne = element(by.css('#txtU')); var PasswordTextBox = element(by.css('#txtP')); var LoginPageSubTextOne = element(by.css('.jmLoginMsg:nth-child(7) > div:nth-child(1)')); var LoginPageSubTextTwo = element(by.css('.jmLoginMsg:nth-child(7) > .ng-scope')); @@ -278,7 +306,7 @@ function Login() { var ValidationText = element(by.css('.ng-binding:nth-child(1)')); var PasswordEyeIcon = element(by.css('.fa-eye')); var ClickHereLinkText = element(by.css('.ng-scope > a')); - var UsernameTextBoxTwo = element(by.css('#txtUsername')); + var UserNameTextBoxTwo = element(by.css('#txtUsername')); //Account Recovery var PageGreetingText = element(by.css('.jmLoginTitle')); var PageOneValidationText = element(by.css('.jmLoginMsg')); @@ -291,7 +319,8 @@ function Login() { 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 EC = protractor.ExpectedConditions; + var WhatDoYouWantToExplorePage = element(by.css('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')); @@ -305,7 +334,7 @@ function Login() { browser.get(browser.params.login); browser.sleep(2500); expect(await LoginPageGreetingText.getText()).toEqual('Login and start exploring.'); - await UsernameTextBoxOne.sendKeys('AutomatedTest332020913@edmin.com'); + await UserNameTextBoxOne.sendKeys('AutomatedTest332020913@edmin.com'); await PasswordTextBox.sendKeys('edmin123').then(function() { browser.sleep(1000); }); @@ -330,37 +359,40 @@ function Login() { }); //Account Recovery expect(await PageGreetingText.getText()).toEqual("Can't Get Into Your Account?"); - await UsernameTextBoxTwo.sendKeys('AutomatedTest332020913@edmin.com'); + await UserNameTextBoxTwo.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 UsernameTextBoxTwo.clear().then(function() { + await UserNameTextBoxTwo.clear().then(function() { browser.sleep(1000); - UsernameTextBoxTwo.sendKeys(browser.params.createUsername); + UserNameTextBoxTwo.sendKeys(browser.params.createdUsername); }); await NextButton.click().then(function() { browser.sleep(2500); }); //Select Recovery Option expect(await PageGreetingText.getText()).toEqual('Awesome. Reset Your Password With Your'); + expect(await PageTwoEmailButton.getText()).toEqual('Email'); 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!'); + expect(await NextButton.getText()).toEqual('Back To Login'); await NextButton.click().then(function() { - browser.sleep(2500); + browser.sleep(5000); }); await ClickHereLinkText.click().then(function() { browser.sleep(2500); }); expect(await PageGreetingText.getText()).toEqual("Can't Get Into Your Account?"); - await UsernameTextBoxTwo.sendKeys(browser.params.createUsername); + await UserNameTextBoxTwo.sendKeys(browser.params.createdUsername); await NextButton.click().then(function() { browser.sleep(2500); }); expect(await PageGreetingText.getText()).toEqual('Awesome. Reset Your Password With Your'); + expect(await PageTwoSecurityQuestionButton.getText()).toEqual('Security Question'); await PageTwoSecurityQuestionButton.click().then(function() { browser.sleep(2500); }); @@ -382,6 +414,7 @@ function Login() { expect(await PageGreetingText.getText()).toEqual('Create A New Password!'); await NewPasswordTextBoxOne.sendKeys('edmin123'); await NewPasswordTextBoxTwo.sendKeys('EDmin123'); + expect(await NextButton.getText()).toEqual('Login'); await NextButton.click().then(function() { browser.sleep(2500); }); @@ -394,16 +427,19 @@ function Login() { browser.sleep(1000); NewPasswordTextBoxTwo.sendKeys(browser.params.password); }); + expect(await NextButton.getText()).toEqual('Login'); await NextButton.click().then(function() { browser.sleep(5000); }); //What do you want to explore? (page) + browser.wait(EC.visibilityOf(WhatDoYouWantToExplorePage), 30000).then(function() { + browser.sleep(2500); + }); expect(await WhatDoYouWantToExplorePage.getText()).toEqual('What do you want to explore?'); await ExploreCareersButton.click().then(function() { browser.sleep(2500); }); - expect(await JourneysDashboardGreeting.getText()).toContain('Hi, '); - expect(await JourneysDashboardGreeting.getText()).toContain('_Automated'); + expect(await JourneysDashboardGreeting.getText()).toEqual('Hi, Jh'); expect(await CareerExplorationPageTitle.getText()).toEqual('Career Exploration'); await ClusterCardThreeSelectButton.click().then(function() { browser.sleep(2500); @@ -417,28 +453,38 @@ function Login() { browser.executeScript('window.scrollTo(0, 395);').then(function() { browser.sleep(5000); }); - //expect(await WagesLocalStatText.getText()).toEqual('San Diego-Carlsbad, CA'); Hank reviewing bug - adding message + expect(await WagesLocalStatText.getText()).toEqual('San Diego-Carlsbad, CA'); + }); +} + +function SignOut() { + it(': SignOut; should log out of journeysmap.', async function () { + var ProfileImage = element(by.css('.roundCenterBackground:nth-child(4)')); + var SignOutButton = element(by.css('.dropDownFAEdits:nth-child(5) > .btn')); + + await ProfileImage.click().then(function() { + browser.sleep(2500); + }); + await SignOutButton.click().then(function() { + browser.sleep(2500); + }); }); } function LoginWithNewPassword() { it(': LoginWithNewPassword; should log in with new password.', async function () { var LoginPageGreetingText = element(by.css('td > div > div:nth-child(1)')); - var UsernameTextBox = element(by.css('#txtU')); + var UserNameTextBox = element(by.css('#txtU')); var PasswordTextBox = element(by.css('#txtP')); var LoginPageSubTextOne = element(by.css('.jmLoginMsg > div:nth-child(1)')); var LoginPageSubTextTwo = element(by.css('.jmLoginMsg > .ng-scope')); var NextButton = element(by.css('.btn')); - //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 EC = protractor.ExpectedConditions; + var MyProgressWidgetGreeting = element(by.css('td > div:nth-child(2)')); + var MyProgressWiegetSubText = element(by.css('td > div:nth-child(3)')); + var FindMyPathButton = element(by.css('.btn-md')); var VideoIcon = element(by.css('.fa-video')); var CloseVideoXIcon = element(by.css('.close')); @@ -446,35 +492,26 @@ function LoginWithNewPassword() { browser.get(browser.params.login); browser.sleep(2500); expect(await LoginPageGreetingText.getText()).toEqual('Login and start exploring.'); - await UsernameTextBox.sendKeys(browser.params.createUsername); + await UserNameTextBox.sendKeys(browser.params.createdUsername); 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."); expect(await LoginPageSubTextTwo.getText()).toEqual('Forgot your password? Click here.'); await NextButton.click().then(function() { - browser.sleep(2500); + browser.sleep(5000); }); - //Security Question DIV | EDM-1748 - browser.wait(EC.visibilityOf(SecurityQuestion)); - browser.sleep(1000); - await SecurityQuestion.click(); - browser.sleep(1000); - await SecuritySelection.click(); - await SecurityAnswer.sendKeys('War Games'); - browser.sleep(1000); - await SecurityQuestionSaveButton.click().then(function() { - browser.sleep(5000); - }); //Dashboard browser.waitForAngular(); - expect(await JourneysDashboardGreeting.getText()).toContain('Hi, '); - expect(await JourneysDashboardGreeting.getText()).toContain('_Automated'); - expect(await MyProgressWidgetGreeting.getText()).toContain('Hello, '); - expect(await MyProgressWidgetGreeting.getText()).toContain('_Automated'); + expect(await JourneysDashboardGreeting.getText()).toEqual('Hi, Jh'); + browser.wait(EC.visibilityOf(MyProgressWidgetGreeting), 30000).then(function() { + browser.sleep(2500); + }); + 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.'); + expect(await FindMyPathButton.getText()).toContain('Find My Path'); await VideoIcon.click().then(function() { browser.sleep(5000); });