123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 |
- require 'browser_test_helper'
- class AdminObjectManagerTreeSelectTest < TestCase
- def test_basic_a
- @browser = browser_instance
- login(
- username: 'master@example.com',
- password: 'test',
- url: browser_url,
- )
- tasks_close_all()
- object_manager_attribute_create(
- data: {
- name: 'browser_test_tree_select1',
- display: 'Browser Test TreeSelect1',
- data_type: 'Tree Select',
- data_option: {
- options: {
- 'Incident' => {
- 'Hardware' => {
- 'Monitor' => {},
- 'Mouse' => {},
- 'Keyboard' => {},
- },
- 'Softwareproblem' => {
- 'CRM' => {},
- 'EDI' => {},
- 'SAP' => {
- 'Authentication' => {},
- 'Not reachable' => {},
- },
- 'MS Office' => {
- 'Excel' => {},
- 'PowerPoint' => {},
- 'Word' => {},
- 'Outlook' => {},
- },
- },
- },
- 'Service request' => {
- 'New software requirement' => {},
- 'New hardware' => {},
- 'Consulting' => {},
- },
- 'Change request' => {},
- },
- },
- },
- )
- watch_for(
- css: '.content.active',
- value: 'Database Update required',
- )
- click(css: '.content.active .tab-pane.active div.js-execute')
- watch_for(
- css: '.modal',
- value: 'restart',
- )
- watch_for_disappear(
- css: '.modal',
- timeout: 240,
- )
- sleep 5
- watch_for(
- css: '.content.active',
- )
- # discard new attribute
- click(css: 'a[href="#manage"]')
- click(css: 'a[href="#system/object_manager"]')
- watch_for(
- css: '.content.active table',
- value: 'browser_test_tree_select1',
- )
- match_not(
- css: '.content.active',
- value: 'Database Update required',
- )
- object_manager_attribute_delete(
- data: {
- name: 'browser_test_tree_select1',
- },
- )
- watch_for(
- css: '.content.active',
- value: 'Database Update required',
- )
- watch_for(
- css: '.content.active table',
- value: 'browser_test_tree_select1',
- )
- click(css: '.content.active .tab-pane.active div.js-execute')
- watch_for(
- css: '.modal',
- value: 'restart',
- )
- watch_for_disappear(
- css: '.modal',
- timeout: 240,
- )
- sleep 5
- watch_for(
- css: '.content.active',
- )
- match_not(
- css: '.content.active',
- value: 'Database Update required',
- )
- match_not(
- css: '.content.active table',
- value: 'browser_test_tree_select1',
- )
- end
- # verify the fix for issue #2206 - Unable to modify tree_select attributes with fresh 2.6
- def test_modify_tree_select_attributes
- @browser = instance = browser_instance
- login(
- username: 'master@example.com',
- password: 'test',
- url: browser_url,
- )
- tasks_close_all()
- object_manager_attribute_create(
- data: {
- name: 'browser_test_tree_select2',
- display: 'Browser Test TreeSelect2',
- data_type: 'Tree Select',
- data_option: {
- options: {
- 'Incident' => {
- 'Hardware' => {
- 'Monitor' => {},
- 'Mouse' => {},
- },
- },
- 'Service request' => {
- 'New software requirement' => {},
- 'New hardware' => {},
- },
- 'Change request' => {},
- },
- },
- },
- )
- object_manager_attribute_migrate
- # open the newly created tree_select and add some new options
- object_manager_attribute_update(
- data: {
- name: 'browser_test_tree_select2',
- },
- do_not_submit: true,
- )
- # add two new first level entries
- 2.times do |i|
- instance.find_elements(css: '.modal .js-treeTable .js-key').last.click
- element = instance.find_elements(css: '.modal .js-treeTable .js-key').last
- element.clear
- element.send_keys("new tree option #{i}")
- end
- click(
- css: '.modal button.js-submit'
- )
- modal_disappear
- object_manager_attribute_migrate
- # open the tree select again and check that the newly added options are there
- watch_for(
- css: '.content.active table',
- value: 'browser_test_tree_select2',
- )
- object_manager_attribute_update(
- data: {
- name: 'browser_test_tree_select2',
- },
- do_not_submit: true,
- )
- 2.times do |i|
- exists(
- css: '.modal .js-treeTable',
- value: "new tree option #{i}",
- )
- end
- modal_close
- # clean up and confirm the deletion of newly created attributes
- object_manager_attribute_delete(
- data: {
- name: 'browser_test_tree_select2',
- },
- )
- object_manager_attribute_migrate
- match_not(
- css: '.content.active table',
- value: 'browser_test_tree_select2',
- )
- end
- end
|