Fix the users test to get the created user id
authorradhika chippada <radhika@curoverse.com>
Thu, 10 Apr 2014 20:44:17 +0000 (16:44 -0400)
committerradhika chippada <radhika@curoverse.com>
Thu, 10 Apr 2014 20:44:17 +0000 (16:44 -0400)
apps/workbench/test/integration/users_test.rb

index aa5fdcc66e161df67ee61adf4430ea55c4deba30..22b92c02e1d23dbc55740f8c6209744a5a3a30df 100644 (file)
@@ -67,15 +67,20 @@ class UsersTest < ActionDispatch::IntegrationTest
 
     # verify that the new user showed up in the users page
     assert page.has_text? 'foo@example.com'
-=begin
-    page.within(:xpath, '//tr[@data-object-uuid][1]') do
-      assert (text.include? 'foo@example.com false'), 'Expected email'
-      new_user_uuid = text.split[0]
 
-      # go to the new user's page
-      click_link new_user_uuid
+    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
 
+    assert new_user_uuid, "Expected new user uuid not found"
+
+    # go to the new user's page
+    click_link new_user_uuid
+
     assert page.has_text? 'modified_by_user_uuid'
     page.within(:xpath, '//a[@data-name="is_active"]') do
       assert_equal "false", text, "Expected new user's is_active to be false"
@@ -84,7 +89,7 @@ class UsersTest < ActionDispatch::IntegrationTest
     click_link 'Metadata'
     assert page.has_text? '(Repository: test_repo)'
     assert !(page.has_text? '(VirtualMachine:)')
-=end
+
     headless.stop
   end