//loginWithInstitution_spec.js describe('Login With Institution Script', function () { //Open browser browser.get(browser.params.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 LoginWithDuplicateAccount(CloseIcon, UsernameTextBox, PasswordTextBox, NextButton); function LoginWithDuplicateAccount(CloseIcon, UsernameTextBox, PasswordTextBox, NextButton) { it(': Login; should attempt to log in with duplicate accont 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.'); expect(InstitutionTextBox.isDisplayed()).toBe(false); browser.sleep(1000); await UsernameTextBox.sendKeys(browser.params.username).then(function() { browser.sleep(1000); UsernameTextBox.sendKeys(protractor.Key.TAB); browser.sleep(1000); expect(InstitutionTextBox.isDisplayed()).toBe(true); }); await PasswordTextBox.sendKeys('EDmin').then(function() { browser.sleep(1000); expect(InstitutionTextBox.isDisplayed()).toBe(true); expect(browser.isElementPresent(InstitutionDropDownList)).toBe(false); }); await InstitutionTextBox.sendKeys('j').then(function() { browser.sleep(1000); expect(InstitutionTextBox.isDisplayed()).toBe(true); expect(browser.isElementPresent(InstitutionDropDownList)).toBe(false); }); await InstitutionTextBox.sendKeys('o').then(function() { browser.sleep(1000); expect(InstitutionTextBox.isDisplayed()).toBe(true); expect(InstitutionDropDownList.isDisplayed()).toBe(true); }); expect(InstitutionDropDownList.isDisplayed()).toBe(true); await InstitutionTextBox.sendKeys('rn').then(function() { browser.sleep(1000); expect(InstitutionTextBox.isDisplayed()).toBe(true); expect(browser.isElementPresent(InstitutionDropDownList)).toBe(false); }); await InstitutionTextBox.clear(); expect(InstitutionTextBox.isDisplayed()).toBe(true); await InstitutionTextBox.sendKeys('journeys').then(function() { browser.sleep(1000); expect(InstitutionTextBox.isDisplayed()).toBe(true); expect(InstitutionDropDownList.isDisplayed()).toBe(true); }); await InstitutionDropDownList.click().then(function() { browser.sleep(1000); expect(browser.isElementPresent(InstitutionDropDownList)).toBe(false); }); 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); }); await NextButton.click().then(function() { browser.sleep(2500); }); expect(ResetPasswordInstitutionTextBox.isDisplayed()).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(); browser.sleep(1000); await ResetPasswordUsernameTextBox.sendKeys(browser.params.username).then(function() { browser.sleep(1000); }); await NextButton.click().then(function() { browser.sleep(2500); expect(ResetPasswordInstitutionTextBox.isDisplayed()).toBe(true); expect(browser.isElementPresent(ResetPasswordValidationMessage)).toBe(false); }); expect(await ResetPasswordGreetingText.getText()).toEqual("Can't Get Into Your Account?"); await ResetPasswordInstitutionTextBox.sendKeys('journeys').then(function() { browser.sleep(2500); expect(ResetPasswordInstitutionDropDownList.isDisplayed()).toBe(true); }); await ResetPasswordInstitutionDropDownList.click().then(function() { browser.sleep(1000); 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?"); 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(1000); }); //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.'); expect(InstitutionTextBox.isDisplayed()).toBe(false); await UsernameTextBox.sendKeys(browser.params.username).then(function() { browser.sleep(1000); }); await PasswordTextBox.sendKeys('EDmin123').then(function() { browser.sleep(1000); }); expect(InstitutionTextBox.isDisplayed()).toBe(true); await InstitutionTextBox.sendKeys('journeys').then(function() { browser.sleep(1000); expect(InstitutionDropDownList.isDisplayed()).toBe(true); }); await InstitutionDropDownList.click().then(function() { browser.sleep(1000); expect(browser.isElementPresent(InstitutionDropDownList)).toBe(false); }); await NextButton.click().then(function() { browser.sleep(2500); }); //Journeys Dashboard browser.waitForAngular(); expect(await JourneysDashboardGreeting.getText()).toContain('Hi, '); browser.sleep(2500); }); } //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); }); }); }