ole-qa-framework 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. data/CHANGELOG.md +882 -0
  2. data/Gemfile +4 -0
  3. data/Gemfile.lock +45 -0
  4. data/LICENSE.md +14 -0
  5. data/README.md +17 -0
  6. data/Rakefile.rb +25 -0
  7. data/examples/README.md +57 -0
  8. data/examples/create_bib_record.rb +64 -0
  9. data/examples/create_requisition.rb +96 -0
  10. data/examples/purap_workflow_test.rb +185 -0
  11. data/lib/common/common_object.rb +57 -0
  12. data/lib/common/data_object.rb +21 -0
  13. data/lib/common/line_object.rb +44 -0
  14. data/lib/common/page.rb +72 -0
  15. data/lib/common/subline_object.rb +47 -0
  16. data/lib/config/default_options.yml +7 -0
  17. data/lib/docstore/docstore.rb +13 -0
  18. data/lib/module/qa_data_helpers.rb +17 -0
  19. data/lib/module/qa_helpers.rb +153 -0
  20. data/lib/module/qa_page_helpers.rb +33 -0
  21. data/lib/ole-qa-framework.rb +178 -0
  22. data/lib/ole_qa_framework/COMPATIBILITY.rb +20 -0
  23. data/lib/ole_qa_framework/VERSION.rb +20 -0
  24. data/lib/olefs/common/e_doc.rb +79 -0
  25. data/lib/olefs/common/line_object.rb +39 -0
  26. data/lib/olefs/common/lookup.rb +30 -0
  27. data/lib/olefs/common/purap_document.rb +73 -0
  28. data/lib/olefs/objects/line_item.rb +105 -0
  29. data/lib/olefs/objects/new_line_item.rb +44 -0
  30. data/lib/olefs/objects/new_preq_line_item.rb +43 -0
  31. data/lib/olefs/objects/new_receiving_line.rb +42 -0
  32. data/lib/olefs/objects/preq_line_item.rb +68 -0
  33. data/lib/olefs/objects/receiving_line.rb +88 -0
  34. data/lib/olefs/pages/building_lookup.rb +36 -0
  35. data/lib/olefs/pages/main_menu.rb +23 -0
  36. data/lib/olefs/pages/payment_request.rb +67 -0
  37. data/lib/olefs/pages/payment_request_creation.rb +44 -0
  38. data/lib/olefs/pages/purchase_order.rb +68 -0
  39. data/lib/olefs/pages/receiving_document.rb +49 -0
  40. data/lib/olefs/pages/requisition.rb +61 -0
  41. data/lib/olefs/pages/vendor_lookup.rb +40 -0
  42. data/lib/olefs/subobjects/accounting_line.rb +46 -0
  43. data/lib/olefs/subobjects/copies_line.rb +32 -0
  44. data/lib/olefs/subobjects/exception_notes_line.rb +26 -0
  45. data/lib/olefs/subobjects/invoice_notes_line.rb +25 -0
  46. data/lib/olefs/subobjects/new_accounting_line.rb +43 -0
  47. data/lib/olefs/subobjects/new_copies_line.rb +37 -0
  48. data/lib/olefs/subobjects/new_exception_notes_line.rb +30 -0
  49. data/lib/olefs/subobjects/new_invoice_notes_line.rb +35 -0
  50. data/lib/olefs/subobjects/new_notes_line.rb +36 -0
  51. data/lib/olefs/subobjects/new_receipt_notes_line.rb +35 -0
  52. data/lib/olefs/subobjects/notes_line.rb +29 -0
  53. data/lib/olefs/subobjects/processing_line.rb +24 -0
  54. data/lib/olefs/subobjects/receipt_notes_line.rb +25 -0
  55. data/lib/olels/common/e_doc.rb +23 -0
  56. data/lib/olels/common/editor.rb +92 -0
  57. data/lib/olels/common/line_object.rb +39 -0
  58. data/lib/olels/common/lookup.rb +30 -0
  59. data/lib/olels/objects/access_info_line.rb +25 -0
  60. data/lib/olels/objects/data_line.rb +31 -0
  61. data/lib/olels/objects/editor_note.rb +79 -0
  62. data/lib/olels/objects/holdings_note.rb +26 -0
  63. data/lib/olels/objects/item_note.rb +26 -0
  64. data/lib/olels/objects/ownership_extent_line.rb +40 -0
  65. data/lib/olels/pages/bib_editor.rb +63 -0
  66. data/lib/olels/pages/describe_workbench.rb +42 -0
  67. data/lib/olels/pages/instance_editor.rb +80 -0
  68. data/lib/olels/pages/item_editor.rb +91 -0
  69. data/lib/olels/pages/loan.rb +102 -0
  70. data/lib/olels/pages/main_menu.rb +31 -0
  71. data/lib/olels/pages/patron_lookup.rb +44 -0
  72. data/lib/olels/pages/return.rb +64 -0
  73. data/lib/olels/subobjects/ownership_note.rb +26 -0
  74. data/ole-qa-framework.gemspec +30 -0
  75. data/pkg/ole-qa-framework-2.1.0.gem +0 -0
  76. data/spec/common/browser_spec.rb +37 -0
  77. data/spec/common/data_object_spec.rb +37 -0
  78. data/spec/common/line_object_spec.rb +49 -0
  79. data/spec/common/page_spec.rb +44 -0
  80. data/spec/common/subline_object_spec.rb +54 -0
  81. data/spec/modules/qa_helpers_spec.rb +55 -0
  82. data/spec/modules/qa_page_helpers_spec.rb +43 -0
  83. data/spec/olefs/accounting_line_spec.rb +85 -0
  84. data/spec/olefs/building_lookup_spec.rb +45 -0
  85. data/spec/olefs/copies_line_spec.rb +70 -0
  86. data/spec/olefs/edocs_spec.rb +75 -0
  87. data/spec/olefs/exception_notes_line_spec.rb +52 -0
  88. data/spec/olefs/invoice_notes_line_spec.rb +45 -0
  89. data/spec/olefs/line_item_spec.rb +155 -0
  90. data/spec/olefs/lookup_spec.rb +44 -0
  91. data/spec/olefs/main_menu_spec.rb +34 -0
  92. data/spec/olefs/notes_line_spec.rb +65 -0
  93. data/spec/olefs/patron_lookup_spec.rb +54 -0
  94. data/spec/olefs/payment_request_spec.rb +85 -0
  95. data/spec/olefs/preq_creation_spec.rb +43 -0
  96. data/spec/olefs/preq_line_item_spec.rb +111 -0
  97. data/spec/olefs/processing_line_spec.rb +44 -0
  98. data/spec/olefs/purap_document_spec.rb +58 -0
  99. data/spec/olefs/purchase_order_spec.rb +77 -0
  100. data/spec/olefs/receipt_notes_line_spec.rb +54 -0
  101. data/spec/olefs/receive_spec.rb +66 -0
  102. data/spec/olefs/receiving_line_spec.rb +125 -0
  103. data/spec/olefs/requisition_spec.rb +83 -0
  104. data/spec/olefs/vendor_lookup_spec.rb +49 -0
  105. data/spec/olels/access_info_line_spec.rb +40 -0
  106. data/spec/olels/bib_editor_spec.rb +84 -0
  107. data/spec/olels/data_line_spec.rb +44 -0
  108. data/spec/olels/describe_workbench_spec.rb +44 -0
  109. data/spec/olels/editor_spec.rb +56 -0
  110. data/spec/olels/edocs_spec.rb +42 -0
  111. data/spec/olels/holdings_note_spec_spec.rb +41 -0
  112. data/spec/olels/instance_editor_spec.rb +81 -0
  113. data/spec/olels/item_editor_spec.rb +94 -0
  114. data/spec/olels/item_note_spec.rb +41 -0
  115. data/spec/olels/loan_spec.rb +104 -0
  116. data/spec/olels/lookup_spec.rb +38 -0
  117. data/spec/olels/main_menu_spec.rb +35 -0
  118. data/spec/olels/ownership_extent_line_spec.rb +58 -0
  119. data/spec/olels/ownership_note_spec.rb +41 -0
  120. data/spec/olels/return_spec.rb +72 -0
  121. data/spec/spec_helper.rb +21 -0
  122. data/spec/workflows/purap_spec.rb +221 -0
  123. metadata +313 -0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ole-qa-framework.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,45 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ole-qa-framework (2.1.0)
5
+ headless
6
+ rspec
7
+ watir-webdriver
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ childprocess (0.3.9)
13
+ ffi (~> 1.0, >= 1.0.11)
14
+ diff-lcs (1.2.4)
15
+ ffi (1.9.0)
16
+ headless (1.0.1)
17
+ multi_json (1.7.7)
18
+ rake (10.1.0)
19
+ rspec (2.13.0)
20
+ rspec-core (~> 2.13.0)
21
+ rspec-expectations (~> 2.13.0)
22
+ rspec-mocks (~> 2.13.0)
23
+ rspec-core (2.13.1)
24
+ rspec-expectations (2.13.0)
25
+ diff-lcs (>= 1.1.3, < 2.0)
26
+ rspec-mocks (2.13.1)
27
+ rubyzip (0.9.9)
28
+ selenium-webdriver (2.33.0)
29
+ childprocess (>= 0.2.5)
30
+ multi_json (~> 1.0)
31
+ rubyzip
32
+ websocket (~> 1.0.4)
33
+ watir-webdriver (0.6.4)
34
+ selenium-webdriver (>= 2.18.0)
35
+ websocket (1.0.7)
36
+ yard (0.8.6.2)
37
+
38
+ PLATFORMS
39
+ ruby
40
+
41
+ DEPENDENCIES
42
+ bundler (~> 1.3)
43
+ ole-qa-framework!
44
+ rake
45
+ yard
data/LICENSE.md ADDED
@@ -0,0 +1,14 @@
1
+ ### Copyright 2005-2013 The Kuali Foundation
2
+ - - -
3
+
4
+ Licensed under the Educational Community License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at:
7
+
8
+ http://www.opensource.org/licenses/ecl2.php
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,17 @@
1
+ # Kuali Open Library Environment
2
+ http://www.kuali.org/ole
3
+ - - -
4
+ ## OLE QA Testing Framework
5
+ - - -
6
+
7
+ ### Open Library Environment Quality Assurance Testing Framework
8
+ - - -
9
+ This is a testing framework for the Kuali Open Library environment. It
10
+ will be used to define OLE pages and screen elements for OLE test scripts
11
+ and the OLE Smoke Test Application.
12
+
13
+ ### Usage Examples
14
+ - - -
15
+ The examples directory contains some minimal example scripts to show
16
+ how the testing framework can be used to fulfill common OLE
17
+ use case scenarios.
data/Rakefile.rb ADDED
@@ -0,0 +1,25 @@
1
+ # Copyright 2005-2013 The Kuali Foundation
2
+ #
3
+ # Licensed under the Educational Community License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at:
6
+ #
7
+ # http://www.opensource.org/licenses/ecl2.php
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ libdir = File.expand_path(File.dirname(__FILE__))
16
+ $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
17
+
18
+ require 'rubygems'
19
+ require 'rspec/core/rake_task'
20
+ require 'bundler/gem_tasks'
21
+
22
+ desc "Print the current version number."
23
+ task :version do
24
+ puts OLE_QA::Framework::VERSION
25
+ end
@@ -0,0 +1,57 @@
1
+ # OLE QA Testing Framework
2
+ ## Examples
3
+ - - -
4
+
5
+ ### Create Bib Record
6
+ create_bib_record.rb
7
+
8
+ This example file shows the simplest way to create a minimal
9
+ MARC bibliographic record in the OLE Library System using this
10
+ Test Framework. It creates the record directly in the editor,
11
+ saves the record, then closes out the session. It does not
12
+ contain any asserts or rescues, so Selenium Errors and OLE
13
+ Errors are not handled.
14
+
15
+ For the sake of simplicity, random text is used to fulfill the
16
+ minimum criteria of a leader string and a control field string.
17
+
18
+ * Bib Record
19
+ * Leader - 'HelloWorld'
20
+ * Control Line - '008','HelloWorld'
21
+ * Title - '245','','','$aStardust'
22
+ * Author - '100','1','','$aNeil Gaiman'
23
+
24
+ ### Create Requisition
25
+ create_requisition.rb
26
+
27
+ This example file shows the simplest straight-through path
28
+ to create a requisition with the minimum requirements for approval:
29
+ a vendor, a delivery address, a requestor phone number, and a line
30
+ item consisting of a bibliographic record with a title, a list price,
31
+ and an accounting string for the purchase to be applied to.
32
+
33
+ This script contains only one error-checking line: at the end of the
34
+ script, there will be an if-elsif-else clause wherein the script first
35
+ checks for a success message upon submission of the requisition, and
36
+ prints it if found, and if not, checks for an error message, and prints
37
+ it if found. If the script finds no success message and no error message,
38
+ it prints whatever message it finds in the appropriate div, with the
39
+ element name requisition.generic_message.
40
+
41
+ * Bib Record
42
+ * Leader - 'HelloWorld'
43
+ * Control Line - '008','HelloWorld'
44
+ * Title - '245','Where is Joe Merchant?'
45
+ * Line Item
46
+ * List Price - '23.00'
47
+ * Accounting Chart Code - 'BL' (Bloomington)
48
+ * Account Number - '2947494' (Linguistics)
49
+ * Object Code - '7112' (Monographs)
50
+ * Percentage - '100.00'
51
+ * Vendor
52
+ * YBP Library Services
53
+ * Delivery
54
+ * Building - 'Wells Library'
55
+ * Room Number - '100'
56
+ * Requestor Info
57
+ * Phone Number - '812-555-5555' (Bloomington, Non-Usable Number)
@@ -0,0 +1,64 @@
1
+ # Copyright 2005-2013 The Kuali Foundation
2
+ #
3
+ # Licensed under the Educational Community License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at:
6
+ #
7
+ # http://www.opensource.org/licenses/ecl2.php
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'ole-qa-framework'
16
+
17
+ # Start a new instance of the OLE Testing Framework.
18
+ # Do not run the browser in headless mode.
19
+ ole = OLE_QA::Framework::Session.new(:headless? => false)
20
+
21
+ # Create an instance of the OLELS Bib Editor Page.
22
+ bib_editor = OLE_QA::Framework::OLELS::Bib_Editor.new(ole)
23
+
24
+ # Open the page directly via URL.
25
+ # Automatically select the iframe with ID "iframeporlet"
26
+ # (the screen context in which most OLE functions are found).
27
+ bib_editor.open
28
+
29
+ # Enter a control line with tag "008" and a value of "HelloWorld"
30
+ bib_editor.control_008_link.click
31
+ bib_editor.control_008_field.wait_until_present
32
+ bib_editor.control_008_field.set("HelloWorld")
33
+
34
+ # Enter a Marc field & subfield line of
35
+ # "245 # # $aStardust"
36
+ bib_editor.data_line_1.tag_field.set("245")
37
+ bib_editor.data_line_1.data_field.set("|aStardust")
38
+
39
+ # Add another data line.
40
+ bib_editor.data_line_1.add_button.click
41
+ bib_editor.add_data_line(2)
42
+
43
+ # Enter a Marc field & subfield line
44
+ # "100 1 # $aNeil Gaiman"
45
+ bib_editor.data_line_2.tag_field.wait_until_present
46
+ bib_editor.data_line_2.tag_field.set("100")
47
+ bib_editor.data_line_2.ind1_field.set("1")
48
+ bib_editor.data_line_2.data_field.set("|aNeil Gaiman")
49
+
50
+ # Set the header fields before saving
51
+ bib_editor.set_button.click
52
+
53
+ # Save the record.
54
+ bib_editor.submit_button.click
55
+
56
+ # Print whatever message appears to the command line.
57
+ bib_editor.message.wait_until_present
58
+ puts bib_editor.message.text
59
+
60
+ # Return to the OLE Library System Main Menu via URL.
61
+ ole.browser.goto(ole.ls_url)
62
+
63
+ # Shut down the OLE Testing Framework.
64
+ ole.quit
@@ -0,0 +1,96 @@
1
+ # Copyright 2005-2013 The Kuali Foundation
2
+ #
3
+ # Licensed under the Educational Community License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at:
6
+ #
7
+ # http://www.opensource.org/licenses/ecl2.php
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'ole-qa-framework'
16
+
17
+ # Start a new instance of the OLE Testing Framework.
18
+ # Do not run the browser in headless mode.
19
+ ole = OLE_QA::Framework::Session.new(:headless? => false)
20
+
21
+ # Create an instance of the OLEFS Requisition Page.
22
+ requisition = OLE_QA::Framework::OLEFS::Requisition.new(ole)
23
+
24
+ # Open the page directly via URL.
25
+ requisition.open
26
+
27
+ # Select a Delivery Location of Wells Library, Room 100
28
+ requisition.delivery_tab_toggle.click
29
+ requisition.building_search_icon.click
30
+ building_lookup = OLE_QA::Framework::OLEFS::Building_Lookup.new(ole)
31
+ building_lookup.building_name_field.set("Wells Library")
32
+ building_lookup.search_button.click
33
+ building_lookup.element(:return_building_link) {building_lookup.browser.a(:xpath => "//td[contains(text(),'Wells Library')]/preceding-sibling::td[3]/a")}
34
+ building_lookup.return_building_link.click
35
+ requisition.room_field.set("100")
36
+
37
+ # Select a Vendor
38
+ requisition.vendor_tab_toggle.click
39
+ requisition.vendor_search_icon.wait_until_present
40
+ requisition.vendor_search_icon.click
41
+ vendor_lookup = OLE_QA::Framework::OLEFS::Vendor_Lookup.new(ole)
42
+ vendor_lookup.vendor_name_field.set("YBP")
43
+ vendor_lookup.search_button.click
44
+ vendor_lookup.element(:return_vendor_link) {vendor_lookup.browser.a(:xpath => "//td[a[contains(text(),'YBP Library Services')]]/preceding-sibling::td[1]/a")}
45
+ vendor_lookup.return_vendor_link.click
46
+
47
+ # Enter a Bibliographic Record on the first Line Item
48
+ # - Use the minimum requisition requirement of a Title.
49
+ # - Use the Bib Editor minimum requirement of an 008 field and a leader field.
50
+ # - Print the success or failure message from the Bib Editor to the command line.
51
+ requisition.new_line_item.new_bib_button.click
52
+ ole.browser.windows[-1].use
53
+ bib_editor = OLE_QA::Framework::OLELS::Bib_Editor.new(ole)
54
+ bib_editor.wait_for_page_to_load
55
+ bib_editor.control_008_link.click
56
+ bib_editor.control_008_field.wait_until_present
57
+ bib_editor.control_008_field.set("HelloWorld")
58
+ bib_editor.data_line_1.tag_field.set("245")
59
+ bib_editor.data_line_1.data_field.set("|aWhere is Joe Merchant?")
60
+ bib_editor.set_button.click
61
+ bib_editor.submit_button.click
62
+ bib_editor.message.wait_until_present
63
+ puts bib_editor.message.text
64
+ bib_editor.close_button.click
65
+ ole.browser.windows[0].use
66
+
67
+ # Enter a list price for the Line Item
68
+ requisition.new_line_item.list_price_field.set("23.00")
69
+
70
+ # Add the Line Item
71
+ requisition.new_line_item.add_button.click
72
+ requisition.create_line_item(1)
73
+
74
+ # Apply the 100% of the Line Item's cost to Acct 2947494, Obj Code 7112
75
+ requisition.line_item_1.accounting_lines_toggle.click
76
+ requisition.line_item_1.new_accounting_line.chart_selector.select("BL")
77
+ requisition.line_item_1.new_accounting_line.account_number_field.set("2947494")
78
+ requisition.line_item_1.new_accounting_line.object_field.set("7112")
79
+ requisition.line_item_1.new_accounting_line.percent_field.set("100.00")
80
+ requisition.line_item_1.new_accounting_line.add_button.click
81
+
82
+ # Enter a Requestor Phone Number in Additional Institutional Info
83
+ requisition.additional_info_tab_toggle.click
84
+ requisition.additional_info_phone_number_field.wait_until_present
85
+ requisition.additional_info_phone_number_field.set("812-555-5555")
86
+
87
+ # Save the Requisition
88
+ requisition.save_button.click
89
+
90
+ # Submit the Requisition and print any resulting message to the command line.
91
+ requisition.submit_button.click
92
+ requisition.generic_message.wait_until_present
93
+ puts requisition.generic_message.text
94
+
95
+ # Exit
96
+ ole.quit
@@ -0,0 +1,185 @@
1
+ # Copyright 2005-2013 The Kuali Foundation
2
+ #
3
+ # Licensed under the Educational Community License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at:
6
+ #
7
+ # http://www.opensource.org/licenses/ecl2.php
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require "ole-qa-framework"
16
+
17
+ # Start a new instance of the OLE Testing Framework.
18
+ # Do not run the browser in headless mode.
19
+ ole = OLE_QA::Framework::Session.new(:headless? => false)
20
+
21
+ # Capture the start time in MM/DD/YYYY format.
22
+ time = Time.now.strftime("%m/%d/%y")
23
+
24
+ # Open a new requisition.
25
+ requisition = OLE_QA::Framework::OLEFS::Requisition.new(ole)
26
+ requisition.open
27
+
28
+ # Set the description field to "PURAP Workflow Test - MM/DD/YYYY".
29
+ requisition.description_field.set("PURAP Workflow Test - #{time}")
30
+
31
+ # Set the delivery address to Wells Library, Room 100.
32
+ requisition.delivery_tab_toggle.click
33
+ requisition.building_search_icon.click
34
+ building_lookup = OLE_QA::Framework::OLEFS::Building_Lookup.new(ole)
35
+ building_lookup.wait_for_page_to_load
36
+ building_lookup.building_name_field.set("Wells Library")
37
+ building_lookup.search_button.click
38
+ building_lookup.browser.a(:xpath => "//td[contains(text(),'Wells Library')]/preceding-sibling::td[3]/a").click
39
+ requisition.wait_for_page_to_load
40
+ requisition.room_field.set("100")
41
+ requisition.delivery_tab_toggle.click
42
+
43
+ # Select "YBP Library Services" as the vendor.
44
+ requisition.vendor_tab_toggle.click
45
+ requisition.vendor_search_icon.click
46
+ vendor_lookup = OLE_QA::Framework::OLEFS::Vendor_Lookup.new(ole)
47
+ vendor_lookup.wait_for_page_to_load
48
+ vendor_lookup.vendor_name_field.set("YBP")
49
+ vendor_lookup.search_button.click
50
+ vendor_lookup.browser.a(:xpath => "//td[a[contains(text(),'YBP Library Services')]]/preceding-sibling::td[1]/a").click
51
+ requisition.wait_for_page_to_load
52
+ requisition.vendor_tab_toggle.click
53
+
54
+ # Add a Bib Record to the new line item with a title only.
55
+ requisition.new_line_item.new_bib_button.click
56
+ ole.browser.windows[-1].use
57
+ bib_editor = OLE_QA::Framework::OLELS::Bib_Editor.new(ole)
58
+ bib_editor.wait_for_page_to_load
59
+ bib_editor.control_008_link.click
60
+ bib_editor.control_008_field.wait_until_present
61
+ bib_editor.control_008_field.set("HELLOWORLD")
62
+ bib_editor.data_line_1.tag_field.set("245")
63
+ bib_editor.data_line_1.data_field.set("|aTitle of Book")
64
+ bib_editor.set_button.click
65
+ bib_editor.submit_button.click
66
+ bib_editor.close_button.click
67
+ ole.browser.windows[0].use
68
+
69
+ # Set the list price to $235.00 and add the line item.
70
+ requisition.new_line_item.list_price_field.set("235.00")
71
+ requisition.new_line_item.add_button.click
72
+ requisition.add_line_item(1)
73
+ requisition.wait_for_page_to_load
74
+
75
+ # Open the line item's accounting lines subtab and add an accounting string.
76
+ # Chart - Bloomington
77
+ # Account - 2947494
78
+ # Object - 7112
79
+ # Percentage - 100
80
+ requisition.line_item_1.accounting_lines_toggle.click
81
+ requisition.line_item_1.new_accounting_line.chart_selector.wait_until_present
82
+ requisition.line_item_1.new_accounting_line.chart_selector.select("BL")
83
+ requisition.line_item_1.new_accounting_line.account_number_field.set("2947494")
84
+ requisition.line_item_1.new_accounting_line.object_field.set("7112")
85
+ requisition.line_item_1.new_accounting_line.percent_field.set("100.00")
86
+ requisition.line_item_1.new_accounting_line.add_button.click
87
+ requisition.line_item_1.add_accounting_line(1)
88
+ requisition.line_item_1.accounting_line_1.chart_selector.wait_until_present
89
+
90
+ # Open the Additional Information tab and add a phone number.
91
+ requisition.additional_info_tab_toggle.click
92
+ requisition.additional_info_phone_number_field.set("812-555-5555")
93
+
94
+ # Submit the requisition and wait for a message to appear.
95
+ # Display that message on the command line.
96
+ requisition.submit_button.click
97
+ requisition.wait_for_page_to_load
98
+ requisition.generic_message.wait_until_present
99
+ puts "Requisition:".ljust(20) + "#{requisition.generic_message.text.strip}"
100
+
101
+ # Reload the requisition.
102
+ requisition.reload_button.click
103
+ requisition.wait_for_page_to_load
104
+
105
+ # Open the View Related tab and check for a purchase order link.
106
+ requisition.view_related_tab_toggle.click
107
+ requisition.view_related_po_link.wait_until_present
108
+
109
+
110
+
111
+ # Get the requisition's Document ID. This will be needed to re-open the requisition later.
112
+ requisition_id = requisition.document_id.text.strip
113
+
114
+ # Get the text of the purchase order link in the View Related tab.
115
+ po_link_text = requisition.view_related_po_link.text.strip
116
+
117
+ # Use a basic spin assert to check whether the requisition has created an approved purchase order yet.
118
+ # Set the timeout to 30 seconds from now.
119
+ end_time = Time.now + 30
120
+ # Wait for a signal since until isn't wrapped in a method.
121
+ catch :done do
122
+ # Repeat this loop until either the timeout expires or the loop is broken.
123
+ until Time.now > end_time
124
+ # Repeat this loop this on a one second interval.
125
+ sleep 1
126
+ # Reopen the requisition.
127
+ ole.browser.goto("http://tst.ole.kuali.org/kew/DocHandler.do?command=displayDocSearchView&docId=#{requisition_id}")
128
+ requisition.wait_for_page_to_load
129
+ # Check the Purchase Order link text in the View Related tab.
130
+ requisition.view_related_tab_toggle.click
131
+ requisition.view_related_po_link.wait_until_present
132
+ po_link_text = requisition.view_related_po_link.text.strip
133
+ # Break out of this loop if the Purchase Order link has a non-asterisk text value.
134
+ throw :done unless po_link_text == '********'
135
+ end
136
+ end
137
+
138
+ # Open the purchase order.
139
+ ole.browser.goto(requisition.view_related_po_link.href)
140
+ purchase_order = OLE_QA::Framework::OLEFS::Purchase_Order.new(ole)
141
+ purchase_order.wait_for_page_to_load
142
+
143
+ # Get the purchase order number and the purchase order's total.
144
+ # These will be used to create the payment request.
145
+ po_number = purchase_order.document_type_id.text.strip
146
+ po_total = purchase_order.grand_total_field.text.strip
147
+
148
+ # Receive the purchase order.
149
+ purchase_order.receiving_button.click
150
+ receiving_doc = OLE_QA::Framework::OLEFS::Receiving_Document.new(ole)
151
+ receiving_doc.wait_for_page_to_load
152
+ receiving_doc.create_receiving_line(1)
153
+ receiving_doc.submit_button.click
154
+ receiving_doc.wait_for_page_to_load
155
+ # Wait for a message to appear after submitting the receiving document.
156
+ # Print that message to the command line.
157
+ receiving_doc.generic_message.wait_until_present
158
+ puts "Receiving:".ljust(20) + "#{receiving_doc.generic_message.text.strip}"
159
+
160
+ # Get a random string of 12 alphanumeric characters to use as the invoice number.
161
+ invoice_number = Array.new(12){rand(36).to_s(36)}.join
162
+
163
+ # Open the payment request creation screen, fill in invoice information,
164
+ # and create the payment request.
165
+ payment_request_create_screen = OLE_QA::Framework::OLEFS::PREQ_Creation.new(ole)
166
+ payment_request_create_screen.open
167
+ payment_request_create_screen.purchase_order_number_field.set(po_number)
168
+ payment_request_create_screen.invoice_date_field.set(time)
169
+ payment_request_create_screen.invoice_number_field.set(invoice_number)
170
+ payment_request_create_screen.invoice_amount_field.set(po_total)
171
+ payment_request_create_screen.continue_button.click
172
+
173
+ # Calculate and approve the payment request once it opens.
174
+ payment_request = OLE_QA::Framework::OLEFS::Payment_Request.new(ole)
175
+ payment_request.wait_for_page_to_load
176
+ payment_request.payment_method_selector.select("Check")
177
+ payment_request.calculate_button.click
178
+ payment_request.wait_for_page_to_load
179
+ payment_request.approve_button.click
180
+
181
+ # Print a final status message to the command line.
182
+ puts "Payment Request:".ljust(20) + 'Approved.' unless payment_request.generic_message.present?
183
+
184
+ # Exit the OLE QA Testing Framework session.
185
+ ole.quit