//myResourcesWidget_spec.js describe('My Resources Widget script', function () { //login-journeysmap landing page var UserNameTextBox = element(by.css('#txtU')); var PasswordTextBox = element(by.css('#txtP')); //Open browser browser.get(browser.params.login); it('should have a title', async function () { await expect(browser.getTitle()).toEqual('Login'); }); //Sign In SignIn(UserNameTextBox, PasswordTextBox); it('should have a title', async function () { await expect(browser.getTitle()).toEqual('My Dashboard'); }); 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(1500); await UserNameTextBox.sendKeys(browser.params.username).then(function() { browser.sleep(1500); }); await PasswordTextBox.sendKeys('3Dm!nAuto').then(function() { browser.sleep(1500); }); await NextButton.click().then(function() { browser.sleep(5000); }); expect(await JourneysGreeting.getText()).toContain('Hi, '); expect(await JourneysGreeting.getText()).toContain('_Automated'); browser.waitForAngular(); browser.getCurrentUrl(); }); } MyResourcesWidget(); //Sign Out*/ SignOut(); }); function MyResourcesWidget() { it(': MyResourcesWidget, Should interact with the My Resources Widget', async function () { var MyResourcesWidgetTitle = element(by.css('#id > .ng-scope > .jrnys_lead-body-copy')); var MyResourcesViewAllLink = element(by.css('#id > .ng-scope .text-color-7a')); var MyResourcesDIVTitle = element(by.css('.col-sm-12 > .ng-binding')); var MyResourcesDIVOneTitle = element(by.css('.col-xs-9 > .ng-binding')); var MyResourcesDIVOneEllipsis = element(by.css('.glyphicon-option-vertical')); var MyResourcesDIVOneFollowIcon = element(by.css('div:nth-child(1) > .text-color-4b > span')); var MyResourcesDIVOneLearnMoreIcon = element(by.css('div:nth-child(2) > .text-color-4b > span:nth-child(2)')); var MyResourcesDIVCloseXIcon = element(by.css('.close')); var MyResourcesOneTitle = element(by.css('.hotTitles')); browser.executeScript('window.scrollTo(0, 2362);').then(function() { browser.sleep(2500); }); expect(await MyResourcesWidgetTitle.getText()).toEqual('My Resources View All'); await MyResourcesViewAllLink.click().then(function() { browser.sleep(2500); }); expect(await MyResourcesDIVTitle.getText()).toEqual('My Resources'); expect(await MyResourcesDIVOneTitle.getText()).toEqual('Test Doc'); await MyResourcesDIVOneEllipsis.click().then(function() { browser.sleep(2500); }); expect(await MyResourcesDIVOneFollowIcon.getText()).toEqual('Follow'); expect(await MyResourcesDIVOneLearnMoreIcon.getText()).toEqual('Learn More'); await MyResourcesDIVCloseXIcon.click().then(function() { browser.sleep(2500); }); expect(await MyResourcesOneTitle.getText()).toEqual('Test Doc'); browser.waitForAngular(); browser.getCurrentUrl(); }); } 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')); await ProfileImage.click().then(function() { browser.sleep(1000); }); await SignOutButton.click().then(function() { browser.sleep(2500); }); browser.get(browser.params.login); browser.sleep(2500); }); }