Files
EdGateAutomatedRegression/profileAndMyProgress_spec.js
2020-07-16 14:56:59 -07:00

218 lines
12 KiB
JavaScript

//profileAndMyProgress_spec.js
describe('Profile And My Progress Widget Scripts', function () {
//app-journeysmap landing page
var UserNameTextBox = element(by.css('#txtU'));
var PasswordTextBox = element(by.css('#txtP'));
//Open browser
//browser.driver.manage().window().setSize(1600, 800);
browser.get('https://app-qa.journeysmap.com/Journey/index.html#/login').then(function() {
browser.sleep(1000);
});
it('should have a title', async function () {
await expect(browser.getTitle()).toEqual('Login');
});
//Sign In
SignIn(UserNameTextBox, PasswordTextBox);
function SignIn(UserNameTextBox, PasswordTextBox) {
it('SignIn, should sign into journeysmap.com', async function () {
var PageGreetingText = element(by.css('td > div > div:nth-child(1)'));
var NextButton = element(by.css('.btn'));
var JourneysGreeting = element(by.css('.dropdown'));
expect(await PageGreetingText.getText()).toEqual('Login and start exploring.');
browser.sleep(2500);
await UserNameTextBox.sendKeys('QA_AutomatedRegression').then(function() {
browser.sleep(2500);
});
await PasswordTextBox.sendKeys('3Dm!nAuto').then(function() {
browser.sleep(2500);
});
await NextButton.click().then(function() {
browser.sleep(5000);
browser.waitForAngular();
browser.getCurrentUrl();
});
expect(await JourneysGreeting.getText()).toEqual('Hi, Automated');
browser.waitForAngular();
browser.getCurrentUrl();
});
}
//<<<<DASHBOARD>>>>
ProfileWidget();
MyProgressWidget();
//Sign Out*/
SignOut();
});
function ProfileWidget() {
it(': ProfileWidget, should expand profile widget, edit About Me widget, then validate Role Model and Education Widgets', async function () {
var ProfileWidgetExpandCollapseIcon = element(by.css('span > .fa'));
var ConnectionsLink = element(by.css('.col-md-3:nth-child(2) .jrnys_support-text'));
var FollowersLink = element(by.css('.col-md-3:nth-child(3) .jrnys_support-text'));
var FollowersDivTitle = element(by.css('.default-color2 > h3'));
var FollowersDivSubText = element(by.css('.col-md-12:nth-child(1)'));
var FollowersDivGotItButton = element(by.css('.btn-lg'));
var AboutMeWidgetTitle = element(by.css('#aboutMeFull > .jrnys_lead-body-copy'));
var AboutMePencil = element(by.css('#aboutMeFull .fa-pencil'));
var ABoutMeInputArea = element(by.id('inputArea'));
var RoleModelWidgetTitle = element(by.css('td > .jrnys_lead-body-copy'));
var RoleModelNameOne = element(by.css('.inner-content-padding > .textSize:nth-child(1)'));
var RoleModelNameTwo = element(by.css('.textSize:nth-child(2)'));
var EducationWidgetTitle = element(by.css('#education > .jrnys_lead-body-copy'));
var EducationStartEndDate = element(by.css('.col-xs-4 > .ng-binding:nth-child(1)'));
var EducationSchoolName = element(by.css('.col-xs-8'));
expect(await ConnectionsLink.getText()).toEqual('CONNECTIONS');
await FollowersLink.click().then(function() {
browser.sleep(1000);
});
expect(await FollowersDivTitle.getText()).toEqual('This feature is on its way!');
expect(await FollowersDivSubText.getText()).toEqual("Love Journeys? Then you'll love what is coming next.");
await FollowersDivGotItButton.click().then(function() {
browser.sleep(1000);
});
await ProfileWidgetExpandCollapseIcon.click().then(function() {
browser.sleep(2500);
});
expect(await AboutMeWidgetTitle.getText()).toEqual('About Me');
browser.actions().mouseMove(element(by.css('.ng-scope > #aboutMeFull'))).perform().then(function() {
browser.sleep(1000);
});
await AboutMePencil.click().then(function() {
browser.sleep(1000);
});
await ABoutMeInputArea.clear().then(function() {
browser.sleep(2500);
});
await ABoutMeInputArea.sendKeys('This is my automated bio, there are many like it but this one is mine.');
await AboutMePencil.click().then(function() {
browser.sleep(1000);
});
browser.executeScript('window.scrollTo(0, 780);').then(function() {
browser.sleep(2500);
});
expect(await RoleModelWidgetTitle.getText()).toEqual('Role Model');
expect(await RoleModelNameOne.getText()).toEqual('Elon Musk');
expect(await RoleModelNameTwo.getText()).toEqual('Emma Watson');
expect(await EducationWidgetTitle.getText()).toEqual('Education');
expect(await EducationStartEndDate.getText()).toEqual('06/2005');
expect(await EducationSchoolName.getText()).toEqual('SUNNYSIDE ELEMENTARY');
browser.executeScript('window.scrollTo(0, 0);').then(function() {
browser.sleep(2500);
});
await ProfileWidgetExpandCollapseIcon.click().then(function() {
browser.sleep(2500);
});
browser.waitForAngular();
browser.getCurrentUrl();
});
}
function MyProgressWidget() {
it(': MyProgressWidget, should interact with My Progress widget, navigate to Interest Survey, toggle language to Spanish then back to English and complete survey', async function () {
var MyProgressWidgetTitle = element(by.css('.yourProgressTitle'));
var ProgressLevel = element(by.css('.myProgressLevel'));
var ProgressWidgetExpandIcon = element(by.css('.full-width .ng-scope'));
var ActionOneCompleted = element(by.css('.col-md-3:nth-child(1) > .ng-scope'));
var ActionTwo = element(by.css('.col-md-3:nth-child(2) > .ng-scope'));
var ActionTwoCompleted = element(by.css('.col-md-3:nth-child(2) > .ng-scope'));
var ActionTwoRetake = element(by.css('div:nth-child(3) > .fa-tasks'));
var InterestSurveyTitle = element(by.css('.jrnys_lead-body-copy'));
var TextOne = element(by.css('.col-md-4:nth-child(1) > .ng-binding:nth-child(1)'));
var TextTwo = element(by.css('.col-md-4:nth-child(2) > .ng-binding:nth-child(1)'));
var TextThree = element(by.css('.col-md-4:nth-child(3) > .ng-binding:nth-child(1)'));
var InactiveLanguageButton = element(by.css('.btn-info > .ng-scope'));
var LanguageAlertDIV = element(by.css('p:nth-child(7)'));
var LanguageAlterConfirmButton = element(by.css('.confirm'));
var DislikeEmoji = element(by.id('emoji_0_0'));
var LikeItEmoji = element(by.id('emoji_0_3'));
var LoveItEmoji = element(by.id('emoji_0_4'));
var PreviousQuestion = element(by.linkText('< Previous Question'));
var CancelSurveyButton = element(by.css('.btn-md'));
var AdministrativeLawJudgesAdjudicatorsAndHearingOfficers = element(by.css('#\\39 d53706e-b04f-4fcb-a36e-d9c48934c2e1 > #territoryCardContainer .territoryCardTitleText > .ng-binding'));
var AdministrativeLawJudgesAdjudicatorsAndHearingOfficersAtAGlanceIcon = element(by.css('#\\39 d53706e-b04f-4fcb-a36e-d9c48934c2e1 > #territoryCardContainer > div > div > div .territoryCardItemText'));
var AdministrativeLawJudgesAdjudicatorsAndHearingOfficersAtBestFitIcon = element(by.css('#\\39 d53706e-b04f-4fcb-a36e-d9c48934c2e1 > #territoryCardContainer .ng-scope > div > div:nth-child(1) > .territoryCardItemText'));
var AdministrativeServicesManagers = element(by.css('#aa3ce6df-8851-4f10-8341-a4b7cdac7b7d > #territoryCardContainer .territoryCardTitleText > .ng-binding'));
var AirTrafficControllers = element(by.css('#\\30 2c1f459-be14-4ea7-8229-404af8ccb881 > #territoryCardContainer .territoryCardTitleText > .ng-binding'));
expect(await MyProgressWidgetTitle.getText()).toEqual('MY PROGRESS');
expect(await ProgressLevel.getText()).toEqual('Level: Scout');
await ProgressWidgetExpandIcon.click().then(function() {
browser.sleep(2500);
});
expect(await ActionOneCompleted.getText()).toContain('Account Creation');
expect(await ActionOneCompleted.getText()).toContain('Completed');
expect(await ActionTwo.getText()).toContain('Interest Survey');
expect(await ActionTwoCompleted.getText()).toContain('Completed');
//Interest Survey page - validate English & Spanish text
await ActionTwoRetake.click().then(function() {
browser.sleep(5000);
});
expect(await InterestSurveyTitle.getText()).toEqual('Interest Survey');
expect(await TextOne.getText()).toEqual("In less than 10 minutes you'll be matched to some exciting careers!");
expect(await TextTwo.getText()).toEqual('For each option, select the emotion that matches how you feel about the activity.');
expect(await TextThree.getText()).toEqual('Say how you really feel, there are no wrong answers!');
await LikeItEmoji.click();
await PreviousQuestion.click();
await InactiveLanguageButton.click().then(function() {
browser.sleep(5000)
});
expect(await LanguageAlertDIV.getText()).toEqual('Changing the language setting will result in starting the survey over again. Do you want to change languages and start at question 1?');
await LanguageAlterConfirmButton.click();
expect(await TextOne.getText()).toEqual('¡En menos de 10 minutos te conectamos con las mejores carreras para ti!');
expect(await TextTwo.getText()).toEqual('Por cada opción, selecciona la emocion que indica como te siendes sobre este tema.');
expect(await TextThree.getText()).toEqual('Indica cómo te sientes realmente, se sincero. ¡no hay respuesta incorrecta!');
await DislikeEmoji.click();
await LikeItEmoji.click();
await LoveItEmoji.click().then(function() {
browser.sleep(5000)
});
await CancelSurveyButton.click().then(function() {
browser.sleep(5000);
browser.waitForAngular();
});
browser.executeScript('window.scrollTo(0, 1405);').then(function() {
browser.sleep(5000);
});
expect(await AdministrativeLawJudgesAdjudicatorsAndHearingOfficers.getText()).toEqual('Administrative Law Judges, Adjudicators, and Hearing Officers');
expect(await AdministrativeLawJudgesAdjudicatorsAndHearingOfficersAtAGlanceIcon.getText()).toContain('At a');
expect(await AdministrativeLawJudgesAdjudicatorsAndHearingOfficersAtAGlanceIcon.getText()).toContain('Glance');
//expect(await AdministrativeLawJudgesAdjudicatorsAndHearingOfficersAtBestFitIcon.getText()).toContain('Interest'); EDM-1726
//expect(await AdministrativeLawJudgesAdjudicatorsAndHearingOfficersAtBestFitIcon.getText()).toContain('Best Fit'); EDM-1726
expect(await AdministrativeServicesManagers.getText()).toEqual('Administrative Services Managers');
expect(await AirTrafficControllers.getText()).toEqual('Air Traffic Controllers');
browser.executeScript('window.scrollTo(0, 0);').then(function() {
browser.sleep(5000);
});
});
}
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();
browser.sleep(1000);
await ProfileImage.click();
browser.sleep(1000);
browser.waitForAngular();
browser.getCurrentUrl();
await SignOutButton.click().then(function() {
browser.sleep(2500);
});
});
}