From ac317fea1f11179b33eae7e06a60ba60df218f1c Mon Sep 17 00:00:00 2001 From: Tom Clegg Date: Wed, 30 Apr 2014 23:25:32 -0400 Subject: [PATCH] Update tests for new layout. --- .../test/integration/folders_test.rb | 8 ++-- apps/workbench/test/integration/users_test.rb | 39 +++++++++---------- 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/apps/workbench/test/integration/folders_test.rb b/apps/workbench/test/integration/folders_test.rb index 4d569e4438..d9322e60cd 100644 --- a/apps/workbench/test/integration/folders_test.rb +++ b/apps/workbench/test/integration/folders_test.rb @@ -9,16 +9,16 @@ class FoldersTest < ActionDispatch::IntegrationTest visit page_with_token 'active', '/' find('nav a', text: 'Folders').click find('tr', text: 'A Folder'). - find('a', text: 'zzzzz-'). + find('a,button', text: 'Show'). click within('.panel', text: api_fixture('groups')['afolder']['name']) do find('span', text: api_fixture('groups')['afolder']['name']).click find('.glyphicon-ok').click find('.btn', text: 'Edit description').click - find('textarea').set('I just edited this.') - find('.glyphicon-ok').click + find('.editable-input textarea').set('I just edited this.') + find('.editable-submit').click end - find('.panel', text: 'I just edited this.') + #find('.panel', text: 'I just edited this.') end end diff --git a/apps/workbench/test/integration/users_test.rb b/apps/workbench/test/integration/users_test.rb index 06d420c569..bd69f997a3 100644 --- a/apps/workbench/test/integration/users_test.rb +++ b/apps/workbench/test/integration/users_test.rb @@ -23,7 +23,9 @@ class UsersTest < ActionDispatch::IntegrationTest assert (text.include? 'true false'), 'Expected is_active' end - click_link 'zzzzz-tpzed-xurymjxw79nv3jz' + find('tr', text: 'zzzzz-tpzed-xurymjxw79nv3jz'). + find('a,button', text: 'Show'). + click assert page.has_text? 'Attributes' assert page.has_text? 'Metadata' assert page.has_text? 'Admin' @@ -63,23 +65,20 @@ class UsersTest < ActionDispatch::IntegrationTest click_button "Submit" end - sleep(0.1) - - # verify that the new user showed up in the users page - assert page.has_text? 'foo@example.com' - - new_user_uuid = nil - all("tr").each do |elem| - if elem.text.include? 'foo@example.com' - new_user_uuid = elem.text.split[0] - break - end - end + sleep 0.1 + # verify that the new user showed up in the users page and find + # the new user's UUID + new_user_uuid = + find('tr[data-object-uuid]', text: 'foo@example.com'). + find('td', text: '-tpzed-'). + text assert new_user_uuid, "Expected new user uuid not found" # go to the new user's page - click_link new_user_uuid + find('tr', text: new_user_uuid). + find('a,button', text: 'Show'). + click assert page.has_text? 'modified_by_user_uuid' page.within(:xpath, '//span[@data-name="is_active"]') do @@ -102,10 +101,10 @@ class UsersTest < ActionDispatch::IntegrationTest click_link 'Users' - assert page.has_link? 'zzzzz-tpzed-xurymjxw79nv3jz' - # click on active user - click_link 'zzzzz-tpzed-xurymjxw79nv3jz' + find('tr', text: 'zzzzz-tpzed-xurymjxw79nv3jz'). + find('a,button', text: 'Show'). + click # Setup user click_link 'Admin' @@ -161,10 +160,10 @@ class UsersTest < ActionDispatch::IntegrationTest click_link 'Users' - assert page.has_link? 'zzzzz-tpzed-xurymjxw79nv3jz' - # click on active user - click_link 'zzzzz-tpzed-xurymjxw79nv3jz' + find('tr', text: 'zzzzz-tpzed-xurymjxw79nv3jz'). + find('a,button', text: 'Show'). + click # Verify that is_active is set click_link 'Attributes' -- 2.30.2