- click_on 'Add a new user'
-
- # for now just check that we are back in Users -> List page
- assert page.has_text? 'zzzzz-tpzed-d9tiejq69daie8f'
+ click_link 'Add a new user'
+
+ sleep(0.1)
+ popup = page.driver.browser.window_handles.last
+ page.within_window popup do
+ assert has_text? 'Virtual Machine'
+ fill_in "email", :with => "foo@example.com"
+ fill_in "repo_name", :with => "test_repo"
+ click_button "Submit"
+ wait_for_ajax
+ end
+
+ visit '/users'
+
+ # 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')['data-object-uuid']
+ assert new_user_uuid, "Expected new user uuid not found"
+
+ # go to the new user's page
+ find('tr', text: new_user_uuid).
+ find('a', text: 'Show').
+ click
+
+ assert page.has_text? 'modified_by_user_uuid'
+ page.within(:xpath, '//span[@data-name="is_active"]') do
+ assert_equal "false", text, "Expected new user's is_active to be false"
+ end
+
+ click_link 'Advanced'
+ click_link 'Metadata'
+ assert page.has_text? 'Repository: test_repo'
+ assert !(page.has_text? 'VirtualMachine:')
+
+ headless.stop