-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f396289
commit f220c39
Showing
10 changed files
with
179 additions
and
8 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* global element, by, browser */ | ||
const EC = require('protractor').ExpectedConditions; | ||
const FU = require('../shared/FormUtils'); | ||
const GridRow = require('../shared/GridRow'); | ||
|
||
const { bhCheckboxTree } = require('../shared/components'); | ||
|
||
class DonorPage { | ||
constructor() { | ||
this.gridId = 'donor-grid'; | ||
this.donorName = element(by.model('DonorAddCtrl.donor.display_name')); | ||
this.donorPhone = element(by.model('DonorAddCtrl.donor.phone')); | ||
this.donorEmail = element(by.model('DonorAddCtrl.donor.email')); | ||
this.donorAddress = element(by.model('DonorAddCtrl.donor.address')); | ||
} | ||
|
||
submit() { | ||
return FU.modal.submit(); | ||
} | ||
|
||
setName(txt) { | ||
return this.donorName.clear().sendKeys(txt); | ||
} | ||
|
||
setPhone(txt) { | ||
return this.donorPhone.clear().sendKeys(txt); | ||
} | ||
|
||
setEmail(txt) { | ||
return this.donorEmail.clear().sendKeys(txt); | ||
} | ||
|
||
setAddress(txt) { | ||
return this.donorAddress.clear().sendKeys(txt); | ||
} | ||
|
||
async openDropdownMenu(label) { | ||
const row = new GridRow(label); | ||
await row.dropdown().click(); | ||
return row; | ||
} | ||
|
||
async editDonor(displayName) { | ||
const row = await this.openDropdownMenu(displayName); | ||
await row.edit().click(); | ||
} | ||
|
||
async deleteDonor(displayName) { | ||
const row = await this.openDropdownMenu(displayName); | ||
await row.remove().click(); | ||
} | ||
|
||
async checkAllPermissions() { | ||
await browser.wait(EC.presenceOf($(bhCheckboxTree.selector)), 1500); | ||
await bhCheckboxTree.toggleAllCheckboxes(); | ||
} | ||
|
||
openCreateModal() { | ||
return FU.buttons.create(); | ||
} | ||
} | ||
|
||
module.exports = DonorPage; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
const helpers = require('../shared/helpers'); | ||
const DonorsPage = require('./donor.page'); | ||
const components = require('../shared/components'); | ||
|
||
// the page object | ||
const page = new DonorsPage(); | ||
|
||
function donorsManagementTests() { | ||
|
||
// navigate to the page | ||
before(() => helpers.navigate('#/donors')); | ||
|
||
it('should add a new donor', async () => { | ||
await page.openCreateModal(); | ||
await page.setName('DFD'); | ||
await page.setEmail('dfid@imaworld.com'); | ||
await page.setPhone('+100000202'); | ||
await page.setAddress('232 USA ..'); | ||
await page.submit(); | ||
await components.notification.hasSuccess(); | ||
}); | ||
|
||
it('should add a edit donor', async () => { | ||
await page.editDonor('DFD'); | ||
await page.setName('DFID'); | ||
await page.submit(); | ||
await components.notification.hasSuccess(); | ||
}); | ||
|
||
it('should add a test donor', async () => { | ||
await page.openCreateModal(); | ||
await page.setName('Test donor'); | ||
await page.submit(); | ||
await components.notification.hasSuccess(); | ||
}); | ||
|
||
it('should delete the test donor', async () => { | ||
await page.deleteDonor('Test donor'); | ||
await page.submit(); | ||
await components.notification.hasSuccess(); | ||
}); | ||
|
||
} | ||
|
||
describe('donor Management Tests', () => { | ||
describe('donor Management', donorsManagementTests); | ||
}); |
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