diff --git a/myResourcesWidget_config.js b/myResourcesWidget_config.js new file mode 100644 index 0000000..61df3aa --- /dev/null +++ b/myResourcesWidget_config.js @@ -0,0 +1,35 @@ +//myResourcesWidget_config.js + +exports.config = { + framework: 'jasmine', + seleniumAddress: 'http://localhost:4444/wd/hub', + specs: ['myResourcesWidget_spec.js'], + + jasmineNodeOpts: { + defaultTimeoutInterval: 360000 + }, + + capabilities: { + browserName: 'chrome' + }, + + onPrepare: function() { + browser.sleep(2500); + browser.driver.manage().window().maximize(); + }, + + params: { + login: 'https://app-qa.journeysmap.com/Journey/index.html#/login', + username: 'QA_AutomatedRegression' + } + + /*multiCapabilities: [{ + browserName: 'chrome' + }, { + browserName: 'firefox' + }]/*, { + browserName: 'internet explorer' + }], { + browserName: 'safari' + }]*/ +} \ No newline at end of file diff --git a/myResourcesWidget_spec.js b/myResourcesWidget_spec.js new file mode 100644 index 0000000..bd3b7df --- /dev/null +++ b/myResourcesWidget_spec.js @@ -0,0 +1,100 @@ +//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('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.'); + await UserNameTextBox.sendKeys(browser.params.username); + browser.sleep(1000); + await PasswordTextBox.sendKeys('3Dm!nAuto'); + browser.sleep(1000); + await NextButton.click().then(function() { + browser.waitForAngular(); + browser.getCurrentUrl(); + }); + 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')); + + browser.waitForAngular(); + browser.sleep(1000); + await ProfileImage.click(); + browser.sleep(1000); + browser.waitForAngular(); + browser.getCurrentUrl(); + await SignOutButton.click().then(function() { + browser.sleep(2500); + }); + }); +} \ No newline at end of file