kuality-coeus 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/Gemfile.lock +16 -18
- data/chromedriver.log +46 -0
- data/features/grants_gov/grants_gov_forms/code_and_form_mapping.feature +26 -0
- data/features/grants_gov/grants_gov_forms/forms_validation.feature +1 -0
- data/features/grants_gov/grants_gov_forms/s2s_questionnaire.feature +19 -0
- data/features/grants_gov/s2s_submission.feature +30 -0
- data/features/grants_gov/s2s_validation.feature +36 -0
- data/features/proposal_development/create_budget_versions.feature +31 -0
- data/features/proposal_development/create_proposal.feature +25 -0
- data/features/proposal_development/key_personnel_validations.feature +41 -0
- data/features/proposal_development/proposal_actions_validations.feature +46 -0
- data/features/proposal_development/proposal_permissions.feature +73 -0
- data/features/proposal_development/proposal_workflow.feature +105 -0
- data/features/proposal_development/special_review_validations.feature +12 -0
- data/features/step_definitions/action_list.rb +12 -0
- data/features/step_definitions/awards/create_award.rb +3 -0
- data/features/step_definitions/grants_gov/forms.rb +34 -0
- data/features/step_definitions/grants_gov/s2s_submission.rb +51 -0
- data/features/step_definitions/institutional_proposals/create_institutional_proposal.rb +3 -0
- data/features/step_definitions/proposal_development/budget_versions.rb +102 -0
- data/features/step_definitions/proposal_development/create_proposal.rb +157 -0
- data/features/step_definitions/proposal_development/edit_proposal.rb +79 -0
- data/features/step_definitions/proposal_development/institute_rates.rb +21 -0
- data/features/step_definitions/proposal_development/key_personnel_validations.rb +74 -0
- data/features/step_definitions/proposal_development/proposal_actions_validations.rb +73 -0
- data/features/step_definitions/proposal_development/proposal_permissions.rb +141 -0
- data/features/step_definitions/proposal_development/proposal_workflow.rb +81 -0
- data/features/step_definitions/proposal_development/s2s_validation.rb +30 -0
- data/features/step_definitions/proposal_development/special_review_validations.rb +7 -0
- data/features/step_definitions/test.rb +3 -0
- data/features/step_definitions/users.rb +65 -0
- data/features/support/env.rb +35 -0
- data/features/test.feature +13 -0
- data/kuality-coeus.gemspec +1 -1
- data/lib/chromedriver.log +4483 -0
- data/lib/kuality-coeus.rb +5 -2
- data/lib/kuality-coeus/core_extensions.rb +10 -0
- data/lib/kuality-coeus/data_objects/award/award.rb +126 -0
- data/lib/kuality-coeus/data_objects/award/award_transaction.rb +57 -0
- data/lib/kuality-coeus/data_objects/budget/budget_periods.rb +114 -0
- data/lib/kuality-coeus/data_objects/budget/budget_versions.rb +221 -0
- data/lib/kuality-coeus/data_objects/budget/subaward_budget.rb +65 -0
- data/lib/kuality-coeus/data_objects/committee_document/committee_document.rb +65 -0
- data/lib/kuality-coeus/data_objects/committee_document/committee_members.rb +30 -0
- data/lib/kuality-coeus/data_objects/committee_document/committee_schedule.rb +27 -0
- data/lib/kuality-coeus/data_objects/committee_document/member_roles.rb +28 -0
- data/lib/kuality-coeus/data_objects/conflict_of_interest/financial_entity.rb +48 -0
- data/lib/kuality-coeus/data_objects/grants_gov/phs_fellowship_questionnaire.rb +90 -0
- data/lib/kuality-coeus/data_objects/grants_gov/phs_training_budget_questionnaire.rb +5 -0
- data/lib/kuality-coeus/data_objects/institutional_proposal/institutional_proposal.rb +20 -0
- data/lib/kuality-coeus/data_objects/institutional_proposal/intellectual_property_review.rb +62 -0
- data/lib/kuality-coeus/data_objects/navigation.rb +64 -0
- data/lib/kuality-coeus/data_objects/proposal_development/compliance_questions.rb +47 -0
- data/lib/kuality-coeus/data_objects/proposal_development/custom_data.rb +41 -0
- data/lib/kuality-coeus/data_objects/proposal_development/degrees.rb +40 -0
- data/lib/kuality-coeus/data_objects/proposal_development/key_personnel.rb +299 -0
- data/lib/kuality-coeus/data_objects/proposal_development/kuali_university_questions.rb +58 -0
- data/lib/kuality-coeus/data_objects/proposal_development/permissions.rb +107 -0
- data/lib/kuality-coeus/data_objects/proposal_development/personnel_attachments.rb +46 -0
- data/lib/kuality-coeus/data_objects/proposal_development/proposal_attachments.rb +41 -0
- data/lib/kuality-coeus/data_objects/proposal_development/proposal_development.rb +301 -0
- data/lib/kuality-coeus/data_objects/proposal_development/proposal_questions.rb +52 -0
- data/lib/kuality-coeus/data_objects/proposal_development/s2s_questionnaire.rb +129 -0
- data/lib/kuality-coeus/data_objects/proposal_development/special_review.rb +79 -0
- data/lib/kuality-coeus/data_objects/rates/institute_rate.rb +209 -0
- data/lib/kuality-coeus/data_objects/user.rb +303 -33
- data/lib/kuality-coeus/gem_extensions.rb +26 -0
- data/lib/kuality-coeus/page_objects/000_base_page.rb +196 -14
- data/lib/kuality-coeus/page_objects/action_list.rb +32 -0
- data/lib/kuality-coeus/page_objects/award/award.rb +25 -0
- data/lib/kuality-coeus/page_objects/award/award_actions.rb +7 -0
- data/lib/kuality-coeus/page_objects/award/award_budget_versions.rb +9 -0
- data/lib/kuality-coeus/page_objects/award/commitments.rb +27 -0
- data/lib/kuality-coeus/page_objects/award/contacts.rb +19 -0
- data/lib/kuality-coeus/page_objects/award/custom_data.rb +6 -0
- data/lib/kuality-coeus/page_objects/award/payment_reports_terms.rb +26 -0
- data/lib/kuality-coeus/page_objects/award/special_review.rb +7 -0
- data/lib/kuality-coeus/page_objects/award/time_and_money.rb +36 -0
- data/lib/kuality-coeus/page_objects/budget/budget_actions.rb +31 -0
- data/lib/kuality-coeus/page_objects/budget/budget_versions.rb +13 -0
- data/lib/kuality-coeus/page_objects/budget/modular_budget.rb +16 -0
- data/lib/kuality-coeus/page_objects/budget/non-personnel.rb +11 -0
- data/lib/kuality-coeus/page_objects/budget/parameters.rb +65 -0
- data/lib/kuality-coeus/page_objects/budget/personnel.rb +56 -0
- data/lib/kuality-coeus/page_objects/budget/rates.rb +7 -0
- data/lib/kuality-coeus/page_objects/budget/summary.rb +5 -0
- data/lib/kuality-coeus/page_objects/budget_document.rb +19 -0
- data/lib/kuality-coeus/page_objects/central_admin.rb +4 -2
- data/lib/kuality-coeus/page_objects/committee/committee.rb +10 -10
- data/lib/kuality-coeus/page_objects/committee/members.rb +4 -4
- data/lib/kuality-coeus/page_objects/committee_document.rb +1 -6
- data/lib/kuality-coeus/page_objects/confirmation.rb +16 -0
- data/lib/kuality-coeus/page_objects/disclosure/disclosure.rb +56 -0
- data/lib/kuality-coeus/page_objects/disclosure/disclosure_actions.rb +9 -0
- data/lib/kuality-coeus/page_objects/document_header.rb +5 -0
- data/lib/kuality-coeus/page_objects/financial_entities.rb +1 -4
- data/lib/kuality-coeus/page_objects/financial_entities/my_financial_entities.rb +6 -0
- data/lib/kuality-coeus/page_objects/financial_entities/new_financial_entity.rb +11 -0
- data/lib/kuality-coeus/page_objects/financial_entities/reporter.rb +5 -3
- data/lib/kuality-coeus/page_objects/identity/person.rb +57 -0
- data/lib/kuality-coeus/page_objects/institute_rates_maintenance.rb +18 -0
- data/lib/kuality-coeus/page_objects/institutional_proposal.rb +18 -0
- data/lib/kuality-coeus/page_objects/institutional_proposal/contacts.rb +32 -0
- data/lib/kuality-coeus/page_objects/institutional_proposal/custom_data.rb +6 -0
- data/lib/kuality-coeus/page_objects/institutional_proposal/distribution.rb +20 -0
- data/lib/kuality-coeus/page_objects/institutional_proposal/institutional_proposal.rb +27 -0
- data/lib/kuality-coeus/page_objects/institutional_proposal/institutional_proposal_actions.rb +7 -0
- data/lib/kuality-coeus/page_objects/institutional_proposal/intellectual_property_review.rb +20 -0
- data/lib/kuality-coeus/page_objects/institutional_proposal/special_review.rb +6 -0
- data/lib/kuality-coeus/page_objects/kc_awards.rb +48 -0
- data/lib/kuality-coeus/page_objects/kc_protocol.rb +15 -0
- data/lib/kuality-coeus/page_objects/login.rb +4 -5
- data/lib/kuality-coeus/page_objects/lookup_pages/000_lookups.rb +10 -0
- data/lib/kuality-coeus/page_objects/lookup_pages/action_list_filter.rb +6 -0
- data/lib/kuality-coeus/page_objects/lookup_pages/address_book_lookup.rb +4 -0
- data/lib/kuality-coeus/page_objects/lookup_pages/development_proposal_lookup.rb +3 -0
- data/lib/kuality-coeus/page_objects/lookup_pages/document_search.rb +10 -0
- data/lib/kuality-coeus/page_objects/lookup_pages/group_lookup.rb +3 -0
- data/lib/kuality-coeus/page_objects/lookup_pages/institute_rates_lookup.rb +12 -0
- data/lib/kuality-coeus/page_objects/lookup_pages/opportunity_lookup.rb +6 -0
- data/lib/kuality-coeus/page_objects/lookup_pages/organization_lookup.rb +5 -0
- data/lib/kuality-coeus/page_objects/lookup_pages/person_extended_attributes.rb +5 -0
- data/lib/kuality-coeus/page_objects/lookup_pages/person_lookup.rb +10 -0
- data/lib/kuality-coeus/page_objects/lookup_pages/role_lookup.rb +6 -0
- data/lib/kuality-coeus/page_objects/lookup_pages/sponsor_lookup.rb +9 -0
- data/lib/kuality-coeus/page_objects/lookup_pages/unit_admin_lookup.rb +3 -0
- data/lib/kuality-coeus/page_objects/lookup_pages/unit_lookup.rb +3 -0
- data/lib/kuality-coeus/page_objects/maintenance.rb +7 -0
- data/lib/kuality-coeus/page_objects/notification_editor.rb +6 -0
- data/lib/kuality-coeus/page_objects/proposal_development.rb +7 -2
- data/lib/kuality-coeus/page_objects/proposal_development/abstracts_and_attachments.rb +54 -0
- data/lib/kuality-coeus/page_objects/proposal_development/key_personnel.rb +126 -0
- data/lib/kuality-coeus/page_objects/proposal_development/pd_custom_data.rb +6 -0
- data/lib/kuality-coeus/page_objects/proposal_development/permissions.rb +44 -0
- data/lib/kuality-coeus/page_objects/proposal_development/phs_fellowship_questionnaire.rb +44 -0
- data/lib/kuality-coeus/page_objects/proposal_development/phs_training_budget_questionnaire.rb +50 -0
- data/lib/kuality-coeus/page_objects/proposal_development/proposal.rb +47 -8
- data/lib/kuality-coeus/page_objects/proposal_development/proposal_actions.rb +62 -0
- data/lib/kuality-coeus/page_objects/proposal_development/proposal_summary.rb +9 -0
- data/lib/kuality-coeus/page_objects/proposal_development/questions.rb +111 -0
- data/lib/kuality-coeus/page_objects/proposal_development/s2s.rb +35 -0
- data/lib/kuality-coeus/page_objects/proposal_development/special_review.rb +6 -0
- data/lib/kuality-coeus/page_objects/protocol/custom_data.rb +6 -0
- data/lib/kuality-coeus/page_objects/protocol/permissions.rb +5 -0
- data/lib/kuality-coeus/page_objects/protocol/personnel.rb +5 -0
- data/lib/kuality-coeus/page_objects/protocol/protocol.rb +11 -0
- data/lib/kuality-coeus/page_objects/protocol/questionnaire.rb +5 -0
- data/lib/kuality-coeus/page_objects/protocol/special_review.rb +6 -0
- data/lib/kuality-coeus/page_objects/rejection_confirmation.rb +5 -0
- data/lib/kuality-coeus/page_objects/researcher.rb +4 -2
- data/lib/kuality-coeus/page_objects/shared/unit_administrator.rb +13 -0
- data/lib/kuality-coeus/page_objects/system/person_extended_attributes.rb +18 -0
- data/lib/kuality-coeus/page_objects/system_admin.rb +7 -0
- data/lib/kuality-coeus/page_objects/unit.rb +2 -4
- data/lib/kuality-coeus/utilities.rb +39 -0
- data/libpeerconnection.log +0 -0
- metadata +140 -5
- data/lib/kuality-coeus/data_objects/committee_document.rb +0 -65
- data/lib/kuality-coeus/data_objects/proposal_development.rb +0 -53
- data/lib/kuality-coeus/navigation.rb +0 -3
data/lib/kuality-coeus.rb
CHANGED
@@ -1,14 +1,17 @@
|
|
1
1
|
require 'test-factory'
|
2
|
+
require 'date'
|
3
|
+
require 'yaml'
|
2
4
|
Dir["#{File.dirname(__FILE__)}/kuality-coeus/*.rb"].each {|f| require f }
|
3
5
|
Dir["#{File.dirname(__FILE__)}/kuality-coeus/page_objects/*.rb"].each {|f| require f }
|
4
6
|
Dir["#{File.dirname(__FILE__)}/kuality-coeus/page_objects/*/*.rb"].each {|f| require f }
|
5
7
|
Dir["#{File.dirname(__FILE__)}/kuality-coeus/data_objects/*.rb"].each {|f| require f }
|
8
|
+
Dir["#{File.dirname(__FILE__)}/kuality-coeus/data_objects/*/*.rb"].each {|f| require f }
|
6
9
|
|
7
10
|
# Initialize this class at the start of your test cases to
|
8
|
-
# open the specified test browser at the specified
|
11
|
+
# open the specified test browser at the specified welcome page URL.
|
9
12
|
#
|
10
13
|
# The initialization will
|
11
|
-
# create the
|
14
|
+
# create the browser object that can be used throughout the page classes
|
12
15
|
class Kuality
|
13
16
|
|
14
17
|
attr_reader :browser
|
@@ -0,0 +1,126 @@
|
|
1
|
+
class AwardObject
|
2
|
+
|
3
|
+
include Foundry
|
4
|
+
include DataFactory
|
5
|
+
include Navigation
|
6
|
+
include DateFactory
|
7
|
+
include StringFactory
|
8
|
+
|
9
|
+
attr_accessor :description, :transaction_type, :award_id, :funding_proposal, :award_status,
|
10
|
+
:award_title, :lead_unit, :activity_type, :award_type, :sponsor_id,
|
11
|
+
:project_start_date, :project_end_date, :obligation_start_date,
|
12
|
+
:obligation_end_date, :anticipated_amount, :obligated_amount, :document_id,
|
13
|
+
:creation_date, :transactions
|
14
|
+
|
15
|
+
def initialize(browser, opts={})
|
16
|
+
@browser = browser
|
17
|
+
|
18
|
+
defaults = {
|
19
|
+
description: random_alphanums,
|
20
|
+
transaction_type: '::random::',
|
21
|
+
award_status: '::random::',
|
22
|
+
award_title: random_alphanums,
|
23
|
+
activity_type: '::random::',
|
24
|
+
award_type: '::random::',
|
25
|
+
project_start_date: right_now, # Note how this is the date hash, for increased flexibility of validations or tests, if necessary
|
26
|
+
project_end_date: in_a_year, # Same goes for this variable. It's the entire date hash
|
27
|
+
sponsor_id: '::random::',
|
28
|
+
lead_unit: '::random::',
|
29
|
+
obligation_start_date: right_now, # Date hash, again
|
30
|
+
obligation_end_date: in_a_year, # and again
|
31
|
+
anticipated_amount: '1000000',
|
32
|
+
obligated_amount: '1000000',
|
33
|
+
transactions: TransactionCollection.new
|
34
|
+
}
|
35
|
+
|
36
|
+
set_options(defaults.merge(opts))
|
37
|
+
end
|
38
|
+
|
39
|
+
def create
|
40
|
+
@creation_date = right_now[:date_w_slashes]
|
41
|
+
visit(CentralAdmin).create_award
|
42
|
+
on Award do |create|
|
43
|
+
create.expand_all
|
44
|
+
fill_out create, :description, :transaction_type, :award_status, :award_title,
|
45
|
+
:activity_type, :award_type, :obligated_amount, :anticipated_amount
|
46
|
+
create.project_start_date.fit @project_start_date[:date_w_slashes]
|
47
|
+
create.project_end_date.fit @project_end_date[:date_w_slashes]
|
48
|
+
create.obligation_start_date.fit @obligation_start_date[:date_w_slashes]
|
49
|
+
create.obligation_end_date.fit @obligation_end_date[:date_w_slashes]
|
50
|
+
set_sponsor_id
|
51
|
+
set_lead_unit
|
52
|
+
create.save
|
53
|
+
@document_id = create.header_document_id
|
54
|
+
@award_id = create.header_award_id
|
55
|
+
end
|
56
|
+
add_funding_proposal if @funding_proposal
|
57
|
+
end
|
58
|
+
|
59
|
+
def add_funding_proposal # TODO: Add support for multiple funding proposals and merge types.
|
60
|
+
on Award do |page|
|
61
|
+
page.expand_all
|
62
|
+
page.institutional_proposal_number.set @funding_proposal
|
63
|
+
page.add_proposal
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def add_transaction opts={}
|
68
|
+
defaults={award_id: @award_id}
|
69
|
+
options = defaults.merge(opts)
|
70
|
+
trans = make AwardTransactionObject, options
|
71
|
+
trans.create
|
72
|
+
@transactions << trans
|
73
|
+
end
|
74
|
+
|
75
|
+
# ========
|
76
|
+
private
|
77
|
+
# ========
|
78
|
+
|
79
|
+
def set_sponsor_id
|
80
|
+
if @sponsor_id=='::random::'
|
81
|
+
on(Award).lookup_sponsor
|
82
|
+
on SponsorLookup do |look|
|
83
|
+
look.sponsor_type_code.pick! '::random::'
|
84
|
+
look.search
|
85
|
+
look.page_links[rand(look.page_links.length)].click if look.page_links.size > 0
|
86
|
+
look.return_random
|
87
|
+
end
|
88
|
+
else
|
89
|
+
on(Award).sponsor_id.fit @sponsor_id
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def set_lead_unit
|
94
|
+
lu_edit = on(Award).lead_unit_id.present?
|
95
|
+
randomize = @lead_unit=='::random::'
|
96
|
+
if lu_edit && randomize
|
97
|
+
on(Award).lookup_lead_unit
|
98
|
+
on UnitLookup do |lk|
|
99
|
+
lk.search
|
100
|
+
lk.return_random
|
101
|
+
end
|
102
|
+
elsif lu_edit && !randomize
|
103
|
+
on(Award).lead_unit_id.fit @lead_unit
|
104
|
+
else
|
105
|
+
@lead_unit=on(Award).lead_unit_ro
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
def navigate
|
110
|
+
doc_search unless on_award?
|
111
|
+
on(TimeAndMoney).return_to_award if on_tm?
|
112
|
+
end
|
113
|
+
|
114
|
+
def on_award?
|
115
|
+
if on(Award).headerinfo_table.exist?
|
116
|
+
on(Award).header_award_id==@award_id
|
117
|
+
else
|
118
|
+
false
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
def on_tm?
|
123
|
+
!(on(Award).t_m_button.exist?)
|
124
|
+
end
|
125
|
+
|
126
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
class AwardTransactionObject
|
2
|
+
|
3
|
+
include Foundry
|
4
|
+
include DataFactory
|
5
|
+
include Navigation
|
6
|
+
include StringFactory
|
7
|
+
|
8
|
+
attr_accessor :award_id, :comment, :source_award, :destination_award, :obligated_change,
|
9
|
+
:anticipated_change
|
10
|
+
|
11
|
+
def initialize(browser, opts={})
|
12
|
+
@browser = browser
|
13
|
+
|
14
|
+
defaults = {
|
15
|
+
comment: random_string
|
16
|
+
}
|
17
|
+
set_options(defaults.merge(opts))
|
18
|
+
requires :award_id
|
19
|
+
end
|
20
|
+
|
21
|
+
def create
|
22
|
+
navigate
|
23
|
+
on TimeAndMoney do |create|
|
24
|
+
create.expand_all
|
25
|
+
create.transaction_comment.fit @comment
|
26
|
+
fill_out create, :source_award, :destination_award, :obligated_change,
|
27
|
+
:anticipated_change
|
28
|
+
create.add_transaction
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
# ========
|
33
|
+
private
|
34
|
+
# ========
|
35
|
+
|
36
|
+
def navigate
|
37
|
+
doc_search unless on_award?
|
38
|
+
on(Award).time_and_money unless on_tm?
|
39
|
+
end
|
40
|
+
|
41
|
+
def on_award?
|
42
|
+
if on(Award).headerinfo_table.exist?
|
43
|
+
on(Award).header_award_id==@award_id
|
44
|
+
else
|
45
|
+
false
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def on_tm?
|
50
|
+
!(on(Award).t_m_button.exist?)
|
51
|
+
end
|
52
|
+
|
53
|
+
end # AwardTransactionObject
|
54
|
+
|
55
|
+
class TransactionCollection < Array
|
56
|
+
|
57
|
+
end # TransactionCollection
|
@@ -0,0 +1,114 @@
|
|
1
|
+
class BudgetPeriodObject
|
2
|
+
|
3
|
+
include Foundry
|
4
|
+
include DataFactory
|
5
|
+
include StringFactory
|
6
|
+
include Navigation
|
7
|
+
|
8
|
+
attr_accessor :document_id, :budget_name, :number, :start_date, :end_date,
|
9
|
+
:total_sponsor_cost, :direct_cost, :f_and_a_cost, :unrecovered_f_and_a,
|
10
|
+
:cost_sharing, :cost_limit, :direct_cost_limit, :datified
|
11
|
+
|
12
|
+
def initialize(browser, opts={})
|
13
|
+
@browser = browser
|
14
|
+
|
15
|
+
defaults = {
|
16
|
+
doc_type: 'Budget Document ' # Note: the trailing space is not a typo!
|
17
|
+
}
|
18
|
+
|
19
|
+
set_options(defaults.merge(opts))
|
20
|
+
requires :document_id, :budget_name, :start_date
|
21
|
+
datify
|
22
|
+
end
|
23
|
+
|
24
|
+
def create
|
25
|
+
navigate
|
26
|
+
on Parameters do |create|
|
27
|
+
create.period_start_date.fit @start_date
|
28
|
+
create.period_end_date.fit @end_date
|
29
|
+
create.total_sponsor_cost.fit @total_sponsor_cost
|
30
|
+
fill_out create, :direct_cost, :cost_sharing, :cost_limit, :direct_cost_limit
|
31
|
+
create.fa_cost.fit @f_and_a_cost
|
32
|
+
create.unrecovered_fa_cost.fit @unrecoverd_f_and_a
|
33
|
+
create.add_budget_period
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def edit opts={}
|
38
|
+
navigate
|
39
|
+
on Parameters do |edit|
|
40
|
+
edit.start_date_period(@number).fit opts[:start_date]
|
41
|
+
edit.end_date_period(@number).fit opts[:end_date]
|
42
|
+
# TODO: At some point it may become critical for the data object to automatically "know" that the total sponsor cost
|
43
|
+
# is always the sum of the direct and f&a costs.
|
44
|
+
dollar_fields.each do |field|
|
45
|
+
edit.send("#{field}_period", @number).fit opts[field]
|
46
|
+
end
|
47
|
+
edit.save
|
48
|
+
break if edit.errors.size > 0
|
49
|
+
end
|
50
|
+
set_options(opts)
|
51
|
+
datify
|
52
|
+
end
|
53
|
+
|
54
|
+
def delete
|
55
|
+
navigate
|
56
|
+
on(Parameters).delete_period @number
|
57
|
+
end
|
58
|
+
|
59
|
+
def dollar_fields
|
60
|
+
[:total_sponsor_cost, :direct_cost, :f_and_a_cost, :unrecovered_f_and_a,
|
61
|
+
:cost_sharing, :cost_limit, :direct_cost_limit]
|
62
|
+
end
|
63
|
+
|
64
|
+
# =======
|
65
|
+
private
|
66
|
+
# =======
|
67
|
+
|
68
|
+
# Nav Aids
|
69
|
+
|
70
|
+
def navigate
|
71
|
+
open_document @doc_type
|
72
|
+
unless on_page?(on(Parameters).on_off_campus) && on_budget?
|
73
|
+
on(Proposal).budget_versions
|
74
|
+
on(BudgetVersions).open @budget_name
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def on_budget?
|
79
|
+
begin
|
80
|
+
on(Parameters).budget_name==@budget_name
|
81
|
+
rescue Selenium::WebDriver::Error::StaleElementReferenceError
|
82
|
+
false
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
# This takes the period start date and converts it into a Date object
|
87
|
+
# which is then stored in @datified.
|
88
|
+
#
|
89
|
+
# It's important in the context of the Budget Periods Collection,
|
90
|
+
# which uses it to determine the order of the Periods on the page.
|
91
|
+
def datify
|
92
|
+
@datified=Date.parse(@start_date[/(?<=\/)\d+$/] + '/' + @start_date[/^\d+\/\d+/])
|
93
|
+
end
|
94
|
+
|
95
|
+
end # BudgetPeriodObject
|
96
|
+
|
97
|
+
class BudgetPeriodsCollection < Array
|
98
|
+
|
99
|
+
def period(number)
|
100
|
+
self.find { |period| period.number==number }
|
101
|
+
end
|
102
|
+
|
103
|
+
# This will update the number values of the budget periods,
|
104
|
+
# based on their start date values.
|
105
|
+
def number!
|
106
|
+
self.sort_by! { |period| period.datified }
|
107
|
+
self.each_with_index { |period, index| period.number=index+1 }
|
108
|
+
end
|
109
|
+
|
110
|
+
def total_sponsor_cost
|
111
|
+
self.collect{ |period| period.total_sponsor_cost.to_f }.inject(0, :+)
|
112
|
+
end
|
113
|
+
|
114
|
+
end # BudgetPeriodsCollection
|
@@ -0,0 +1,221 @@
|
|
1
|
+
class BudgetVersionsObject
|
2
|
+
|
3
|
+
include Foundry
|
4
|
+
include DataFactory
|
5
|
+
include StringFactory
|
6
|
+
include Navigation
|
7
|
+
|
8
|
+
attr_accessor :name, :document_id, :status,
|
9
|
+
# Stuff on Budget Versions page...
|
10
|
+
:version, :direct_cost, :f_and_a, :on_off_campus,
|
11
|
+
:total, :final, :residual_funds, :cost_sharing, :unrecovered_fa,
|
12
|
+
:comments, :f_and_a_rate_type, :last_updated, :last_updated_by,
|
13
|
+
# Stuff on the Parameters page...
|
14
|
+
:project_start_date, :project_end_date, :total_direct_cost_limit,
|
15
|
+
:budget_periods, :unrecovered_fa_rate_type, :f_and_a_rate_type,
|
16
|
+
:submit_cost_sharing, :residual_funds, :total_cost_limit,
|
17
|
+
:subaward_budgets
|
18
|
+
|
19
|
+
|
20
|
+
def initialize(browser, opts={})
|
21
|
+
@browser = browser
|
22
|
+
|
23
|
+
defaults = {
|
24
|
+
name: random_alphanums_plus(40),
|
25
|
+
cost_sharing: '0.00',
|
26
|
+
f_and_a: '0.00',
|
27
|
+
budget_periods: BudgetPeriodsCollection.new,
|
28
|
+
subaward_budgets: SubawardBudgetCollection.new
|
29
|
+
}
|
30
|
+
|
31
|
+
set_options(defaults.merge(opts))
|
32
|
+
requires :document_id, :doc_type
|
33
|
+
end
|
34
|
+
|
35
|
+
def create
|
36
|
+
navigate
|
37
|
+
on BudgetVersions do |add|
|
38
|
+
@doc_header=add.doc_title
|
39
|
+
add.name.set @name
|
40
|
+
add.add
|
41
|
+
add.final(@name).fit @final
|
42
|
+
add.budget_status(@name).pick! @status
|
43
|
+
add.save
|
44
|
+
break if parameters.compact==nil # No reason to continue if there aren't other things to do
|
45
|
+
# Otherwise, go to parameters page and fill out the rest of the stuff...
|
46
|
+
add.open(@name)
|
47
|
+
end
|
48
|
+
#TODO: This needs to be dealt with more intelligently.
|
49
|
+
# It's clear that we need to learn more about how to set up
|
50
|
+
# sponsors better, so that we can predict when this dialog
|
51
|
+
# will show up and when it won't...
|
52
|
+
confirmation
|
53
|
+
on Parameters do |parameters|
|
54
|
+
@project_start_date=parameters.project_start_date
|
55
|
+
@project_end_date=parameters.project_end_date
|
56
|
+
parameters.total_direct_cost_limit.fit @total_direct_cost_limit
|
57
|
+
fill_out parameters, :comments, :modular_budget,
|
58
|
+
:residual_funds, :total_cost_limit, :unrecovered_fa_rate_type,
|
59
|
+
:f_and_a_rate_type, :submit_cost_sharing
|
60
|
+
parameters.on_off_campus.fit @on_off_campus
|
61
|
+
parameters.alert.ok if parameters.alert.exists?
|
62
|
+
parameters.save
|
63
|
+
end
|
64
|
+
confirmation
|
65
|
+
get_budget_periods
|
66
|
+
end
|
67
|
+
|
68
|
+
def add_period opts={}
|
69
|
+
defaults={
|
70
|
+
document_id: @document_id,
|
71
|
+
budget_name: @name,
|
72
|
+
doc_type: @doc_header
|
73
|
+
}
|
74
|
+
opts.merge!(defaults)
|
75
|
+
|
76
|
+
bp = create BudgetPeriodObject, opts
|
77
|
+
return if on(Parameters).errors.size > 0 # No need to continue the method if we have an error
|
78
|
+
@budget_periods << bp
|
79
|
+
@budget_periods.number! # This updates the number value of all periods, as necessary
|
80
|
+
end
|
81
|
+
|
82
|
+
def edit_period number, opts={}
|
83
|
+
@budget_periods.period(number).edit opts
|
84
|
+
@budget_periods.number!
|
85
|
+
end
|
86
|
+
|
87
|
+
def delete_period number
|
88
|
+
@budget_periods.period(number).delete
|
89
|
+
@budget_periods.delete(@budget_periods.period(number))
|
90
|
+
@budget_periods.number!
|
91
|
+
end
|
92
|
+
|
93
|
+
# Please note, this method is for VERY basic editing...
|
94
|
+
# Use it for editing the Budget Version while on the Proposal, but not the Periods
|
95
|
+
def edit opts={}
|
96
|
+
navigate
|
97
|
+
on BudgetVersions do |edit|
|
98
|
+
edit.final(@name).fit opts[:final]
|
99
|
+
edit.budget_status(@name).fit opts[:budget_status]
|
100
|
+
# TODO: More here as needed...
|
101
|
+
edit.save
|
102
|
+
end
|
103
|
+
set_options(opts)
|
104
|
+
end
|
105
|
+
|
106
|
+
def open_budget
|
107
|
+
navigate
|
108
|
+
on BudgetVersions do |page|
|
109
|
+
page.open @name
|
110
|
+
end
|
111
|
+
#TODO: This needs to be dealt with more intelligently.
|
112
|
+
# It's clear that we need to learn more about how to set up
|
113
|
+
# sponsors better, so that we can predict when this dialog
|
114
|
+
# will show up and when it won't...
|
115
|
+
confirmation
|
116
|
+
end
|
117
|
+
|
118
|
+
def copy_all_periods(new_name)
|
119
|
+
navigate
|
120
|
+
new_version_number='x'
|
121
|
+
on(BudgetVersions).copy @name
|
122
|
+
on(Confirmation).copy_all_periods
|
123
|
+
on BudgetVersions do |copy|
|
124
|
+
copy.name_of_copy.set new_name
|
125
|
+
copy.save
|
126
|
+
new_version_number=copy.version(new_name)
|
127
|
+
end
|
128
|
+
new_bv = self.clone
|
129
|
+
new_bv.name=new_name
|
130
|
+
new_bv.version=new_version_number
|
131
|
+
new_bv
|
132
|
+
end
|
133
|
+
|
134
|
+
def copy_one_period(new_name, version)
|
135
|
+
# pending resolution of a bug
|
136
|
+
end
|
137
|
+
|
138
|
+
def default_periods
|
139
|
+
open_budget
|
140
|
+
on Parameters do |page|
|
141
|
+
page.parameters unless page.parameters_button.parent.class_name=='tabright tabcurrent'
|
142
|
+
page.default_periods
|
143
|
+
end
|
144
|
+
@budget_periods.clear
|
145
|
+
get_budget_periods
|
146
|
+
end
|
147
|
+
|
148
|
+
def add_subaward_budget(opts={})
|
149
|
+
open_budget
|
150
|
+
on(Parameters).budget_actions
|
151
|
+
sab = make SubawardBudgetObject, opts
|
152
|
+
sab.create
|
153
|
+
@subaward_budgets << sab
|
154
|
+
end
|
155
|
+
|
156
|
+
# =======
|
157
|
+
private
|
158
|
+
# =======
|
159
|
+
|
160
|
+
# This is just a collection of the instance variables
|
161
|
+
# associated with the Parameters page. It's used to determine
|
162
|
+
# whether or not the create method should go to that page
|
163
|
+
# and fill stuff out.
|
164
|
+
def parameters
|
165
|
+
[@total_direct_cost_limit, @on_off_campus, @comments, @modular_budget,
|
166
|
+
@residual_funds, @total_cost_limit, @unrecovered_fa_rate_type, @f_and_a_rate_type,
|
167
|
+
@submit_cost_sharing]
|
168
|
+
end
|
169
|
+
|
170
|
+
def get_budget_periods
|
171
|
+
on Parameters do |page|
|
172
|
+
1.upto(page.period_count) do |number|
|
173
|
+
period = make BudgetPeriodObject, document_id: @document_id,
|
174
|
+
budget_name: @name, start_date: page.start_date_period(number).value,
|
175
|
+
end_date: page.end_date_period(number).value,
|
176
|
+
total_sponsor_cost: page.total_sponsor_cost_period(number).value.groom,
|
177
|
+
direct_cost: page.direct_cost_period(number).value.groom,
|
178
|
+
f_and_a_cost: page.fa_cost_period(number).value.groom,
|
179
|
+
unrecovered_f_and_a: page.unrecovered_fa_period(number).value.groom,
|
180
|
+
cost_sharing: page.cost_sharing_period(number).value.groom,
|
181
|
+
cost_limit: page.cost_limit_period(number).value.groom,
|
182
|
+
direct_cost_limit: page.direct_cost_limit_period(number).value.groom
|
183
|
+
@budget_periods << period
|
184
|
+
end
|
185
|
+
end
|
186
|
+
@budget_periods.number!
|
187
|
+
end
|
188
|
+
|
189
|
+
# Nav Aids...
|
190
|
+
|
191
|
+
def navigate
|
192
|
+
@doc_header ||= @doc_type
|
193
|
+
open_document @doc_header
|
194
|
+
on(Proposal).budget_versions unless on_page?(on(BudgetVersions).name)
|
195
|
+
end
|
196
|
+
|
197
|
+
# Use this if the confirmation dialog may appear
|
198
|
+
# due to missing rates...
|
199
|
+
def confirmation
|
200
|
+
begin
|
201
|
+
on(Confirmation) do |conf|
|
202
|
+
conf.yes if conf.yes_button.present?
|
203
|
+
end
|
204
|
+
rescue
|
205
|
+
# do nothing because the dialog isn't there
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
end # BudgetVersionsObject
|
210
|
+
|
211
|
+
class BudgetVersionsCollection < Array
|
212
|
+
|
213
|
+
def budget(name)
|
214
|
+
self.find { |budget| budget.name==name }
|
215
|
+
end
|
216
|
+
|
217
|
+
def copy_all_periods(name, new_name)
|
218
|
+
self << self.budget(name).copy_all_periods(new_name)
|
219
|
+
end
|
220
|
+
|
221
|
+
end # BudgetVersionsCollection
|