Created
July 5, 2017 09:12
-
-
Save rafalf/d2120de19b56a4b37500164a3f91caa5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var pageObject = require('../../po/pages').container.PageObject; | |
var templatePage = pageObject.getTemplatePage(); | |
var searchPage = pageObject.getSearchPage(); | |
var slidersPage = pageObject.getSlidersPage(); | |
var detailsPage = pageObject.getDetailsPage(); | |
var loginPage = pageObject.getLoginPage(); | |
var usersData = require('../../data/users/data'); | |
var commonHelper = require('../../helpers/common.helper.js'); | |
describe('Company whitelists', function () { | |
var baseUrl = usersData.baseUrl; | |
var widgetUrl = usersData.widgetUrl; | |
var widgetUrlAutoTest = usersData.widgetUrlAutoTest; | |
var widgetUrlSingleWhitelist = usersData.widgetUrlSingleWhitelist; | |
var widgetUrlAutoMultiWhitelist = usersData.widgetUrlAutoMultiWhitelist; | |
var nonprofitName = usersData.nonprofitName; | |
var fundraiserName = usersData.fundraiserName; | |
var fundraiserTargetName = usersData.fundraiserTargetName; | |
var fundraiserWorldName = usersData.fundraiserWorldName; | |
var nonprofit501c3Name = usersData.nonprofits501c3.nonprofit501c3Name; | |
var nonprofit501c3EIN = usersData.nonprofits501c3.nonprofit501c3EIN; | |
var nonprofit501c3State = usersData.nonprofits501c3.nonprofit501c3State; | |
var charity15Alias = usersData.dataPop.acharity15Alias; | |
var acharity1Alias = usersData.dataPop.acharity1Alias; | |
describe('Whitelist of 5', function () { | |
beforeAll(function () { | |
console.log(widgetUrlAutoTest); | |
browser.get(widgetUrlAutoTest); | |
commonHelper.waitUntilElementPresent(commonHelper.widgetPanel); | |
}); | |
afterAll(function () { | |
commonHelper.clearAllData(); | |
}); | |
it('should see whitelist of 5', function () { | |
commonHelper.waitUntilElementVisible(searchPage.elAllBenefPassports.get(0)); | |
expect(searchPage.getAllBenefPassports()).toBe(5); | |
expect(searchPage.inSearch.isPresent()).toBeFalsy(); | |
}); | |
it('should click o info icon - verify overlay', function () { | |
commonHelper.selectInfoOnPassport(nonprofitName); | |
commonHelper.waitUntilElementPresent(commonHelper.overlayContent); | |
expect(commonHelper.getOverlayBeneficiaryName()).toBe(nonprofitName) | |
}); | |
it('should close overlay', function () { | |
commonHelper.closeOverlay() | |
commonHelper.waitUntilElementIsNotPresent(commonHelper.overlayContent) | |
}); | |
it('should click o info icon - world fundraiser panel', function () { | |
commonHelper.selectInfoOnPassport(fundraiserWorldName); | |
commonHelper.waitUntilElementPresent(commonHelper.worldFundraiserPanel); | |
}); | |
it('should change country', function () { | |
commonHelper.selectCountry('Algeria'); | |
expect(searchPage.getIsYourCountryText()).toMatch('.+ Algeria .+') | |
}); | |
it('should verify raised amount', function () { | |
expect(commonHelper.getRaisedAmount()).toMatch('.+0.00') | |
}); | |
it('should go back', function () { | |
searchPage.selectGoBack(); | |
}); | |
it('should click o info icon - world fundraiser panel', function () { | |
commonHelper.selectInfoOnPassport(fundraiserTargetName); | |
commonHelper.waitUntilElementPresent(commonHelper.worldFundraiserPanel); | |
}); | |
it('should verify target amount', function () { | |
expect(commonHelper.getTargetAmount()).toMatch('.+10,000,000'); | |
}); | |
it('should click on beneficiary info - verify overlay', function () { | |
searchPage.selectInfoIcon(); | |
commonHelper.waitUntilElementPresent(commonHelper.overlayContent); | |
expect(commonHelper.getOverlayBeneficiaryName()).toBe(nonprofitName); | |
}); | |
it('should close overlay', function () { | |
commonHelper.closeOverlay(); | |
commonHelper.waitUntilElementIsNotPresent(commonHelper.overlayContent); | |
}); | |
it('should go back', function () { | |
searchPage.selectGoBack(); | |
commonHelper.waitUntilElementVisible(searchPage.elAllBenefPassports.get(0)); | |
}); | |
it('should select 2 benefiaries and continue', function () { | |
searchPage.selectNthResultBeneficiaryAvatar(3); | |
searchPage.selectNthResultBeneficiaryAvatar(4); | |
commonHelper.selectContinueBtn(); | |
}); | |
it('should select sliders', function () { | |
detailsPage.clickSliders(); | |
commonHelper.waitUntilElementPresent(commonHelper.slidersPanel); | |
}); | |
it('should click add and see 5 whitelisted beneficiaries', function () { | |
slidersPage.clickAdd(); | |
commonHelper.waitUntilElementVisible(searchPage.elAllBenefPassports.get(0)); | |
expect(searchPage.getAllBenefPassports()).toBe(5); | |
}); | |
}); | |
describe('Whitelist of 1', function () { | |
// locked admin whitelist | |
// not allowed to add more beneficiaries | |
var companyEmailWhitelist = usersData.emails.companyEmailWhitelist; | |
var password = usersData.emails.password; | |
beforeAll(function () { | |
console.log(widgetUrlSingleWhitelist); | |
browser.get(widgetUrlSingleWhitelist); | |
commonHelper.waitUntilElementPresent(commonHelper.widgetPanel); | |
}); | |
afterAll(function () { | |
commonHelper.clearAllData(); | |
}); | |
it('should skip search panel - enter amount: 1000', function () { | |
commonHelper.waitUntilElementVisible(detailsPage.inAmount); | |
detailsPage.enterAmount('1000'); | |
expect(searchPage.inSearch.isPresent()).toBeFalsy(); | |
}); | |
it('should not see add beneficiaries', function () { | |
expect(detailsPage.lnkAddBenef.isPresent()).toBeFalsy(); | |
}); | |
it('should click sign in', function () { | |
commonHelper.clickLnkTopBarSignIn(); | |
commonHelper.waitUntilElementPresent(commonHelper.loginPanel); | |
}); | |
it('should log in as a company', function () { | |
loginPage.enterEmail(companyEmailWhitelist); | |
loginPage.enterPassword(password); | |
loginPage.clickBtnLogIn(); | |
commonHelper.waitUntilElementIsNotPresent(commonHelper.spinner); | |
commonHelper.waitUntilElementPresent(commonHelper.donationDetailsPanel); | |
}); | |
it('should log out', function () { | |
commonHelper.clickTopBarAvatar(); | |
commonHelper.waitUntilElementPresent(commonHelper.overlayContent); | |
commonHelper.clickLogout(); | |
commonHelper.waitUntilElementIsNotPresent(commonHelper.overlayContent); | |
}); | |
it('should whitelist be displaying', function () { | |
commonHelper.waitUntilElementPresent(commonHelper.donationDetailsPanel); | |
expect(commonHelper.searchResultsPanel.isPresent()).toBeFalsy(); | |
}); | |
}); | |
describe('Whitelist of 32', function () { | |
beforeAll(function () { | |
console.log(widgetUrlAutoMultiWhitelist); | |
browser.get(widgetUrlAutoMultiWhitelist); | |
commonHelper.waitUntilElementPresent(commonHelper.widgetPanel); | |
}); | |
afterAll(function () { | |
commonHelper.clearAllData(); | |
}); | |
it('should see whitelist of: 32 --> 5 displaying', function () { | |
commonHelper.waitUntilElementPresent(searchPage.inSearch); | |
expect(searchPage.getAllBenefPassports()).toBe(5); | |
}); | |
it('should click next page', function () { | |
commonHelper.moveMouseOver(commonHelper.pageNext) | |
expect(commonHelper.pagePrevious.getAttribute('class')).toContain('disabled'); | |
expect(commonHelper.pageNext.getAttribute('class')).not.toContain('disabled'); | |
commonHelper.clickNext() | |
expect(commonHelper.pagePrevious.getAttribute('class')).not.toContain('disabled'); | |
expect(commonHelper.pageNext.getAttribute('class')).not.toContain('disabled'); | |
}); | |
it('should click next x 7', function () { | |
for (var x=0; x < 7; x++){ | |
commonHelper.clickNext(); | |
}; | |
expect(searchPage.getAllBenefPassports()).toBe(2); | |
}); | |
it('should enter and search fundraiser: [automation.fundraiser.test]',function () { | |
commonHelper.waitUntilElementPresent(searchPage.inSearch); | |
searchPage.enterNameToSearch(fundraiserName); | |
searchPage.selectSearchBtn(); | |
expect(searchPage.getAllBenefPassports()).toBe(0); | |
}); | |
it('should enter and search fundraiser: charity15Alias',function () { | |
searchPage.enterNameToSearch(charity15Alias); | |
searchPage.selectSearchBtn(); | |
expect(searchPage.getAllBenefPassports()).toBe(1); | |
}); | |
it('should click on advanced search',function () { | |
searchPage.selectAdvancedSearchLnk(); | |
}); | |
it('should search by category - Animals', function () { | |
searchPage.selectCategory('Animals') | |
searchPage.selectSearchAdvancedBtn(); | |
expect(searchPage.getAllBenefPassports()).toBe(0); | |
}); | |
it('should enter and search fundraiser: charity1Alias',function () { | |
searchPage.enterNameToSearch(acharity1Alias); | |
searchPage.selectSearchAdvancedBtn(); | |
expect(searchPage.getAllBenefPassports()).toBe(1); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment