From 5425e24e3eda95d188a139750a16877eaac0fb57 Mon Sep 17 00:00:00 2001 From: Juan Huerta Date: Tue, 13 Oct 2020 14:44:26 -0700 Subject: [PATCH] Updated to run on Prod --- topCareerWidget_config.js | 2 +- topCareerWidget_spec.js | 138 +++++++++++++++++++++++++++----------- 2 files changed, 101 insertions(+), 39 deletions(-) diff --git a/topCareerWidget_config.js b/topCareerWidget_config.js index 4cc2142..9ab171b 100644 --- a/topCareerWidget_config.js +++ b/topCareerWidget_config.js @@ -19,7 +19,7 @@ exports.config = { params: { login: 'https://app-qa.journeysmap.com/Journey/index.html#/login', - userName: 'QA_AutomatedRegression' + username: 'QA_AutomatedRegression' } /*multiCapabilities: [{ diff --git a/topCareerWidget_spec.js b/topCareerWidget_spec.js index 2f232ae..368e844 100644 --- a/topCareerWidget_spec.js +++ b/topCareerWidget_spec.js @@ -26,7 +26,7 @@ describe('Top Career Widget script', function () { var JourneysGreeting = element(by.css('.dropdown')); expect(await PageGreetingText.getText()).toEqual('Login and start exploring.'); - await UserNameTextBox.sendKeys(browser.params.userName); + await UserNameTextBox.sendKeys(browser.params.username); browser.sleep(1000); await PasswordTextBox.sendKeys('3Dm!nAuto'); browser.sleep(1000); @@ -34,14 +34,16 @@ describe('Top Career Widget script', function () { browser.waitForAngular(); browser.getCurrentUrl(); }); - expect(await JourneysGreeting.getText()).toEqual('Hi, Automated'); + expect(await JourneysGreeting.getText()).toContain('Hi,'); + expect(await JourneysGreeting.getText()).toContain('_Automated'); browser.waitForAngular(); browser.getCurrentUrl(); }); } - //EditTopCareer(); + EditTopCareer(); TopCareerWidget(); + //Sign Out*/ SignOut(); }); @@ -177,7 +179,7 @@ function TopCareerWidget() { var WagesLowTextTwo = element(by.css('g:nth-child(9) > text')); var WagesXAxisFiveText = element(by.css('g:nth-child(6) > text')); var RateTypeText = element(by.css('.dropdown-menu tr:nth-child(3) > td:nth-child(1)')); - var HourlyButton = element(by.css('#tdRateType > .btn-info')); + var HourlyButton = element(by.xpath("//button[contains(.,'Hourly')]")); var AnnualButton = element(by.css('.btn:nth-child(2)')) var CollegePathwaysWidgetTitle = element(by.css('#liDegree .jrnys_lead-body-copy')); var ComputerApplicationsMinorCollegeWide = element(by.css('#\\36 3f93734-c4e9-48cd-8ff4-041e10760da5 > #territoryCardContainer .territoryCardTitleText > .ng-binding')); @@ -221,6 +223,7 @@ function TopCareerWidget() { var SanDiegoStateUniversity = element(by.css('#recommendedColleges .item:nth-child(2) > .col-xs-4:nth-child(2) .territoryCardTitleText:nth-child(2) > .ng-binding:nth-child(1)')); var CaliforniaStateUniversitySanMarcos = element(by.css('#recommendedColleges .item:nth-child(2) > .col-xs-4:nth-child(3) .territoryCardTitleText:nth-child(2) > .ng-binding:nth-child(1)')); var TopResourcesWidgetTitle = element(by.css('#id .jrnys_lead-body-copy')); + var JourneysGreeting = element(by.css('.dropdown')); var TopResourcesCardOneHeader = element(by.css('.item:nth-child(1) > .col-xs-4:nth-child(1) .hotTitles')); var TopResourcesCardTwoHeader = element(by.css('.item:nth-child(1) > .col-xs-4:nth-child(2) .hotTitles')); var TopResourcesCardThreeHeader = element(by.css('.item:nth-child(1) > .col-xs-4:nth-child(3) .hotTitles')); @@ -329,13 +332,10 @@ function TopCareerWidget() { var MultimediaArtistsAndAnimators = element(by.css('#\\32 a294540-b4cc-4886-a4de-edb17e7a748e > #territoryCardContainer .territoryCardTitleText > .ng-binding')); var NetworkAndComputerSystemsAdministrators = element(by.css('#ce3ef31a-9e4e-4ab8-a950-61b07731ad66 > #territoryCardContainer .territoryCardTitleText > .ng-binding')); var SoftwareDevelopersApplications = element(by.css('#\\32 26a35d5-9f4d-4f3e-8327-bce9c771d0e6 > #territoryCardContainer .territoryCardTitleText > .ng-binding')); - //var NearbyPlacesRightScroll = element(by.xpath('//li[17]')).element(by.css('.glyphicon-chevron-right')); - //var NearbyPlacesLeftScroll = element(by.xpath('//li[17]')).element(by.css('.glyphicon-chevron-left')); - - //REMOVE - browser.executeScript('window.scrollTo(0, 1885);').then(function() { - browser.sleep(2500); - }); + var DashboardHeaderLink = element(by.css('.ng-scope:nth-child(1) > a > span')); + var MyResourcesOneHeader = element(by.css('.col-xs-4:nth-child(1) .hotTitles')); + var MyResourcesOneSaveIcon = element(by.css('.col-xs-4:nth-child(1) .journey-save:nth-child(1)')); + var MyResourcesTwoHeader = element(by.css('.col-xs-4:nth-child(2) .hotTitles')); await TopCareerLink.click().then(function() { browser.sleep(5000); @@ -411,8 +411,8 @@ function TopCareerWidget() { expect(await WagesSubTextSeven.getText()).toEqual('https://www.bls.gov/oes/special.requests/oesm17all.zip'); await WagesWidgetCloseBackOfCardIcon.click().then(function() { browser.sleep(1000); + browser.executeScript('window.scrollTo(0, 780);'); }); - browser.executeScript('window.scrollTo(0, 780);'); expect(await CurrentDataNationalHeader.getText()).toEqual('National'); expect(await CurrentDataLocalHeader.getText()).toEqual('San Diego-Carlsbad, CA Metro Area'); //expect(await WagesTypeText.getText()).toEqual('4');//Can't ID @@ -472,9 +472,12 @@ function TopCareerWidget() { }); expect(await RateTypeText.getText()).toEqual('Rate Type'); expect(await HourlyButton.getText()).toEqual('Hourly'); + expect(HourlyButton.getCssValue('background-color')).toBe('rgba(52, 152, 219, 1)'); //blue: non-active expect(await AnnualButton.getText()).toEqual('Annual'); + expect(AnnualButton.getCssValue('background-color')).toBe('rgba(26, 188, 156, 1)'); //journey green: active await HourlyButton.click().then(function() { browser.sleep(2500); + browser.executeScript('window.scrollTo(0, 780);'); }); expect(await CurrentDataNationalHeader.getText()).toEqual('National'); expect(await CurrentDataLocalHeader.getText()).toContain('Oregon'); @@ -487,10 +490,27 @@ function TopCareerWidget() { expect(await WagesXAxisThreeText.getText()).toEqual('$60'); expect(await WagesXAxisFourText.getText()).toEqual('$80'); expect(await WagesXAxisFiveText.getText()).toEqual('$100'); - browser.executeScript('window.scrollTo(0, 1255);').then(function() { - browser.sleep(2495); + await WagesFilterIcon.click().then(function() { + browser.sleep(2500); }); + expect(HourlyButton.getCssValue('background-color')).toBe('rgba(26, 188, 156, 1)'); //journey green: active + expect(AnnualButton.getCssValue('background-color')).toBe('rgba(52, 152, 219, 1)'); //blue: non-active + await AnnualButton.click().then(function() { + browser.sleep(2500); + }); + expect(await CurrentDataNationalHeader.getText()).toEqual('National'); + expect(await CurrentDataLocalHeader.getText()).toContain('Oregon'); + expect(await WagesHighTextTwo.getText()).toEqual('High'); + expect(await WagesMedianTextTwo.getText()).toEqual('Median'); + expect(await WagesLowTextTwo.getText()).toEqual('Low'); + expect(await Wages0Text.getText()).toEqual('$0'); + expect(await WagesXAxisOneText.getText()).toEqual('$50,000'); + expect(await WagesXAxisTwoText.getText()).toEqual('$100,000'); + expect(await WagesXAxisThreeText.getText()).toEqual('$150,000'); + expect(await WagesXAxisFourText.getText()).toEqual('$200,000'); + expect(await WagesXAxisFiveText.getText()).toEqual('$250,000'); //College Pathways + browser.executeScript('window.scrollTo(0, 1255);'); expect(await CollegePathwaysWidgetTitle.getText()).toEqual('College Pathways'); expect(await ComputerApplicationsMinorCollegeWide.getText()).toEqual('Computer Applications Minor—College-Wide'); expect(await ComputerScienceBS.getText()).toEqual('Computer Science B.S.'); @@ -560,21 +580,38 @@ function TopCareerWidget() { }); //Top Resources expect(await TopResourcesWidgetTitle.getText()).toEqual('Top Resources View All'); - expect(await TopResourcesCardOneHeader.getText()).toEqual('Computer and Information Research Scientists (Information Technology)'); - expect(await TopResourcesCardTwoHeader.getText()).toEqual('How to Become a Research Scientist'); - expect(await TopResourcesCardThreeHeader.getText()).toEqual('Computer and Information Research Scientists'); - await TopResourcesRightScroll.click().then(function() { - browser.sleep(2500); + await JourneysGreeting.getText().then(async function(actualText) { + if(actualText.indexOf('Qa_Automated') !== -1) { + expect(await TopResourcesCardOneHeader.getText()).toEqual('Computer and Information Research Scientists (Information Technology)'); + expect(await TopResourcesCardTwoHeader.getText()).toEqual('How to Become a Research Scientist'); + expect(await TopResourcesCardThreeHeader.getText()).toEqual('Computer and Information Research Scientists'); + await TopResourcesRightScroll.click().then(function() { + browser.sleep(2500); + }); + expect(await TopResourcesCardFourHeader.getText()).toEqual('Computer and Information Research Scientists'); + expect(await TopResourcesCardFiveHeader.getText()).toEqual('Computer and Information Research Scientists'); + expect(await TopResourcesCardSixHeader.getText()).toEqual('Arduino download link for Thinkabitlab'); + await TopResourcesLeftScroll.click().then(function() { + browser.sleep(2500); + }); + expect(await TopResourcesCardThreeHeader.getText()).toEqual('Computer and Information Research Scientists'); + } else { + expect(await TopResourcesCardOneHeader.getText()).toEqual('How to Become a Research Scientist'); + expect(await TopResourcesCardTwoHeader.getText()).toEqual('Computer and Information Research Scientists (Information Technology)'); + expect(await TopResourcesCardThreeHeader.getText()).toEqual('Computer and Information Research Scientists'); + await TopResourcesRightScroll.click().then(function() { + browser.sleep(2500); + }); + expect(await TopResourcesCardFourHeader.getText()).toEqual('Computer and Information Research Scientists'); + expect(await TopResourcesCardFiveHeader.getText()).toEqual('Computer and Information Research Scientists'); + await TopResourcesLeftScroll.click().then(function() { + browser.sleep(2500); + }); + expect(await TopResourcesCardThreeHeader.getText()).toEqual('Computer and Information Research Scientists'); + } }); - expect(await TopResourcesCardFourHeader.getText()).toEqual('Computer and Information Research Scientists'); - expect(await TopResourcesCardFiveHeader.getText()).toEqual('Computer and Information Research Scientists'); - expect(await TopResourcesCardSixHeader.getText()).toEqual('Arduino download link for Thinkabitlab'); - await TopResourcesLeftScroll.click().then(function() { - browser.sleep(2500); - }); - expect(await TopResourcesCardThreeHeader.getText()).toEqual('Computer and Information Research Scientists'); await TopResourcesCardThreeSaveIcon.click().then(function() { - browser.sleep(2500); + browser.sleep(2500); }); browser.executeScript('window.scrollTo(0, 3640);').then(function() { browser.sleep(2500); @@ -588,24 +625,24 @@ function TopCareerWidget() { }); //expect(await JobListingsDIVHeader.getText()).toEqual('Job Listings: 85'); await XCloseLink.click().then(function() { - browser.sleep(1000); + browser.sleep(2500); }); expect(await InternshipsTotalsLink.getText()).toContain('Internships'); //expect(await InternshipsTotalsLink.getText()).toEqual('0');//stored value needed expect(await ApprenticeshipsTotalsLink.getText()).toContain('Apprenticeships');//value sometimes is disabled //expect(await ApprenticeshipsTotalsLink.getText()).toEqual('0');//stored value needed await FindOpportunitiesChangeLocationLink.click().then(function() { - browser.sleep(1000); + browser.sleep(2500); }); expect(await ChangeLocationDIVTitle.getText()).toEqual('Change Location'); expect(await ChangeLocationDIVSubTitle.getText()).toEqual("Let's search the location you're most interested in."); await ChnageLocationEnterZipCodeTextBox.sendKeys('85013'); browser.sleep(1000); element(by.cssContainingText('option', '1000')).click().then(function() { - browser.sleep(1000); + browser.sleep(2500); }); await ChangeLocationApplyButton.click().then(function() { - browser.sleep(1000); + browser.sleep(2500); }); expect(await FindOpportunitiesSubText.getText()).toEqual('Great News! We found lots of opportunities within a 1000 mile radius of you.'); await JobsTotalsLink.click().then(function() { @@ -613,7 +650,7 @@ function TopCareerWidget() { }); //expect(await JobListingsDIVHeader.getText()).toEqual('Job Listings: 85');//stored value needed await XCloseLink.click().then(function() { - browser.sleep(1000); + browser.sleep(2500); }); /*await InternshipsTotalsLink.click().then(function() { browser.sleep(2500); @@ -634,27 +671,33 @@ function TopCareerWidget() { expect(await TotalInJourneys.getText()).toContain('Total in Journeys'); expect(await TotalInJourneys.getText()).toContain('1'); await MySubmittedResourcesLink.click().then(function() { - browser.sleep(1000); + browser.sleep(2500); }); expect(await MySubmittedResourcesWidgetTitle.getText()).toEqual('My Submitted Resources'); - expect(await MyResourceTitle.getText()).toEqual('Test Doc'); + await JourneysGreeting.getText().then(async function(actualText) { + if(actualText.indexOf('Qa_Automated') !== -1) { + expect(await MyResourceTitle.getText()).toEqual('Test Doc'); + } else { + expect(await MyResourceTitle.getText()).toEqual('Recommended Careers Doc'); + } + }); await EllipsisResource.click().then(function() { - browser.sleep(1000); + browser.sleep(2500); }); expect(await MyResourceFollowIcon.getText()).toEqual('Follow'); expect(await MyResourceLearnMoreIcon.getText()).toEqual('Learn More'); await XCloseLink.click().then(function() { - browser.sleep(1000); + browser.sleep(2500); }); expect(await ForThisMapPoint.getText()).toContain('For this map point'); expect(await ForThisMapPoint.getText()).toContain('0'); expect(await SubmitResourceWidgetSubTextTwo.getText()).toEqual('Help expand the system by submitting a resource.'); await SubmitAResourceWidgetButton.click().then(function() { - browser.sleep(1000); + browser.sleep(2500); }); expect(await SubmitAResourceDIVTitle.getText()).toEqual('Submit a Resource'); await SubmitAResourceDIVCancelButton.click().then(function() { - browser.sleep(1000); + browser.sleep(2500); }); browser.executeScript('window.scrollTo(0, 4118);').then(function() { browser.sleep(2500); @@ -763,6 +806,25 @@ function TopCareerWidget() { await NearbyPlacesRightScroll.click().then(function() { browser.sleep(2500); }); + //Remove Saved Resource from My Resources widget on dashboard + await DashboardHeaderLink.click().then(function() { + browser.sleep(5000); + }); + browser.executeScript('window.scrollTo(0, 2362);').then(function() { + browser.sleep(2500); + }); + expect(await MyResourcesOneHeader.getText()).toEqual('Computer and Information Research Scientists'); + expect(await MyResourcesTwoHeader.getText()).toEqual('Test Doc'); + await MyResourcesOneSaveIcon.click().then(function() { + browser.sleep(2500); + }); + browser.refresh().then(function() { + browser.sleep(5000); + }); + browser.executeScript('window.scrollTo(0, 2362);').then(function() { + browser.sleep(2500); + }); + expect(await MyResourcesOneHeader.getText()).toEqual(''); browser.waitForAngular(); browser.getCurrentUrl(); });