-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#126 added basic tests for valuations, claims, payments
- Loading branch information
Showing
6 changed files
with
141 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
describe('Claims page', function() { | ||
beforeEach(function () { | ||
browser.get('http://127.0.0.1:8000/#/claims'); | ||
}); | ||
|
||
// tests its on the claims page | ||
it('should be on the claims page', function() { | ||
expect(browser.driver.getCurrentUrl()).toBe('http://127.0.0.1:8000/#/claims'); | ||
}); | ||
|
||
// add a claim | ||
it('should add a claim', function(){ | ||
// open the add claim modal and fill in the form | ||
var addClaimModal = element(by.id('saveClaimModal')); | ||
var projectname = ""; | ||
element(by.css('nav ul li a i.fa-plus-square')).click(); | ||
expect(addClaimModal.isDisplayed()).toBe(true); | ||
var projectselect = addClaimModal.element(by.id('inputProject_chosen')) | ||
projectselect.click(); | ||
projectselect.all(by.css('.chosen-results li')).then(function(items) { | ||
items[1].getText().then(function(name){projectname = name;}); | ||
items[1].click(); | ||
}); | ||
|
||
var valselect = addClaimModal.element(by.id('inputValuation_chosen')) | ||
valselect.click(); | ||
valselect.all(by.css('.chosen-results li')).then(function(items) { | ||
items[1].click(); | ||
}) | ||
|
||
addClaimModal.element(by.css('#inputDate i.fa-calendar')).click(); | ||
addClaimModal.element(by.css('#inputDate ul table tbody tr td.day.active')).click() | ||
addClaimModal.element(by.buttonText('Save')).click(); | ||
|
||
// check the claim was added | ||
element(by.repeater('obj in jsonclaims').row(0).column('obj.Project')).getText().then(function(name){ | ||
expect(name).toBe(projectname); | ||
}); | ||
}); | ||
|
||
// delete claim | ||
it('should delete a claim', function(){ | ||
// click the claim | ||
element(by.repeater('obj in jsonclaims').row(0)).click(); | ||
// delete | ||
element(by.css('nav ul li a i.fa-trash')).click(); | ||
element(by.buttonText('Delete')).click(); | ||
}); | ||
}); |
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,49 @@ | ||
// run test on the payments page | ||
describe('Payments Page', function () { | ||
beforeEach(function () { | ||
browser.get('http://127.0.0.1:8000/#/payments'); | ||
}); | ||
|
||
// tests its on the payments page | ||
it('should be on the payments page', function() { | ||
expect(browser.driver.getCurrentUrl()).toBe('http://127.0.0.1:8000/#/payments'); | ||
}); | ||
|
||
// add a payment | ||
it('should add a new payment', function () { | ||
// open the add payment modal and fill in the form | ||
var paymentModal = element(by.id('savePaymentModal')); | ||
element(by.css('nav ul li a i.fa-plus-square')).click(); | ||
expect(paymentModal.isDisplayed()).toBe(true); | ||
paymentModal.element(by.model('formData.ReferenceNumber')).sendKeys('TEST'); | ||
|
||
var projectname = ""; | ||
var projectselect = paymentModal.element(by.id('inputProject_chosen')) | ||
projectselect.click(); | ||
projectselect.all(by.css('.chosen-results li')).then(function(items) { | ||
items[1].getText().then(function(name){projectname = name;}); | ||
items[1].click(); | ||
}); | ||
paymentModal.element(by.css('#inputDate i.fa-calendar')).click(); | ||
paymentModal.element(by.css('#inputDate ul table tbody tr td.day.active')).click() | ||
|
||
paymentModal.element(by.model('formData.Amount')).sendKeys('1000'); | ||
|
||
expect(paymentModal.element(by.buttonText('Save')).isEnabled()).toBe(true); | ||
paymentModal.element(by.buttonText('Save')).click(); | ||
|
||
// check the claim was added | ||
element(by.repeater('obj in jsonpayments').row(0).column('obj.Project')).getText().then(function(name){ | ||
expect(name).toBe(projectname); | ||
}); | ||
}); | ||
|
||
// delete payment | ||
it('should delete a payment', function(){ | ||
// click the payment | ||
element(by.repeater('obj in jsonpayments').row(0)).click(); | ||
// delete | ||
element(by.css('nav ul li a i.fa-trash')).click(); | ||
element(by.buttonText('Delete')).click(); | ||
}); | ||
}); |
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,34 @@ | ||
describe('Valuations page', function() { | ||
beforeEach(function () { | ||
browser.get('http://127.0.0.1:8000/#/valuations'); | ||
}); | ||
|
||
// tests its on the valuations page | ||
it('should be on the valuations page', function() { | ||
expect(browser.driver.getCurrentUrl()).toBe('http://127.0.0.1:8000/#/valuations'); | ||
}); | ||
|
||
// add a valuation | ||
it('should add a valuation', function(){ | ||
// open the add valuation modal and fill in the form | ||
var addValuationModal = element(by.id('saveValuationModal')); | ||
var projectname = ""; | ||
element(by.css('nav ul li a i.fa-plus-square')).click(); | ||
expect(addValuationModal.isDisplayed()).toBe(true); | ||
var projectselect = addValuationModal.element(by.id('inputProject_chosen')) | ||
projectselect.click(); | ||
projectselect.all(by.css('.chosen-results li')).then(function(items) { | ||
items[1].getText().then(function(name){projectname = name;}); | ||
items[1].click(); | ||
}); | ||
|
||
addValuationModal.element(by.css('#inputDate i.fa-calendar')).click(); | ||
addValuationModal.element(by.css('#inputDate ul table tbody tr td.day.active')).click() | ||
addValuationModal.element(by.buttonText('Save')).click(); | ||
|
||
// check the valuation was added | ||
element(by.repeater('obj in jsonvaluations').row(0).column('obj.Project')).getText().then(function(name){ | ||
expect(name).toBe(projectname); | ||
}); | ||
}); | ||
}); |