//loginWithInstitution_spec.js describe('Login With Institution Script', function () { //Open browser browser.get('https://app-qa.journeysmap.com/Journey/index.html#/login'); it('should have a title', async function () { await expect(browser.getTitle()).toEqual('Login'); }); var CloseIcon = element(by.css('.fas')); var UsernameTextBox = element(by.css('#txtU')); var PasswordTextBox = element(by.css('#txtP')); var NextButton = element(by.css('.btn')); //Sign Up SignUp(CloseIcon, UsernameTextBox, PasswordTextBox, NextButton); function SignUp(CloseIcon, UsernameTextBox, PasswordTextBox, NextButton) { 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 InstitutionTextBox = element(by.css('#txtZ')); var SubTextOne = element(by.css('.jmLoginMsg:nth-child(7) > div:nth-child(1)')); var SubTextTwo = element(by.css('.jmLoginMsg:nth-child(7) > .ng-scope')); var InstitutionDropDownList = element(by.css('.ng-scope > .ng-binding')); var ValidationMessage = element(by.css('.ng-binding:nth-child(1)')); var FogotPasswordLink = element(by.css('.ng-scope > a')); //Reset Password var ResetPasswordInstitutionTextBox = element(by.css('#txtZone')); var ResetPasswordInstitutionDropDownList = element(by.css('.ng-binding:nth-child(1)')); var ResetPasswordGreetingText = element(by.css('.jmLoginTitle')); var ResetPasswordUsernameTextBox = element(by.css('#txtUsername')); var ResetPasswordValidationMessage = element(by.css('.jmLoginMsg')); //Journeys Dashboard var JourneysDashboardGreeting = element(by.css('.dropdown')); expect(await LoginPageGreetingText.getText()).toEqual('Login and start exploring.'); expect(await SubTextOne.getText()).toEqual("Don't have an account? Creating one is free! Sign up here."); expect(await SubTextTwo.getText()).toEqual('Forgot your password? Click here.'); await UsernameTextBox.sendKeys('gnight147').then(function() { browser.sleep(2500); }); await PasswordTextBox.sendKeys('EDmin').then(function() { browser.sleep(2500); }); expect(browser.isElementPresent(InstitutionDropDownList)).toBe(false); await InstitutionTextBox.sendKeys('j').then(function() { browser.sleep(1000); }); expect(browser.isElementPresent(InstitutionDropDownList)).toBe(false); await InstitutionTextBox.sendKeys('o').then(function() { browser.sleep(1000); }); await InstitutionTextBox.sendKeys('in').then(function() { browser.sleep(1000); }); expect(browser.isElementPresent(InstitutionDropDownList)).toBe(false); await InstitutionTextBox.clear(); await InstitutionTextBox.sendKeys('jour').then(function() { browser.sleep(1000); }); await InstitutionDropDownList.click().then(function() { browser.sleep(2500); }); await NextButton.click().then(function() { browser.sleep(2500); }); expect(await ValidationMessage.getText()).toEqual("Uh oh. Something isn't quite right. Please try again."); expect(await SubTextOne.getText()).toEqual("Don't have an account? Creating one is free! Sign up here."); expect(await SubTextTwo.getText()).toEqual('Forgot your password? Click here.'); await FogotPasswordLink.click().then(function() { browser.sleep(2500); }); //Reset Password Page expect(await ResetPasswordGreetingText.getText()).toEqual("Can't Get Into Your Account?"); await ResetPasswordUsernameTextBox.sendKeys('jhuerta').then(function() { browser.sleep(2500); }); expect(browser.isElementPresent(ResetPasswordInstitutionDropDownList)).toBe(false); await NextButton.click().then(function() { browser.sleep(2500); }); expect(browser.isElementPresent(ResetPasswordInstitutionDropDownList)).toBe(false); expect(await ResetPasswordValidationMessage.getText()).toEqual("Oops. Looks like we don't recognize your information. Please try again. Or contact help@journeysmap.com."); await ResetPasswordUsernameTextBox.clear(); await ResetPasswordUsernameTextBox.sendKeys('gnight147').then(function() { browser.sleep(2500); }); expect(browser.isElementPresent(ResetPasswordInstitutionDropDownList)).toBe(false); await NextButton.click().then(function() { browser.sleep(2500); }); expect(await ResetPasswordGreetingText.getText()).toEqual("Can't Get Into Your Account?"); await ResetPasswordInstitutionTextBox.sendKeys('journeys').then(function() { browser.sleep(2000); }); await NextButton.click().then(function() { browser.sleep(2500); }); expect(await ResetPasswordGreetingText.getText()).toEqual("Can't Get Into Your Account?"); expect(await ResetPasswordValidationMessage.getText()).toEqual("Oops. Looks like we don't recognize your information. Please try again. Or contact help@journeysmap.com."); await CloseIcon.click().then(function() { browser.sleep(2500); }); //Back to Login Page expect(await LoginPageGreetingText.getText()).toEqual('Login and start exploring.'); expect(await SubTextOne.getText()).toEqual("Don't have an account? Creating one is free! Sign up here."); expect(await SubTextTwo.getText()).toEqual('Forgot your password? Click here.'); await UsernameTextBox.sendKeys('gnight147').then(function() { browser.sleep(2500); }); await PasswordTextBox.sendKeys('EDmin123').then(function() { browser.sleep(2500); }); expect(browser.isElementPresent(InstitutionDropDownList)).toBe(false); await InstitutionTextBox.sendKeys('journeys').then(function() { browser.sleep(2500); }); await NextButton.click().then(function() { browser.sleep(2500); }); //Journeys Dashboard browser.waitForAngular(); expect(await JourneysDashboardGreeting.getText()).toEqual('Hi, Good'); }); } //Action Calls //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); }); }); }